ir done'ish

This commit is contained in:
agra
2026-03-01 22:38:41 +02:00
parent 6a920dbd2c
commit f763765ea2
17 changed files with 1443 additions and 15017 deletions

View File

@@ -1782,6 +1782,24 @@ END;
print("opt param 7: {}\n", opt_process(7)); // opt param 7: 7
}
// Assignment to optional variable (f32 → ?f32)
{
iw: ?f32 = null;
w: f32 = 42.5;
iw = w;
print("opt reassign: {}\n", iw ?? 0.0); // opt reassign: 42.5
// Assignment of computed value to optional
iw2: ?f32 = null;
a: ?f32 = 10.0;
if v := a { iw2 = v + 5.0; }
print("opt compute assign: {}\n", iw2 ?? 0.0); // opt compute assign: 15.0
// Re-assign optional back to null
iw2 = null;
print("opt re-null: {}\n", iw2 ?? 99.0); // opt re-null: 99.0
}
// Generic function with ?T return
{
first_pos :: ($T: Type, a: T, b: T) -> ?T {