From 22035400ed7b7fcda088a1a5b1ca6505b23bf63f Mon Sep 17 00:00:00 2001 From: Zuhaitz Méndez Fernández de Aránguiz Date: Sat, 24 Jan 2026 03:09:59 +0000 Subject: Fix for #102 --- tests/features/test_traits_suite.zc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tests/features') 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(); +} -- cgit v1.2.3