// issue-0006: literal `0` in integer comparison inferred as float inside f32 ternary // // When `s64 != 0` is used as the condition of a ternary whose result type is f32, // the literal `0` in the comparison leaks the ternary's f32 type instead of matching // the LHS s64 type. This generates invalid LLVM IR: // %icmp = icmp ne i64 %load, float 0.000000e+00 // // The same comparison works fine in a regular if-statement. #import "modules/std.sx"; main :: () -> void { x : s64 = 42; // OK: comparison in statement context if x != 0 { out("ok\n"); } // BUG: comparison as condition of f32 ternary — `0` inferred as f32 result : f32 = if x != 0 then 1.0 else 2.0; print("result = {}\n", result); }