Files
sx/examples/91-protocol-typeparam-parse.sx
2026-05-18 17:40:10 +03:00

21 lines
512 B
Plaintext

// Phase 1 (xx-via-Into mechanism): proves the new syntax parses + lowers
// without error. The parameterised protocol Into(Target: Type) and the
// matching `impl Into(Block) for Closure() -> void` declarations are
// registered but unused. Resolution (Phase 3) is what makes the impl
// reachable from `xx`.
#import "modules/std.sx";
MyTag :: struct { value: s64 = 0; }
impl Into(MyTag) for s64 {
convert :: (self: s64) -> MyTag {
.{ value = self };
}
}
main :: () -> s32 {
print("ok\n");
0;
}