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.
28 lines
1.1 KiB
Plaintext
28 lines
1.1 KiB
Plaintext
// `cast(T) expr` accepts any compile-time-resolvable type argument,
|
|
// including compound shapes: `*T`, `[*]T`, `?T`, `[]T`. The same lowering
|
|
// makes a compound type literal a first-class `Type` value in expression
|
|
// position (`t : Type = *i64;`), mirroring named types (`t : Type = f64;`).
|
|
// Regression (issue 0118): compound casts fell into the runtime-dispatch
|
|
// path and died with "unresolved 'unknown_expr'".
|
|
|
|
#import "modules/std.sx";
|
|
|
|
main :: () {
|
|
x := 42;
|
|
p : *i64 = @x;
|
|
q : *i64 = cast(*i64) p; // no-op pointer cast
|
|
print("a: {}\n", q.*);
|
|
addr : i64 = xx p;
|
|
r : *i64 = cast(*i64) addr; // int → ptr through compound cast
|
|
print("b: {}\n", r.*);
|
|
mp : [*]i64 = cast([*]i64) p; // ptr → many-pointer
|
|
print("c: {}\n", mp[0]);
|
|
o : ?i32 = cast(?i32) 7; // optional wrap
|
|
print("d: {}\n", o ?? -1);
|
|
arr := .[1, 2, 3];
|
|
s : []i64 = cast([]i64) arr; // array → slice
|
|
print("e: {} {}\n", s.len, s[2]);
|
|
t : Type = *i64; // first-class compound Type value
|
|
print("f: {}\n", type_name(t));
|
|
}
|