From 96ef1857bac446f4e065e7c10530213e361d726a Mon Sep 17 00:00:00 2001 From: lemon Date: Sun, 7 Aug 2022 22:36:57 +0200 Subject: add tagged unions --- bootstrap/test2.cff | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'bootstrap/test2.cff') diff --git a/bootstrap/test2.cff b/bootstrap/test2.cff index 3061d6e..e5e484a 100644 --- a/bootstrap/test2.cff +++ b/bootstrap/test2.cff @@ -18,6 +18,12 @@ struct Bit { def Y = 3.3; +enum union Value { + None, + Int i32, + Flo f32, +} + extern fn main() void { let n Node = {#null, 0}; let n Node = {&n, 1}; @@ -25,6 +31,9 @@ extern fn main() void { let x int #?; x = X + 1 + Y; + let v Value = :None; + v = :Int 3; + printf("n %d\n", n.value); printf("n link %d\n", n.link.value); -- cgit v1.2.3