summaryrefslogtreecommitdiff
path: root/tests/features
diff options
context:
space:
mode:
authorZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-24 03:09:59 +0000
committerZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-24 03:09:59 +0000
commit22035400ed7b7fcda088a1a5b1ca6505b23bf63f (patch)
tree512e60eb2fd1f359c73905b52b2ec5808c875c5d /tests/features
parentf38a4868b6585a28e4dee23fd595cdc192dbde00 (diff)
Fix for #102
Diffstat (limited to 'tests/features')
-rw-r--r--tests/features/test_traits_suite.zc19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/features/test_traits_suite.zc b/tests/features/test_traits_suite.zc
index d546a24..7a2a262 100644
--- a/tests/features/test_traits_suite.zc
+++ b/tests/features/test_traits_suite.zc
@@ -102,3 +102,22 @@ test "test_derive" {
var p3 = Point{x: 10, y: 21};
assert(p1.eq(&p3) == false, "Eq works (false)");
}
+
+test "implicit_trait_cast" {
+ var c = Circle { radius: 10.0 };
+ // This previously required explicit casting: print_shape_info((Shape)(&c));
+ print_shape_info(&c);
+
+ var r = Rectangle { width: 5.0, height: 5.0 };
+ print_shape_info(&r);
+}
+
+var g_def_circle = Circle { radius: 2.0 };
+
+fn print_default_shape(s: Shape = &g_def_circle) {
+ println "Default Shape: {s.name()}";
+}
+
+test "implicit_trait_cast_default" {
+ print_default_shape();
+}