From b885629239d04d2860a8853799a3d335d8bec154 Mon Sep 17 00:00:00 2001 From: Zuhaitz Méndez Fernández de Aránguiz Date: Sat, 17 Jan 2026 15:33:18 +0000 Subject: Add support for mixin method dispatch. --- tests/features/test_mixin_methods.zc | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/features/test_mixin_methods.zc (limited to 'tests/features') diff --git a/tests/features/test_mixin_methods.zc b/tests/features/test_mixin_methods.zc new file mode 100644 index 0000000..0932429 --- /dev/null +++ b/tests/features/test_mixin_methods.zc @@ -0,0 +1,33 @@ + +struct Foo { + i: i32; +} + +impl Foo { + fn get_i(self) -> i32 { + return self.i; + } + + fn set_i(self, val: i32) { + self.i = val; + } +} + +struct Bar { + use Foo; + f: f32; +} + +test "test_mixin_methods" { + var b: Bar; + b.i = 42; + b.f = 3.14; + + var val = b.get_i(); + assert(val == 42, "Mixin method get_i() should return 42"); + + b.set_i(100); + assert(b.i == 100, "Mixin method set_i() should update i to 100"); + + "Mixin method dispatch OK"; +} -- cgit v1.2.3