Surface rename of the signed integer family: s1..s64 become i1..i64
(u1..u64, usize, isize unchanged). 'string' keeps the s-prefix arm in
name classification; width parsing moves to the i-prefix arm next to
isize.
Internal TypeId tags follow the surface (.s8/.s16/.s32/.s64 ->
.i8/.i16/.i32/.i64), as do mono-key mangle fragments (ptr_i64,
tu_i64_bool) and all display/diagnostic formatting (i{d}).
Migrated in the same sweep: stdlib + examples + issue repros + FFI C
companions (shared symbol names like ffi_id_i64), expected
stdout/stderr/ir snapshots, specs.md, readme.md, CLAUDE.md/AGENTS.md,
implementation_plan.md, docs/, issue writeups. Vendored stb_image and
historical flow state left untouched.
zig build test: 426/426; examples suite: 595/595.
32 lines
899 B
Plaintext
32 lines
899 B
Plaintext
// A value-position match (`if subject == { case … }`) returning a small
|
|
// integer type works when arms mix positive and negated literals: every arm
|
|
// value is lowered against the merge's result type, so the phi operands all
|
|
// share one width.
|
|
//
|
|
// Regression (issue 0066): a negated-literal arm (`else: -1`) previously
|
|
// lowered at a narrower width than the positive arms, tripping LLVM's
|
|
// "PHI node operands are not the same type as the result".
|
|
|
|
#import "modules/std.sx";
|
|
|
|
sign :: (n: i32) -> i32 {
|
|
if n == {
|
|
case 0: 0;
|
|
else: if n > 0 then 1 else -1;
|
|
}
|
|
}
|
|
|
|
classify :: (n: i32) -> i32 {
|
|
if n == {
|
|
case 0: 100;
|
|
case 1: 10;
|
|
else: -1;
|
|
}
|
|
}
|
|
|
|
main :: () -> i32 {
|
|
print("sign: {} {} {}\n", sign(-9), sign(0), sign(9)); // -1 0 1
|
|
print("classify: {} {} {}\n", classify(0), classify(1), classify(5)); // 100 10 -1
|
|
0
|
|
}
|