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.
56 lines
1.1 KiB
Plaintext
56 lines
1.1 KiB
Plaintext
// Test: compound assignment operators on global variables
|
|
// Ensures += -= *= /= %= &= |= ^= <<= >>= all do load-modify-store
|
|
|
|
#import "modules/std.sx";
|
|
|
|
g_add : i64 = 10;
|
|
g_sub : i64 = 10;
|
|
g_mul : i64 = 10;
|
|
g_div : i64 = 100;
|
|
g_mod : i64 = 10;
|
|
g_and : i64 = 0xff;
|
|
g_or : i64 = 0x0f;
|
|
g_xor : i64 = 0xff;
|
|
g_shl : i64 = 1;
|
|
g_shr : i64 = 256;
|
|
|
|
main :: () -> void {
|
|
// += repeated: should accumulate, not reset
|
|
g_add += 1;
|
|
g_add += 1;
|
|
g_add += 1;
|
|
print("add: {}\n", g_add); // 13
|
|
|
|
g_sub -= 3;
|
|
g_sub -= 2;
|
|
print("sub: {}\n", g_sub); // 5
|
|
|
|
g_mul *= 2;
|
|
g_mul *= 3;
|
|
print("mul: {}\n", g_mul); // 60
|
|
|
|
g_div /= 5;
|
|
g_div /= 4;
|
|
print("div: {}\n", g_div); // 5
|
|
|
|
g_mod %= 3;
|
|
print("mod: {}\n", g_mod); // 1
|
|
|
|
g_and &= 0x0f;
|
|
print("and: {}\n", g_and); // 15
|
|
|
|
g_or |= 0xf0;
|
|
print("or: {}\n", g_or); // 255
|
|
|
|
g_xor ^= 0x0f;
|
|
print("xor: {}\n", g_xor); // 240
|
|
|
|
g_shl <<= 4;
|
|
g_shl <<= 2;
|
|
print("shl: {}\n", g_shl); // 64
|
|
|
|
g_shr >>= 3;
|
|
g_shr >>= 2;
|
|
print("shr: {}\n", g_shr); // 8
|
|
}
|