Move examples/*.sx and their expected/ snapshots into per-category subfolders (examples/<category>/...). Folder = leading filename token, with ffi-objc/ffi-jni kept whole; filenames are unchanged. The corpus runner and LSP sweep now discover each category's expected/ dir, while issues/ stays flat. Example 1058's repo-root-relative companion import is made file-relative. Path strings embedded in 164 snapshots were regenerated (path-only changes). Test-layout docs in CLAUDE.md updated.
33 lines
1.0 KiB
Plaintext
33 lines
1.0 KiB
Plaintext
// A comparison with mismatched scalar operands (int vs float, or two float
|
|
// widths) must promote both operands to the common type before emitting the
|
|
// compare — `lowerBinaryOp` now coerces each operand to the promoted float
|
|
// type for the ordering/equality arms (as the arithmetic arms already do),
|
|
// so the cast materializes and LLVM gets a well-typed fcmp instead of a
|
|
// mixed-type compare that the verifier rejects / silently mis-evaluates.
|
|
//
|
|
// Regression (issue 0146).
|
|
#import "modules/std.sx";
|
|
|
|
// i32 < f32: the `xx i` cast must materialize as an i32->f32 SIToFP.
|
|
ceil_half :: (v: f32) -> i32 {
|
|
t := v - 0.5;
|
|
i : i32 = xx t;
|
|
if xx i < t { // 1.0 < 1.8 -> true
|
|
i += 1;
|
|
}
|
|
i
|
|
}
|
|
|
|
// f64 vs f32 sibling: `xx y + 0.5` infers f64; comparing to an f32 must FPExt.
|
|
ge :: (y: i32, lo: f32) -> i32 {
|
|
sy := xx y + 0.5; // 3.5 (f64)
|
|
if sy >= lo { return 1; }
|
|
0
|
|
}
|
|
|
|
main :: () -> i32 {
|
|
print("{}\n", ceil_half(2.3)); // 2
|
|
print("{}\n", ge(3, 2.0)); // 1
|
|
0
|
|
}
|