lang: rename signed integer types sN -> iN
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.
This commit is contained in:
@@ -16,33 +16,33 @@
|
||||
// one, so no float leaf shape escapes. The array-dimension site phrases the same
|
||||
// rejection as "must be an integer".
|
||||
//
|
||||
// The escape hatch stays open: `y : s64 = xx 1.5` (or `cast(s64) 1.5`)
|
||||
// The escape hatch stays open: `y : i64 = xx 1.5` (or `cast(i64) 1.5`)
|
||||
// truncates with no error — exercised on the POSITIVE side (example 0168).
|
||||
//
|
||||
// Regression (issue 0095): `y : s64 = 1.5` silently truncated to 1,
|
||||
// `y : s64 = M + 0.5` to 2, and `y : s64 = F + 0.25` (float-const leaf) to 2.
|
||||
// Regression (issue 0095): `y : i64 = 1.5` silently truncated to 1,
|
||||
// `y : i64 = M + 0.5` to 2, and `y : i64 = F + 0.25` (float-const leaf) to 2.
|
||||
#import "modules/std.sx";
|
||||
|
||||
M :: 2; // int module const, for the INT-const-EXPRESSION cases
|
||||
F : f64 : 2.5; // float module const, for the FLOAT-const-LEAF cases
|
||||
|
||||
Bad :: struct {
|
||||
f : s64 = 3.5; // non-integral float LITERAL field default → error
|
||||
fe : s64 = M + 0.5; // non-integral int-const-EXPR field default → error
|
||||
ff : s64 = F + 0.25; // non-integral float-const-LEAF field default → error
|
||||
f : i64 = 3.5; // non-integral float LITERAL field default → error
|
||||
fe : i64 = M + 0.5; // non-integral int-const-EXPR field default → error
|
||||
ff : i64 = F + 0.25; // non-integral float-const-LEAF field default → error
|
||||
}
|
||||
|
||||
badLit :: (x : s64 = 2.5) -> s64 { return x; } // non-integral LITERAL param default → error
|
||||
badExpr :: (x : s64 = M + 0.5) -> s64 { return x; } // non-integral int-const-EXPR param default → error
|
||||
badFlt :: (x : s64 = F + 0.25) -> s64 { return x; } // non-integral float-const-LEAF param default → error
|
||||
badLit :: (x : i64 = 2.5) -> i64 { return x; } // non-integral LITERAL param default → error
|
||||
badExpr :: (x : i64 = M + 0.5) -> i64 { return x; } // non-integral int-const-EXPR param default → error
|
||||
badFlt :: (x : i64 = F + 0.25) -> i64 { return x; } // non-integral float-const-LEAF param default → error
|
||||
|
||||
main :: () {
|
||||
y : s64 = 1.5; // non-integral float LITERAL local → error
|
||||
ye : s64 = M + 0.5; // non-integral int-const-EXPRESSION local → error
|
||||
yf : s64 = F + 0.25; // non-integral float-const-LEAF local → error
|
||||
yn : s64 = f64.true_min + 0.5; // non-integral numeric-limit float expr → error
|
||||
ym : s64 = 5.5 % 2.0; // non-integral float `%` remainder (1.5) → error
|
||||
ad : [F + 0.25]s64 = ---; // non-integral float-const-LEAF array DIMENSION → error
|
||||
y : i64 = 1.5; // non-integral float LITERAL local → error
|
||||
ye : i64 = M + 0.5; // non-integral int-const-EXPRESSION local → error
|
||||
yf : i64 = F + 0.25; // non-integral float-const-LEAF local → error
|
||||
yn : i64 = f64.true_min + 0.5; // non-integral numeric-limit float expr → error
|
||||
ym : i64 = 5.5 % 2.0; // non-integral float `%` remainder (1.5) → error
|
||||
ad : [F + 0.25]i64 = ---; // non-integral float-const-LEAF array DIMENSION → error
|
||||
b := Bad.{};
|
||||
print("{} {} {}\n", b.f, b.fe, b.ff);
|
||||
print("{} {} {}\n", badLit(), badExpr(), badFlt());
|
||||
|
||||
Reference in New Issue
Block a user