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.
36 lines
1.3 KiB
Plaintext
36 lines
1.3 KiB
Plaintext
// Backtick raw-identifier escape: a leading backtick makes the following
|
|
// identifier RAW — its text excludes the backtick and it is never the
|
|
// reserved/builtin keyword, so a reserved type-name spelling (`i2`, `u8`, …)
|
|
// can be used as an ordinary identifier. Exercised in every VALUE position:
|
|
// global, local, param, struct field + member access, function name + call,
|
|
// and a later reference. (A raw identifier in TYPE position references a
|
|
// backtick-declared type instead — see examples/0154.) A *bare* `i2` is still
|
|
// the reserved type name (see examples/1119), so the escape is the only way to
|
|
// spell these as values.
|
|
// Regression (issue 0089).
|
|
#import "modules/std.sx";
|
|
|
|
// Global named with a reserved type spelling.
|
|
`u8 := 100;
|
|
|
|
// Function whose name is a reserved type spelling, with a reserved-name param.
|
|
`i2 :: (`i1: i64) -> i64 { return `i1 * 2; }
|
|
|
|
Point :: struct {
|
|
`i2: f64; // field name is a reserved type spelling
|
|
`u16: i64;
|
|
}
|
|
|
|
main :: () {
|
|
// Local with a reserved type spelling; later reference resolves to it.
|
|
`i64 := 7;
|
|
`i64 = `i64 + 1;
|
|
print("local = {}\n", `i64);
|
|
|
|
print("global = {}\n", `u8);
|
|
print("fn = {}\n", `i2(21)); // calls the `i2 function
|
|
|
|
p := Point.{ `i2 = 2.5, `u16 = 9 };
|
|
print("field = {} {}\n", p.`i2, p.`u16);
|
|
}
|