diff --git a/CLAUDE.md b/CLAUDE.md index ba26dbb..6f47fba 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -73,9 +73,9 @@ There is no "wrap up first" option. a lookup fails in the compiler. Examples of the pattern to root out: ```zig -// NEVER write this — lookup fails, return s64 and pretend nothing +// NEVER write this — lookup fails, return i64 and pretend nothing // happened. Any caller asking `what type is this?` gets a lie. -return self.module.types.findByName(name_id) orelse .s64; +return self.module.types.findByName(name_id) orelse .i64; // NEVER write this — same shape, dressed up: return scope.lookup(name) orelse default_type; @@ -86,9 +86,9 @@ These defaults silently produce wrong results in cases the implementer didn't think of. The classic failure mode: the default coincidentally matches the size/shape of one common case, so the test suite passes and the bug ships invisibly. issue-0042 lived for years because -`resolveTypeArg`'s `orelse .s64` returned 8 bytes for unresolved +`resolveTypeArg`'s `orelse .i64` returned 8 bytes for unresolved type-alias names — coincidentally correct for any 8-byte target -(`s64`, `*T`, `f64`, function pointers), and silently wrong for +(`i64`, `*T`, `f64`, function pointers), and silently wrong for everything else. ✅ **Required:** when a lookup that *must* succeed fails, emit a @@ -102,7 +102,7 @@ as a silently-corrupted size or alignment. `void` is a real, heavily-checked type (void returns, void params, "no value" markers), and pervasive `if (ty == .void) { skip / return-nothing }` checks would silently swallow the failure — trading one silent default -(`.s64`) for another (`.void`) one layer down. The same objection rules +(`.i64`) for another (`.void`) one layer down. The same objection rules out `noreturn` (diverging expressions) and any other load-bearing builtin. Instead, add a **distinct** `.unresolved`-style `TypeId` whose sole meaning is "resolution failed". A dedicated value (1) can't be mistaken for a real @@ -311,7 +311,7 @@ LongLived :: struct { } // Direct allocs too: - grow_buf :: (self: *LongLived, n: s64) { + grow_buf :: (self: *LongLived, n: i64) { self.buf = self.own_allocator.alloc(n); } } diff --git a/current/CHECKPOINT-FFI.md b/current/CHECKPOINT-FFI.md index 8add606..60d1fb0 100644 --- a/current/CHECKPOINT-FFI.md +++ b/current/CHECKPOINT-FFI.md @@ -30,7 +30,7 @@ build_block_convert($args, $R)`. | issue-0050 fix | `5316bf7` | Same isolation pattern as 0048 applied to `monomorphizeFunction`. | | 5.1.A xfail | `3bd6f26` | `build_block_convert(args: []Type, $ret: Type) -> string` undefined — pin output format via `examples/176-build-block-convert.sx` across 3 void shapes + 1 non-void shape. | | 5.1.B fix | `aeb950b` | Builder added to `library/modules/std/objc_block.sx`. Emits nested `callconv(.c)` trampoline + Block literal source. | -| 5.2.A xfail | `f5342e9` | Generic `Into(Block)` impl absent — `Closure(s64, s64) -> void` (uncovered by hand-rolled impls) emits the "no Into(Block) for cl_s64_s64__void" diagnostic per `examples/177-generic-into-block.sx`. | +| 5.2.A xfail | `f5342e9` | Generic `Into(Block)` impl absent — `Closure(i64, i64) -> void` (uncovered by hand-rolled impls) emits the "no Into(Block) for cl_i64_i64__void" diagnostic per `examples/177-generic-into-block.sx`. | | 5.2.B fix | `165b621` | Generic impl `Closure(..$args) -> $R` added with `#insert build_block_convert($args, $R)`. `lowerExpr`'s `.comptime_pack_ref` + `resolveTypeArg` + `type_bridge.isTypeShapedAstNode` extended so impl-mono `$args` (pack_bindings) and `$R` (type_bindings) resolve in both expr and type positions. | | 5.3 | `2eaf932` | Delete hand-rolled `__block_invoke_void` + `__block_invoke_bool` + the two per-shape impls. The generic impl covers both at runtime. | @@ -40,11 +40,11 @@ What's now possible end-to-end (from ```sx #import "modules/std/objc_block.sx"; -main :: () -> s32 { - cl := (a: s64, b: s64) => { g_a = a; g_b = b; }; +main :: () -> i32 { + cl := (a: i64, b: i64) => { g_a = a; g_b = b; }; blk : Block = xx cl; // generic impl mono'd for - // Closure(s64, s64) -> void - invoke_fn : (*Block, s64, s64) -> void callconv(.c) = xx blk.invoke; + // Closure(i64, i64) -> void + invoke_fn : (*Block, i64, i64) -> void callconv(.c) = xx blk.invoke; invoke_fn(@blk, 10, 20); 0; } @@ -53,9 +53,9 @@ main :: () -> s32 { The `xx cl : Block` site monomorphises the generic `Into(Block) for Closure(..$args) -> $R` impl. Inside the impl mono, `#insert build_block_convert($args, $R)` evaluates the -builder at comptime with `$args = [s64, s64]` and `$R = void`, +builder at comptime with `$args = [i64, i64]` and `$R = void`, and substitutes the resulting source — a nested -`__invoke :: (block_self: *Block, arg0: s64, arg1: s64) -> void +`__invoke :: (block_self: *Block, arg0: i64, arg1: i64) -> void callconv(.c) { ... }` trampoline plus the Block literal that points its `invoke` slot at `@__invoke`. Stack-local block layout matches Apple's published spec; UIKit / Foundation consumers can @@ -96,7 +96,7 @@ generic Into(Block) builder body rests on. |---|---|---| | 4A.bare.1.A | `c792642` | Expected-failing lock-in for bare `$args` (parser rejection diff). | | 4A.bare.1.B | `5a4a19b` | Parser makes `[` optional after `$`; new `ComptimePackRef` AST node + sema no-op arms + `lowerExpr` arm calling new `buildPackSliceValue(arg_types)` helper. Helper emits `alloca [N x Any]`, one `const_type(arg_tys[i])` per slot, then a `{data_ptr, len}` slice aggregate. emit_llvm's `const_type` arm relaxed to silent undef-i64 (storage of Type values in runtime aggregates is harmless; loud bail moves to USE sites). | -| 4A.bare.4.A | `95e61d8` | Expected-failing lock-in for `type_name(list[i])` silently returning "s64" via `resolveTypeArg`'s catch-all `else => .s64`. | +| 4A.bare.4.A | `95e61d8` | Expected-failing lock-in for `type_name(list[i])` silently returning "i64" via `resolveTypeArg`'s catch-all `else => .i64`. | | 4A.bare.4.B | `d99c0fd` | `tryLowerReflectionCall` splits on new `isStaticTypeArg(node)` helper. Static args fold to const_string (today's fast path); dynamic args emit `callBuiltin(.type_name, [arg_ref])` for the interp's arm. emit_llvm's reflection-builtin arm relaxed to silent undef-i64 — same reasoning as const_type: storage-position misuse is impossible, use-site misuse caught by the interp arm's `asTypeId orelse bailDetail`. | | 4A.bare.5 | `2162662` | End-to-end smoke `examples/172-pack-builder-smoke.sx`. `describe(..$args)` walks `$args` at #run time, calls `type_name(list[i])` per position. Four call shapes (empty, one-arg, two-arg, four-mixed) verify the full chain works. | @@ -106,7 +106,7 @@ What now works end-to-end (from `examples/172-pack-builder-smoke.sx`): describe :: (..$args) -> string { list := $args; s := "["; - i : s64 = 0; + i : i64 = 0; while i < list.len { if i > 0 { s = concat(s, ", "); } s = concat(s, type_name(list[i])); @@ -117,7 +117,7 @@ describe :: (..$args) -> string { } #run { print("{}\n", describe(true, 3.14, "x", 99)); } -// → [bool, f64, string, s64] +// → [bool, f64, string, i64] ``` The pack flows through a real `[]Type` slice value; the loop @@ -130,7 +130,7 @@ Known follow-ups (not blocking step 5): - `type_eq` / `has_impl` dynamic-arg dispatch — should follow the same `isStaticTypeArg` split that `type_name` got in 4A.bare.4.B. Today their dynamic-arg case still silently - folds via the same `resolveTypeArg .s64` fall-through. + folds via the same `resolveTypeArg .i64` fall-through. Wire when a real use case needs them. - `has_impl` interp arm — still bails "not yet wired". Needs a protocol-map snapshot on `Interpreter.init`. @@ -160,7 +160,7 @@ helpers, source-language `$args[$i]` in expression position. | 4.0 foundation | `ac60d98` | New `Op.const_type: TypeId` opcode (dedicated, never piggybacks on `const_int`). Interp emits `Value.type_tag(tid)`. emit_llvm bails loudly (Type is comptime-only; LLVM never sees one). `Value.asTypeId() ?TypeId` helper. `evalCmp` arm for `.type_tag, .type_tag` — TypeId equality. Mixed `.type_tag` vs `.int` falls through to `typeErrorDetail`. Zig unit tests confirm the variant. | | 4.1 reflection arms | `9600ba5` | `BuiltinId.type_name` / `.type_eq` / `.has_impl` for the interp-time fallback when lowering can't fold the call statically. Static-arg calls keep the existing `tryLowerReflectionCall` const-emission fast path. `has_impl` interp arm bails with "not yet wired" — interp-time has_impl needs a queryable snapshot of the host's protocol maps (its own follow-up). emit_llvm bails loudly on all three (comptime-only). | | 4.2 audit + bitcast guard | `55c72af` | `box_any`/`unbox_any` audit: layout was already correct (tag stays `.int`; value field can be `.type_tag`). `bitcast` interp arm guards against `.type_tag → ` casts — catches the `xx val to string` shape in `any_to_string`'s `case type:` arm that pre-dates type_tag and would silently mis-coerce. | -| 4.3 source construction | `fd03b58` | Parser accepts `$[]` in expression position (yields the same `pack_index_type_expr` AST node already used in type positions in step 3). Lowering: `lowerExpr` arm emits `const_type(arg_tys[index])`; `resolveTypeArg` arm reads `pack_arg_types[name][index]` directly so lower-time fold paths (`tryLowerReflectionCall`, `tryConstBoolCondition`) see the bound TypeId rather than falling through to the `.s64` silent-arm default. | +| 4.3 source construction | `fd03b58` | Parser accepts `$[]` in expression position (yields the same `pack_index_type_expr` AST node already used in type positions in step 3). Lowering: `lowerExpr` arm emits `const_type(arg_tys[index])`; `resolveTypeArg` arm reads `pack_arg_types[name][index]` directly so lower-time fold paths (`tryLowerReflectionCall`, `tryConstBoolCondition`) see the bound TypeId rather than falling through to the `.i64` silent-arm default. | Audit summary — every Value-switch in interp.zig was checked for silent fall-through. Findings: @@ -180,11 +180,11 @@ What's now possible end-to-end (from `examples/169-pack-value-dispatch.sx`): ```sx show :: (..$args) -> string => type_name($args[0]); -show(42) // "s64" +show(42) // "i64" show("hi") // "string" describe :: (..$args) -> string { - inline if type_eq($args[0], s64) { return "got s64"; } + inline if type_eq($args[0], i64) { return "got i64"; } inline if type_eq($args[0], string) { return "got string"; } ... } @@ -231,29 +231,29 @@ What works: - `x : $args[1] = args[1]` — local-var annotation. - `fp : (*void, $args[0]) -> $args[1] = handler;` — fn-pointer type literal (the shape step 5's generic trampoline body needs). -- `inline if type_eq($args[0], s64) { ... }` (when the `$args[0]` +- `inline if type_eq($args[0], i64) { ... }` (when the `$args[0]` argument is in a type position — `type_eq` reads call args via `resolveTypeArg` which routes to `resolveTypeWithBindings`). -- `has_impl(Hash, s64)` (plain protocols). -- `has_impl(Into(Block), s64)` (parameterised protocols). +- `has_impl(Hash, i64)` (plain protocols). +- `has_impl(Into(Block), i64)` (parameterised protocols). New tests: - `examples/165-pack-type-position.sx` — return type + local - var annotation; two heterogeneous call shapes (s64+string, - string+s64) confirm distinct monos. + var annotation; two heterogeneous call shapes (i64+string, + string+i64) confirm distinct monos. - `examples/166-pack-type-position-three.sx` — `args[2]` (third - element) as return type across three (s64,s64,string), - (bool,f64,s64), (string,string,bool) shapes. + element) as return type across three (i64,i64,string), + (bool,f64,i64), (string,string,bool) shapes. - `examples/167-pack-type-fnptr.sx` — fn-pointer type literal with `$args[$i]` in both param + return positions. - `examples/168-pack-reflection-intrinsics.sx` — type_name, type_eq (with inline-if folding), has_impl for both plain - (Allocator/CAllocator) and parameterised (custom Wrap(s64) - for s32) protocols. + (Allocator/CAllocator) and parameterised (custom Wrap(i64) + for i32) protocols. Out of scope (deferred): - `$args[$i]` in EXPRESSION position (the parser only accepts - it in type positions today — `type_eq($args[0], s64)` works + it in type positions today — `type_eq($args[0], i64)` works because the call-arg path resolves through `resolveTypeArg`, but bare `$args[0]` as a value would need an extra parser arm). - `$args[$i]` in struct field types. @@ -280,7 +280,7 @@ $args[1], ...) -> $R` per-position types. Closes the nested-comptime-call + return bug. The pack-fn face was incidentally fixed by step 2b's mono refactor (pack-fn calls now bypass the inline-return-slot setup that leaked into -nested comptime). The plain `($x: s32)` comptime face stayed +nested comptime). The plain `($x: i32)` comptime face stayed on the inline path until this fix. `createComptimeFunction` wraps a comptime expression into a @@ -305,7 +305,7 @@ only `func` / `current_block` / `inst_counter` / `scope` / fn-local flags the wrapper's lowering needs fresh. `examples/issue-0046.sx` (regression test): `helper :: ($x: -s32) -> s64 { print("inside\n"); return 42; }` called from +i32) -> i64 { print("inside\n"); return 42; }` called from `main`. Pre-fix: interp panic at storeAtRawPtr. Post-fix: prints "inside" then "n=42". @@ -339,7 +339,7 @@ New tests: `log_count(items: []Any)`. - `examples/163-pack-runtime-index.sx` — `while i < args.len { args[i] }` over a 4-arg pack. -- `examples/164-pack-mixed-comptime.sx` — `tagged($tag: s32, +- `examples/164-pack-mixed-comptime.sx` — `tagged($tag: i32, ..$args)` called with different `tag` values gets distinct monos (`tagged__ct_7__pack_*`, `tagged__ct_9__pack`). @@ -364,7 +364,7 @@ caller's basic block. `examples/158-pack-mono-dedup.sx` confirms end-to-end: `count(), count(1), count(2), count(1,2,3), count("x", true)` produces `0 1 1 3 2` at runtime AND emits exactly 4 monos in -IR — the two `s64` calls share one mono. +IR — the two `i64` calls share one mono. Plumbing in `src/ir/lower.zig`: - `isPackFn(fd)` — true when the only comptime param is a @@ -492,7 +492,7 @@ Out of scope: "unresolved 'result'" because nested comptime inlining loses the scope where stdlib's `#insert build_format` declared `result`. Same class as the - `helper :: ($x: s32) -> s64 { print(...); return 42; }` + `helper :: ($x: i32) -> i64 { print(...); return 42; }` pattern; pre-dates step 2. Worth filing if step 2's later slices need it; today's typed-indexing test exercises only field access and arithmetic, no nested print. @@ -516,7 +516,7 @@ Root cause was broader than packs: `format`/`print` use arrow form (`=> expr`) or `#insert`-only bodies, so no stdlib comptime fn took the `return`-with-trailing-statements path. Step 1.b made `..$args` parseable; the natural smoke test -`foo :: (..$args) -> s64 { return 42; }` was the first body to +`foo :: (..$args) -> i64 { return 42; }` was the first body to hit it. Fix in `src/ir/lower.zig`: @@ -575,10 +575,10 @@ New plumbing in [src/ir/lower.zig](../src/ir/lower.zig): concrete source closure during monomorphisation. `examples/155-pack-impl-match.sx` flips from the -"no Into(Block) for cl_s32_bool__bool" lock-in diagnostic to +"no Into(Block) for cl_i32_bool__bool" lock-in diagnostic to "pack impl match ok": one user-declared `impl Into(Block) for Closure(..$args) -> $R` covers a -`Closure(s32, bool) -> bool` source that stdlib has no +`Closure(i32, bool) -> bool` source that stdlib has no hand-rolled impl for. The constructed Block isn't invoked (invoke=null) — the test exercises matching + monomorphisation, not the trampoline (step 5 of the plan). @@ -607,9 +607,9 @@ Replaces a hand-rolled Into impl in stdlib once step 2 + step Pinned today's matching behaviour ahead of 1d.B. A user-declared `impl Into(Block) for Closure(..$args) -> $R` registers under a pack-shaped source key in `param_impl_map`; the xx site mangles -the concrete `Closure(s32, bool) -> bool` source and finds +the concrete `Closure(i32, bool) -> bool` source and finds nothing → the existing focused diagnostic fires ("no `Into(Block) -for cl_s32_bool__bool` impl — add a per-signature +for cl_i32_bool__bool` impl — add a per-signature `__block_invoke_` trampoline + Into impl..."). The pack impl is reachable in the file but never considered. @@ -691,7 +691,7 @@ current parser-rejection behavior so the next commit's parser extension shows up as a behavior shift. New: `examples/150-pack-parse.sx` declares -`foo :: (..$args) -> s64`. Today's parser hits `..` where it +`foo :: (..$args) -> i64`. Today's parser hits `..` where it expects a parameter name (after parsing the leading `dollar` sigil that doesn't appear) and emits "expected parameter name" at column 9 of line 15. Expected output captures this rejection. @@ -742,7 +742,7 @@ lookup. Infrastructure only; populated but not yet read. Added stand-ins for the opaque Obj-C runtime types to `library/modules/std/objc.sx`: `id`, `Class`, `SEL` resolve to -`*void`; `BOOL` to `s8`. All zero-cost at the LLVM layer; the +`*void`; `BOOL` to `i8`. All zero-cost at the LLVM layer; the header's old caveat about lacking aliases is gone. `141-objc-type-aliases.sx` exercises them against the real macOS Obj-C runtime via `isKindOfClass`. @@ -793,13 +793,13 @@ Four design questions still open (see roadmap). A trailing variadic param on a `#foreign` declaration now maps to the C calling convention's `...` instead of sx's slice-packing path. Drops the existing per-arity shim pattern (`__log_2i :: (prio, tag, fmt, a: -s32, b: s32) -> s32 #foreign __android_log_print;`) for a single +i32, b: i32) -> i32 #foreign __android_log_print;`) for a single declarative form: ```sx -sx_ffi_sum_ints :: (n: s32, args: ..s32) -> s64 #foreign; +sx_ffi_sum_ints :: (n: i32, args: ..i32) -> i64 #foreign; -main :: () -> s32 { +main :: () -> i32 { print("{}\n", sx_ffi_sum_ints(3, 10, 20, 30)); // → 60 } ``` @@ -821,15 +821,15 @@ locks in the green state in one commit): getting boxed into a typed slice. 3. **C default argument promotion**. New `promoteCVariadicArgs` ([src/ir/lower.zig](src/ir/lower.zig)) applies the standard - promotions to args past the fixed param count: `bool/s8/s16/u8/u16 - → s32` via sext/zext, `f32 → f64` via fpext. Wired into the two + promotions to args past the fixed param count: `bool/i8/i16/u8/u16 + → i32` via sext/zext, `f32 → f64` via fpext. Wired into the two `lowerCall` paths right after `coerceCallArgs`. `examples/ffi-foreign-cvariadic.sx` + `.c` lock the matrix end-to-end: `sum_ints(3, 10, 20, 30) → 60`, `sum_ints(0) → 0`, `avg_doubles(2, 1.5, 2.5) → 2.0`, `avg_doubles(3, 1.0, 2.0, 3.0) → 2.0`, and a null-terminated `count_args` chain of `*u8` strings → `3`. All four -return shapes (s64 / f64 / s32) and three element types (s32 / f64 / +return shapes (i64 / f64 / i32) and three element types (i32 / f64 / *u8) exercise the variadic-slot ABI through the C `va_arg` machinery in the .c helper. @@ -887,7 +887,7 @@ plus 2 codegen fixes surfaced along the way.** |------|-------------------------------|---------------------------------------------------------------------------------------| | 0.0 | tests/cross_compile.sh | empty tuple list, exits 0; skip-with-warning when toolchains missing | | 0.1 | ffi-01-primitives.sx | every primitive type round-trips through `#import c { #source / #include }` | -| 0.2 | ffi-02-small-struct.sx | Vec2 (8 B), Vec4f (16 B HFA), Pair64 (2×s64), Quad32 (4×s32) — four ABI slots | +| 0.2 | ffi-02-small-struct.sx | Vec2 (8 B), Vec4f (16 B HFA), Pair64 (2×i64), Quad32 (4×i32) — four ABI slots | | 0.3 | ffi-03-large-struct.sx | Big24 (24 B), Big48 (48 B) via byval params + sret return | | 0.4 | ffi-04-fp-struct.sx | FQuad (16 B HFA), DQuad (32 B HFA — UIEdgeInsets-shape) | | 0.5 | ffi-05-string-args.sx | [:0]u8, sx `string` slice-decay, [*]u8 + len, mutate-via-C, C-returned pointer | @@ -1110,8 +1110,8 @@ describes is implemented in [src/ir/lower.zig](../src/ir/lower.zig) Apple's runtime DSL encoding table: -- `v` = void, `i` = s32, `q` = s64, `f` = f32, `d` = f64, `B` = bool, -- `c` = s8/BOOL, `C` = u8, `s` = s16, `S` = u16, `l/L` = long, +- `v` = void, `i` = i32, `q` = i64, `f` = f32, `d` = f64, `B` = bool, +- `c` = i8/BOOL, `C` = u8, `s` = i16, `S` = u16, `l/L` = long, `Q` = u64, `*` = `[*]u8`, - `@` = id (object), `#` = Class, `:` = SEL, `^v` = `*void`. - Struct: `{Name=field0field1...}`, nested + cycle-broken. @@ -1159,7 +1159,7 @@ landing the parallel JNI codegen. | 1.29 | `uikit_create_gl_context` — `alloc` / `initWithAPI:` / `setCurrentContext:` + duplicate of 1.27's screen-scale read | done | | 1.30 | `uikit_subscribe_keyboard_notifications` — first standalone 4-keyword selector exercise (`addObserver:selector:name:object:`) | done | | 1.31 | `uikit_scene_will_connect_ios` — biggest cluster; the iOS scene-lifecycle entry. UIWindow / UIViewController / SxGLView wiring; EAGL drawable-properties dict build; `nativeScale` + `setContentScaleFactor:` DPI path; `displayLinkWithTarget:selector:` + run-loop install. Exercises every return shape used in uikit.sx. Net -44 lines (104 → 60). | done (b3558c3) | -| 1.32 | `uikit_keyboard_will_change_frame` — `userInfo` / `objectForKey:` / `CGRectValue` / `doubleValue` / `unsignedLongValue` / `screen.bounds`. First standalone exercise of `#objc_call(CGRect)` (HFA, structurally equivalent to UIEdgeInsets) and `#objc_call(u64)` (LLVM-equivalent to s64). Net -14 lines. Runtime-verified by the locked-in test `examples/ffi-objc-call-12-rect-u64-returns.sx` (ac78490). | done (e1d300c) | +| 1.32 | `uikit_keyboard_will_change_frame` — `userInfo` / `objectForKey:` / `CGRectValue` / `doubleValue` / `unsignedLongValue` / `screen.bounds`. First standalone exercise of `#objc_call(CGRect)` (HFA, structurally equivalent to UIEdgeInsets) and `#objc_call(u64)` (LLVM-equivalent to i64). Net -14 lines. Runtime-verified by the locked-in test `examples/ffi-objc-call-12-rect-u64-returns.sx` (ac78490). | done (e1d300c) | | 1.33 | **uikit.sx sweep — all remaining dispatch sites.** `renderbufferStorage:fromDrawable:` (bool, GL setup); `presentRenderbuffer:` (bool, every frame); `targetTimestamp` / `duration` (f64, every frame in `uikit_gl_view_tick`); `bounds` (CGRect, `uikit_compute_layer_pixel_size`); `locationInView:` (CGPoint HFA, every touch); `anyObject` (*void, every touch). First standalone `#objc_call(CGPoint)` exercise. Net -15 lines. Runtime-verified end-to-end: tapped a black pawn in iOS-sim chess and the move played correctly (1...d5, 2...d4). | done | Verification per cluster: zig build / zig test / run_examples / @@ -1178,9 +1178,9 @@ the work that remains is lowering + emit_llvm. | 1.15 | `#jni_call(void)` codegen — new `.jni_msg_send` IR opcode + emit_llvm expansion: load `*env` for the vtable, GEP into slots 31 (GetObjectClass), 33 (GetMethodID), 61 (CallVoidMethod). No method-ID caching yet; static dispatch + non-void returns drop to `LLVMGetUndef` until 1.18+. | done (134c197 xfail + 9afcaa5 fix) | | 1.16 | Lock in pre-caching IR shape — two `#jni_call` sites with literal `("noop", "()V")` emit two independent `GetMethodID` calls. IR snapshot at `tests/expected/ffi-jni-call-03-methodid-sharing.ir`. | done (13018ef) | | 1.17 | Literal-keyed slot interning — `JniMsgSend.cache_key: ?CacheKey` carries the literal `(name, sig)` pair from `lower.zig`; `emit_llvm.getOrCreateJniSlots` interns `@SX_JNI_CLS_` and `@SX_JNI_MID_` globals per unique pair; per-call lowering does null-check + lazy populate via `GetObjectClass` → `NewGlobalRef` (slot 21) → `GetMethodID` on miss. Two literal sites now share one slot pair. | done (0d883b4) | -| 1.18 | `#jni_call(s32)` → CallIntMethod (vtable slot 49). One arm added to the `call_method_offset` switch; reuses the 1.17 cache. | done (1d7ea72 xfail + ebcfe4c fix) | +| 1.18 | `#jni_call(i32)` → CallIntMethod (vtable slot 49). One arm added to the `call_method_offset` switch; reuses the 1.17 cache. | done (1d7ea72 xfail + ebcfe4c fix) | | 1.18+ | Lift JNI vtable offsets into a `const Jni` named-constants struct. Pre-loaded Object/Boolean/Long/Float/Double slots so 1.19–1.22 are one-line switch arms. | done (c1877fc) | -| 1.19 | `#jni_call(s64)` → CallLongMethod (vtable slot 52). One arm added. | done (da5b635 xfail + 5945a8c fix) | +| 1.19 | `#jni_call(i64)` → CallLongMethod (vtable slot 52). One arm added. | done (da5b635 xfail + 5945a8c fix) | | 1.20 | `#jni_call(f64)` → CallDoubleMethod (vtable slot 58). First non-integer JNI return. | done (xfail + ca4ba75 fix) | | 1.21 | `#jni_call(bool)` → CallBooleanMethod (vtable slot 37). | done (xfail + b0e8659 fix) | | 1.22 | `#jni_call(*void)` → CallObjectMethod (vtable slot 34). Pointer-return detected via `TypeInfo.pointer | .many_pointer` ahead of the primitive switch. LocalRef cleanup deferred — chess consumes objects inline. | done (xfail + b5694cc fix) | @@ -1200,7 +1200,7 @@ All ten sub-steps (1.15–1.24) shipped. `#jni_call(T)` and `#jni_static_call(T)` lower to JNI vtable indirection with shared `(name, sig)` literal-keyed slot interning (one `jclass GlobalRef` + one `jmethodID` per unique pair, populated lazily on the first -matching call). Return-type matrix covers `void` / `s32` / `s64` / +matching call). Return-type matrix covers `void` / `i32` / `i64` / `f64` / `bool` / `*T`. Static dispatch skips `GetObjectClass` and uses the parallel `GetStaticMethodID` + `CallStaticMethod` family. Both OS gates verified by `cross_compile.sh` (3/3 tuples @@ -1284,14 +1284,14 @@ alias; no lowering yet. | # | What | Status | |-----|---|---| -| 2.8 | `src/ir/jni_descriptor.zig` + `.test.zig`. `writeType` appends one JNI descriptor for an sx type AST node; `deriveMethod` returns the full `(args)ret` descriptor for a `ForeignMethodDecl`, skipping the implicit `self` on instance methods. `Context.enclosing_path` resolves `*Self` to its `L;` form. Primitive table-driven (void→V, bool→Z, s8/u8→B, s16→S, u16→C, s32→I, s64→J, f32→F, f64→D); arrays `[]T`/`[*]T`/`[N]T` → `[`. Cross-class `*Foo` → explicit error (lands in 2.9). 10 unit tests pass. **Cadence note**: landed as single commit since internal compiler functions don't have a sx-level snapshot surface yet — the rule re-applies at 2.11 where call-site lowering becomes end-to-end observable. | done (21c4906) | +| 2.8 | `src/ir/jni_descriptor.zig` + `.test.zig`. `writeType` appends one JNI descriptor for an sx type AST node; `deriveMethod` returns the full `(args)ret` descriptor for a `ForeignMethodDecl`, skipping the implicit `self` on instance methods. `Context.enclosing_path` resolves `*Self` to its `L;` form. Primitive table-driven (void→V, bool→Z, i8/u8→B, i16→S, u16→C, i32→I, i64→J, f32→F, f64→D); arrays `[]T`/`[*]T`/`[N]T` → `[`. Cross-class `*Foo` → explicit error (lands in 2.9). 10 unit tests pass. **Cadence note**: landed as single commit since internal compiler functions don't have a sx-level snapshot surface yet — the rule re-applies at 2.11 where call-site lowering becomes end-to-end observable. | done (21c4906) | | 2.9 | Cross-class `*Foo` resolves via `Context.classes: ?*const ClassRegistry` (a `StringHashMap` of sx alias → foreign path). `*Self` and `*Foo` share one code path. Retired `CrossClassRefNotYetSupported` in favour of `UnknownClassAlias`, which fires for both "no registry provided" and "alias not in registry". | done (5188265) | | 2.10 | `deriveMethod` short-circuits to the `jni_descriptor_override` (2.6 escape-hatch) when present, returning the override verbatim through an `allocator.dupe`. Bypasses normal derivation entirely — including resolution failures, which lets users escape `UnknownClassAlias` errors for synthetic-method cases. | done (ca840ff) | ## Phase 2B complete (signature derivation) `src/ir/jni_descriptor.zig` handles every shape the parser can hand it: -- Primitive types: `void/bool/s8..s64/u8/u16/f32/f64` → JNI single-char. +- Primitive types: `void/bool/i8..i64/u8/u16/f32/f64` → JNI single-char. - Arrays / slices / many-pointers: `[` (recursive). - `*Self` → `L;`. - `*Foo` → looks up Foo's foreign path in the supplied registry. @@ -1431,8 +1431,8 @@ When sx grows the cross-target story far enough: forwarding, R.1–R.5 retiring the legacy NativeActivity surface — all landed; chess on Pixel runs end-to-end as the integration witness). JNI return + parameter type validation lives in lowering with source- -spanned diagnostics; CallMethod coverage spans bool / s8 / s16 / -u16 / s32 / s64 / f32 / f64 / pointer; varargs promotion is wired. +spanned diagnostics; CallMethod coverage spans bool / i8 / i16 / +u16 / i32 / i64 / f32 / f64 / pointer; varargs promotion is wired. Phase 3 step 3.0 landed (for real this time): `inst.method(args)` on an `#objc_class` / `#objc_protocol` receiver derives the selector via @@ -1534,7 +1534,7 @@ type-check. turned out to be a red herring: the actual root cause was that `inferExprType` for a chained call `Cls.static().instance(...)` never looked the inner call's foreign-class declaration up, so the outer -dispatch saw a `.s64` receiver, the `foreign_class_map.get(...)` lookup +dispatch saw a `.i64` receiver, the `foreign_class_map.get(...)` lookup missed, and lowering emitted `error: unresolved 'method'`. The macOS target appeared to work because `inline if OS == .ios { ... }` strips the gated body before lowering — eliding every call that would have @@ -1832,11 +1832,11 @@ zig build && zig build test && bash tests/run_examples.sh && bash tests/cross_co `emitFunctionDecl` ([src/ir/emit_llvm.zig:682](src/ir/emit_llvm.zig#L682)) passes `is_var_arg=1` to `LLVMFunctionType` accordingly. New `promoteCVariadicArgs` applies C default argument promotion - (`bool/s8/s16/u8/u16 → s32`, `f32 → f64`) to extras past the fixed + (`bool/i8/i16/u8/u16 → i32`, `f32 → f64`) to extras past the fixed param count. `packVariadicCallArgs` early-outs for foreign+variadic so the slice-packing path is bypassed entirely. New test - `examples/ffi-foreign-cvariadic.sx` + `.c` exercise s64 / f64 / s32 - returns through C `va_arg` over s32 / f64 / `*u8` element types. + `examples/ffi-foreign-cvariadic.sx` + `.c` exercise i64 / f64 / i32 + returns through C `va_arg` over i32 / f64 / `*u8` element types. Stale-snapshot drift from in-progress std.sx additions (`xml_escape`, `path_join`, `BuildOptions.set_post_link_*`) re-pinned in 12 expected files — verified all diffs were dead-decl additions, string @@ -1878,10 +1878,10 @@ zig build && zig build test && bash tests/run_examples.sh && bash tests/cross_co nonvirt : CallNonvirtualByteMethod=70 / Char=73 / Short=76 static : CallStaticByteMethod=120 / Char=123 / Short=126 Each variant's `.jni_msg_send` return-type switch grew rows for - `.s8` / `.s16` / `.u16` (jbyte / jshort / jchar). New + `.i8` / `.i16` / `.u16` (jbyte / jshort / jchar). New `LLVMEmitter.jniPromoteVararg(val, raw_ty)` handles the call-site promotion that JNI's variadic CallMethod runtime expects: - s8 / s16 → SExt to i32 + i8 / i16 → SExt to i32 u8 / u16 / bool → ZExt to i32 f32 → FPExt to f64 Pointers and wide types pass through unchanged. Wired into all @@ -1895,8 +1895,8 @@ zig build && zig build test && bash tests/run_examples.sh && bash tests/cross_co hiding the more useful "unsupported return/parameter type at this token" diagnostic. New cross-compile test `examples/114-jni-promoted-narrow-types.sx` exercises a - `#jni_class` returning `s8 / s16 / u16` and a varargs method - taking `(s8, s16, u16, f32)`; IR shows the expected + `#jni_class` returning `i8 / i16 / u16` and a varargs method + taking `(i8, i16, u16, f32)`; IR shows the expected `sext i8 → i32`, `sext i16 → i32`, `zext i16 → i32`, and `double 1.5e+00` (FPExt folded for the constant) at the call site. Tests 112 / 113 migrated to use `u32` (Java has no @@ -1910,7 +1910,7 @@ zig build && zig build test && bash tests/run_examples.sh && bash tests/cross_co methods) and rejects unsupported parameter types at the type token's span; `lowerJniCall` validates each method arg's TypeId post-lowering against the arg expression's span. Same supported - set as returns (bool / s32 / s64 / f32 / f64 / pointer) minus + set as returns (bool / i32 / i64 / f32 / f64 / pointer) minus `void` for params. Refactor splits `validateJniReturnType` / `validateJniParamType` over a shared `validateJniType` core that formats the diagnostic with a "return type" / "parameter type" @@ -1923,7 +1923,7 @@ zig build && zig build test && bash tests/run_examples.sh && bash tests/cross_co `examples/113-jni-unsupported-param-type.sx` locks in the parameter-type diagnostic shape (e.g. `examples/113-jni-unsupported-param-type.sx:16:30: error: JNI - call 'Foo.take': unsupported parameter type 's8' (...)`). 143 + call 'Foo.take': unsupported parameter type 'i8' (...)`). 143 host + 9 cross tests green; chess on Pixel still builds clean. - 2026-05-20: JNI return-type validation lifted from emit_llvm @@ -1931,11 +1931,11 @@ zig build && zig build test && bash tests/run_examples.sh && bash tests/cross_co in `src/ir/lower.zig`) so the diagnostic carries the return-type slot's source span. New `Lowering.validateJniReturnType` helper mirrors the supported - set in emit_llvm's `.jni_msg_send` switch (void / bool / s32 / - s64 / f32 / f64 / pointer types); a `*Foo.bad()` call where + set in emit_llvm's `.jni_msg_send` switch (void / bool / i32 / + i64 / f32 / f64 / pointer types); a `*Foo.bad()` call where `bad()` returns an unsupported type now produces e.g. `examples/112-jni-unsupported-return-type.sx:15:29: error: - JNI call 'Foo.bad': unsupported return type 's8' (JNI lowering + JNI call 'Foo.bad': unsupported return type 'i8' (JNI lowering supports ...)`. emit_llvm's diagnostic stays as defense in depth — it would only fire if a future IR path bypasses the lowering check. New focused test @@ -1969,13 +1969,13 @@ zig build && zig build test && bash tests/run_examples.sh && bash tests/cross_co - 2026-05-20: chess-on-Pixel size bug fixed by refactoring `library/modules/platform/android.sx` to zero module-level - globals. Root cause: android.sx exported `g_viewport_w : s32 = 0` - and `g_viewport_h : s32 = 0` at module scope; chess's `main.sx` + globals. Root cause: android.sx exported `g_viewport_w : i32 = 0` + and `g_viewport_h : i32 = 0` at module scope; chess's `main.sx` declared its own `g_viewport_w : f32 = 800.0` at module scope. When chess `#import`ed android.sx, the imported public global shadowed chess's local decl for the unqualified name resolution, so chess's writes (`g_viewport_w = fc.viewport_w`) silently - clobbered android.sx's s32 with the logical f32 cast to s32 (414 + clobbered android.sx's i32 with the logical f32 cast to i32 (414 instead of 1080). `Gles3Gpu.pixel_w` then fed `glViewport(0,0, 414,831)`, clipping rendering to a 414-pixel box in the GL- bottom-left. Refactor moved every piece of Android backend state @@ -2008,7 +2008,7 @@ zig build && zig build test && bash tests/run_examples.sh && bash tests/cross_co `lowerObjcStaticCall` route through the same helper so the IR Ref's recorded ret_ty matches what `inferExprType` reports. Pre-fix: `UIWindow.alloc().initWithWindowScene(scene)` (and any other chained - shape) collapsed the inner ret to `.s64`, the next dispatch's + shape) collapsed the inner ret to `.i64`, the next dispatch's `foreign_class_map.get(...)` missed, and lowering emitted `error: unresolved 'initWithWindowScene'`. The "lazy-lower" wording in the issue file is a red herring — the bug fires on direct calls too; diff --git a/current/CHECKPOINT-MEM.md b/current/CHECKPOINT-MEM.md index b83e4e2..083e175 100644 --- a/current/CHECKPOINT-MEM.md +++ b/current/CHECKPOINT-MEM.md @@ -38,8 +38,8 @@ game rebuilt.
Prior steps (2026-05-25 era) -- **`resolveType(null) → .s64` silent fallback removed.** `resolveType` - now takes a non-optional `*const Node`; the `null → .s64` branch is +- **`resolveType(null) → .i64` silent fallback removed.** `resolveType` + now takes a non-optional `*const Node`; the `null → .i64` branch is gone. Callers that legitimately had no annotation handle it themselves: top-level `var_decl` at `lower.zig:630` infers from the initializer or diagnoses if neither is present (matches the @@ -54,7 +54,7 @@ game rebuilt. ...`), which makes the always-non-null path obvious from the type. Real-world impact: `g_pi := 3.14;` at the top level used to be - silently typed as `s64`. Now it infers as `f64`. Regression at + silently typed as `i64`. Now it infers as `f64`. Regression at `examples/137-toplevel-var-type-inference.sx` (count/pi/flag — int / float / bool inferred correctly). 159/159 example tests + chess clean. @@ -161,7 +161,7 @@ game rebuilt. recursive heap content). Also closes the type-inference half of the same bug: `NAME :: #run - expr;` with no annotation used to default to `s64` (silent fallback + expr;` with no annotation used to default to `i64` (silent fallback in `resolveType(null)`). `lowerComptimeGlobal` now infers from the expression's return type when no annotation is provided. The silent fallback in `resolveType` itself is left in place for other @@ -255,7 +255,7 @@ Phase 0 spike outcomes: inst.zig BuiltinId, lower.zig (registry + return-type + reflection handler), interp.zig (fallback), sema.zig (allowed-builtins list), lsp/server.zig (both completion tables), library/modules/std.sx. - Smoke coverage added in `examples/50-smoke.sx` (u8/s32/s64/Point). + Smoke coverage added in `examples/50-smoke.sx` (u8/i32/i64/Point). - **0.7** `#import` transitivity — surfaced and fixed via issue-0038. - **0.8** `#foreign("c")` rename syntax — confirmed `#foreign libc "name"`. @@ -270,7 +270,7 @@ verification: `size_of(*u8)=8`, `size_of(Ptr where Ptr::*u8)=8`, `size_of(?u8)=2`, `size_of(Maybe where Maybe::?u8)=2` — all clean on interp + codegen. -Also landed during 0041/0042: the silent `.s64` fallback in +Also landed during 0041/0042: the silent `.i64` fallback in `resolveTypeArg` is gone — unresolved type names now emit a real diagnostic. Surfaced and removed two bogus `size_of(Complex)` / `size_of(Sx)` calls in `examples/10-generic-struct.sx` that were @@ -334,7 +334,7 @@ What landed: store honours the destination width — no more "assume 8 bytes" silent clobber. Regression test at `examples/132-comptime-typed-store-widths.sx` exercises every - primitive width (u8/u16/u32/u64, s8..s64, bool, f32, f64) via + primitive width (u8/u16/u32/u64, i8..i64, bool, f32, f64) via comptime checksums compared to runtime checksums. - Call-convention mismatch at bare-fn → fn-pointer coercion is now a compile error (commit `f886d5f`). The chess-debug sweep that @@ -563,7 +563,7 @@ Allocator value naturally. builds) + m3te (23/23). Suite 582/582, zbt 0. Discriminator note: Obj-C `.alloc()` is zero-arg; Allocator `.alloc(size)` has an arg — the sed keyed on `\.alloc\((?!\))`. -- **2026-05-25 (latest)** — `resolveType(null) → .s64` removed. +- **2026-05-25 (latest)** — `resolveType(null) → .i64` removed. Signature changed to non-optional `*const Node`; 12 callers surveyed and classified. The three unguarded ones — top-level `var_decl` at `lower.zig:630` (now mirrors lowerVarDecl's @@ -573,7 +573,7 @@ Allocator value naturally. `if (x != null)` blocks; cleaned up to optional-payload syntax. `examples/137-toplevel-var-type-inference.sx` proves the visible win: `g_pi := 3.14;` at module scope now infers `f64` (used to be - silent `s64`). 159/159 + chess clean. + silent `i64`). 159/159 + chess clean. - **2026-05-25 (penultimate)** — Phase 1.4a shipped. `valueToLLVMConst` takes IR `TypeId` (not LLVM type) + an interpreter handle. String/slice fat pointers are serialized by capturing the @@ -616,8 +616,8 @@ Allocator value naturally. at line 676 now passes `global.name` so the diagnostic locates the offending `#run` site. `lowerComptimeGlobal` (`lower.zig:6384`) infers the return type from the expression when the user omits - the type annotation — closes the silent-s64 default for `NAME :: - #run expr;` bindings. The broader `resolveType(null) -> .s64` + the type annotation — closes the silent-i64 default for `NAME :: + #run expr;` bindings. The broader `resolveType(null) -> .i64` fallback is left in place for other callers — flagged for a follow-up audit. Regression at `examples/134-comptime-aggregate-global.sx`. 156/156 + chess green. @@ -687,7 +687,7 @@ Allocator value naturally. (`Tracer.count = 1`) — interp + codegen parity. 152/152 + chess green. - **2026-05-24** — issue-0041 and issue-0042 both fixed end-to-end. - Also removed the silent `.s64` fallback in `resolveTypeArg`, + Also removed the silent `.i64` fallback in `resolveTypeArg`, guarded the two upstream callers (`buildTypeBindings`, `inferGenericReturnType`) with `type_bridge.isTypeShapedAstNode`, and fixed three parser regressions introduced by the 0041 work @@ -759,8 +759,8 @@ Allocator value naturally. `mi.ret_type == void_ptr`, but `*void` is overloaded — both Self-disguised-as-*void AND a literal `-> *void` return appear as the same `TypeId`. With `target_type` leaking from the enclosing - function's return type (e.g. `main -> s32`), every `*void` return - was loaded as `s32`, yielding 0 → null. Fix: stash `ret_is_self` + function's return type (e.g. `main -> i32`), every `*void` return + was loaded as `i32`, yielding 0 → null. Fix: stash `ret_is_self` on `ProtocolMethodInfo` during `registerProtocolDecl` (set when the AST return-type node is the `Self` type-expr), and gate the unbox on that flag. Regression at @@ -781,12 +781,12 @@ Allocator value naturally. ## Known issues (discovered during execution) -### ISSUE-MEM-001: Type inference defaults `p := malloc(64)` to `s64` +### ISSUE-MEM-001: Type inference defaults `p := malloc(64)` to `i64` **Severity:** medium (workaround exists; bites unexpectedly). **Symptom:** Writing `p := malloc(64)` (no explicit type) infers -`p: s64` instead of `p: *void`. Subsequent `free(p)` then fails LLVM +`p: i64` instead of `p: *void`. Subsequent `free(p)` then fails LLVM verification with "Call parameter type does not match function signature!" because `free` expects `ptr` but receives `i64`. @@ -795,8 +795,8 @@ or `xx malloc(64);` at the call site. **Reproduction:** ```sx -main :: () -> s32 { - p := malloc(64); // p inferred as s64 +main :: () -> i32 { + p := malloc(64); // p inferred as i64 free(p); // LLVM verify fails: ptr expected, i64 given 0; } @@ -804,7 +804,7 @@ main :: () -> s32 { **Root cause:** Likely in the inference path for `:=` declarations when the RHS is a `*void`-returning #builtin. The compiler defaults -the binding to s64 instead of matching the return type. To +the binding to i64 instead of matching the return type. To investigate in a future session. **Status:** Open. Not blocking mem.sx work but worth fixing as a @@ -920,9 +920,9 @@ where users need the underlying state (TrackingAllocator). its auto-unbox path on `mi.ret_type == void_ptr`, but the same `TypeId` covers both Self-disguised-as-*void and a literal `-> *void`. With `target_type` leaking from the surrounding -function (e.g. `main -> s32`), every protocol call returning +function (e.g. `main -> i32`), every protocol call returning `*void` got its result loaded as `sizeof(target_type)` bytes — for -`s32` that's the first 4 bytes of the malloc'd block, which were +`i32` that's the first 4 bytes of the malloc'd block, which were zero, comparing equal to null. **Fix:** Tag `ProtocolMethodInfo` with `ret_is_self: bool`, set in diff --git a/docs/error-handling.md b/docs/error-handling.md index 1b0628d..f61d609 100644 --- a/docs/error-handling.md +++ b/docs/error-handling.md @@ -12,14 +12,14 @@ wrapped around them. A function that can fail adds a trailing `!` to its return type: ```sx -parse_digit :: (s: string) -> (s32, !) { +parse_digit :: (s: string) -> (i32, !) { if s.len == 0 raise error.Empty; if !is_digit(s[0]) raise error.BadDigit; return s[0] - '0'; } ``` -The `(s32, !)` says "returns an `s32` on success, or an error." The `!` +The `(i32, !)` says "returns an `i32` on success, or an error." The `!` is one more slot in sx's normal multi-return — the error rides alongside the values, it doesn't replace them. @@ -61,7 +61,7 @@ in the signature: ```sx ParseErr :: error { Empty, BadDigit, Overflow }; -parse_int :: (s: string) -> (s32, !ParseErr) { +parse_int :: (s: string) -> (i32, !ParseErr) { if s.len == 0 raise error.Empty; if overflowed raise error.Overflow; ... @@ -109,7 +109,7 @@ When you call a failable function and want its error to bubble up to *your* caller, prefix the call with `try`: ```sx -two_digits :: (s: string) -> (s32, !) { +two_digits :: (s: string) -> (i32, !) { a := try parse_digit(s); // if this fails, two_digits fails b := try parse_digit(s[1..]); return a * 10 + b; @@ -153,7 +153,7 @@ attempt. port := parse_port(s) or 8080; // if parsing fails, port = 8080 ``` -The error is absorbed; `port` is a plain `s32`. +The error is absorbed; `port` is a plain `i32`. ### Chain attempts — first success wins @@ -347,7 +347,7 @@ For human-readable context, use `log` on the error path — the tag tells you *what* failed, the log tells you the *details*: ```sx -parse :: (s: string) -> (s32, !) { +parse :: (s: string) -> (i32, !) { onfail e { log.warn("parsing {}: {}", s, e); } ... } diff --git a/examples/0010-basic-basic.sx b/examples/0010-basic-basic.sx index aa428cd..5d22607 100644 --- a/examples/0010-basic-basic.sx +++ b/examples/0010-basic-basic.sx @@ -1,5 +1,5 @@ #import "modules/std.sx"; -main :: () -> s32 { +main :: () -> i32 { if false then 40 else 42 } \ No newline at end of file diff --git a/examples/0012-basic-shadow.sx b/examples/0012-basic-shadow.sx index 288655c..7defba8 100644 --- a/examples/0012-basic-shadow.sx +++ b/examples/0012-basic-shadow.sx @@ -1,5 +1,5 @@ #import "modules/std.sx"; -main :: () -> s32 { +main :: () -> i32 { x := 42; { print("scope opened\n"); diff --git a/examples/0013-basic-defer.sx b/examples/0013-basic-defer.sx index 4502c8c..829002d 100644 --- a/examples/0013-basic-defer.sx +++ b/examples/0013-basic-defer.sx @@ -1,5 +1,5 @@ #import "modules/std.sx"; -main :: () -> s32 { +main :: () -> i32 { defer print("still here\n"); return 42; } diff --git a/examples/0016-basic-while.sx b/examples/0016-basic-while.sx index ff4321e..b8804e2 100644 --- a/examples/0016-basic-while.sx +++ b/examples/0016-basic-while.sx @@ -1,6 +1,6 @@ #import "modules/std.sx"; -sumOf10 :: () -> s32 { +sumOf10 :: () -> i32 { i:= 1; s:=0; while i <= 10 { diff --git a/examples/0018-basic-quicksort.sx b/examples/0018-basic-quicksort.sx index 113474c..193c4aa 100644 --- a/examples/0018-basic-quicksort.sx +++ b/examples/0018-basic-quicksort.sx @@ -1,7 +1,7 @@ #import "modules/std.sx"; quick_sort :: (items: []$T) { - partition :: (items: []T, lo: s64, hi: s64) -> s64 { + partition :: (items: []T, lo: i64, hi: i64) -> i64 { pivot := items[hi]; i := lo - 1; j := lo; @@ -17,7 +17,7 @@ quick_sort :: (items: []$T) { i } - sort :: (items: []T, lo: s64, hi: s64) { + sort :: (items: []T, lo: i64, hi: i64) { if lo < hi { pi := partition(items, lo, hi); sort(items, lo, pi - 1); @@ -29,7 +29,7 @@ quick_sort :: (items: []$T) { } main :: () { - arr : []s64 = .[333, 2, 3, 5, 2, 2, 3, 4, 5, 6, 6, 1]; + arr : []i64 = .[333, 2, 3, 5, 2, 2, 3, 4, 5, 6, 6, 1]; quick_sort(arr); print("{}\n", arr); } diff --git a/examples/0019-basic-dot-shorthand.sx b/examples/0019-basic-dot-shorthand.sx index 22d82d9..bf84914 100644 --- a/examples/0019-basic-dot-shorthand.sx +++ b/examples/0019-basic-dot-shorthand.sx @@ -24,7 +24,7 @@ Vec2 :: struct { unit_x :: () -> Vec2 { Vec2.{ x = 1.0, y = 0.0 } } add :: (a: Vec2, b: Vec2) -> Vec2 { Vec2.{ x = a.x + b.x, y = a.y + b.y } } scale :: (v: Vec2, s: f32) -> Vec2 { Vec2.{ x = v.x * s, y = v.y * s } } - len :: (v: Vec2) -> s32 { xx (v.x + v.y) } + len :: (v: Vec2) -> i32 { xx (v.x + v.y) } } EdgeInsets :: struct { @@ -39,16 +39,16 @@ EdgeInsets :: struct { } Trio :: struct { - a: s32; - b: s32; - c: s32; + a: i32; + b: i32; + c: i32; - make :: (a: s32, b: s32, c: s32) -> Trio { Trio.{ a = a, b = b, c = c } } - sum :: (t: Trio) -> s32 { t.a + t.b + t.c } + make :: (a: i32, b: i32, c: i32) -> Trio { Trio.{ a = a, b = b, c = c } } + sum :: (t: Trio) -> i32 { t.a + t.b + t.c } } Result :: enum { - ok: s32; + ok: i32; err: string; } @@ -121,7 +121,7 @@ main :: () { // T8: .variant(payload) as function argument (match-as-expression) { - describe :: (sh: Shape) -> s32 { + describe :: (sh: Shape) -> i32 { if sh == { case .circle: 10; case .rect: 20; @@ -145,7 +145,7 @@ main :: () { // T10: Match as expression returning tagged enum { - select :: (n: s32) -> Shape { + select :: (n: i32) -> Shape { if n == { case 0: .none; case 1: .circle(1.0); @@ -243,7 +243,7 @@ main :: () { // E2: Function taking both types — each resolves correctly { use_both :: (sh: Shape, v: Vec2) { - ms : s32 = 0; + ms : i32 = 0; if sh == { case .circle: (r) { ms = xx r; } else: {} } print("E2: {} {} {}\n", ms, v.x, v.y); } @@ -252,7 +252,7 @@ main :: () { // E3: Bare .variant (no parens) as function arg { - check_none :: (sh: Shape) -> s32 { + check_none :: (sh: Shape) -> i32 { if sh == { case .none: 1; else: 0; } } print("E3: {}\n", check_none(.none)); @@ -268,7 +268,7 @@ main :: () { // E5: Tagged enum .variant(payload) in match-as-expression { sh : Shape = .circle(42.0); - r : s32 = 0; + r : i32 = 0; if sh == { case .circle: (v) { r = xx v; } case .rect: (sz) { r = xx sz.w; } @@ -280,7 +280,7 @@ main :: () { // E6: Color enum (plain, not tagged) still works with bare .variant { c : Color = .green; - ci : s32 = xx c; + ci : i32 = xx c; print("E6: {}\n", ci); } diff --git a/examples/0020-basic-inline-if-return-fallthrough.sx b/examples/0020-basic-inline-if-return-fallthrough.sx index 5ada8c2..8d30221 100644 --- a/examples/0020-basic-inline-if-return-fallthrough.sx +++ b/examples/0020-basic-inline-if-return-fallthrough.sx @@ -11,6 +11,6 @@ do_it :: () -> bool { true } -main :: () -> s32 { +main :: () -> i32 { if do_it() then 0 else 1 } diff --git a/examples/0021-basic-expression-bodied-fn.sx b/examples/0021-basic-expression-bodied-fn.sx index c5c3677..6ee3595 100644 --- a/examples/0021-basic-expression-bodied-fn.sx +++ b/examples/0021-basic-expression-bodied-fn.sx @@ -9,21 +9,21 @@ #import "modules/std.sx"; -double :: (x: s32) -> s32 => x * 2; +double :: (x: i32) -> i32 => x * 2; -sum :: (a: s32, b: s32) -> s32 => a + b; +sum :: (a: i32, b: i32) -> i32 => a + b; -answer :: () -> s32 => 42; +answer :: () -> i32 => 42; Point :: struct { - x: s32; - y: s32; + x: i32; + y: i32; - total :: (self: *Point) -> s32 => self.x + self.y; - scaled :: (self: *Point, by: s32) -> s32 => (self.x + self.y) * by; + total :: (self: *Point) -> i32 => self.x + self.y; + scaled :: (self: *Point, by: i32) -> i32 => (self.x + self.y) * by; } -main :: () -> s32 { +main :: () -> i32 { print("double: {}\n", double(7)); print("sum: {}\n", sum(3, 4)); print("answer: {}\n", answer()); diff --git a/examples/0022-basic-for-range.sx b/examples/0022-basic-for-range.sx index 599e9d1..b9e6483 100644 --- a/examples/0022-basic-for-range.sx +++ b/examples/0022-basic-for-range.sx @@ -9,7 +9,7 @@ Show :: protocol { show :: () -> string; } -A :: struct { x: s64; } +A :: struct { x: i64; } B :: struct { s: string; } impl Show for A { show :: (self: *A) -> string => "A"; } impl Show for B { show :: (self: *B) -> string => "B"; } @@ -21,7 +21,7 @@ each :: (..xs: Show) -> void { } } -main :: () -> s32 { +main :: () -> i32 { // Runtime range, cursor used. for 0..3 (i) { print("i={}\n", i); } diff --git a/examples/0023-basic-for-by-ref-capture.sx b/examples/0023-basic-for-by-ref-capture.sx index 1917bfa..2d38fbc 100644 --- a/examples/0023-basic-for-by-ref-capture.sx +++ b/examples/0023-basic-for-by-ref-capture.sx @@ -7,9 +7,9 @@ Shape :: enum { none; } -main :: () -> s32 { +main :: () -> i32 { // By-ref mutation writes back into the array (impossible with a value copy). - xs : [3]s64 = .[1, 2, 3]; + xs : [3]i64 = .[1, 2, 3]; for xs (*x) { x.* = x + 100; } print("{} {} {}\n", xs[0], xs[1], xs[2]); diff --git a/examples/0024-basic-for-list.sx b/examples/0024-basic-for-list.sx index a9a2f5a..af26d01 100644 --- a/examples/0024-basic-for-list.sx +++ b/examples/0024-basic-for-list.sx @@ -4,23 +4,23 @@ #import "modules/std.sx"; Box :: struct { - v: s64; - boxed :: (self: Box) -> s64 { self.v } // value receiver + v: i64; + boxed :: (self: Box) -> i64 { self.v } // value receiver } -sum_ptr :: (xs: *List(s64)) -> s64 { - total : s64 = 0; +sum_ptr :: (xs: *List(i64)) -> i64 { + total : i64 = 0; for xs (n) { total = total + n; } // iterate through a *List total } -main :: () -> s32 { - xs := List(s64).{}; +main :: () -> i32 { + xs := List(i64).{}; xs.append(10); xs.append(20); xs.append(30); - s : s64 = 0; + s : i64 = 0; for xs (n) { s = s + n; } // value capture print("sum {}\n", s); // 60 @@ -33,7 +33,7 @@ main :: () -> s32 { bs := List(Box).{}; bs.append(.{ v = 7 }); - bt : s64 = 0; + bt : i64 = 0; for bs (*b) { bt = bt + b.boxed(); } // *Box receiver, value-self method print("boxes {}\n", bt); // 7 0 diff --git a/examples/0025-basic-literals.sx b/examples/0025-basic-literals.sx index 7720ef7..6b1ea25 100644 --- a/examples/0025-basic-literals.sx +++ b/examples/0025-basic-literals.sx @@ -45,7 +45,7 @@ END; print("heredoc: {}\n", hd); // Undefined with type - undef_val : s32 = ---; + undef_val : i32 = ---; undef_val = 77; print("undef-then-set: {}\n", undef_val); @@ -54,7 +54,7 @@ END; print("enum-lit: {}\n", c); // Null pointer - np : *s32 = null; + np : *i32 = null; print("null-ptr: {}\n", np); // String .len diff --git a/examples/0026-basic-operators.sx b/examples/0026-basic-operators.sx index 47c9c77..9fb4842 100644 --- a/examples/0026-basic-operators.sx +++ b/examples/0026-basic-operators.sx @@ -4,17 +4,17 @@ #import "modules/std/test.sx"; pkg :: #import "tests/fixtures/testpkg"; -add :: (a: s32, b: s32) -> s32 { a + b } +add :: (a: i32, b: i32) -> i32 { a + b } -mul :: (a: s32, b: s32) -> s32 { a * b } +mul :: (a: i32, b: i32) -> i32 { a * b } // P4 edge: Chained default→default calls Chained :: protocol { - base :: (msg: string) -> s32; - wrap :: (msg: string) -> s32 { + base :: (msg: string) -> i32; + wrap :: (msg: string) -> i32 { self.base(msg) + 1 } - double_wrap :: (msg: string) -> s32 { + double_wrap :: (msg: string) -> i32 { self.wrap(msg) + self.wrap(msg) } } @@ -136,31 +136,31 @@ main :: () { // Implicit widening conversions wu : u8 = 200; - ws : s64 = wu; - print("widen-u8-s64: {}\n", ws); + ws : i64 = wu; + print("widen-u8-i64: {}\n", ws); - wi3 : s32 = 42; + wi3 : i32 = 42; wf : f64 = wi3; - print("widen-s32-f64: {}\n", wf); + print("widen-i32-f64: {}\n", wf); wf32 : f32 = 1.5; wf64 : f64 = wf32; print("widen-f32-f64: {}\n", wf64); wu2 : u8 = 100; - ws2 : s16 = wu2; - print("widen-u8-s16: {}\n", ws2); + ws2 : i16 = wu2; + print("widen-u8-i16: {}\n", ws2); // More xx narrowing - xl : s64 = 12345; - xs : s32 = xx xl; - print("xx-s64-s32: {}\n", xs); + xl : i64 = 12345; + xs : i32 = xx xl; + print("xx-i64-i32: {}\n", xs); xd : f64 = 1.5; xf : f32 = xx xd; print("xx-f64-f32: {}\n", xf); xdf : f64 = 7.9; - xdi : s32 = xx xdf; - print("xx-f64-s32: {}\n", xdi); + xdi : i32 = xx xdf; + print("xx-f64-i32: {}\n", xdi); } diff --git a/examples/0027-basic-control-flow.sx b/examples/0027-basic-control-flow.sx index 601e1c2..6710570 100644 --- a/examples/0027-basic-control-flow.sx +++ b/examples/0027-basic-control-flow.sx @@ -116,7 +116,7 @@ main :: () { print("nested-break: {} {}\n", nb_outer, nb_icount); // For loop basic - farr : [4]s32 = .[10, 20, 30, 40]; + farr : [4]i32 = .[10, 20, 30, 40]; out("for:"); for farr (it) { out(" "); @@ -163,7 +163,7 @@ main :: () { out("\n"); // For on slice - fsl : []s32 = .[10, 20, 30]; + fsl : []i32 = .[10, 20, 30]; out("for-slice:"); for fsl (it) { print(" {}", it); @@ -178,8 +178,8 @@ main :: () { out("\n"); // Nested for - nf_a : [2]s32 = .[0, 1]; - nf_b : [2]s32 = .[0, 1]; + nf_a : [2]i32 = .[0, 1]; + nf_b : [2]i32 = .[0, 1]; out("for-nested:"); for nf_a (oa) { for nf_b (ob) { @@ -189,7 +189,7 @@ main :: () { out("\n"); // For with break preserving index - fbi : [5]s32 = .[10, 20, 30, 40, 50]; + fbi : [5]i32 = .[10, 20, 30, 40, 50]; fbi_idx := 0; for fbi, 0.. (it, ix) { if it == 30 { fbi_idx = ix; break; } diff --git a/examples/0028-basic-functions.sx b/examples/0028-basic-functions.sx index 8742de2..80da654 100644 --- a/examples/0028-basic-functions.sx +++ b/examples/0028-basic-functions.sx @@ -4,23 +4,23 @@ #import "modules/std/test.sx"; pkg :: #import "tests/fixtures/testpkg"; -add :: (a: s32, b: s32) -> s32 { a + b } +add :: (a: i32, b: i32) -> i32 { a + b } -mul :: (a: s32, b: s32) -> s32 { a * b } +mul :: (a: i32, b: i32) -> i32 { a * b } identity :: (x: $T) -> T { x } -pair_add :: (a: $T, b: $U) -> s64 { - cast(s64) a + cast(s64) b +pair_add :: (a: $T, b: $U) -> i64 { + cast(i64) a + cast(i64) b } -typed_sum :: (..args: []s32) -> s32 { +typed_sum :: (..args: []i32) -> i32 { result := 0; for args (it) { result = result + it; } result } -apply :: (f: (s32, s32) -> s32, x: s32, y: s32) -> s32 { +apply :: (f: (i32, i32) -> i32, x: i32, y: i32) -> i32 { f(x, y) } @@ -28,11 +28,11 @@ void_return :: () { return; } -implicit_return :: (x: s32) -> s32 { +implicit_return :: (x: i32) -> i32 { x * 2 } -early_return :: (x: s32) -> s32 { +early_return :: (x: i32) -> i32 { if x > 10 { return 99; } x } @@ -53,7 +53,7 @@ main :: () { print("typed-const: {}\n", TYPED_PI); // Variable with default init - di : s32; + di : i32; print("default-init: {}\n", di); // Implicit return @@ -68,7 +68,7 @@ main :: () { print("void-return: ok\n"); // Generic — single param - print("generic-s32: {}\n", identity(42)); + print("generic-i32: {}\n", identity(42)); print("generic-f32: {}\n", identity(1.5)); print("generic-bool: {}\n", identity(true)); @@ -76,7 +76,7 @@ main :: () { print("generic-multi: {}\n", pair_add(10, 20)); // Lambda - double :: (x: s32) => x * 2; + double :: (x: i32) => x * 2; print("lambda: {}\n", double(7)); // Lambda with return type @@ -84,7 +84,7 @@ main :: () { print("lambda-ret: {}\n", halve(10.0)); // Local function (non-lambda) - local_add :: (a: s32, b: s32) -> s32 { a + b } + local_add :: (a: i32, b: i32) -> i32 { a + b } print("local-fn: {}\n", local_add(3, 4)); // Nested function calls @@ -94,11 +94,11 @@ main :: () { print("varargs: {}\n", typed_sum(1, 2, 3, 4, 5)); // Spread - spread_arr : [3]s32 = .[10, 20, 30]; + spread_arr : [3]i32 = .[10, 20, 30]; print("spread: {}\n", typed_sum(..spread_arr)); // Function pointers - fp : (s32, s32) -> s32 = add; + fp : (i32, i32) -> i32 = add; print("fp: {}\n", fp(3, 4)); fp = mul; print("fp-reassign: {}\n", fp(3, 4)); diff --git a/examples/0030-basic-builtins.sx b/examples/0030-basic-builtins.sx index 57ef873..ac44b3e 100644 --- a/examples/0030-basic-builtins.sx +++ b/examples/0030-basic-builtins.sx @@ -4,7 +4,7 @@ #import "modules/std/test.sx"; pkg :: #import "tests/fixtures/testpkg"; -Point :: struct { x, y: s32; } +Point :: struct { x, y: i32; } Color :: enum { red; green; blue; } @@ -29,14 +29,14 @@ main :: () { print("sqrt-f64: {}\n", sqrt(16.0)); // size_of - print("sizeof-s32: {}\n", size_of(s32)); + print("sizeof-i32: {}\n", size_of(i32)); print("sizeof-f64: {}\n", size_of(f64)); print("sizeof-struct: {}\n", size_of(Point)); // align_of print("alignof-u8: {}\n", align_of(u8)); - print("alignof-s32: {}\n", align_of(s32)); - print("alignof-s64: {}\n", align_of(s64)); + print("alignof-i32: {}\n", align_of(i32)); + print("alignof-i64: {}\n", align_of(i64)); print("alignof-struct: {}\n", align_of(Point)); // type_of + category matching @@ -121,7 +121,7 @@ main :: () { // cast cval : f64 = 3.7; - print("cast: {}\n", cast(s32) cval); - cv2 : s32 = 42; + print("cast: {}\n", cast(i32) cval); + cv2 : i32 = 42; print("cast-int-f64: {}\n", cast(f64) cv2); } diff --git a/examples/0031-basic-local-fn-return.sx b/examples/0031-basic-local-fn-return.sx index 842d0e0..f80d75d 100644 --- a/examples/0031-basic-local-fn-return.sx +++ b/examples/0031-basic-local-fn-return.sx @@ -4,7 +4,7 @@ #import "modules/std/test.sx"; pkg :: #import "tests/fixtures/testpkg"; -Point :: struct { x, y: s32; } +Point :: struct { x, y: i32; } Shape :: enum { circle: f32; diff --git a/examples/0032-basic-ufcs-return-type.sx b/examples/0032-basic-ufcs-return-type.sx index b9f6681..8eae97c 100644 --- a/examples/0032-basic-ufcs-return-type.sx +++ b/examples/0032-basic-ufcs-return-type.sx @@ -4,9 +4,9 @@ #import "modules/std/test.sx"; pkg :: #import "tests/fixtures/testpkg"; -Point :: struct { x, y: s32; } +Point :: struct { x, y: i32; } -point_sum :: (p: Point) -> s32 { p.x + p.y } +point_sum :: (p: Point) -> i32 { p.x + p.y } // #run compile-time constants diff --git a/examples/0033-basic-if-struct.sx b/examples/0033-basic-if-struct.sx index fd74020..1371ca1 100644 --- a/examples/0033-basic-if-struct.sx +++ b/examples/0033-basic-if-struct.sx @@ -4,7 +4,7 @@ #import "modules/std/test.sx"; pkg :: #import "tests/fixtures/testpkg"; -Point :: struct { x, y: s32; } +Point :: struct { x, y: i32; } main :: () { diff --git a/examples/0035-basic-array-loop-mutation.sx b/examples/0035-basic-array-loop-mutation.sx index c2945c9..817b7ec 100644 --- a/examples/0035-basic-array-loop-mutation.sx +++ b/examples/0035-basic-array-loop-mutation.sx @@ -11,7 +11,7 @@ main :: () { // ======================================================== print("=== 25. Array Loop Mutation ===\n"); { - arr : [4]s32 = .[0, 0, 0, 0]; + arr : [4]i32 = .[0, 0, 0, 0]; i := 0; while i < 4 { arr[i] = xx (i + 1); diff --git a/examples/0036-basic-ufcs-aliases.sx b/examples/0036-basic-ufcs-aliases.sx index 0866b6d..3b3bf79 100644 --- a/examples/0036-basic-ufcs-aliases.sx +++ b/examples/0036-basic-ufcs-aliases.sx @@ -10,7 +10,7 @@ main :: () { { print("=== UFCS Aliases ===\n"); - num_sum :: (a: s64, b: s64) -> s64 { a + b } + num_sum :: (a: i64, b: i64) -> i64 { a + b } sum :: ufcs num_sum; print("{}\n", num_sum(40, 2)); // 42 — direct call @@ -20,7 +20,7 @@ main :: () { print("{}\n", num_sum(40, 2)); // 42 — direct (was tuple full-splat) print("{}\n", 40 |> sum(2)); // 42 — pipe (was tuple partial-splat) - compute :: (a: s64, b: s64, c: s64, d: s64) -> s64 { a + b * c - d } + compute :: (a: i64, b: i64, c: i64, d: i64) -> i64 { a + b * c - d } calc :: ufcs compute; print("{}\n", compute(1, 2, 3, 4)); // 1+2*3-4 = 3 (was tuple full-splat) @@ -28,14 +28,14 @@ main :: () { print("{}\n", 1 |> calc(2, 3, 4)); // same = 3 — pipe UFCS // Tuple return type - swap :: (a: s64, b: s64) -> (s64, s64) { (b, a) } + swap :: (a: i64, b: i64) -> (i64, i64) { (b, a) } s := swap(1, 2); a := s.0; b := s.1; print("{}\n", a); // 2 print("{}\n", b); // 1 - wrap :: (x: s64) -> (s64) { (x,) } + wrap :: (x: i64) -> (i64) { (x,) } t := wrap(99); print("{}\n", t.0); // 99 } diff --git a/examples/0037-basic-trailing-commas.sx b/examples/0037-basic-trailing-commas.sx index 37eecac..ead980d 100644 --- a/examples/0037-basic-trailing-commas.sx +++ b/examples/0037-basic-trailing-commas.sx @@ -4,7 +4,7 @@ #import "modules/std/test.sx"; pkg :: #import "tests/fixtures/testpkg"; -add :: (a: s32, b: s32) -> s32 { a + b } +add :: (a: i32, b: i32) -> i32 { a + b } main :: () { @@ -23,12 +23,12 @@ main :: () { assert(v.w == 4.0); // Function call with trailing comma - add :: (a: s64, b: s64) -> s64 { return a + b; } + add :: (a: i64, b: i64) -> i64 { return a + b; } r := add(10, 20,); assert(r == 30); // Array literal with trailing comma - arr := s64.[1, 2, 3,]; + arr := i64.[1, 2, 3,]; assert(arr[2] == 3); print("trailing commas ok\n"); diff --git a/examples/0038-basic-dead-code-after-terminator.sx b/examples/0038-basic-dead-code-after-terminator.sx index 027aa59..bc630e9 100644 --- a/examples/0038-basic-dead-code-after-terminator.sx +++ b/examples/0038-basic-dead-code-after-terminator.sx @@ -14,15 +14,15 @@ E :: error { Neg } // dead `return 99;` after an unconditional return -const_one :: () -> s64 { return 1; return 99; } +const_one :: () -> i64 { return 1; return 99; } // dead `return x;` after an unconditional raise (the failable closure shape) -always_raise :: (x: s64) -> (s64, !E) { raise error.Neg; return x; } +always_raise :: (x: i64) -> (i64, !E) { raise error.Neg; return x; } // guard: a conditional return must still fall through to the trailing return -clamp :: (x: s64) -> s64 { if x > 10 { return 10; } return x; } +clamp :: (x: i64) -> i64 { if x > 10 { return 10; } return x; } -main :: () -> s32 { +main :: () -> i32 { print("const_one={}\n", const_one()); // 1 print("raised={}\n", always_raise(5) catch (e) 0); // 0 print("clamp_hi={}\n", clamp(42)); // 10 diff --git a/examples/0039-basic-free-fn-ufcs-pointer-receiver.sx b/examples/0039-basic-free-fn-ufcs-pointer-receiver.sx index 2ae61f3..7806c6b 100644 --- a/examples/0039-basic-free-fn-ufcs-pointer-receiver.sx +++ b/examples/0039-basic-free-fn-ufcs-pointer-receiver.sx @@ -7,14 +7,14 @@ #import "modules/std.sx"; -Counter :: struct { n: s32; } +Counter :: struct { n: i32; } // FREE functions (defined outside the struct), pointer first param. -bump :: ufcs (c: *Counter) -> s32 { c.n += 1; return c.n; } +bump :: ufcs (c: *Counter) -> i32 { c.n += 1; return c.n; } // reached ONLY via UFCS — must still be emitted. reset :: ufcs (c: *Counter) { c.n = 0; } -main :: () -> s32 { +main :: () -> i32 { c := Counter.{ n = 10 }; a := c.bump(); // 11, mutates c b := c.bump(); // 12 diff --git a/examples/0040-basic-block-value.sx b/examples/0040-basic-block-value.sx index c193870..06dd967 100644 --- a/examples/0040-basic-block-value.sx +++ b/examples/0040-basic-block-value.sx @@ -12,22 +12,22 @@ #import "modules/std.sx"; // Implicit return: trailing expression, no `;`. -double :: (n: s32) -> s32 { n * 2 } +double :: (n: i32) -> i32 { n * 2 } // if/else as a value — each branch's last expression has no `;`. -sign :: (n: s32) -> s32 { +sign :: (n: i32) -> i32 { if n < 0 { -1 } else if n > 0 { 1 } else { 0 } } // A value-producing block bound to a name. -sum3 :: (a: s32, b: s32, c: s32) -> s32 { +sum3 :: (a: i32, b: i32, c: i32) -> i32 { t := { x := a + b; x + c }; // block value is `x + c` t } // Match arms keep their `;` (exempt): the arm `;` is an arm terminator, so each // arm still yields its expression as the match value. -classify :: (n: s32) -> s32 { +classify :: (n: i32) -> i32 { if n == { case 0: 100; case 1: 10; @@ -35,8 +35,8 @@ classify :: (n: s32) -> s32 { } } -main :: () -> s32 { - total : s32 = 0; +main :: () -> i32 { + total : i32 = 0; total = total + double(10); // 20 total = total + sign(-7); // -1 total = total + sum3(1, 2, 3); // 6 diff --git a/examples/0041-basic-block-value-reject.sx b/examples/0041-basic-block-value-reject.sx index 69cd5b7..07e20f8 100644 --- a/examples/0041-basic-block-value-reject.sx +++ b/examples/0041-basic-block-value-reject.sx @@ -6,8 +6,8 @@ #import "modules/std.sx"; // `n * 2;` discards the value → the function returns nothing. -double :: (n: s32) -> s32 { +double :: (n: i32) -> i32 { n * 2; } -main :: () -> s32 { double(5) } +main :: () -> i32 { double(5) } diff --git a/examples/0042-basic-block-value-destructure.sx b/examples/0042-basic-block-value-destructure.sx index 20d7efb..f61d025 100644 --- a/examples/0042-basic-block-value-destructure.sx +++ b/examples/0042-basic-block-value-destructure.sx @@ -8,9 +8,9 @@ #import "modules/std.sx"; -pair :: () -> (s32, s32) { (5, 7) } +pair :: () -> (i32, i32) { (5, 7) } -main :: () -> s32 { +main :: () -> i32 { // destructure decl inside a value-bound block sum := { a, b := pair(); diff --git a/examples/0043-basic-match-value-mixed-width.sx b/examples/0043-basic-match-value-mixed-width.sx index fb46ce4..17085b1 100644 --- a/examples/0043-basic-match-value-mixed-width.sx +++ b/examples/0043-basic-match-value-mixed-width.sx @@ -9,14 +9,14 @@ #import "modules/std.sx"; -sign :: (n: s32) -> s32 { +sign :: (n: i32) -> i32 { if n == { case 0: 0; else: if n > 0 then 1 else -1; } } -classify :: (n: s32) -> s32 { +classify :: (n: i32) -> i32 { if n == { case 0: 100; case 1: 10; @@ -24,7 +24,7 @@ classify :: (n: s32) -> s32 { } } -main :: () -> s32 { +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 diff --git a/examples/0044-basic-default-arg-expansion.sx b/examples/0044-basic-default-arg-expansion.sx index d564b05..137a753 100644 --- a/examples/0044-basic-default-arg-expansion.sx +++ b/examples/0044-basic-default-arg-expansion.sx @@ -6,9 +6,9 @@ #import "modules/std.sx"; -scale :: (n: s32, factor: s32 = 2) -> s32 { n * factor } +scale :: (n: i32, factor: i32 = 2) -> i32 { n * factor } -label :: (n: s32, prefix: string = "v", suffix: string = "!") -> s32 { +label :: (n: i32, prefix: string = "v", suffix: string = "!") -> i32 { print("{}{}{}\n", prefix, n, suffix); n } diff --git a/examples/0045-basic-string-eq-short-circuit.sx b/examples/0045-basic-string-eq-short-circuit.sx index 5f0ed2b..b296275 100644 --- a/examples/0045-basic-string-eq-short-circuit.sx +++ b/examples/0045-basic-string-eq-short-circuit.sx @@ -11,7 +11,7 @@ Json :: enum { str: string; - int_: s64; + int_: i64; null_; } diff --git a/examples/0046-basic-int-formatter-extremes.sx b/examples/0046-basic-int-formatter-extremes.sx index 7454cde..d2b2a3e 100644 --- a/examples/0046-basic-int-formatter-extremes.sx +++ b/examples/0046-basic-int-formatter-extremes.sx @@ -1,9 +1,9 @@ // Integer `{}` formatting across the full signed/unsigned range. // -// Regression (issue 0090): the `{}` formatter was s64-based — it negated -// the value to print the sign (so s64::MIN, whose magnitude is -// unrepresentable as a positive s64, rendered as a bare "-"), and it had -// no unsigned-aware path (so a u64 all-ones value printed as the s64 +// Regression (issue 0090): the `{}` formatter was i64-based — it negated +// the value to print the sign (so i64::MIN, whose magnitude is +// unrepresentable as a positive i64, rendered as a bare "-"), and it had +// no unsigned-aware path (so a u64 all-ones value printed as the i64 // reinterpretation, "-1"). Both extremes now render correctly: signed // MIN prints all its digits, and unsigned integers print as unsigned // decimal across all 64 bits. @@ -12,16 +12,16 @@ main :: () { // Signed extreme: magnitude is never negated, so MIN survives. - print("s64.min={}\n", s64.min); - print("s64.max={}\n", s64.max); + print("i64.min={}\n", i64.min); + print("i64.max={}\n", i64.max); // Unsigned extreme: all 64 bits as unsigned decimal, not -1. print("u64.max={}\n", u64.max); // Spread across widths — signed. - print("s8.min={} s8.max={}\n", s8.min, s8.max); - print("s16.min={} s16.max={}\n", s16.min, s16.max); - print("s32.min={} s32.max={}\n", s32.min, s32.max); + print("i8.min={} i8.max={}\n", i8.min, i8.max); + print("i16.min={} i16.max={}\n", i16.min, i16.max); + print("i32.min={} i32.max={}\n", i32.min, i32.max); // Spread across widths — unsigned (max is all-ones for that width). print("u8.max={} u16.max={}\n", u8.max, u16.max); @@ -31,7 +31,7 @@ main :: () { print("u8.min={} u64.min={} zero={}\n", u8.min, u64.min, 0); // Ordinary signed/unsigned values still print correctly. - neg : s32 = -42; + neg : i32 = -42; pos : u32 = 4000000000; print("neg={} pos={}\n", neg, pos); } diff --git a/examples/0047-basic-loop-local-stack-reuse.sx b/examples/0047-basic-loop-local-stack-reuse.sx index 36e6bea..a1cfed0 100644 --- a/examples/0047-basic-loop-local-stack-reuse.sx +++ b/examples/0047-basic-loop-local-stack-reuse.sx @@ -8,10 +8,10 @@ #import "modules/std.sx"; -main :: () -> s32 { +main :: () -> i32 { sum := 0; for 0..1000000 (i) { - buf : [128]s64 = ---; + buf : [128]i64 = ---; buf[0] = i; sum += buf[0]; } diff --git a/examples/0048-basic-for-array-large.sx b/examples/0048-basic-for-array-large.sx index ffe433a..70e9d2c 100644 --- a/examples/0048-basic-for-array-large.sx +++ b/examples/0048-basic-for-array-large.sx @@ -8,8 +8,8 @@ #import "modules/std.sx"; -main :: () -> s32 { - arr : [4096]s64 = ---; +main :: () -> i32 { + arr : [4096]i64 = ---; i := 0; while i < 4096 { arr[i] = i; i += 1; } sum := 0; @@ -17,7 +17,7 @@ main :: () -> s32 { print("sum={}\n", sum); // By-value capture is a copy: mutating it leaves the array untouched. - small : [3]s64 = .[10, 20, 30]; + small : [3]i64 = .[10, 20, 30]; for small (x) { x += 100; } print("copy-guard: {} {} {}\n", small[0], small[1], small[2]); 0 diff --git a/examples/0049-basic-defer-break-continue.sx b/examples/0049-basic-defer-break-continue.sx index e762044..16e766e 100644 --- a/examples/0049-basic-defer-break-continue.sx +++ b/examples/0049-basic-defer-break-continue.sx @@ -6,7 +6,7 @@ #import "modules/std.sx"; -main :: () -> s32 { +main :: () -> i32 { for 0..3 (i) { defer print("cleanup {}\n", i); if i == 1 { break; } diff --git a/examples/0050-basic-for-multi-iterable.sx b/examples/0050-basic-for-multi-iterable.sx index 3cd645a..ee2e3a6 100644 --- a/examples/0050-basic-for-multi-iterable.sx +++ b/examples/0050-basic-for-multi-iterable.sx @@ -1,29 +1,29 @@ #import "modules/std.sx"; -pair_sum :: (xs: []s64, ys: []s64) -> s64 { +pair_sum :: (xs: []i64, ys: []i64) -> i64 { total := 0; for xs, ys (x, y) { total += x * y; } total } -make :: () -> [3]s64 { - r : [3]s64 = .[7, 8, 9]; +make :: () -> [3]i64 { + r : [3]i64 = .[7, 8, 9]; r } -main :: () -> s32 { +main :: () -> i32 { // Agra's example: a 1..5 inclusive, b open-ended following along. for 1..=5, 0.. (a, b) { print("{}:{} ", a, b); } print("\n"); // Index idiom replacing the old (x, i) form. - xs : [3]s64 = .[10, 20, 30]; + xs : [3]i64 = .[10, 20, 30]; for xs, 0.. (x, i) { print("[{}]={} ", i, x); } print("\n"); // Parallel slices. - a4 : [4]s64 = .[1, 2, 3, 4]; - b4 : [4]s64 = .[10, 20, 30, 40]; + a4 : [4]i64 = .[1, 2, 3, 4]; + b4 : [4]i64 = .[10, 20, 30, 40]; print("dot={}\n", pair_sum(a4, b4)); // Arrow bodies. diff --git a/examples/0051-basic-for-range-bounds.sx b/examples/0051-basic-for-range-bounds.sx index bbd5de5..8cb35b5 100644 --- a/examples/0051-basic-for-range-bounds.sx +++ b/examples/0051-basic-for-range-bounds.sx @@ -7,7 +7,7 @@ #import "modules/std.sx"; -main :: () -> s32 { +main :: () -> i32 { for 0<..<5 (i) { print("{} ", i); } print("| 0<..<5\n"); for 0=..=5 (i) { print("{} ", i); } @@ -22,7 +22,7 @@ main :: () -> s32 { print("| 0..=5\n"); // Exclusive-start open range following a bounded first iterable. - xs : [3]s64 = .[10, 20, 30]; + xs : [3]i64 = .[10, 20, 30]; for xs, 2<.. (x, i) { print("{}@{} ", x, i); } print("| xs, 2<..\n"); diff --git a/examples/0052-basic-slice-range-bounds.sx b/examples/0052-basic-slice-range-bounds.sx index 66e94cb..9fdb55e 100644 --- a/examples/0052-basic-slice-range-bounds.sx +++ b/examples/0052-basic-slice-range-bounds.sx @@ -6,15 +6,15 @@ #import "modules/std.sx"; -dump :: (s: []s64, tag: string) { +dump :: (s: []i64, tag: string) { print("{}: ", tag); for s (v) { print("{} ", v); } print("(len {})\n", s.len); } -main :: () -> s32 { - xs : [6]s64 = .[10, 11, 12, 13, 14, 15]; - full : []s64 = xs[0..6]; +main :: () -> i32 { + xs : [6]i64 = .[10, 11, 12, 13, 14, 15]; + full : []i64 = xs[0..6]; dump(full[1..=3], "1..=3"); // 11 12 13 dump(full[0<..<4], "0<..<4"); // 11 12 13 diff --git a/examples/0053-basic-ufcs-opt-in.sx b/examples/0053-basic-ufcs-opt-in.sx index 7fd852e..079d329 100644 --- a/examples/0053-basic-ufcs-opt-in.sx +++ b/examples/0053-basic-ufcs-opt-in.sx @@ -8,17 +8,17 @@ #import "modules/std.sx"; -bump :: (x: s64) -> s64 { x + 1 } -bump2 :: ufcs (x: s64) -> s64 { x + 2 } +bump :: (x: i64) -> i64 { x + 1 } +bump2 :: ufcs (x: i64) -> i64 { x + 2 } bump3 :: ufcs bump; -Counter :: struct { n: s64; } -inc :: ufcs (c: *Counter, by: s64) -> s64 { c.n += by; c.n } +Counter :: struct { n: i64; } +inc :: ufcs (c: *Counter, by: i64) -> i64 { c.n += by; c.n } gfirst :: ufcs (xs: []$T) -> T { xs[0] } main :: () { - f : s64 = 40; + f : i64 = 40; print("marked: {}\n", f.bump2()); // 42 print("alias: {}\n", f.bump3()); // 41 print("direct: {}\n", bump(f)); // 41 — plain fn, direct @@ -29,7 +29,7 @@ main :: () { print("ptr-recv: {}\n", c.inc(5)); // 15 — auto address-of receiver arr := .[7, 8, 9]; - xs : []s64 = arr; + xs : []i64 = arr; print("generic-dot: {}\n", xs.gfirst()); // 7 - print("generic-direct: {}\n", gfirst(xs)); // 7 — plan types it s64, not a T stub + print("generic-direct: {}\n", gfirst(xs)); // 7 — plan types it i64, not a T stub } diff --git a/examples/0054-basic-dot-call-default-args.sx b/examples/0054-basic-dot-call-default-args.sx index e998fe6..9912dbd 100644 --- a/examples/0054-basic-dot-call-default-args.sx +++ b/examples/0054-basic-dot-call-default-args.sx @@ -7,19 +7,19 @@ #import "modules/std.sx"; Point :: struct { - x: s64; - scaled :: (self: Point, k: s64 = 2) -> s64 { return self.x * k; } + x: i64; + scaled :: (self: Point, k: i64 = 2) -> i64 { return self.x * k; } } -bump :: ufcs (p: Point, by: s64 = 10) -> s64 { return p.x + by; } +bump :: ufcs (p: Point, by: i64 = 10) -> i64 { return p.x + by; } -sum_var :: (..xs: []s64) -> s64 { +sum_var :: (..xs: []i64) -> i64 { t := 0; for xs (x) { t = t + x; } return t; } -here :: (loc: Source_Location = #caller_location) -> s64 { return loc.line; } +here :: (loc: Source_Location = #caller_location) -> i64 { return loc.line; } main :: () { p := Point.{ x = 5 }; diff --git a/examples/0055-basic-large-stack-array.sx b/examples/0055-basic-large-stack-array.sx index 9445c80..fb53bb2 100644 --- a/examples/0055-basic-large-stack-array.sx +++ b/examples/0055-basic-large-stack-array.sx @@ -13,7 +13,7 @@ #import "modules/std.sx"; -checksum :: () -> s64 { +checksum :: () -> i64 { buf : [65536]u8 = ---; i := 0; while i < 65536 { @@ -29,14 +29,14 @@ checksum :: () -> s64 { return sum; } -big :: () -> s64 { - buf : [131072]s64 = ---; +big :: () -> i64 { + buf : [131072]i64 = ---; buf[0] = 11; buf[131071] = 31; return buf[0] + buf[131071]; } -main :: () -> s32 { +main :: () -> i32 { out(int_to_string(checksum())); out("\n"); out(int_to_string(big())); diff --git a/examples/0100-types-structs.sx b/examples/0100-types-structs.sx index c0aa83a..b5fb41b 100644 --- a/examples/0100-types-structs.sx +++ b/examples/0100-types-structs.sx @@ -5,7 +5,7 @@ Vec4 :: struct { Complex :: struct { foo : enum { - S: s32; + S: i32; B: struct { val: string; }; diff --git a/examples/0101-types-types.sx b/examples/0101-types-types.sx index 8d420c0..36fe2eb 100644 --- a/examples/0101-types-types.sx +++ b/examples/0101-types-types.sx @@ -1,7 +1,7 @@ #import "modules/std.sx"; SPECIAL_VALUE :u8: 42; -resolve :: (x: u8) -> s32 { +resolve :: (x: u8) -> i32 { return 12 + x; } @@ -9,7 +9,7 @@ Foo :: struct { a : u2; // this will have 0 as default b : u8 = SPECIAL_VALUE; c : u8 = ---; // default for c is undefined - d : u8 = #run xx resolve(5); // converts s32 to u8 + d : u8 = #run xx resolve(5); // converts i32 to u8 } main :: () { @@ -38,6 +38,6 @@ Pack :: struct { c: u8; d: u32; f: u64; - v: s32; + v: i32; x: f32; } diff --git a/examples/0103-types-categories.sx b/examples/0103-types-categories.sx index 2c207bb..fc1c074 100644 --- a/examples/0103-types-categories.sx +++ b/examples/0103-types-categories.sx @@ -1,11 +1,11 @@ #import "modules/std.sx"; Point :: struct { - x, y: s32; + x, y: i32; } Color :: struct { - r, g, b: s32; + r, g, b: i32; } main :: () { diff --git a/examples/0104-types-union.sx b/examples/0104-types-union.sx index 6e510a8..75c9f91 100644 --- a/examples/0104-types-union.sx +++ b/examples/0104-types-union.sx @@ -2,7 +2,7 @@ Overlay :: union { f: f32; - i: s32; + i: i32; } Vec2 :: union { diff --git a/examples/0105-types-flags.sx b/examples/0105-types-flags.sx index 2d5ef9b..8c992fc 100644 --- a/examples/0105-types-flags.sx +++ b/examples/0105-types-flags.sx @@ -54,12 +54,12 @@ main :: () { // Explicit values w :WindowFlags = .vsync | .resizable; print("\nwindow: {}\n", w); - print("raw value: {}\n", cast(s64) w); + print("raw value: {}\n", cast(i64) w); // Backing type on plain enums c :Color = .blue; print("\ncolor: {}\n", c); - print("raw: {}\n", cast(s64) c); + print("raw: {}\n", cast(i64) c); // Bitwise ops work on plain integers too x := 0xFF & 0x0F; diff --git a/examples/0106-types-compound-assign-global.sx b/examples/0106-types-compound-assign-global.sx index 4d7af78..d865a38 100644 --- a/examples/0106-types-compound-assign-global.sx +++ b/examples/0106-types-compound-assign-global.sx @@ -3,16 +3,16 @@ #import "modules/std.sx"; -g_add : s64 = 10; -g_sub : s64 = 10; -g_mul : s64 = 10; -g_div : s64 = 100; -g_mod : s64 = 10; -g_and : s64 = 0xff; -g_or : s64 = 0x0f; -g_xor : s64 = 0xff; -g_shl : s64 = 1; -g_shr : s64 = 256; +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 diff --git a/examples/0107-types-int-cmp-in-float-ternary.sx b/examples/0107-types-int-cmp-in-float-ternary.sx index cd8a28b..7a34652 100644 --- a/examples/0107-types-int-cmp-in-float-ternary.sx +++ b/examples/0107-types-int-cmp-in-float-ternary.sx @@ -5,7 +5,7 @@ #import "modules/std.sx"; main :: () -> void { - x : s64 = 42; + x : i64 = 42; // OK: comparison in statement context if x != 0 { out("ok\n"); } diff --git a/examples/0108-types-list-items-assign-big-T.sx b/examples/0108-types-list-items-assign-big-T.sx index aa4ed08..b6a5e99 100644 --- a/examples/0108-types-list-items-assign-big-T.sx +++ b/examples/0108-types-list-items-assign-big-T.sx @@ -5,19 +5,19 @@ #import "modules/std.sx"; // 40-byte struct — triggers the bug. -// Shrink to [4]s64 (32 bytes) and the bug goes away. +// Shrink to [4]i64 (32 bytes) and the bug goes away. BigNode :: struct { - data: [5]s64; // 40 bytes + data: [5]i64; // 40 bytes } Tree :: struct { nodes: List(BigNode); // items(8) + len(8) + cap(8) = 24 bytes - generation: s64; // 8 bytes — total 32 bytes + generation: i64; // 8 bytes — total 32 bytes } Container :: struct { tree: Tree; - sentinel: s64; + sentinel: i64; do_work :: (self: *Container) { self.tree.nodes.items = xx 0; // BUG: corrupts self.sentinel diff --git a/examples/0109-types-global-compound-assign.sx b/examples/0109-types-global-compound-assign.sx index 0d20f26..b459451 100644 --- a/examples/0109-types-global-compound-assign.sx +++ b/examples/0109-types-global-compound-assign.sx @@ -3,7 +3,7 @@ #import "modules/std.sx"; -g_counter : s64 = 0; +g_counter : i64 = 0; tick :: () { g_counter += 1; @@ -14,7 +14,7 @@ main :: () -> void { // Test 1: += always produces 1 (BUG) out("--- Test 1: += (broken) ---\n"); out("Expected: 1, 2, 3\n"); - i : s64 = 0; + i : i64 = 0; while i < 3 { tick(); i += 1; diff --git a/examples/0110-types-global-array-init.sx b/examples/0110-types-global-array-init.sx index f81f50d..05e8adb 100644 --- a/examples/0110-types-global-array-init.sx +++ b/examples/0110-types-global-array-init.sx @@ -3,7 +3,7 @@ #import "modules/std.sx"; -VALS : [4]s32 = .[-2, -1, 42, 99]; +VALS : [4]i32 = .[-2, -1, 42, 99]; main :: () { out("VALS: "); diff --git a/examples/0111-types-global-struct-defaults.sx b/examples/0111-types-global-struct-defaults.sx index 39eb16a..82a783c 100644 --- a/examples/0111-types-global-struct-defaults.sx +++ b/examples/0111-types-global-struct-defaults.sx @@ -5,7 +5,7 @@ Foo :: struct { running: bool = true; - x: s32 = 42; + x: i32 = 42; name: string = "default"; } diff --git a/examples/0112-types-global-type-alias.sx b/examples/0112-types-global-type-alias.sx index 2a129a7..f353a8b 100644 --- a/examples/0112-types-global-type-alias.sx +++ b/examples/0112-types-global-type-alias.sx @@ -10,7 +10,7 @@ ok :: () -> Handle { 0 } g : Handle = 0; -main :: () -> s32 { +main :: () -> i32 { g = ok(); if g == 0 then 0 else 1 } diff --git a/examples/0113-types-toplevel-var-type-inference.sx b/examples/0113-types-toplevel-var-type-inference.sx index 11c042a..9ea8e97 100644 --- a/examples/0113-types-toplevel-var-type-inference.sx +++ b/examples/0113-types-toplevel-var-type-inference.sx @@ -1,7 +1,7 @@ -// Pre-fix: `resolveType(null)` silently returned `.s64`, so a top-level -// var without a type annotation got typed as `s64` regardless of what +// Pre-fix: `resolveType(null)` silently returned `.i64`, so a top-level +// var without a type annotation got typed as `i64` regardless of what // the initializer was. For `g_pi := 3.14;` this meant the float literal -// was assigned to an s64 slot, producing a wrong value at runtime or +// was assigned to an i64 slot, producing a wrong value at runtime or // the wrong codegen shape. // // After the fix `lowerVarDecl` at the top level mirrors the local-scope @@ -9,11 +9,11 @@ // the initializer's type. Mirrors how `:=` already worked for locals. #import "modules/std.sx"; -g_count := 42; // inferred s64 -g_pi := 3.14; // inferred f64 — used to silently become s64 +g_count := 42; // inferred i64 +g_pi := 3.14; // inferred f64 — used to silently become i64 g_flag := true; // inferred bool -main :: () -> s32 { +main :: () -> i32 { print("count = {}\n", g_count); print("pi = {}\n", g_pi); print("flag = {}\n", g_flag); diff --git a/examples/0114-types-build-block-convert.sx b/examples/0114-types-build-block-convert.sx index e24da22..847fb1b 100644 --- a/examples/0114-types-build-block-convert.sx +++ b/examples/0114-types-build-block-convert.sx @@ -7,7 +7,7 @@ // // This test exercises the builder directly (no `#insert`, no impl // wiring) — three pack shapes through the same `void`-returning -// wrapper plus one non-void `s32`-returning wrapper to pin the +// wrapper plus one non-void `i32`-returning wrapper to pin the // `return typed_fn(...)` branch. The expected output captures the // generated source verbatim so any formatting drift surfaces here // rather than as a downstream compile error inside the eventual @@ -20,15 +20,15 @@ preview_void :: (..$args) -> string { return build_block_convert($args, void); } -preview_s32 :: (..$args) -> string { - return build_block_convert($args, s32); +preview_i32 :: (..$args) -> string { + return build_block_convert($args, i32); } run_all :: () { print("--- void / 0 args ---\n{}\n", preview_void()); print("--- void / bool ---\n{}\n", preview_void(true)); - print("--- void / s64, string ---\n{}\n", preview_void(42, "hi")); - print("--- s32 / f64 ---\n{}\n", preview_s32(3.14)); + print("--- void / i64, string ---\n{}\n", preview_void(42, "hi")); + print("--- i32 / f64 ---\n{}\n", preview_i32(3.14)); } #run run_all(); diff --git a/examples/0115-types-compound-type-in-expression.sx b/examples/0115-types-compound-type-in-expression.sx index 32c23fb..021a6a0 100644 --- a/examples/0115-types-compound-type-in-expression.sx +++ b/examples/0115-types-compound-type-in-expression.sx @@ -2,7 +2,7 @@ // `align_of` accept pointer (`*T`), optional (`?T`), array (`[N]T`), // function (`(A) -> B`), and tuple (`(A, B)`) types directly. Also // const-decl RHS aliases through the same forms (`Ptr :: *u8;` etc). -// Same shape as the existing `size_of(s32)` baseline path. +// Same shape as the existing `size_of(i32)` baseline path. #import "modules/std.sx"; @@ -10,9 +10,9 @@ Ptr :: *u8; Maybe :: ?u8; Arr :: [3]u8; -Cb :: (s32) -> s32; +Cb :: (i32) -> i32; -main :: () -> s32 { +main :: () -> i32 { // Direct: parser fix for *T, ?T + existing [N]T path. print("size_of(*u8) = {}\n", size_of(*u8)); print("align_of(*u8) = {}\n", align_of(*u8)); @@ -20,10 +20,10 @@ main :: () -> s32 { print("size_of([3]u8) = {}\n", size_of([3]u8)); // Function-type literal in expression position. - print("size_of((s32)->s32) = {}\n", size_of((s32) -> s32)); + print("size_of((i32)->i32) = {}\n", size_of((i32) -> i32)); // Tuple literal reinterpreted as tuple type at the type-demanding site. - print("size_of((s32, s32)) = {}\n", size_of((s32, s32))); + print("size_of((i32, i32)) = {}\n", size_of((i32, i32))); // Aliases. print("size_of(Ptr) = {}\n", size_of(Ptr)); diff --git a/examples/0116-types-type-alias-size-align.sx b/examples/0116-types-type-alias-size-align.sx index ae337ed..9319bba 100644 --- a/examples/0116-types-type-alias-size-align.sx +++ b/examples/0116-types-type-alias-size-align.sx @@ -1,19 +1,19 @@ // Type alias resolution through `size_of` / `align_of` — a const-decl -// alias (`MyInt :: s32;`, `MyChain :: MyInt;`, `WideAlias :: Wide;`) +// alias (`MyInt :: i32;`, `MyChain :: MyInt;`, `WideAlias :: Wide;`) // resolves through `type_alias_map` when used as a `$T: Type` argument. // Covers chains and struct-name aliases, not just structural-type // aliases (those land in `examples/182-compound-type-in-expression.sx`). #import "modules/std.sx"; -MyInt :: s32; +MyInt :: i32; MyChain :: MyInt; -Wide :: struct { a: s64; b: s64; } +Wide :: struct { a: i64; b: i64; } WideAlias :: Wide; -main :: () -> s32 { - print("direct s32: {}\n", size_of(s32)); - print("alias s32: {}\n", size_of(MyInt)); - print("chain s32: {}\n", size_of(MyChain)); +main :: () -> i32 { + print("direct i32: {}\n", size_of(i32)); + print("alias i32: {}\n", size_of(MyInt)); + print("chain i32: {}\n", size_of(MyChain)); print("align alias: {}\n", align_of(MyInt)); print("align chain: {}\n", align_of(MyChain)); print("size struct-alias: {}\n", size_of(WideAlias)); diff --git a/examples/0117-types-block-string-arg.sx b/examples/0117-types-block-string-arg.sx index a968185..f68954d 100644 --- a/examples/0117-types-block-string-arg.sx +++ b/examples/0117-types-block-string-arg.sx @@ -17,7 +17,7 @@ g_s: string = ""; -main :: () -> s32 { +main :: () -> i32 { cl := (s: string) => { g_s = s; }; b : Block = xx cl; invoke_fn : (*Block, string) -> void callconv(.c) = xx b.invoke; diff --git a/examples/0118-types-type-all-interactions.sx b/examples/0118-types-type-all-interactions.sx index 64a2dca..a06d1a0 100644 --- a/examples/0118-types-type-all-interactions.sx +++ b/examples/0118-types-type-all-interactions.sx @@ -12,7 +12,7 @@ // ── Test fixtures ───────────────────────────────────────────── -Point :: struct { x: s32; y: s32; } +Point :: struct { x: i32; y: i32; } Color :: enum { red; green; blue; } @@ -24,7 +24,7 @@ identity :: ($T: Type, val: T) -> T => val; // time fold via type_eq → const_bool → inline-if folds the // branch away). describe :: ($T: Type) -> string { - inline if type_eq(T, s64) { return "int64"; } + inline if type_eq(T, i64) { return "int64"; } inline if type_eq(T, string) { return "text"; } inline if type_eq(T, bool) { return "boolean"; } return "other"; @@ -34,7 +34,7 @@ describe :: ($T: Type) -> string { type_list :: (..$args) -> string { list := $args; s := "["; - i : s64 = 0; + i : i64 = 0; while i < list.len { if i > 0 { s = concat(s, ", "); } s = concat(s, type_name(list[i])); @@ -46,21 +46,21 @@ type_list :: (..$args) -> string { // Type stored in a struct field. TypeHolder :: struct { t: Type; } -main :: () -> s32 { +main :: () -> i32 { // ── 1. Type literal equality ──────────────────────────── print("=== 1. literal == ===\n"); - print("s64 == s64: {}\n", s64 == s64); - print("s64 == string: {}\n", s64 == string); + print("i64 == i64: {}\n", i64 == i64); + print("i64 == string: {}\n", i64 == string); print("*u8 == *u8: {}\n", *u8 == *u8); - print("?s64 == ?s64: {}\n", ?s64 == ?s64); - print("?s64 == ?s32: {}\n", ?s64 == ?s32); + print("?i64 == ?i64: {}\n", ?i64 == ?i64); + print("?i64 == ?i32: {}\n", ?i64 == ?i32); // ── 2. type_of(value) ─────────────────────────────────── print("=== 2. type_of(value) == T ===\n"); - a : s64 = 42; + a : i64 = 42; b : f64 = 3.14; s : string = "hi"; - print("type_of(a) == s64: {}\n", type_of(a) == s64); + print("type_of(a) == i64: {}\n", type_of(a) == i64); print("type_of(b) == f64: {}\n", type_of(b) == f64); print("type_of(s) == string: {}\n", type_of(s) == string); print("type_of(a) == f64: {}\n", type_of(a) == f64); @@ -77,7 +77,7 @@ main :: () -> s32 { // ── 4. type_name on literals + variables ──────────────── print("=== 4. type_name ===\n"); - print("type_name(s64): {}\n", type_name(s64)); + print("type_name(i64): {}\n", type_name(i64)); print("type_name(*u8): {}\n", type_name(*u8)); print("type_name(Point): {}\n", type_name(Point)); print("type_name(Color): {}\n", type_name(Color)); @@ -86,39 +86,39 @@ main :: () -> s32 { // ── 5. Print Type values directly ─────────────────────── print("=== 5. print Type values ===\n"); - print("literal: {}\n", s64); + print("literal: {}\n", i64); t = string; print("var: {}\n", t); print("type_of(b): {}\n", type_of(b)); // ── 6. Generic dispatch via $T: Type ──────────────────── print("=== 6. generic dispatch ===\n"); - print("describe(s64): {}\n", describe(s64)); + print("describe(i64): {}\n", describe(i64)); print("describe(string): {}\n", describe(string)); print("describe(bool): {}\n", describe(bool)); print("describe(f64): {}\n", describe(f64)); // ── 7. identity(T, val) ───────────────────────────────── print("=== 7. identity($T, val) ===\n"); - print("identity(s64, 7): {}\n", identity(s64, 7)); + print("identity(i64, 7): {}\n", identity(i64, 7)); print("identity(string, hi): {}\n", identity(string, "hi")); print("identity(bool, true): {}\n", identity(bool, true)); // ── 8. Comptime-generated struct (Wrap($T)) ───────────── print("=== 8. Wrap($T) ===\n"); - w_int := Wrap(s64).{ v = 42 }; + w_int := Wrap(i64).{ v = 42 }; w_str := Wrap(string).{ v = "wrapped" }; - print("Wrap(s64).v: {}\n", w_int.v); + print("Wrap(i64).v: {}\n", w_int.v); print("Wrap(string).v: {}\n", w_str.v); // ── 9. Reflection builtins on Types ───────────────────── print("=== 9. reflection on Type ===\n"); - print("size_of(s64): {}\n", size_of(s64)); + print("size_of(i64): {}\n", size_of(i64)); print("size_of(*u8): {}\n", size_of(*u8)); print("align_of(f64): {}\n", align_of(f64)); print("field_count(Point): {}\n", field_count(Point)); - print("type_eq(s64, s64): {}\n", type_eq(s64, s64)); - print("type_eq(s64, string): {}\n", type_eq(s64, string)); + print("type_eq(i64, i64): {}\n", type_eq(i64, i64)); + print("type_eq(i64, string): {}\n", type_eq(i64, string)); // ── 10. Type pack (..$args) walking ───────────────────── print("=== 10. ..$args walking ===\n"); @@ -129,15 +129,15 @@ main :: () -> s32 { // ── 11. Type in struct field ──────────────────────────── print("=== 11. Type in struct field ===\n"); - h := TypeHolder.{ t = s64 }; - print("h.t == s64: {}\n", h.t == s64); + h := TypeHolder.{ t = i64 }; + print("h.t == i64: {}\n", h.t == i64); print("h.t == string: {}\n", h.t == string); print("type_name(h.t): {}\n", type_name(h.t)); // ── 12. Compound type literals ────────────────────────── print("=== 12. compound literals ===\n"); print("type_name(*Point): {}\n", type_name(*Point)); - print("type_name([4]s32): {}\n", type_name([4]s32)); + print("type_name([4]i32): {}\n", type_name([4]i32)); print("type_name([]bool): {}\n", type_name([]bool)); print("type_name(?f64): {}\n", type_name(?f64)); @@ -146,13 +146,13 @@ main :: () -> s32 { // ** stdout ** // === 1. literal == === -// s64 == s64: true -// s64 == string: false +// i64 == i64: true +// i64 == string: false // *u8 == *u8: true -// ?s64 == ?s64: true -// ?s64 == ?s32: false +// ?i64 == ?i64: true +// ?i64 == ?i32: false // === 2. type_of(value) == T === -// type_of(a) == s64: true +// type_of(a) == i64: true // type_of(b) == f64: true // type_of(s) == string: true // type_of(a) == f64: false @@ -162,45 +162,45 @@ main :: () -> s32 { // after reassign t == string: true // t == bool: true // === 4. type_name === -// type_name(s64): s64 +// type_name(i64): i64 // type_name(*u8): *u8 // type_name(Point): Point // type_name(Color): Color // type_name(t): f64 // === 5. print Type values === -// literal: s64 +// literal: i64 // var: string // type_of(b): f64 // === 6. generic dispatch === -// describe(s64): int64 +// describe(i64): int64 // describe(string): text // describe(bool): boolean // describe(f64): other // === 7. identity($T, val) === -// identity(s64, 7): 7 +// identity(i64, 7): 7 // identity(string, hi): hi // identity(bool, true): true // === 8. Wrap($T) === -// Wrap(s64).v: 42 +// Wrap(i64).v: 42 // Wrap(string).v: wrapped // === 9. reflection on Type === -// size_of(s64): 8 +// size_of(i64): 8 // size_of(*u8): 8 // align_of(f64): 8 // field_count(Point): 2 -// type_eq(s64, s64): true -// type_eq(s64, string): false +// type_eq(i64, i64): true +// type_eq(i64, string): false // === 10. ..$args walking === // type_list(): [] -// type_list(1): [s64] -// type_list(1, "x"): [s64, string] +// type_list(1): [i64] +// type_list(1, "x"): [i64, string] // type_list(true, 3.14): [bool, f64] // === 11. Type in struct field === -// h.t == s64: true +// h.t == i64: true // h.t == string: false -// type_name(h.t): s64 +// type_name(h.t): i64 // === 12. compound literals === // type_name(*Point): *Point -// type_name([4]s32): [4]s32 +// type_name([4]i32): [4]i32 // type_name([]bool): []bool // type_name(?f64): ?f64 diff --git a/examples/0119-types-tuple-values.sx b/examples/0119-types-tuple-values.sx index ccb0873..a71c338 100644 --- a/examples/0119-types-tuple-values.sx +++ b/examples/0119-types-tuple-values.sx @@ -2,16 +2,16 @@ // return, and operators. Regression for the tuple-construction bug where // an inferred `:=` tuple literal lowered its element values under the // enclosing fn's (narrower) return `target_type`, mismatching the -// independently-inferred s64 field types and yielding garbage on read. +// independently-inferred i64 field types and yielding garbage on read. #import "modules/std.sx"; -Box :: struct { xs: (s32, s32); } +Box :: struct { xs: (i32, i32); } -swap :: (a: s64, b: s64) -> (s64, s64) { (b, a) } -fst :: (t: (s64, s64)) -> s64 { t.0 } +swap :: (a: i64, b: i64) -> (i64, i64) { (b, a) } +fst :: (t: (i64, i64)) -> i64 { t.0 } -main :: () -> s32 { +main :: () -> i32 { // Inferred positional tuple + numeric field access. pair := (40, 2); print("pair {} {}\n", pair.0, pair.1); @@ -21,8 +21,8 @@ main :: () -> s32 { print("named {} {} {}\n", named.x, named.0, named.1); // Element into a typed local (access path, not just print). - a : s64 = pair.0; - b : s64 = pair.1; + a : i64 = pair.0; + b : i64 = pair.1; print("locals {} {}\n", a, b); // Tuple-typed struct field: store a tuple value, read both elements. @@ -46,9 +46,9 @@ main :: () -> s32 { print("mem {}\n", 3 in (1, 2, 3)); print("lex {}\n", (1, 2) < (1, 3)); - // Mixed-size fields: a tuple with both an s64 and a string (16-byte fat + // Mixed-size fields: a tuple with both an i64 and a string (16-byte fat // pointer). Field types are tracked per-position, so reading each back is - // typed correctly (s64 prints as a number, string as text). + // typed correctly (i64 prints as a number, string as text). mixed := (42, "hi"); print("mixed {} {}\n", mixed.0, mixed.1); 0 diff --git a/examples/0120-types-tuple-element-assign.sx b/examples/0120-types-tuple-element-assign.sx index 42e8b9c..c066d1a 100644 --- a/examples/0120-types-tuple-element-assign.sx +++ b/examples/0120-types-tuple-element-assign.sx @@ -7,15 +7,15 @@ #import "modules/std.sx"; -main :: () -> s32 { +main :: () -> i32 { // Positional element assignment. - a : (s32, string) = ---; + a : (i32, string) = ---; a.0 = 11; a.1 = "x"; print("a: {} {}\n", a.0, a.1); // Named tuple: write + read by name, and read by position. - p : (x: s32, y: string) = ---; + p : (x: i32, y: string) = ---; p.x = 22; p.y = "y"; print("p: x={} y={} .0={}\n", p.x, p.y, p.0); diff --git a/examples/0121-types-types.sx b/examples/0121-types-types.sx index c9f700e..5d1c40f 100644 --- a/examples/0121-types-types.sx +++ b/examples/0121-types-types.sx @@ -4,7 +4,7 @@ #import "modules/std/test.sx"; pkg :: #import "tests/fixtures/testpkg"; -Point :: struct { x, y: s32; } +Point :: struct { x, y: i32; } Color :: enum { red; green; blue; } @@ -16,7 +16,7 @@ Shape :: enum { Overlay :: union { f: f32; - i: s32; + i: i32; } Vec2 :: union { @@ -25,27 +25,27 @@ Vec2 :: union { } Defaults :: struct { - a: s32; - b: s32 = 99; - c: s32 = ---; + a: i32; + b: i32 = 99; + c: i32 = ---; } MyFloat :: f64; Status :: enum u8 { ok; err; timeout; } -add :: (a: s32, b: s32) -> s32 { a + b } +add :: (a: i32, b: i32) -> i32 { a + b } -mul :: (a: s32, b: s32) -> s32 { a * b } +mul :: (a: i32, b: i32) -> i32 { a * b } vec3 :: (x: f32, y: f32, z: f32) -> Vector(3, f32) { .[x, y, z] } // Global variable for address-of test -g_smoke_val : s32 = 42; +g_smoke_val : i32 = 42; -write_to_ptr :: (p: *s32) { +write_to_ptr :: (p: *i32) { p.* = 99; } @@ -57,15 +57,15 @@ main :: () { print("=== 3. Types ===\n"); // Primitive types - v_s8 : s8 = 127; - v_s16 : s16 = 32000; - v_s32 : s32 = 100000; + v_i8 : i8 = 127; + v_i16 : i16 = 32000; + v_i32 : i32 = 100000; v_u8 : u8 = 255; v_u16 : u16 = 65000; v_u32 : u32 = 4000000; - print("s8: {}\n", v_s8); - print("s16: {}\n", v_s16); - print("s32: {}\n", v_s32); + print("i8: {}\n", v_i8); + print("i16: {}\n", v_i16); + print("i32: {}\n", v_i32); print("u8: {}\n", v_u8); print("u16: {}\n", v_u16); print("u32: {}\n", v_u32); @@ -88,8 +88,8 @@ main :: () { print("struct-named: {}\n", p3); // Shorthand (variable name = field name) - x : s32 = 5; - y : s32 = 6; + x : i32 = 5; + y : i32 = 6; p4 := Point.{ x, y }; print("struct-shorthand: {}\n", p4); @@ -226,7 +226,7 @@ main :: () { o : Overlay = ---; o.f = 3.14; print("union-f: {}\n", o.f); - // Type punning — read same bits as s32 + // Type punning — read same bits as i32 print("union-i: {}\n", o.i); // Union member promotion @@ -237,22 +237,22 @@ main :: () { print("promoted-data0: {}\n", uv.data[0]); // --- Arrays --- - arr : [5]s32 = .[10, 20, 30, 40, 50]; + arr : [5]i32 = .[10, 20, 30, 40, 50]; print("arr[2]: {}\n", arr[2]); print("arr.len: {}\n", arr.len); // Array element assignment - aa : [3]s32 = .[1, 2, 3]; + aa : [3]i32 = .[1, 2, 3]; aa[1] = 99; print("arr-assign: {}\n", aa); // --- Slices --- - sl : []s32 = .[1, 2, 3, 4, 5]; + sl : []i32 = .[1, 2, 3, 4, 5]; print("sl[0]: {}\n", sl[0]); print("sl.len: {}\n", sl.len); // Slice element write - sla : []s32 = .[10, 20, 30]; + sla : []i32 = .[10, 20, 30]; sla[1] = 55; print("sl-assign: {}\n", sla); @@ -265,7 +265,7 @@ main :: () { print("tail: {}\n", tail); // Slice of slice - sos : []s32 = .[10, 20, 30, 40, 50]; + sos : []i32 = .[10, 20, 30, 40, 50]; mid := sos[1..4]; inner := mid[0..2]; print("slice-of-slice: {}\n", inner); @@ -289,18 +289,18 @@ main :: () { print("auto-deref: {}\n", ptr.x); // Many-pointer - mp : [*]s32 = @arr[0]; + mp : [*]i32 = @arr[0]; print("mp[0]: {}\n", mp[0]); print("mp[3]: {}\n", mp[3]); // Many-pointer write - mpw : [5]s32 = .[10, 20, 30, 40, 50]; - mpw_ptr : [*]s32 = @mpw[0]; + mpw : [5]i32 = .[10, 20, 30, 40, 50]; + mpw_ptr : [*]i32 = @mpw[0]; mpw_ptr[2] = 99; print("mp-write: {}\n", mpw[2]); // Pointer-null comparison - np : *s32 = null; + np : *i32 = null; print("ptr==null: {}\n", np == null); print("ptr!=null: {}\n", np != null); np2 := @pv.x; @@ -309,13 +309,13 @@ main :: () { // Pointer to nested struct field Inner3 :: struct { a: f32; b: f32; c: f32; } - Outer3 :: struct { key: s32; inner: Inner3; } + Outer3 :: struct { key: i32; inner: Inner3; } out3 := Outer3.{ key = 42, inner = Inner3.{ a = 1.0, b = 2.0, c = 3.0 } }; ip3 := @out3.inner; print("ptr-nested-field: {} {} {}\n", ip3.a, ip3.b, ip3.c); // Store to many-pointer field must not corrupt adjacent memory - MpHolder :: struct { items: [*]s64; sentinel: s64; } + MpHolder :: struct { items: [*]i64; sentinel: i64; } mph := MpHolder.{ items = xx 0, sentinel = 42 }; mph.items = xx 0; print("mp-store-sentinel: {}\n", mph.sentinel); diff --git a/examples/0122-types-flags.sx b/examples/0122-types-flags.sx index 2f5ed8a..5b8220d 100644 --- a/examples/0122-types-flags.sx +++ b/examples/0122-types-flags.sx @@ -42,12 +42,12 @@ main :: () { print("flags-all: {}\n", pall); // Cast to int - print("flags-raw: {}\n", cast(s64) perm); + print("flags-raw: {}\n", cast(i64) perm); // Flags with explicit values wf : WindowFlags = .vsync | .resizable; print("flags-explicit: {}\n", wf); - print("flags-explicit-raw: {}\n", cast(s64) wf); + print("flags-explicit-raw: {}\n", cast(i64) wf); // --- Multi-target assignment (swap) --- print("--- swap ---\n"); @@ -62,7 +62,7 @@ main :: () { // Array element swap { - sarr : [3]s64 = .[1, 2, 3]; + sarr : [3]i64 = .[1, 2, 3]; sarr[0], sarr[2] = sarr[2], sarr[0]; print("arr swap: {} {}\n", sarr[0], sarr[2]); } @@ -87,7 +87,7 @@ main :: () { // Destructure from function return { - dswap :: (a: s64, b: s64) -> (s64, s64) { (b, a) } + dswap :: (a: i64, b: i64) -> (i64, i64) { (b, a) } dx, dy := dswap(1, 2); print("fn: {} {}\n", dx, dy); } diff --git a/examples/0123-types-compound-assign.sx b/examples/0123-types-compound-assign.sx index 5f8aad1..51643db 100644 --- a/examples/0123-types-compound-assign.sx +++ b/examples/0123-types-compound-assign.sx @@ -16,9 +16,9 @@ main :: () { ca_a += ca_b; print("f64+=f32: {}\n", ca_a); - ca_c : s64 = 100; - ca_d : s32 = 7; + ca_c : i64 = 100; + ca_d : i32 = 7; ca_c -= ca_d; - print("s64-=s32: {}\n", ca_c); + print("i64-=i32: {}\n", ca_c); } } diff --git a/examples/0124-types-array-of-structs.sx b/examples/0124-types-array-of-structs.sx index 43bea69..e9843b3 100644 --- a/examples/0124-types-array-of-structs.sx +++ b/examples/0124-types-array-of-structs.sx @@ -4,7 +4,7 @@ #import "modules/std/test.sx"; pkg :: #import "tests/fixtures/testpkg"; -Point :: struct { x, y: s32; } +Point :: struct { x, y: i32; } main :: () { diff --git a/examples/0125-types-type-named-var-rejected.sx b/examples/0125-types-type-named-var-rejected.sx index 47a6711..26fcf2c 100644 --- a/examples/0125-types-type-named-var-rejected.sx +++ b/examples/0125-types-type-named-var-rejected.sx @@ -1,4 +1,4 @@ -// A local declared with a reserved/builtin type-name spelling (`s2` is the +// A local declared with a reserved/builtin type-name spelling (`i2` is the // arbitrary-width `sN` integer type) is rejected at the declaration site. // Previously such a name parsed as a `.type_expr`, so address-of sites // mis-lowered it (load-by-value to a `ptr` param → LLVM verifier abort, or a @@ -6,8 +6,8 @@ // error at the declaration; exit 1. #import "modules/std.sx"; -main :: () -> s32 { - s2 := 42; - print("s2: {}\n", s2); +main :: () -> i32 { + i2 := 42; + print("i2: {}\n", i2); return 0; } diff --git a/examples/0126-types-nested-arrays.sx b/examples/0126-types-nested-arrays.sx index ff40a18..44ae8a5 100644 --- a/examples/0126-types-nested-arrays.sx +++ b/examples/0126-types-nested-arrays.sx @@ -11,7 +11,7 @@ main :: () { // ======================================================== print("=== 23. Nested Arrays ===\n"); { - matrix : [2][3]s32 = .[ .[1, 2, 3], .[4, 5, 6] ]; + matrix : [2][3]i32 = .[ .[1, 2, 3], .[4, 5, 6] ]; print("m[0][0]: {}\n", matrix[0][0]); print("m[0][2]: {}\n", matrix[0][2]); print("m[1][0]: {}\n", matrix[1][0]); diff --git a/examples/0127-types-using.sx b/examples/0127-types-using.sx index 06b6687..5771fa5 100644 --- a/examples/0127-types-using.sx +++ b/examples/0127-types-using.sx @@ -9,25 +9,25 @@ main :: () { // === 26. #using struct composition === print("=== 26. #using ===\n"); { - UBase :: struct { x: s32; y: s32; } - UExt :: struct { #using UBase; z: s32; } + UBase :: struct { x: i32; y: i32; } + UExt :: struct { #using UBase; z: i32; } e := UExt.{ x = 1, y = 2, z = 3 }; print("using-x: {}\n", e.x); print("using-y: {}\n", e.y); print("using-z: {}\n", e.z); // #using in middle position - UHeader :: struct { version: s32; } - UPacket :: struct { id: s32; #using UHeader; payload: s32; } + UHeader :: struct { version: i32; } + UPacket :: struct { id: i32; #using UHeader; payload: i32; } p := UPacket.{ id = 10, version = 42, payload = 99 }; print("pkt-id: {}\n", p.id); print("pkt-ver: {}\n", p.version); print("pkt-pay: {}\n", p.payload); // Multiple #using - UPos :: struct { px: s32; py: s32; } - UCol :: struct { r: s32; g: s32; } - USprite :: struct { #using UPos; #using UCol; scale: s32; } + UPos :: struct { px: i32; py: i32; } + UCol :: struct { r: i32; g: i32; } + USprite :: struct { #using UPos; #using UCol; scale: i32; } s := USprite.{ px = 10, py = 20, r = 255, g = 128, scale = 1 }; print("sprite-px: {}\n", s.px); print("sprite-r: {}\n", s.r); diff --git a/examples/0128-types-tuples.sx b/examples/0128-types-tuples.sx index 3dee7e5..92b4d65 100644 --- a/examples/0128-types-tuples.sx +++ b/examples/0128-types-tuples.sx @@ -20,7 +20,7 @@ main :: () { single := (42,); print("{}\n", single.0); - zeroed : (s32, s32) = ---; + zeroed : (i32, i32) = ---; print("{}\n", zeroed.0); print("{}\n", zeroed.1); } diff --git a/examples/0129-types-tuple-operators.sx b/examples/0129-types-tuple-operators.sx index 091c8db..348c9d6 100644 --- a/examples/0129-types-tuple-operators.sx +++ b/examples/0129-types-tuple-operators.sx @@ -5,34 +5,34 @@ #import "modules/std/test.sx"; pkg :: #import "tests/fixtures/testpkg"; -Point :: struct { x, y: s32; } +Point :: struct { x, y: i32; } OptNode :: struct { - value: s32; - next: ?s32; + value: i32; + next: ?i32; } -OptInner :: struct { val: s32; } +OptInner :: struct { val: i32; } OptOuter :: struct { inner: ?OptInner; } -add :: (a: s32, b: s32) -> s32 { a + b } +add :: (a: i32, b: i32) -> i32 { a + b } -mul :: (a: s32, b: s32) -> s32 { a * b } +mul :: (a: i32, b: i32) -> i32 { a * b } identity :: (x: $T) -> T { x } -apply :: (f: (s32, s32) -> s32, x: s32, y: s32) -> s32 { +apply :: (f: (i32, i32) -> i32, x: i32, y: i32) -> i32 { f(x, y) } // P4 edge: Chained default→default calls Chained :: protocol { - base :: (msg: string) -> s32; - wrap :: (msg: string) -> s32 { + base :: (msg: string) -> i32; + wrap :: (msg: string) -> i32 { self.base(msg) + 1 } - double_wrap :: (msg: string) -> s32 { + double_wrap :: (msg: string) -> i32 { self.wrap(msg) + self.wrap(msg) } } @@ -106,7 +106,7 @@ main :: () { // ── alloc_slice ────────────────────────────────────────── { - items := alloc_slice(s64, 5); + items := alloc_slice(i64, 5); items[0] = 10; items[1] = 20; items[2] = 30; @@ -182,7 +182,7 @@ main :: () { b2 := a.alloc_bytes(24); print("buf pos: {}\n", buf.pos); // buf pos: 48 b3 := a.alloc_bytes(200); - b3_i : s64 = xx b3; + b3_i : i64 = xx b3; print("buf overflow: {}\n", b3_i); // buf overflow: 0 buf.reset(); print("buf reset: {}\n", buf.pos); // buf reset: 0 @@ -209,30 +209,30 @@ main :: () { // Basic optional creation and null { - x: ?s32 = 42; - y: ?s32 = null; + x: ?i32 = 42; + y: ?i32 = null; print("opt x: {}\n", x); // opt x: 42 print("opt y: {}\n", y); // opt y: null } // Force unwrap { - x: ?s32 = 10; + x: ?i32 = 10; val := x!; print("unwrap: {}\n", val); // unwrap: 10 } // Null coalescing { - x: ?s32 = 42; - y: ?s32 = null; + x: ?i32 = 42; + y: ?i32 = null; a := x ?? 0; b := y ?? 99; print("coalesce a: {}\n", a); // coalesce a: 42 print("coalesce b: {}\n", b); // coalesce b: 99 // Chained ?? (right-associative): a ?? b ?? c - z: ?s32 = null; + z: ?i32 = null; c := x ?? y ?? 0; d := z ?? y ?? 99; e := z ?? z ?? 0; @@ -243,8 +243,8 @@ main :: () { // If-binding (safe unwrap) { - x: ?s32 = 7; - y: ?s32 = null; + x: ?i32 = 7; + y: ?i32 = null; if val := x { print("if-bind x: {}\n", val); // if-bind x: 7 } @@ -257,21 +257,21 @@ main :: () { // Pattern matching on optionals { - check :: (v: ?s32) -> s32 { + check :: (v: ?i32) -> i32 { return if v == { case .some: (val) { val } case .none: { 0 } }; } - a: ?s32 = 55; - b: ?s32 = null; + a: ?i32 = 55; + b: ?i32 = null; print("match some: {}\n", check(a)); // match some: 55 print("match none: {}\n", check(b)); // match none: 0 } // Optional with implicit wrapping { - opt_wrap :: (n: s32) -> ?s32 { + opt_wrap :: (n: i32) -> ?i32 { if n > 0 { return n; } @@ -293,11 +293,11 @@ main :: () { // ?T as function parameter { - opt_process :: (val: ?s32) -> s32 { + opt_process :: (val: ?i32) -> i32 { return val ?? 0; } - a: ?s32 = 42; - b: ?s32 = null; + a: ?i32 = 42; + b: ?i32 = null; print("opt param a: {}\n", opt_process(a)); // opt param a: 42 print("opt param b: {}\n", opt_process(b)); // opt param b: 0 print("opt param 7: {}\n", opt_process(7)); // opt param 7: 7 @@ -328,9 +328,9 @@ main :: () { if b > 0 { return b; } return null; } - print("generic opt 1: {}\n", first_pos(s32, 5, 10)); // generic opt 1: 5 - print("generic opt 2: {}\n", first_pos(s32, 0, 7)); // generic opt 2: 7 - print("generic opt 3: {}\n", first_pos(s32, 0, 0)); // generic opt 3: null + print("generic opt 1: {}\n", first_pos(i32, 5, 10)); // generic opt 1: 5 + print("generic opt 2: {}\n", first_pos(i32, 0, 7)); // generic opt 2: 7 + print("generic opt 3: {}\n", first_pos(i32, 0, 0)); // generic opt 3: null } // Optional chaining (?.) @@ -351,10 +351,10 @@ main :: () { // Flow-sensitive narrowing { - x: ?s32 = 42; - y: ?s32 = null; + x: ?i32 = 42; + y: ?i32 = null; - // if x != null → x is narrowed to s32 + // if x != null → x is narrowed to i32 if x != null { print("narrow x: {}\n", x); // narrow x: 42 } @@ -376,7 +376,7 @@ main :: () { // Guard narrowing { - guard_fn :: (v: ?s32) -> s32 { + guard_fn :: (v: ?i32) -> i32 { if v == null { return 0; } return v; } @@ -386,9 +386,9 @@ main :: () { // Compound narrowing: && chains { - a: ?s32 = 10; - b: ?s32 = 20; - c: ?s32 = null; + a: ?i32 = 10; + b: ?i32 = 20; + c: ?i32 = null; if a != null and b != null { print("and both: {} {}\n", a, b); // and both: 10 20 } @@ -401,7 +401,7 @@ main :: () { // Compound guard narrowing: || chains { - guard2 :: (a: ?s32, b: ?s32) -> s32 { + guard2 :: (a: ?i32, b: ?i32) -> i32 { if a == null or b == null { return 0; } return a + b; } @@ -411,8 +411,8 @@ main :: () { // Nested if narrowing { - a: ?s32 = 10; - b: ?s32 = 20; + a: ?i32 = 10; + b: ?i32 = 20; if a != null { if b != null { print("nested narrow: {} {}\n", a, b); // nested narrow: 10 20 @@ -422,7 +422,7 @@ main :: () { // Guard narrowing used in loop { - guard_loop :: (v: ?s32) -> s32 { + guard_loop :: (v: ?i32) -> i32 { if v == null { return 0; } sum := 0; i := 0; @@ -438,7 +438,7 @@ main :: () { // --- block-body lambdas --- { // block-body lambda with return type - clamp := (x: s64, lo: s64, hi: s64) -> s64 { + clamp := (x: i64, lo: i64, hi: i64) -> i64 { if x < lo { return lo; } if x > hi { return hi; } return x; @@ -457,59 +457,59 @@ main :: () { // --- named params in function types --- { // Named params are documentation only — ignored for type identity - apply_named :: (f: (x: s32, y: s32) -> s32, a: s32, b: s32) -> s32 { + apply_named :: (f: (x: i32, y: i32) -> i32, a: i32, b: i32) -> i32 { return f(a, b); } - add :: (a: s32, b: s32) -> s32 { return a + b; } + add :: (a: i32, b: i32) -> i32 { return a + b; } print("named-fn-type: {}\n", apply_named(add, 3, 4)); // named-fn-type: 7 } // --- xx on function pointers --- { - MyEnv :: struct { n: s32; } - typed_fn :: (e: *MyEnv, x: s32) -> s32 { + MyEnv :: struct { n: i32; } + typed_fn :: (e: *MyEnv, x: i32) -> i32 { return x + e.n; } - // xx cast: (*MyEnv, s32) -> s32 → (*void, s32) -> s32 - f : (*void, s32) -> s32 = xx typed_fn; + // xx cast: (*MyEnv, i32) -> i32 → (*void, i32) -> i32 + f : (*void, i32) -> i32 = xx typed_fn; env := MyEnv.{ n = 100 }; print("xx-fnptr: {}\n", f(xx @env, 42)); // xx-fnptr: 142 } // --- closure type: construct and access fields --- { - dummy_fn :: (env: *void, x: s32) -> s32 { + dummy_fn :: (env: *void, x: i32) -> i32 { return x * 2; } fn_ptr : *void = xx dummy_fn; null_env : *void = xx 0; - c : Closure(s32) -> s32 = .{ fn_ptr = fn_ptr, env = null_env }; + c : Closure(i32) -> i32 = .{ fn_ptr = fn_ptr, env = null_env }; print("closure-type: fn_ptr-nonnull={}\n", c.fn_ptr != null_env); print("closure-type: env-null={}\n", c.env == null_env); } // --- closure calling convention --- { - Env :: struct { n: s32; } - impl_fn :: (env: *void, x: s32) -> s32 { + Env :: struct { n: i32; } + impl_fn :: (env: *void, x: i32) -> i32 { e : *Env = xx env; return x + e.n; } env := Env.{ n = 5 }; fn_ptr : *void = xx impl_fn; env_ptr : *void = xx @env; - c : Closure(s32) -> s32 = .{ fn_ptr = fn_ptr, env = env_ptr }; + c : Closure(i32) -> i32 = .{ fn_ptr = fn_ptr, env = env_ptr }; print("closure-call: {}\n", c(10)); } // --- auto-promotion: bare fn → Closure --- { - double :: (x: s32) -> s32 { return x * 2; } - apply :: (f: Closure(s32) -> s32, x: s32) -> s32 { return f(x); } + double :: (x: i32) -> i32 { return x * 2; } + apply :: (f: Closure(i32) -> i32, x: i32) -> i32 { return f(x); } print("auto-promote: {}\n", apply(double, 10)); // Named function to Closure variable - f : Closure(s32) -> s32 = double; + f : Closure(i32) -> i32 = double; print("auto-promote-var: {}\n", f(5)); } @@ -517,35 +517,35 @@ main :: () { { // capture scalar n := 42; - f := closure((x: s32) => x + n); + f := closure((x: i32) => x + n); print("closure-capture: {}\n", f(10)); // capture by value is a snapshot m := 5; - g := closure((x: s32) => x + m); + g := closure((x: i32) => x + m); m = 100; print("closure-snapshot: {}\n", g(10)); // no captures (null env) - h := closure((x: s32) => x * 2); + h := closure((x: i32) => x * 2); print("closure-nocap: {}\n", h(7)); // multiple captures a := 10; b := 20; - multi := closure((x: s32) => x + a + b); + multi := closure((x: i32) => x + a + b); print("closure-multi: {}\n", multi(3)); // block-body closure with return offset := 50; - clamp := closure((x: s64) -> s64 { + clamp := closure((x: i64) -> i64 { if x < 0 { return 0; } if x > 100 { return 100; } return x + offset; }); - r1 : s64 = clamp(10); - r2 : s64 = clamp(0 - 5); - r3 : s64 = clamp(999); + r1 : i64 = clamp(10); + r2 : i64 = clamp(0 - 5); + r3 : i64 = clamp(999); print("closure-block: {}\n", r1); print("closure-block: {}\n", r2); print("closure-block: {}\n", r3); @@ -558,10 +558,10 @@ main :: () { logger("hello"); // pass closure to higher-order function - dbl :: (x: s32) -> s32 { return x * 2; } - apply_cl :: (f2: Closure(s32) -> s32, x: s32) -> s32 { return f2(x); } - factor : s32 = 3; - print("closure-hof: {}\n", apply_cl(closure((x: s32) -> s32 => x * factor), 10)); + dbl :: (x: i32) -> i32 { return x * 2; } + apply_cl :: (f2: Closure(i32) -> i32, x: i32) -> i32 { return f2(x); } + factor : i32 = 3; + print("closure-hof: {}\n", apply_cl(closure((x: i32) -> i32 => x * factor), 10)); // auto-promoted bare fn passed alongside closures print("closure-hof-bare: {}\n", apply_cl(dbl, 10)); @@ -579,42 +579,42 @@ main :: () { f_bool("hello"); // C5.B3: two params - base : s32 = 100; - f_2p := closure((x: s32, y: s32) -> s32 => x + y + base); + base : i32 = 100; + f_2p := closure((x: i32, y: i32) -> i32 => x + y + base); print("closure-2p: {}\n", f_2p(3, 4)); // C5.B4: three params - bias : s32 = 1; - f_3p := closure((a: s32, b: s32, c2: s32) -> s32 => a + b + c2 + bias); + bias : i32 = 1; + f_3p := closure((a: i32, b: i32, c2: i32) -> i32 => a + b + c2 + bias); print("closure-3p: {}\n", f_3p(10, 20, 30)); - // C5.B5: mixed param types (string + s32) - extra : s32 = 5; - f_mix := closure((name: string, age: s32) { + // C5.B5: mixed param types (string + i32) + extra : i32 = 5; + f_mix := closure((name: string, age: i32) { print("closure-mix: {} is {}\n", name, age + extra); }); f_mix("Alice", 30); // C5.C3: return bool - threshold : s32 = 100; - f_rbool := closure((x: s32) -> bool { return x > threshold; }); + threshold : i32 = 100; + f_rbool := closure((x: i32) -> bool { return x > threshold; }); print("closure-rbool: {} {}\n", f_rbool(50), f_rbool(200)); // C5.D3: reduce / fold - reduce :: (arr: []s32, f3: Closure(s32, s32) -> s32, init: s32) -> s32 { + reduce :: (arr: []i32, f3: Closure(i32, i32) -> i32, init: i32) -> i32 { acc := init; - i : s64 = 0; + i : i64 = 0; while i < arr.len { acc = f3(acc, arr[i]); i += 1; } return acc; } - r_nums : []s32 = .[1, 2, 3, 4, 5]; - r_bonus : s32 = 100; - r_total := reduce(r_nums, closure((acc: s32, x: s32) -> s32 => acc + x), r_bonus); + r_nums : []i32 = .[1, 2, 3, 4, 5]; + r_bonus : i32 = 100; + r_total := reduce(r_nums, closure((acc: i32, x: i32) -> i32 => acc + x), r_bonus); print("closure-reduce: {}\n", r_total); // C5.G1: factory function - make_adder :: (n: s32) -> Closure(s32) -> s32 { - return closure((x: s32) -> s32 => x + n); + make_adder :: (n: i32) -> Closure(i32) -> i32 { + return closure((x: i32) -> i32 => x + n); } add5 := make_adder(5); add10 := make_adder(10); @@ -629,18 +629,18 @@ main :: () { // C5.H1: closure captures another closure inner_n := 10; - inner_cl := closure((x: s64) -> s64 => x + inner_n); - outer_cl := closure((x: s64) -> s64 => inner_cl(x) * 2); + inner_cl := closure((x: i64) -> i64 => x + inner_n); + outer_cl := closure((x: i64) -> i64 => inner_cl(x) * 2); print("closure-compose: {}\n", outer_cl(5)); // C5.M7: multiple closures from same scope capture independently - shared : s32 = 10; - cl_a := closure((x: s32) -> s32 => x + shared); - cl_b := closure((x: s32) -> s32 => x * shared); + shared : i32 = 10; + cl_a := closure((x: i32) -> i32 => x + shared); + cl_b := closure((x: i32) -> i32 => x * shared); print("closure-indep: {} {}\n", cl_a(5), cl_b(5)); // C6: optional closures - f_none : ?Closure(s64) -> s64 = null; + f_none : ?Closure(i64) -> i64 = null; if h := f_none { print("should not print: {}\n", h(1)); } else { @@ -648,7 +648,7 @@ main :: () { } opt_n := 10; - f_some : ?Closure(s64) -> s64 = closure((x: s64) -> s64 => x + opt_n); + f_some : ?Closure(i64) -> i64 = closure((x: i64) -> i64 => x + opt_n); if h := f_some { print("opt-closure: {}\n", h(5)); } else { @@ -656,9 +656,9 @@ main :: () { } // Struct with optional closure callback - Btn :: struct { label: string; on_click: ?Closure(s64) -> void; } + Btn :: struct { label: string; on_click: ?Closure(i64) -> void; } btn_x := 99; - btn_cl := closure((id: s64) { + btn_cl := closure((id: i64) { print("opt-closure-btn: {} {}\n", id, btn_x); }); btn1 := Btn.{ label = "OK", on_click = btn_cl }; @@ -667,15 +667,15 @@ main :: () { if h := btn2.on_click { h(2); } else { print("opt-closure-btn: null\n"); } // C5.A6: capture pointer (shared mutable state) - count_a6 : s32 = 0; + count_a6 : i32 = 0; p_a6 := @count_a6; inc_fn := closure(() { p_a6.* += 1; }); inc_fn(); inc_fn(); inc_fn(); print("closure-ptr: {}\n", count_a6); - // C5.A9: capture enum value (as s32 tag) - c_a9 : s32 = 2; // simulate enum tag - f_a9 := closure(() -> s32 => c_a9); + // C5.A9: capture enum value (as i32 tag) + c_a9 : i32 = 2; // simulate enum tag + f_a9 := closure(() -> i32 => c_a9); print("closure-enum: {}\n", f_a9()); // C5.C4: return string @@ -690,59 +690,59 @@ main :: () { print("closure-rstruct: {} {}\n", res_c5.x, res_c5.y); // C5.G2: factory with multiple captures - make_linear :: (m: s32, b: s32) -> Closure(s32) -> s32 { - return closure((x: s32) -> s32 => m * x + b); + make_linear :: (m: i32, b: i32) -> Closure(i32) -> i32 { + return closure((x: i32) -> i32 => m * x + b); } lin := make_linear(3, 7); print("closure-linear: {}\n", lin(10)); // C5.G3: factory returning clamper - make_clamper :: (lo: s32, hi: s32) -> Closure(s32) -> s32 { - return closure((x: s32) -> s32 { + make_clamper :: (lo: i32, hi: i32) -> Closure(i32) -> i32 { + return closure((x: i32) -> i32 { if x < lo { return lo; } if x > hi { return hi; } return x; }); } clamp_fn := make_clamper(0, 255); - cv1 : s32 = xx -10; - cv2 : s32 = 100; - cv3 : s32 = 999; + cv1 : i32 = xx -10; + cv2 : i32 = 100; + cv3 : i32 = 999; print("closure-clamp: {} {} {}\n", clamp_fn(cv1), clamp_fn(cv2), clamp_fn(cv3)); // C5.H2: compose - compose :: (f_h2: Closure(s32) -> s32, g_h2: Closure(s32) -> s32) -> Closure(s32) -> s32 { - return closure((x: s32) -> s32 => f_h2(g_h2(x))); + compose :: (f_h2: Closure(i32) -> i32, g_h2: Closure(i32) -> i32) -> Closure(i32) -> i32 { + return closure((x: i32) -> i32 => f_h2(g_h2(x))); } - one_h2 : s32 = 1; - two_h2 : s32 = 2; - add1_h2 := closure((x: s32) -> s32 => x + one_h2); - mul2_h2 := closure((x: s32) -> s32 => x * two_h2); + one_h2 : i32 = 1; + two_h2 : i32 = 2; + add1_h2 := closure((x: i32) -> i32 => x + one_h2); + mul2_h2 := closure((x: i32) -> i32 => x * two_h2); composed := compose(mul2_h2, add1_h2); print("closure-compose2: {}\n", composed(5)); // C5.H3: chain of closures - ch_k1 : s32 = 1; - ch_k2 : s32 = 2; - ch_k10 : s32 = 10; - ch_a := closure((x: s32) -> s32 => x + ch_k1); - ch_b := closure((x: s32) -> s32 => ch_a(x) * ch_k2); - ch_c := closure((x: s32) -> s32 => ch_b(x) + ch_k10); + ch_k1 : i32 = 1; + ch_k2 : i32 = 2; + ch_k10 : i32 = 10; + ch_a := closure((x: i32) -> i32 => x + ch_k1); + ch_b := closure((x: i32) -> i32 => ch_a(x) * ch_k2); + ch_c := closure((x: i32) -> i32 => ch_b(x) + ch_k10); print("closure-chain: {}\n", ch_c(5)); // C5.D1: map - map_cl :: (arr: [*]s32, cnt: s64, f_map: Closure(s32) -> s32, result: [*]s32) { + map_cl :: (arr: [*]i32, cnt: i64, f_map: Closure(i32) -> i32, result: [*]i32) { i := 0; while i < cnt { result[i] = f_map(arr[i]); i += 1; } } - map_src : [5]s32 = .[1, 2, 3, 4, 5]; - map_dst : [5]s32 = .[0, 0, 0, 0, 0]; - factor_d1 : s32 = 3; - map_cl(xx @map_src, 5, closure((x: s32) -> s32 => x * factor_d1), xx @map_dst); + map_src : [5]i32 = .[1, 2, 3, 4, 5]; + map_dst : [5]i32 = .[0, 0, 0, 0, 0]; + factor_d1 : i32 = 3; + map_cl(xx @map_src, 5, closure((x: i32) -> i32 => x * factor_d1), xx @map_dst); print("closure-map: {} {} {} {} {}\n", map_dst[0], map_dst[1], map_dst[2], map_dst[3], map_dst[4]); // C5.D2: filter - filter_cl :: (arr: [*]s32, cnt: s64, pred: Closure(s32) -> bool, result: [*]s32) -> s64 { + filter_cl :: (arr: [*]i32, cnt: i64, pred: Closure(i32) -> bool, result: [*]i32) -> i64 { j := 0; i := 0; while i < cnt { @@ -751,13 +751,13 @@ main :: () { } return j; } - min_val : s32 = 3; - filt_dst : [5]s32 = .[0, 0, 0, 0, 0]; - kept := filter_cl(xx @map_src, 5, closure((x: s32) -> bool => x >= min_val), xx @filt_dst); + min_val : i32 = 3; + filt_dst : [5]i32 = .[0, 0, 0, 0, 0]; + kept := filter_cl(xx @map_src, 5, closure((x: i32) -> bool => x >= min_val), xx @filt_dst); print("closure-filter: {} [{} {} {}]\n", kept, filt_dst[0], filt_dst[1], filt_dst[2]); // C5.D4: sort comparator (bubble sort) - sort_cl :: (arr: [*]s32, cnt: s64, less: Closure(s32, s32) -> bool) { + sort_cl :: (arr: [*]i32, cnt: i64, less: Closure(i32, i32) -> bool) { i := 0; while i < cnt { j := 0; @@ -772,119 +772,119 @@ main :: () { i += 1; } } - sort_arr : [5]s32 = .[5, 3, 1, 4, 2]; + sort_arr : [5]i32 = .[5, 3, 1, 4, 2]; descending := true; - sort_cl(xx @sort_arr, 5, closure((a: s32, b: s32) -> bool { + sort_cl(xx @sort_arr, 5, closure((a: i32, b: i32) -> bool { if descending { return a > b; } return a < b; })); print("closure-sort: {} {} {} {} {}\n", sort_arr[0], sort_arr[1], sort_arr[2], sort_arr[3], sort_arr[4]); // C5.D5: for_each with index - for_each_cl :: (arr: [*]s32, cnt: s64, f_fe: Closure(s32, s64) -> void) { - i : s64 = 0; + for_each_cl :: (arr: [*]i32, cnt: i64, f_fe: Closure(i32, i64) -> void) { + i : i64 = 0; while i < cnt { f_fe(arr[i], i); i += 1; } } fe_label := "item"; - fe_arr : [3]s32 = .[10, 20, 30]; - for_each_cl(xx @fe_arr, 3, closure((val: s32, idx: s64) { + fe_arr : [3]i32 = .[10, 20, 30]; + for_each_cl(xx @fe_arr, 3, closure((val: i32, idx: i64) { print("closure-fe: {} {}={}\n", fe_label, idx, val); })); // C5.D6: find - find_cl :: (arr: [*]s32, cnt: s64, pred_f: Closure(s32) -> bool) -> s64 { - i : s64 = 0; + find_cl :: (arr: [*]i32, cnt: i64, pred_f: Closure(i32) -> bool) -> i64 { + i : i64 = 0; while i < cnt { if pred_f(arr[i]) { return i; } i += 1; } return -1; } - target : s32 = 30; - found_idx := find_cl(xx @fe_arr, 3, closure((x: s32) -> bool => x == target)); + target : i32 = 30; + found_idx := find_cl(xx @fe_arr, 3, closure((x: i32) -> bool => x == target)); print("closure-find: {}\n", found_idx); // C5.D7: any - any_cl :: (arr: [*]s32, cnt: s64, pred_a: Closure(s32) -> bool) -> bool { - i : s64 = 0; + any_cl :: (arr: [*]i32, cnt: i64, pred_a: Closure(i32) -> bool) -> bool { + i : i64 = 0; while i < cnt { if pred_a(arr[i]) { return true; } i += 1; } return false; } - has_big := any_cl(xx @fe_arr, 3, closure((x: s32) -> bool => x > 100)); - has_20 := any_cl(xx @fe_arr, 3, closure((x: s32) -> bool => x == 20)); + has_big := any_cl(xx @fe_arr, 3, closure((x: i32) -> bool => x > 100)); + has_20 := any_cl(xx @fe_arr, 3, closure((x: i32) -> bool => x == 20)); print("closure-any: {} {}\n", has_big, has_20); // C5.E4: auto-promotion in struct field assignment - Widget :: struct { transform: Closure(s32) -> s32; } - negate_fn :: (x: s32) -> s32 { return 0 - x; } + Widget :: struct { transform: Closure(i32) -> i32; } + negate_fn :: (x: i32) -> i32 { return 0 - x; } w_e4 := Widget.{ transform = negate_fn }; print("closure-struct-field: {}\n", w_e4.transform(5)); // C5.F1: single closure callback in struct Button :: struct { label: string; - on_press: Closure(s32) -> void; + on_press: Closure(i32) -> void; } btn_x2 := 99; - btn_cb := closure((id: s32) { + btn_cb := closure((id: i32) { print("closure-btn: {} {}\n", id, btn_x2); }); btn3 := Button.{ label = "OK", on_press = btn_cb }; btn3.on_press(1); // C5.J1: stateful counter via pointer capture - state_j1 : s32 = 0; + state_j1 : i32 = 0; p_j1 := @state_j1; - inc_j1 := closure(() -> s32 { p_j1.* += 1; return p_j1.*; }); + inc_j1 := closure(() -> i32 { p_j1.* += 1; return p_j1.*; }); print("closure-counter: {} {} {}\n", inc_j1(), inc_j1(), inc_j1()); // C5.J2: stateful accumulator - state_j2 : s32 = 100; + state_j2 : i32 = 100; p_j2 := @state_j2; - acc_j2 := closure((x: s32) -> s32 { p_j2.* += x; return p_j2.*; }); + acc_j2 := closure((x: i32) -> i32 { p_j2.* += x; return p_j2.*; }); print("closure-acc: {} {}\n", acc_j2(5), acc_j2(10)); // C5.K2: block-body with local variables and loops - base_k2 : s32 = 100; - sum_fn := closure((items: [*]s32, cnt: s64) -> s32 { - total : s32 = 0; - i : s64 = 0; + base_k2 : i32 = 100; + sum_fn := closure((items: [*]i32, cnt: i64) -> i32 { + total : i32 = 0; + i : i64 = 0; while i < cnt { total += items[i]; i += 1; } return total + base_k2; }); - k2_arr : [5]s32 = .[1, 2, 3, 4, 5]; + k2_arr : [5]i32 = .[1, 2, 3, 4, 5]; print("closure-loop: {}\n", sum_fn(xx @k2_arr, 5)); // C5.M3: reassigning a closure variable - n_m3 : s32 = 1; - f_m3 := closure((x: s32) -> s32 => x + n_m3); + n_m3 : i32 = 1; + f_m3 := closure((x: i32) -> i32 => x + n_m3); print("closure-reassign: {}\n", f_m3(10)); - m_m3 : s32 = 2; - f_m3 = closure((x: s32) -> s32 => x * m_m3); + m_m3 : i32 = 2; + f_m3 = closure((x: i32) -> i32 => x * m_m3); print("closure-reassign: {}\n", f_m3(10)); // C5.M6b: snapshot verified with struct capture pt_m6 := Point.{ x = 5, y = 10 }; - f_m6 := closure(() -> s32 => pt_m6.x + pt_m6.y); + f_m6 := closure(() -> i32 => pt_m6.x + pt_m6.y); pt_m6 = Point.{ x = 99, y = 99 }; print("closure-snapstruct: {}\n", f_m6()); // C5.M2: closure capturing auto-promoted closure - double_m2 :: (x: s32) -> s32 { return x * 2; } - base_m2 : Closure(s32) -> s32 = double_m2; - n_m2 : s32 = 1; - f_m2 := closure((x: s32) -> s32 => base_m2(x) + n_m2); + double_m2 :: (x: i32) -> i32 { return x * 2; } + base_m2 : Closure(i32) -> i32 = double_m2; + n_m2 : i32 = 1; + f_m2 := closure((x: i32) -> i32 => base_m2(x) + n_m2); print("closure-cap-promoted: {}\n", f_m2(5)); // C5.M5: immediately invoked closure (via temp var) - n_m5 : s32 = 5; - iife := closure((x: s32) -> s32 => x + n_m5); + n_m5 : i32 = 5; + iife := closure((x: i32) -> i32 => x + n_m5); result_m5 := iife(10); print("closure-iife: {}\n", result_m5); @@ -901,9 +901,9 @@ main :: () { // C5.F5: callback receiving caller context Panel :: struct { title: string; - on_resize: Closure(string, s32, s32) -> void; + on_resize: Closure(string, i32, i32) -> void; } - p_f5_cb := closure((title: string, w: s32, h: s32) { + p_f5_cb := closure((title: string, w: i32, h: i32) { print("closure-panel: {} {}x{}\n", title, w, h); }); p_f5 := Panel.{ title = "main", on_resize = p_f5_cb }; @@ -921,11 +921,11 @@ main :: () { // C5.I1: creating closures in a loop (each captures different value) // TEMPORARILY DISABLED — closure-in-loop causes infinite loop (index_gep element size issue?) - // cl_arr : [5]Closure(s32) -> s32 = ---; + // cl_arr : [5]Closure(i32) -> i32 = ---; // i_loop := 0; // while i_loop < 5 { - // val_loop : s32 = xx (i_loop * 10); - // cl_arr[i_loop] = closure((x: s32) -> s32 => x + val_loop); + // val_loop : i32 = xx (i_loop * 10); + // cl_arr[i_loop] = closure((x: i32) -> i32 => x + val_loop); // i_loop += 1; // } // I2: calling closures from array @@ -935,11 +935,11 @@ main :: () { // C5.M4: closure in conditional expression (via temp var) use_fast := true; - k_fast : s32 = 2; - k_slow : s32 = 10; - f_fast := closure((x: s32) -> s32 => x * k_fast); - f_slow := closure((x: s32) -> s32 => x + k_slow); - f_cond : Closure(s32) -> s32 = if use_fast then f_fast else f_slow; + k_fast : i32 = 2; + k_slow : i32 = 10; + f_fast := closure((x: i32) -> i32 => x * k_fast); + f_slow := closure((x: i32) -> i32 => x + k_slow); + f_cond : Closure(i32) -> i32 = if use_fast then f_fast else f_slow; print("closure-cond: {}\n", f_cond(5)); // C5.F4: multiple callbacks on one struct @@ -954,22 +954,22 @@ main :: () { if h := form_f4.on_cancel { h(); } else { print("closure-form: no cancel\n"); } // C5.L3: auto-promoted closure env is null (no free needed) - double_l3 :: (x: s32) -> s32 { return x * 2; } - f_l3 : Closure(s32) -> s32 = double_l3; + double_l3 :: (x: i32) -> i32 { return x * 2; } + f_l3 : Closure(i32) -> i32 = double_l3; print("closure-null-env: {}\n", f_l3.env == null); // C5.A7: capture slice (fat pointer like string) - sl_a7 : [3]s32 = .[10, 20, 30]; - ptr_a7 : [*]s32 = xx @sl_a7; - f_a7 := closure((i: s64) -> s32 => ptr_a7[i]); + sl_a7 : [3]i32 = .[10, 20, 30]; + ptr_a7 : [*]i32 = xx @sl_a7; + f_a7 := closure((i: i64) -> i32 => ptr_a7[i]); print("closure-slice: {} {} {}\n", f_a7(0), f_a7(1), f_a7(2)); // C5.L1: arena bulk free (closures allocated on arena, freed in bulk) gpa_l1 := GPA.init(); arena_l1 := Arena.init(xx gpa_l1, 4096); push Context.{ allocator = xx arena_l1 } { - n_l1 : s32 = 5; - f_l1 := closure((x: s32) -> s32 => x + n_l1); + n_l1 : i32 = 5; + f_l1 := closure((x: i32) -> i32 => x + n_l1); print("closure-arena: {}\n", f_l1(10)); } arena_l1.deinit(); @@ -977,26 +977,26 @@ main :: () { // C5.L2: GPA manual free (verify env alloc/dealloc) gpa_l2 := GPA.init(); a_l2 : Allocator = xx gpa_l2; - n_l2 : s32 = 7; - result_l2 : s32 = 0; + n_l2 : i32 = 7; + result_l2 : i32 = 0; push Context.{ allocator = a_l2 } { - f_l2 := closure((x: s32) -> s32 => x + n_l2); + f_l2 := closure((x: i32) -> i32 => x + n_l2); result_l2 = f_l2(10); a_l2.dealloc_bytes(f_l2.env); } print("closure-gpa: {} allocs={}\n", result_l2, gpa_l2.alloc_count); // C5.A10: capture optional - val_a10 : ?s32 = 42; - f_a10 := closure(() -> s32 { + val_a10 : ?i32 = 42; + f_a10 := closure(() -> i32 { if v := val_a10 { return v; } return 0; }); print("closure-opt: {}\n", f_a10()); // C5.C6: return optional - limit_c6 : s32 = 100; - f_c6 := closure((x: s32) -> ?s32 { + limit_c6 : i32 = 100; + f_c6 := closure((x: i32) -> ?i32 { if x > limit_c6 { return null; } return x; }); @@ -1006,19 +1006,19 @@ main :: () { if v := r2_c6 { print("should-not-print\n"); } else { print("closure-ropt: none\n"); } // C5.M8: array of closures with mixed origins - double_m8 :: (x: s32) -> s32 { return x * 2; } - n_m8 : s32 = 10; - fns_m8 : [3]Closure(s32) -> s32 = ---; + double_m8 :: (x: i32) -> i32 { return x * 2; } + n_m8 : i32 = 10; + fns_m8 : [3]Closure(i32) -> i32 = ---; fns_m8[0] = double_m8; // auto-promoted - fns_m8[1] = closure((x: s32) -> s32 => x + n_m8); // captured - fns_m8[2] = closure((x: s32) -> s32 => x * x); // no capture + fns_m8[1] = closure((x: i32) -> i32 => x + n_m8); // captured + fns_m8[2] = closure((x: i32) -> i32 => x * x); // no capture tmp_m8 := fns_m8[0]; print("closure-mixed: {}\n", tmp_m8(5)); tmp_m8 = fns_m8[1]; print("closure-mixed: {}\n", tmp_m8(5)); tmp_m8 = fns_m8[2]; print("closure-mixed: {}\n", tmp_m8(5)); // C5.E1: independent closures from same factory (each has own env) - mk_e1 :: (n: s32) -> Closure(s32) -> s32 { - return closure((x: s32) -> s32 => x * n); + mk_e1 :: (n: i32) -> Closure(i32) -> i32 { + return closure((x: i32) -> i32 => x * n); } f1_e1 := mk_e1(2); f2_e1 := mk_e1(3); @@ -1026,33 +1026,33 @@ main :: () { print("closure-factory-indep: {} {} {}\n", f1_e1(10), f2_e1(10), f3_e1(10)); // C5.E2: deep chain — closure capturing closure capturing closure - v_e2 : s32 = 1; - k2_e2 : s32 = 2; - k100_e2 : s32 = 100; - f0_e2 := closure((x: s32) -> s32 => x + v_e2); - f1_e2 := closure((x: s32) -> s32 => f0_e2(x) * k2_e2); - f2_e2 := closure((x: s32) -> s32 => f1_e2(x) + k100_e2); + v_e2 : i32 = 1; + k2_e2 : i32 = 2; + k100_e2 : i32 = 100; + f0_e2 := closure((x: i32) -> i32 => x + v_e2); + f1_e2 := closure((x: i32) -> i32 => f0_e2(x) * k2_e2); + f2_e2 := closure((x: i32) -> i32 => f1_e2(x) + k100_e2); print("closure-deep-chain: {}\n", f2_e2(10)); // C5.E3: many captures (stress env struct) - c1_e3 : s32 = 1; - c2_e3 : s32 = 2; - c3_e3 : s32 = 3; - c4_e3 : s32 = 4; - c5_e3 : s32 = 5; - c6_e3 : s32 = 6; - c7_e3 : s32 = 7; - c8_e3 : s32 = 8; - big_env := closure(() -> s32 => c1_e3 + c2_e3 + c3_e3 + c4_e3 + c5_e3 + c6_e3 + c7_e3 + c8_e3); + c1_e3 : i32 = 1; + c2_e3 : i32 = 2; + c3_e3 : i32 = 3; + c4_e3 : i32 = 4; + c5_e3 : i32 = 5; + c6_e3 : i32 = 6; + c7_e3 : i32 = 7; + c8_e3 : i32 = 8; + big_env := closure(() -> i32 => c1_e3 + c2_e3 + c3_e3 + c4_e3 + c5_e3 + c6_e3 + c7_e3 + c8_e3); print("closure-8cap: {}\n", big_env()); // C5.E5: closure with many parameters (4 params) - multi_param := closure((a: s32, b: s32, c: s32, d: s32) -> s32 => a + b + c + d); - a_e5 : s32 = 1; b_e5 : s32 = 2; c_e5 : s32 = 3; d_e5 : s32 = 4; + multi_param := closure((a: i32, b: i32, c: i32, d: i32) -> i32 => a + b + c + d); + a_e5 : i32 = 1; b_e5 : i32 = 2; c_e5 : i32 = 3; d_e5 : i32 = 4; print("closure-4param: {}\n", multi_param(a_e5, b_e5, c_e5, d_e5)); // C5.E7: two closures sharing the same captured pointer - shared : s32 = 0; + shared : i32 = 0; shared_p := @shared; inc_shared := closure(() { shared_p.* += 1; }); add5_shared := closure(() { shared_p.* += 5; }); @@ -1068,21 +1068,21 @@ main :: () { print("closure-f64: {}\n", a_e8 > 314.0); // C5.E9: zero-capture closure (env should be null, like auto-promoted) - no_cap := closure((x: s32) -> s32 => x * x); + no_cap := closure((x: i32) -> i32 => x * x); print("closure-zerocap: {} {}\n", no_cap(7), no_cap.env == null); // C5.E10: closure capturing and calling struct method pt_e10 := Point.{ x = 3, y = 4 }; p_e10 := @pt_e10; - get_xy := closure(() -> s32 => p_e10.x + p_e10.y); + get_xy := closure(() -> i32 => p_e10.x + p_e10.y); print("closure-struct-method: {}\n", get_xy()); // C5.E11: multiple closures from same factory with different captures - fns_e11 : [3]Closure(s32) -> s32 = ---; + fns_e11 : [3]Closure(i32) -> i32 = ---; i_e11 := 0; while i_e11 < 3 { - multiplier : s32 = xx (i_e11 + 1); - fns_e11[i_e11] = closure((x: s32) -> s32 => x * multiplier); + multiplier : i32 = xx (i_e11 + 1); + fns_e11[i_e11] = closure((x: i32) -> i32 => x * multiplier); i_e11 += 1; } t_e11 := fns_e11[0]; print("closure-multi-factory: {}\n", t_e11(10)); @@ -1091,18 +1091,18 @@ main :: () { // C5.E12: closure capturing bool flag_e12 := true; - check_fn := closure((x: s32) -> bool { + check_fn := closure((x: i32) -> bool { if flag_e12 { return x > 0; } return x < 0; }); - pos_e12 : s32 = 5; - neg_e12 : s32 = xx -3; + pos_e12 : i32 = 5; + neg_e12 : i32 = xx -3; print("closure-bool-cap: {} {}\n", check_fn(pos_e12), check_fn(neg_e12)); // C5.E13: closure as argument to another closure - apply_fn := closure((f_app: Closure(s32) -> s32, val: s32) -> s32 => f_app(val)); - k_e13 : s32 = 100; - inner_fn := closure((x: s32) -> s32 => x + k_e13); + apply_fn := closure((f_app: Closure(i32) -> i32, val: i32) -> i32 => f_app(val)); + k_e13 : i32 = 100; + inner_fn := closure((x: i32) -> i32 => x + k_e13); print("closure-as-arg: {}\n", apply_fn(inner_fn, 42)); // C5.E14: closure capturing string and formatting @@ -1111,33 +1111,33 @@ main :: () { print("closure-strfmt: {}\n", greet_fn("world")); // C5.E15: reassigning shared pointer target between closure calls - val_e15 : s32 = 10; + val_e15 : i32 = 10; p_e15 := @val_e15; - read_fn := closure(() -> s32 => p_e15.*); + read_fn := closure(() -> i32 => p_e15.*); print("closure-ptr-before: {}\n", read_fn()); val_e15 = 42; print("closure-ptr-after: {}\n", read_fn()); // C5.E16: closure returning negative value - off_e16 : s32 = 100; - neg_fn := closure((x: s32) -> s32 => x - off_e16); - val_e16 : s32 = 30; + off_e16 : i32 = 100; + neg_fn := closure((x: i32) -> i32 => x - off_e16); + val_e16 : i32 = 30; print("closure-neg: {}\n", neg_fn(val_e16)); // C5.E17: closure with protocol value capture (#inline protocol) gpa_e17 := GPA.init(); a_e17 : Allocator = xx gpa_e17; - alloc_fn := closure((size: s64) -> *void => a_e17.alloc_bytes(size)); + alloc_fn := closure((size: i64) -> *void => a_e17.alloc_bytes(size)); ptr_e17 := alloc_fn(32); print("closure-proto-cap: {}\n", ptr_e17 != null); a_e17.dealloc_bytes(ptr_e17); // C5.E18: chained factory — compose two factories - make_scaler :: (factor: s32) -> Closure(s32) -> s32 { - return closure((x: s32) -> s32 => x * factor); + make_scaler :: (factor: i32) -> Closure(i32) -> i32 { + return closure((x: i32) -> i32 => x * factor); } - make_offset :: (off: s32) -> Closure(s32) -> s32 { - return closure((x: s32) -> s32 => x + off); + make_offset :: (off: i32) -> Closure(i32) -> i32 { + return closure((x: i32) -> i32 => x + off); } s_fn := make_scaler(3); o_fn := make_offset(7); @@ -1145,11 +1145,11 @@ main :: () { print("closure-chain-factory: {}\n", o_fn(s_fn(10))); // C5.E19: closure in while loop condition helper - threshold : s32 = 50; - above_fn := closure((x: s32) -> bool => x >= threshold); - vals_e19 : [5]s32 = .[10, 30, 50, 70, 90]; - count_above : s32 = 0; - idx_e19 : s64 = 0; + threshold : i32 = 50; + above_fn := closure((x: i32) -> bool => x >= threshold); + vals_e19 : [5]i32 = .[10, 30, 50, 70, 90]; + count_above : i32 = 0; + idx_e19 : i64 = 0; while idx_e19 < 5 { if above_fn(vals_e19[idx_e19]) { count_above += 1; } idx_e19 += 1; @@ -1159,43 +1159,43 @@ main :: () { // ---- Inferred closure parameter types ---- // CI.1: inferred params from typed variable - f_ci1 : Closure(s32, s32) -> s32 = closure((a, b) => a + b); - a_ci1 : s32 = 3; - b_ci1 : s32 = 4; + f_ci1 : Closure(i32, i32) -> i32 = closure((a, b) => a + b); + a_ci1 : i32 = 3; + b_ci1 : i32 = 4; print("closure-infer: {}\n", f_ci1(a_ci1, b_ci1)); // CI.2: inferred params from function argument - apply_ci :: (f: Closure(s32) -> s32, x: s32) -> s32 { return f(x); } - k_ci : s32 = 10; - v_ci : s32 = 5; + apply_ci :: (f: Closure(i32) -> i32, x: i32) -> i32 { return f(x); } + k_ci : i32 = 10; + v_ci : i32 = 5; print("closure-infer-arg: {}\n", apply_ci(closure((x) => x + k_ci), v_ci)); // CI.3: inferred with block body - h_ci : Closure(s32, s32) -> s32 = closure((a, b) { return a * b; }); + h_ci : Closure(i32, i32) -> i32 = closure((a, b) { return a * b; }); print("closure-infer-block: {}\n", h_ci(a_ci1, b_ci1)); // CI.4: inferred with captures - cap_ci : s32 = 100; - f_ci4 : Closure(s32) -> s32 = closure((x) => x + cap_ci); + cap_ci : i32 = 100; + f_ci4 : Closure(i32) -> i32 = closure((x) => x + cap_ci); print("closure-infer-cap: {}\n", f_ci4(v_ci)); // CI.5: inferred in factory return - mk_ci :: (n: s32) -> Closure(s32) -> s32 { return closure((x) => x * n); } + mk_ci :: (n: i32) -> Closure(i32) -> i32 { return closure((x) => x * n); } f_ci5 := mk_ci(7); print("closure-infer-factory: {}\n", f_ci5(v_ci)); // CI.6: inferred with higher-order (closure taking closure) - compose_ci :: (f: Closure(s32) -> s32, g: Closure(s32) -> s32) -> Closure(s32) -> s32 { - return closure((x: s32) -> s32 => f(g(x))); + compose_ci :: (f: Closure(i32) -> i32, g: Closure(i32) -> i32) -> Closure(i32) -> i32 { + return closure((x: i32) -> i32 => f(g(x))); } - one_ci : s32 = 1; - two_ci : s32 = 2; + one_ci : i32 = 1; + two_ci : i32 = 2; c_ci := compose_ci(closure((x) => x + one_ci), closure((x) => x * two_ci)); print("closure-infer-compose: {}\n", c_ci(v_ci)); // CI.7: inferred void return msg_ci := "infer-void"; - cb_ci : Closure(s32) -> void = closure((x) { print("closure-{}: {}\n", msg_ci, x); }); + cb_ci : Closure(i32) -> void = closure((x) { print("closure-{}: {}\n", msg_ci, x); }); cb_ci(42); } } diff --git a/examples/0131-types-init-blocks.sx b/examples/0131-types-init-blocks.sx index f98ce75..a0f2bce 100644 --- a/examples/0131-types-init-blocks.sx +++ b/examples/0131-types-init-blocks.sx @@ -4,28 +4,28 @@ #import "modules/std/test.sx"; pkg :: #import "tests/fixtures/testpkg"; -Point :: struct { x, y: s32; } +Point :: struct { x, y: i32; } -add :: (a: s32, b: s32) -> s32 { a + b } +add :: (a: i32, b: i32) -> i32 { a + b } Counter :: protocol { inc :: (); - get :: () -> s32; + get :: () -> i32; } Summable :: protocol { - sum :: () -> s32; + sum :: () -> i32; } -SimpleCounter :: struct { val: s32; } +SimpleCounter :: struct { val: i32; } impl Counter for SimpleCounter { inc :: (self: *SimpleCounter) { self.val += 1; } - get :: (self: *SimpleCounter) -> s32 { self.val } + get :: (self: *SimpleCounter) -> i32 { self.val } } impl Summable for Point { - sum :: (self: *Point) -> s32 { self.x + self.y } + sum :: (self: *Point) -> i32 { self.x + self.y } } // Phase 2: #inline protocol for dynamic dispatch @@ -37,7 +37,7 @@ Pair :: struct ($T: Type) { } impl Summable for Pair($T) { - sum :: (self: *Pair(T)) -> s32 { + sum :: (self: *Pair(T)) -> i32 { xx self.a + xx self.b } } @@ -46,10 +46,10 @@ impl Summable for Pair($T) { // Init block test struct Builder :: struct { - total: s32; - count: s32; + total: i32; + count: i32; - add :: (self: *Builder, val: s32) { + add :: (self: *Builder, val: i32) { self.total += val; self.count += 1; } @@ -104,7 +104,7 @@ main :: () { // IB5: init block + auto type erasure combined { - use_counter :: (c: Counter) -> s32 { c.inc(); c.inc(); c.get() } + use_counter :: (c: Counter) -> i32 { c.inc(); c.inc(); c.get() } result := use_counter(SimpleCounter.{ val = 0 } { self.val = 50; }); @@ -138,10 +138,10 @@ main :: () { // SM2: Shorthand in variable declaration with explicit type { Pair :: struct { - a: s64; - b: s64; + a: i64; + b: i64; - make :: (a: s64, b: s64) -> Pair { + make :: (a: i64, b: i64) -> Pair { Pair.{ a = a, b = b } } } @@ -188,13 +188,13 @@ main :: () { c : usize = a + 8; print("usize+8: {}\n", c); - // coercion from s32 - x : s32 = 10; + // coercion from i32 + x : i32 = 10; y : usize = xx x; - print("s32->usize: {}\n", y); + print("i32->usize: {}\n", y); - // coercion to s64 - z : s64 = xx a; - print("usize->s64: {}\n", z); + // coercion to i64 + z : i64 = xx a; + print("usize->i64: {}\n", z); } } diff --git a/examples/0132-types-forward-type-alias.sx b/examples/0132-types-forward-type-alias.sx index 8f17709..148a2df 100644 --- a/examples/0132-types-forward-type-alias.sx +++ b/examples/0132-types-forward-type-alias.sx @@ -1,6 +1,6 @@ // Forward identifier type alias — an alias whose target is declared LATER // in the file resolves the same as an ordered one. `MyChain :: MyInt;` -// appears before `MyInt :: s32;`, yet `MyChain` resolves to `s32` and a +// appears before `MyInt :: i32;`, yet `MyChain` resolves to `i32` and a // forward chain (`A :: B; B :: C; C :: u8;`) converges too. // Regression (issue 0069): the scan only registered identifier aliases whose // target was already known, so a forward alias was falsely flagged @@ -8,17 +8,17 @@ #import "modules/std.sx"; MyChain :: MyInt; -MyInt :: s32; +MyInt :: i32; A :: B; B :: C; C :: u8; -main :: () -> s32 { +main :: () -> i32 { v: MyChain = 7; n: A = 3; - print("chain s32: {}\n", size_of(MyChain)); + print("chain i32: {}\n", size_of(MyChain)); print("forward u8: {}\n", size_of(A)); - print("v + n: {}\n", v + cast(s32) n); + print("v + n: {}\n", v + cast(i32) n); return v; } diff --git a/examples/0133-types-forward-alias-global.sx b/examples/0133-types-forward-alias-global.sx index 572cb88..be70219 100644 --- a/examples/0133-types-forward-alias-global.sx +++ b/examples/0133-types-forward-alias-global.sx @@ -1,6 +1,6 @@ // Forward identifier type alias as a TOP-LEVEL annotation — a global var // and a typed module constant whose annotation is a forward alias -// (`A :: B; B :: s32;`) resolve to the alias target, the same as the +// (`A :: B; B :: i32;`) resolve to the alias target, the same as the // ordered form, instead of a fabricated stub. // Regression (issue 0070): top-level global / typed-const annotations were // resolved inside the scan loop BEFORE the forward-alias fixpoint ran, so @@ -10,12 +10,12 @@ #import "modules/std.sx"; A :: B; -B :: s32; +B :: i32; g : A = 7; K : A : 35; -main :: () -> s32 { +main :: () -> i32 { print("global g: {}\n", g); print("const K: {}\n", K); return g + K; diff --git a/examples/0134-types-global-init-from-module-const.sx b/examples/0134-types-global-init-from-module-const.sx index 9a542ef..7daa1a6 100644 --- a/examples/0134-types-global-init-from-module-const.sx +++ b/examples/0134-types-global-init-from-module-const.sx @@ -1,18 +1,18 @@ // Top-level global initialized from a module constant copies the constant's // value (not a silent zero). `K : A : 42; g : A = K;` resolves the forward -// alias `A` to `s32` and materializes `g`'s static initializer from `K`. +// alias `A` to `i32` and materializes `g`'s static initializer from `K`. // Regression (issue 0071): `registerTopLevelGlobal`'s init_val switch only // handled literals/array/struct literals; an identifier initializer fell // through to a null payload and the global silently zero-initialized. #import "modules/std.sx"; A :: B; -B :: s32; +B :: i32; K : A : 42; g : A = K; -main :: () -> s32 { +main :: () -> i32 { print("g={}\n", g); return g; } diff --git a/examples/0135-types-self-streaming-nonreserved.sx b/examples/0135-types-self-streaming-nonreserved.sx index 9c7dafd..026bfb1 100644 --- a/examples/0135-types-self-streaming-nonreserved.sx +++ b/examples/0135-types-self-streaming-nonreserved.sx @@ -7,14 +7,14 @@ // type-named identifiers). #import "modules/std.sx"; -Hasher :: struct { total: s64 = 0; count: s64 = 0; } +Hasher :: struct { total: i64 = 0; count: i64 = 0; } -update :: ufcs (self: *Hasher, n: s64) { +update :: ufcs (self: *Hasher, n: i64) { self.total += n; self.count += 1; } -main :: () -> s32 { +main :: () -> i32 { hasher := Hasher.{ total = 0, count = 0 }; update(@hasher, 10); // explicit address-of receiver hasher.update(20); // autoref receiver diff --git a/examples/0136-types-global-array-element-store.sx b/examples/0136-types-global-array-element-store.sx index 1f41eb7..c1718de 100644 --- a/examples/0136-types-global-array-element-store.sx +++ b/examples/0136-types-global-array-element-store.sx @@ -9,14 +9,14 @@ #import "modules/std.sx"; -g : [3]s64 = .[10, 20, 30]; +g : [3]i64 = .[10, 20, 30]; -Pair :: struct { a: s64; b: s64; } +Pair :: struct { a: i64; b: i64; } gp : [2]Pair = .[ .{ a = 1, b = 2 }, .{ a = 3, b = 4 } ]; -grid : [2][3]s64 = .[ .[0, 0, 0], .[0, 0, 0] ]; +grid : [2][3]i64 = .[ .[0, 0, 0], .[0, 0, 0] ]; -write_global :: (i: s64, v: s64) { g[i] = v; } +write_global :: (i: i64, v: i64) { g[i] = v; } main :: () { // Scalar global array — const index. @@ -39,7 +39,7 @@ main :: () { print("gp[0]={},{}\n", gp[0].a, gp[0].b); // 10,20 print("gp[j]={},{}\n", gp[j].a, gp[j].b); // 30,40 - // Nested-array global — element is [3]s64, recursive indexed lvalue. + // Nested-array global — element is [3]i64, recursive indexed lvalue. grid[1][2] = 7; r := 0; grid[r][0] = 5; diff --git a/examples/0137-types-global-aggregate-literal-init.sx b/examples/0137-types-global-aggregate-literal-init.sx index 8987220..42b8026 100644 --- a/examples/0137-types-global-aggregate-literal-init.sx +++ b/examples/0137-types-global-aggregate-literal-init.sx @@ -11,8 +11,8 @@ #import "modules/std.sx"; -Pair :: struct { a: s64; b: s64; } -WithArr :: struct { id: s64; xs: [3]s64; } +Pair :: struct { a: i64; b: i64; } +WithArr :: struct { id: i64; xs: [3]i64; } // global array of struct literals pairs : [2]Pair = .[ .{ a = 1, b = 2 }, .{ a = 3, b = 4 } ]; diff --git a/examples/0138-types-global-aggregate-null-pointer-field.sx b/examples/0138-types-global-aggregate-null-pointer-field.sx index a292e57..d0f21c2 100644 --- a/examples/0138-types-global-aggregate-null-pointer-field.sx +++ b/examples/0138-types-global-aggregate-null-pointer-field.sx @@ -7,19 +7,19 @@ // `.null_literal` arm, so a `null` in a pointer field made the whole aggregate // look non-constant and the global was rejected with "must be initialized by a // compile-time constant". The fix serializes a null literal to a constant zero -// pointer (the same way a top-level pointer global `p : *s64 = null;` does) +// pointer (the same way a top-level pointer global `p : *i64 = null;` does) // while still rejecting genuinely non-constant fields (see diagnostics 1126). #import "modules/std.sx"; -Box :: struct { p: *s64; marker: s64; } -Inner :: struct { q: *s64; tag: s64; } -Outer :: struct { inner: Inner; label: s64; } +Box :: struct { p: *i64; marker: i64; } +Inner :: struct { q: *i64; tag: i64; } +Outer :: struct { inner: Inner; label: i64; } // array-of-struct with null pointer fields + scalar neighbors boxes : [2]Box = .[ .{ p = null, marker = 11 }, .{ p = null, marker = 22 } ]; // global array of all-null pointers -ptrs : [3]*s64 = .[ null, null, null ]; +ptrs : [3]*i64 = .[ null, null, null ]; // nested: struct containing a struct with a null pointer field nested : [2]Outer = .[ .{ inner = .{ q = null, tag = 1 }, label = 100 }, diff --git a/examples/0139-types-global-enum-literal-init.sx b/examples/0139-types-global-enum-literal-init.sx index 98cd432..0883a2e 100644 --- a/examples/0139-types-global-enum-literal-init.sx +++ b/examples/0139-types-global-enum-literal-init.sx @@ -19,7 +19,7 @@ Color :: enum u8 { red; green; blue; } Code :: enum u16 { ok :: 200; not_found :: 404; teapot :: 418; } Pair :: struct { a: Color; b: Color; } -Row :: struct { status: Code; pad: s64; } +Row :: struct { status: Code; pad: i64; } // scalar enum global chosen : Color = .green; diff --git a/examples/0140-types-named-const-array-dim.sx b/examples/0140-types-named-const-array-dim.sx index caf79d0..29b7f99 100644 --- a/examples/0140-types-named-const-array-dim.sx +++ b/examples/0140-types-named-const-array-dim.sx @@ -15,18 +15,18 @@ N :: 4; M :: 3; -P :: struct { x: s64; y: s64; } +P :: struct { x: i64; y: i64; } // Type aliases whose dimension is the named const N (stateless registration). -Arr :: [N]s64; +Arr :: [N]i64; SArr :: [N]string; // Inline union field with a named-const dimension (stateless registration). -U :: union { a: [N]s64; tag: s64; } +U :: union { a: [N]i64; tag: i64; } main :: () { // Scalar elements (direct local): store then read back. - a : [N]s64 = ---; + a : [N]i64 = ---; a[0] = 7; a[3] = 42; print("scalar a0={} a3={}\n", a[0], a[3]); @@ -35,7 +35,7 @@ main :: () { s : [N]string = ---; s[0] = "hi"; s[1] = "yo"; - print("string s0={} s1={}\n", s[0], s[1]); + print("string i0={} i1={}\n", s[0], s[1]); // Struct elements (direct local). ps : [N]P = ---; @@ -43,7 +43,7 @@ main :: () { ps[2] = P.{ x = 5, y = 6 }; print("struct p0x={} p0y={} p2x={}\n", ps[0].x, ps[0].y, ps[2].x); - // Type-alias dimension (scalar): same layout as the direct `[N]s64`. + // Type-alias dimension (scalar): same layout as the direct `[N]i64`. aa : Arr = ---; aa[0] = 11; aa[3] = 99; @@ -53,10 +53,10 @@ main :: () { sa : SArr = ---; sa[0] = "al"; sa[2] = "ok"; - print("alias s0={} s2={}\n", sa[0], sa[2]); + print("alias i0={} i2={}\n", sa[0], sa[2]); - // Nested fixed array `[N][M]s64`: both dimensions are named consts. - grid : [N][M]s64 = ---; + // Nested fixed array `[N][M]i64`: both dimensions are named consts. + grid : [N][M]i64 = ---; grid[0][0] = 1; grid[3][2] = 8; print("nested g00={} g32={}\n", grid[0][0], grid[3][2]); diff --git a/examples/0141-types-slice-literal-direct-call-arg.sx b/examples/0141-types-slice-literal-direct-call-arg.sx index 8351d6b..eaa9dce 100644 --- a/examples/0141-types-slice-literal-direct-call-arg.sx +++ b/examples/0141-types-slice-literal-direct-call-arg.sx @@ -7,14 +7,14 @@ // bytes and returned garbage (0). #import "modules/std.sx"; -count_nope :: (xs: []string) -> s64 { +count_nope :: (xs: []string) -> i64 { n := 0; i := 0; while i < xs.len { if xs[i] == "nope" { n += 1; } i += 1; } return n; } -sum :: (xs: []s64) -> s64 { +sum :: (xs: []i64) -> i64 { s := 0; i := 0; while i < xs.len { s += xs[i]; i += 1; } @@ -29,6 +29,6 @@ main :: () { // numeric slice: direct literal vs local-bound — both sum to 100. print("num direct={}\n", sum(.[10, 20, 30, 40])); - nums : []s64 = .[10, 20, 30, 40]; + nums : []i64 = .[10, 20, 30, 40]; print("num local={}\n", sum(nums)); } diff --git a/examples/0142-types-nested-slice-literal-elements.sx b/examples/0142-types-nested-slice-literal-elements.sx index 7a1e088..a21bece 100644 --- a/examples/0142-types-nested-slice-literal-elements.sx +++ b/examples/0142-types-nested-slice-literal-elements.sx @@ -1,5 +1,5 @@ // A nested array/slice literal (`.[.[1, 2], .[3, 4]]`) at an expected slice-of- -// slices type (`[][]s64`) materializes each inner `[N]T` literal as a real `[]T` +// slices type (`[][]i64`) materializes each inner `[N]T` literal as a real `[]T` // slice, so indexing the inner slice in the callee reads element contents // correctly — for both the local-bound form and the direct-call-argument form. // Regression (issue 0085): inner literals were appended as raw `[N]T` arrays @@ -9,7 +9,7 @@ // recurses with the nesting, so every level coerces. #import "modules/std.sx"; -sum_nested :: (xss: [][]s64) -> s64 { +sum_nested :: (xss: [][]i64) -> i64 { total := 0; i := 0; while i < xss.len { @@ -20,7 +20,7 @@ sum_nested :: (xss: [][]s64) -> s64 { return total; } -count_x :: (xss: [][]string) -> s64 { +count_x :: (xss: [][]string) -> i64 { n := 0; i := 0; while i < xss.len { @@ -32,8 +32,8 @@ count_x :: (xss: [][]string) -> s64 { } main :: () { - // numeric [][]s64 — local-bound vs direct-arg both sum to 10. - local : [][]s64 = .[.[1, 2], .[3, 4]]; + // numeric [][]i64 — local-bound vs direct-arg both sum to 10. + local : [][]i64 = .[.[1, 2], .[3, 4]]; print("num local={}\n", sum_nested(local)); print("num direct={}\n", sum_nested(.[.[1, 2], .[3, 4]])); diff --git a/examples/0143-types-typed-const-array-dim.sx b/examples/0143-types-typed-const-array-dim.sx index b29831d..b114c15 100644 --- a/examples/0143-types-typed-const-array-dim.sx +++ b/examples/0143-types-typed-const-array-dim.sx @@ -1,5 +1,5 @@ // A named-const array dimension lays out identically whether the const is -// TYPED (`N : s64 : 16`) or untyped (`N :: 16`), used DIRECTLY (`a : [N]T`) or +// TYPED (`N : i64 : 16`) or untyped (`N :: 16`), used DIRECTLY (`a : [N]T`) or // through a type alias (`Arr :: [N]T`), and regardless of whether the const is // declared before or after the alias that consumes it. // @@ -13,22 +13,22 @@ // stateful and stateless paths share one dimension resolver. #import "modules/std.sx"; -NT : s64 : 8; // typed const used as a dimension +NT : i64 : 8; // typed const used as a dimension -P :: struct { x: s64; y: s64; } +P :: struct { x: i64; y: i64; } // Type aliases whose dimension is the TYPED const NT (stateless registration). -TArr :: [NT]s64; +TArr :: [NT]i64; TSArr :: [NT]string; TPArr :: [NT]P; // Forward reference: this alias is declared BEFORE its dimension const NF. -FArr :: [NF]s64; +FArr :: [NF]i64; NF :: 5; main :: () { // Typed-const dimension, DIRECT local decl. - d : [NT]s64 = ---; + d : [NT]i64 = ---; d[0] = 3; d[7] = 21; print("direct d0={} d7={} len={}\n", d[0], d[7], d.len); @@ -43,7 +43,7 @@ main :: () { s : TSArr = ---; s[0] = "hi"; s[7] = "yo"; - print("alias s0={} s7={}\n", s[0], s[7]); + print("alias i0={} i7={}\n", s[0], s[7]); // Typed-const dimension via ALIAS (struct elements). ps : TPArr = ---; @@ -52,7 +52,7 @@ main :: () { print("alias p0x={} p0y={} p7x={}\n", ps[0].x, ps[0].y, ps[7].x); // Nested fixed array whose both dimensions are the typed const NT. - grid : [NT][NT]s64 = ---; + grid : [NT][NT]i64 = ---; grid[0][0] = 1; grid[7][7] = 10; print("nested g00={} g77={}\n", grid[0][0], grid[7][7]); diff --git a/examples/0144-types-const-expr-array-dim.sx b/examples/0144-types-const-expr-array-dim.sx index 3551300..403de68 100644 --- a/examples/0144-types-const-expr-array-dim.sx +++ b/examples/0144-types-const-expr-array-dim.sx @@ -16,50 +16,50 @@ M :: 4; N :: 6; -TK : s64 : 2; // typed const, used inside an expression dimension +TK : i64 : 2; // typed const, used inside an expression dimension -P :: struct { x: s64; y: s64; } +P :: struct { x: i64; y: i64; } -AddAlias :: [M + 1]s64; // 5 -MulAlias :: [M * N]s64; // 24 -SubAlias :: [N - M]s64; // 2 -NestAlias :: [M + N - 1]s64; // 9 -ParenAlias :: [(M + 1) * 2]s64; // 10 -TypedAlias :: [M + TK]s64; // 6 +AddAlias :: [M + 1]i64; // 5 +MulAlias :: [M * N]i64; // 24 +SubAlias :: [N - M]i64; // 2 +NestAlias :: [M + N - 1]i64; // 9 +ParenAlias :: [(M + 1) * 2]i64; // 10 +TypedAlias :: [M + TK]i64; // 6 StrAlias :: [M + 1]string; // 5, slice/pointer elements StructAlias :: [M + 1]P; // 5, struct elements main :: () { // const + literal: direct and via alias resolve to the same length. - add_d : [M + 1]s64 = ---; + add_d : [M + 1]i64 = ---; add_a : AddAlias = ---; add_d[4] = 7; add_a[4] = 7; print("add direct.len={} alias.len={} d4={} a4={}\n", add_d.len, add_a.len, add_d[4], add_a[4]); // const * const. - mul_d : [M * N]s64 = ---; + mul_d : [M * N]i64 = ---; mul_a : MulAlias = ---; mul_d[23] = 230; mul_a[23] = 230; print("mul direct.len={} alias.len={} d23={} a23={}\n", mul_d.len, mul_a.len, mul_d[23], mul_a[23]); // const - const. - sub_d : [N - M]s64 = ---; + sub_d : [N - M]i64 = ---; sub_a : SubAlias = ---; sub_d[1] = 9; sub_a[1] = 9; print("sub direct.len={} alias.len={} d1={} a1={}\n", sub_d.len, sub_a.len, sub_d[1], sub_a[1]); // nested and parenthesised forms (direct vs alias). - nest_d : [M + N - 1]s64 = ---; + nest_d : [M + N - 1]i64 = ---; nest_a : NestAlias = ---; - paren_d : [(M + 1) * 2]s64 = ---; + paren_d : [(M + 1) * 2]i64 = ---; paren_a : ParenAlias = ---; print("nest direct.len={} alias.len={} paren direct.len={} alias.len={}\n", nest_d.len, nest_a.len, paren_d.len, paren_a.len); // typed const inside the expression dimension. - typ_d : [M + TK]s64 = ---; + typ_d : [M + TK]i64 = ---; typ_a : TypedAlias = ---; print("typed direct.len={} alias.len={}\n", typ_d.len, typ_a.len); @@ -67,7 +67,7 @@ main :: () { str_a : StrAlias = ---; str_a[0] = "hi"; str_a[4] = "yo"; - print("str alias.len={} s0={} s4={}\n", str_a.len, str_a[0], str_a[4]); + print("str alias.len={} i0={} i4={}\n", str_a.len, str_a[0], str_a[4]); // struct elements. ps : StructAlias = ---; diff --git a/examples/0145-types-integral-float-array-dim.sx b/examples/0145-types-integral-float-array-dim.sx index cb385c1..c3b6074 100644 --- a/examples/0145-types-integral-float-array-dim.sx +++ b/examples/0145-types-integral-float-array-dim.sx @@ -1,8 +1,8 @@ // An array dimension accepts any compile-time numeric constant whose value is a // positive INTEGRAL number — an integral float (`4.0`) folds to its integer just // like `4`. A float-typed const (`N : f64 : 4.0`), an untyped-float const -// (`M :: 4.0`), and a direct float literal (`[4.0]s64`) all lay out the same -// `[4]s64` as the integer spelling, so element store/read is in bounds. +// (`M :: 4.0`), and a direct float literal (`[4.0]i64`) all lay out the same +// `[4]i64` as the integer spelling, so element store/read is in bounds. // // Regression (issue 0083 / F0.4 attempt 8, Agra ruling): an integral float used // as a dimension was wrongly rejected "must be a compile-time integer constant". @@ -15,15 +15,15 @@ N : f64 : 4.0; // float-typed const M :: 4.0; // untyped float const main :: () { - a : [N]s64 = ---; // dim from a float-typed const + a : [N]i64 = ---; // dim from a float-typed const a[0] = 10; a[3] = 40; print("a len={} a0={} a3={}\n", a.len, a[0], a[3]); - b : [M]s64 = ---; // dim from an untyped float const + b : [M]i64 = ---; // dim from an untyped float const b[1] = 21; print("b len={} b1={}\n", b.len, b[1]); - c : [4.0]s64 = ---; // direct integral-float-literal dim + c : [4.0]i64 = ---; // direct integral-float-literal dim c[2] = 32; print("c len={} c2={}\n", c.len, c[2]); } diff --git a/examples/0146-types-comptime-count-matrix.sx b/examples/0146-types-comptime-count-matrix.sx index a0fc208..e86b7c4 100644 --- a/examples/0146-types-comptime-count-matrix.sx +++ b/examples/0146-types-comptime-count-matrix.sx @@ -4,9 +4,9 @@ // SAME leaf forms to the SAME value through one shared evaluator // (`program_index.evalConstIntExpr` / `moduleConstInt`). The leaf forms // exercised here: untyped int const (`M`), a named const with an EXPRESSION RHS -// (`N :: M + 1`), a typed-int const (`S : s64 : 5`), an integral float const +// (`N :: M + 1`), a typed-int const (`S : i64 : 5`), an integral float const // (`F :: 4.0` ≡ 4), and an ALIASED integer constraint (`Count :: u32`, -// `Small :: s8`) on a value-param. +// `Small :: i8`) on a value-param. // // Regression (issue 0083): two cells of this surface diverged from the rest. // (1) A named const whose RHS is an expression (`N :: M + 1`) did not fold as a @@ -20,27 +20,27 @@ M :: 2; // untyped int const N :: M + 1; // named const, EXPRESSION RHS (== 3) -S : s64 : 5; // typed-int const +S : i64 : 5; // typed-int const KU : u32 : 3; // typed-u32 const F :: 4.0; // integral float const (== 4) Count :: u32; // integer ALIAS — value-param constraint -Small :: s8; // integer ALIAS — value-param constraint +Small :: i8; // integer ALIAS — value-param constraint -ArrN :: [N]s64; // array dim via alias: expression const (3) -ArrF :: [F]s64; // array dim via alias: integral float (4) -ArrS :: [S]s64; // array dim via alias: typed const (5) +ArrN :: [N]i64; // array dim via alias: expression const (3) +ArrF :: [F]i64; // array dim via alias: integral float (4) +ArrS :: [S]i64; // array dim via alias: typed const (5) Buf :: struct ($K: u32, $T: Type) { data: [K]T; } BufC :: struct ($K: Count, $T: Type) { data: [K]T; } // ALIASED u32 constraint -BufS :: struct ($K: Small, $T: Type) { data: [K]T; } // ALIASED s8 constraint +BufS :: struct ($K: Small, $T: Type) { data: [K]T; } // ALIASED i8 constraint Make :: ($K: u32, $T: Type) -> Type { return [K]T; } // type-fn value-param main :: () { // array dimension — DIRECT - a : [N]s64 = ---; a[0] = 7; a[2] = 9; + a : [N]i64 = ---; a[0] = 7; a[2] = 9; print("dim.direct.expr: len={} a0={} a2={}\n", a.len, a[0], a[2]); - f : [F]s64 = ---; f[3] = 40; + f : [F]i64 = ---; f[3] = 40; print("dim.direct.float: len={} f3={}\n", f.len, f[3]); // array dimension — via type ALIAS @@ -54,13 +54,13 @@ main :: () { v4 : Vector(F, f32) = .[1.0, 2.0, 3.0, 4.0]; print("lane.float4: {}\n", v4.w); - // generic value-param — struct binder: expr const, aliased u32, aliased s8 - bn : Buf(N, s64) = ---; bn.data[2] = 30; print("vp.struct.expr: len={} v={}\n", bn.data.len, bn.data[2]); - bc : BufC(KU, s64) = ---; bc.data[2] = 31; print("vp.struct.alias.u32: len={} v={}\n", bc.data.len, bc.data[2]); - bs : BufS(4, s64) = ---; bs.data[3] = 32; print("vp.struct.alias.s8: len={} v={}\n", bs.data.len, bs.data[3]); + // generic value-param — struct binder: expr const, aliased u32, aliased i8 + bn : Buf(N, i64) = ---; bn.data[2] = 30; print("vp.struct.expr: len={} v={}\n", bn.data.len, bn.data[2]); + bc : BufC(KU, i64) = ---; bc.data[2] = 31; print("vp.struct.alias.u32: len={} v={}\n", bc.data.len, bc.data[2]); + bs : BufS(4, i64) = ---; bs.data[3] = 32; print("vp.struct.alias.i8: len={} v={}\n", bs.data.len, bs.data[3]); // generic value-param — type-fn binder: expr const - mk : Make(N, s64) = ---; mk[2] = 33; print("vp.typefn.expr: len={} v={}\n", mk.len, mk[2]); + mk : Make(N, i64) = ---; mk[2] = 33; print("vp.typefn.expr: len={} v={}\n", mk.len, mk[2]); // inline-for bound — expr const (3) and integral float (4) s := 0; inline for 0..N (i) { s += i; } print("for.expr: {}\n", s); // 0+1+2 = 3 diff --git a/examples/0147-types-zero-count-context.sx b/examples/0147-types-zero-count-context.sx index ea3ce77..f7a0323 100644 --- a/examples/0147-types-zero-count-context.sx +++ b/examples/0147-types-zero-count-context.sx @@ -8,10 +8,10 @@ // "positive integral", which wrongly implied `[0]T` / `Box(0)` are illegal. #import "modules/std.sx"; -Box :: struct($N: u32) { items: [N]s64; } +Box :: struct($N: u32) { items: [N]i64; } main :: () { - a : [0]s64 = ---; + a : [0]i64 = ---; print("array_dim={}\n", a.len); b : Box(0) = ---; diff --git a/examples/0148-types-int-numeric-limits.sx b/examples/0148-types-int-numeric-limits.sx index f623bb0..9e6ff93 100644 --- a/examples/0148-types-int-numeric-limits.sx +++ b/examples/0148-types-int-numeric-limits.sx @@ -5,61 +5,61 @@ // `usize`/`isize` (target-width). Usable in expressions and in array-dimension // position via the comptime-int path (`[u8.max]T`). // -// The extreme values that the s64-based integer formatter cannot render -// directly — `s64.min` (i64::MIN) and the all-ones `u64.max`/`usize.max` — are +// The extreme values that the i64-based integer formatter cannot render +// directly — `i64.min` (i64::MIN) and the all-ones `u64.max`/`usize.max` — are // asserted EXACTLY via comparison and untagged-union bit reinterpret, never via // the formatter (which prints i64::MIN as a bare "-" and u64.max as "-1"). #import "modules/std.sx"; // Untagged union for the exact u64.max bit-reinterpret check. -UU :: union { u: u64; s: s64; } +UU :: union { u: u64; s: i64; } -main :: () -> s32 { +main :: () -> i32 { // Sub-byte widths — arbitrary bit-width arithmetic, not a per-name table. - print("s1.min={} s1.max={}\n", s1.min, s1.max); // -1 0 - print("s2.min={} s2.max={}\n", s2.min, s2.max); // -2 1 - print("s3.max={}\n", s3.max); // 3 + print("i1.min={} i1.max={}\n", i1.min, i1.max); // -1 0 + print("i2.min={} i2.max={}\n", i2.min, i2.max); // -2 1 + print("i3.max={}\n", i3.max); // 3 print("u1.min={} u1.max={}\n", u1.min, u1.max); // 0 1 print("u2.max={}\n", u2.max); // 3 // Byte / word widths. - print("s8.min={} s8.max={}\n", s8.min, s8.max); // -128 127 + print("i8.min={} i8.max={}\n", i8.min, i8.max); // -128 127 print("u8.max={}\n", u8.max); // 255 - print("s32.min={} s32.max={}\n", s32.min, s32.max); // -2147483648 2147483647 + print("i32.min={} i32.max={}\n", i32.min, i32.max); // -2147483648 2147483647 - // s64 extremes: max prints; min (i64::MIN) is pinned by relation since the + // i64 extremes: max prints; min (i64::MIN) is pinned by relation since the // formatter cannot render it (this is independent of this feature). - print("s64.max={}\n", s64.max); // 9223372036854775807 - print("s64.min+1 == -(s64.max): {}\n", s64.min + 1 == -9223372036854775807); // true - print("s64.min + s64.max == -1: {}\n", s64.min + s64.max == -1); // true + print("i64.max={}\n", i64.max); // 9223372036854775807 + print("i64.min+1 == -(i64.max): {}\n", i64.min + 1 == -9223372036854775807); // true + print("i64.min + i64.max == -1: {}\n", i64.min + i64.max == -1); // true - // u64.max / usize.max = all-ones (18446744073709551615); reinterpret to s64 + // u64.max / usize.max = all-ones (18446744073709551615); reinterpret to i64 // to confirm the bit pattern is -1 (and NOT a mangled value). o : UU = ---; o.u = u64.max; - print("u64.max as s64 == -1: {}\n", o.s == -1); // true + print("u64.max as i64 == -1: {}\n", o.s == -1); // true o.u = usize.max; - print("usize.max as s64 == -1: {}\n", o.s == -1); // true (host = u64) + print("usize.max as i64 == -1: {}\n", o.s == -1); // true (host = u64) print("usize.max == u64.max: {}\n", usize.max == u64.max); // true - print("isize.min == s64.min: {}\n", isize.min == s64.min); // true (host = s64) + print("isize.min == i64.min: {}\n", isize.min == i64.min); // true (host = i64) // Result carries the QUERIED type: each binding is declared with the queried // type and round-trips, so a mistyped fold (e.g. boxed as Any / widened) // would not type-check here. - m3 : s3 = s3.max; + m3 : i3 = i3.max; mu : u8 = u8.max; - ms : s8 = s8.min; + ms : i8 = i8.min; print("typed: m3={} mu={} ms={}\n", m3, mu, ms); // 3 255 -128 - // Array-dimension / comptime-int path: `[u8.max]T` and `[s16.max]T` are + // Array-dimension / comptime-int path: `[u8.max]T` and `[i16.max]T` are // valid counts (255 and 32767), usable end-to-end. a : [u8.max]u8 = ---; a[254] = 7; print("[u8.max]u8 len={} a[254]={}\n", a.len, a[254]); // 255 7 - b : [s16.max]u8 = ---; + b : [i16.max]u8 = ---; b[32766] = 9; - print("[s16.max]u8 len={} b[32766]={}\n", b.len, b[32766]); // 32767 9 + print("[i16.max]u8 len={} b[32766]={}\n", b.len, b[32766]); // 32767 9 return 0; } diff --git a/examples/0149-types-int-numeric-limits-errors.sx b/examples/0149-types-int-numeric-limits-errors.sx index 522cf96..c797f2c 100644 --- a/examples/0149-types-int-numeric-limits-errors.sx +++ b/examples/0149-types-int-numeric-limits-errors.sx @@ -8,9 +8,9 @@ // Each case is accurate and located at the access; the program exits non-zero. #import "modules/std.sx"; -MyStruct :: struct { a: s64; } +MyStruct :: struct { a: i64; } -main :: () -> s32 { +main :: () -> i32 { b := bool.max; s := MyStruct.min; v := void.max; diff --git a/examples/0151-types-backtick-raw-identifier.sx b/examples/0151-types-backtick-raw-identifier.sx index 5338d22..98f2698 100644 --- a/examples/0151-types-backtick-raw-identifier.sx +++ b/examples/0151-types-backtick-raw-identifier.sx @@ -1,10 +1,10 @@ // 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 (`s2`, `u8`, …) +// 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* `s2` is still +// 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). @@ -14,22 +14,22 @@ `u8 := 100; // Function whose name is a reserved type spelling, with a reserved-name param. -`s2 :: (`s1: s64) -> s64 { return `s1 * 2; } +`i2 :: (`i1: i64) -> i64 { return `i1 * 2; } Point :: struct { - `s2: f64; // field name is a reserved type spelling - `u16: s64; + `i2: f64; // field name is a reserved type spelling + `u16: i64; } main :: () { // Local with a reserved type spelling; later reference resolves to it. - `s64 := 7; - `s64 = `s64 + 1; - print("local = {}\n", `s64); + `i64 := 7; + `i64 = `i64 + 1; + print("local = {}\n", `i64); print("global = {}\n", `u8); - print("fn = {}\n", `s2(21)); // calls the `s2 function + print("fn = {}\n", `i2(21)); // calls the `i2 function - p := Point.{ `s2 = 2.5, `u16 = 9 }; - print("field = {} {}\n", p.`s2, p.`u16); + p := Point.{ `i2 = 2.5, `u16 = 9 }; + print("field = {} {}\n", p.`i2, p.`u16); } diff --git a/examples/0152-types-backtick-control-flow.sx b/examples/0152-types-backtick-control-flow.sx index 89dd721..91ef9fd 100644 --- a/examples/0152-types-backtick-control-flow.sx +++ b/examples/0152-types-backtick-control-flow.sx @@ -1,5 +1,5 @@ // Backtick raw identifier across every control-flow / capture / binding form, -// plus bare later uses. A reserved type-name spelling (`s2`, `u8`, …) works as a +// plus bare later uses. A reserved type-name spelling (`i2`, `u8`, …) works as a // binding name in a destructure, an `if`/`while` optional binding, a `for` // capture + index, and a match-arm capture; a backtick-named function is // bare-callable; and a backtick struct field is bare- or backtick-accessible. @@ -10,37 +10,37 @@ // Regression (issue 0089 — attempt-2 completeness across binding forms). #import "modules/std.sx"; -pair :: () -> (s64, s64) { (1, 2) } -maybe :: () -> ?s64 { return 42; } +pair :: () -> (i64, i64) { (1, 2) } +maybe :: () -> ?i64 { return 42; } // Function named with a reserved spelling — bare-callable (no backtick at call). -`s2 :: (n: s64) -> s64 { return n + 1; } +`i2 :: (n: i64) -> i64 { return n + 1; } -Quad :: struct { `s1: s32; `s2: s32; } +Quad :: struct { `i1: i32; `i2: i32; } -main :: () -> s32 { +main :: () -> i32 { // destructure binding names `u8, rest := pair(); print("dstr = {} {}\n", `u8, rest); // if optional binding + bare-position reference inside the branch - if `s16 := maybe() { - print("if = {}\n", `s16); + if `i16 := maybe() { + print("if = {}\n", `i16); } // while optional binding (name only — the while binding isn't body-exposed) - while `s32 := maybe() { + while `i32 := maybe() { break; } // for capture + index names - xs := [3]s64.{ 10, 20, 30 }; + xs := [3]i64.{ 10, 20, 30 }; for xs, 0.. (`bool, `u16) { print("for = {} @ {}\n", `bool, `u16); } // match-arm capture - opt: ?s64 = 5; + opt: ?i64 = 5; m := if opt == { case .some: (`string) { `string * 2 } case .none: { 0 } @@ -48,10 +48,10 @@ main :: () -> s32 { print("match = {}\n", m); // backtick function called BARE and via backtick — both resolve to the fn - print("call = {} {}\n", s2(10), `s2(10)); + print("call = {} {}\n", i2(10), `i2(10)); // struct field named with a reserved spelling: bare + backtick member access - q := Quad.{ `s1 = 7, `s2 = 9 }; - print("field = {} {} | {} {}\n", q.s1, q.s2, q.`s1, q.`s2); + q := Quad.{ `i1 = 7, `i2 = 9 }; + print("field = {} {} | {} {}\n", q.i1, q.i2, q.`i1, q.`i2); return 0; } diff --git a/examples/0153-types-backtick-const-fn-decl.sx b/examples/0153-types-backtick-const-fn-decl.sx index 4b1c5ba..cdf002c 100644 --- a/examples/0153-types-backtick-const-fn-decl.sx +++ b/examples/0153-types-backtick-const-fn-decl.sx @@ -1,22 +1,22 @@ // Backtick raw-identifier escape at the `::` declaration sites: a leading // backtick makes a CONSTANT name and a FUNCTION name raw, so a reserved type -// spelling (`s2`, `u8`) can be declared and used. Complements examples/0151 +// spelling (`i2`, `u8`) can be declared and used. Complements examples/0151 // (var / param / field / global). The backtick fn is callable both via the // backtick (`` `u8(5) ``) and bare (`u8(5)`) — the bare reserved-name callee // resolves to the raw fn because its declaration is raw (issue 0089). A *bare* -// `s2 :: …` / `u8 :: …` declaration is still the reserved-name error (see +// `i2 :: …` / `u8 :: …` declaration is still the reserved-name error (see // examples/1140). // Regression (issue 0089). #import "modules/std.sx"; // Constant whose name is a reserved type spelling. -`s2 :: 2.5; +`i2 :: 2.5; // Function whose name is a reserved type spelling. -`u8 :: (n: s64) -> s64 { return n + 7; } +`u8 :: (n: i64) -> i64 { return n + 7; } -main :: () -> s32 { - print("const = {}\n", `s2); +main :: () -> i32 { + print("const = {}\n", `i2); print("fn tick = {}\n", `u8(5)); print("fn bare = {}\n", u8(5)); return 0; diff --git a/examples/0154-types-backtick-raw-type-reference.sx b/examples/0154-types-backtick-raw-type-reference.sx index 9935b45..746beab 100644 --- a/examples/0154-types-backtick-raw-type-reference.sx +++ b/examples/0154-types-backtick-raw-type-reference.sx @@ -1,8 +1,8 @@ // Backtick raw identifier in TYPE position (the universal model, issue 0089): // `` `name `` is the LITERAL identifier `name` used as a type reference, never -// the builtin/reserved spelling. A reserved type spelling (`s2`, `u8`, …) can +// the builtin/reserved spelling. A reserved type spelling (`i2`, `u8`, …) can // therefore both DECLARE a type (struct / enum / union / error-set / alias) and -// be REFERENCED as that type via the backtick — while a BARE `s2` in type +// be REFERENCED as that type via the backtick — while a BARE `i2` in type // position remains the signed-int type (see `add` below) and a bare reserved- // name declaration still errors (see examples/1141). The backtick is required // to declare or reference these names; it is never part of the name's text. @@ -10,18 +10,18 @@ #import "modules/std.sx"; // Type-introducing decls whose NAME is a reserved spelling. -`s2 :: struct { x: s64; } -`s8 :: enum { A; B; } -`u16 :: union { i: s32; f: f32; } +`i2 :: struct { x: i64; } +`i8 :: enum { A; B; } +`u16 :: union { i: i32; f: f32; } `u32 :: error { Bad, Empty } -RawAlias :: `s2; // alias to a backtick-declared struct +RawAlias :: `i2; // alias to a backtick-declared struct -// A bare `s2` in type position is still the 2-bit signed int. -add :: (a: s2, b: s2) -> s2 { return a + b; } +// A bare `i2` in type position is still the 2-bit signed int. +add :: (a: i2, b: i2) -> i2 { return a + b; } -main :: () -> s32 { +main :: () -> i32 { // Reference the backtick struct as a type; field access works. - v : `s2 = ---; + v : `i2 = ---; v.x = 7; // Reference via a normal alias too. @@ -29,7 +29,7 @@ main :: () -> s32 { a.x = 11; // Backtick enum / union type references. - e : `s8 = .A; + e : `i8 = .A; u : `u16 = ---; u.i = 5; @@ -37,6 +37,6 @@ main :: () -> s32 { print("alias = {}\n", a.x); print("enum = {}\n", e == .A); print("union = {}\n", u.i); - print("bare = {}\n", add(1, 0)); // bare s2 = the 2-bit int type + print("bare = {}\n", add(1, 0)); // bare i2 = the 2-bit int type return 0; } diff --git a/examples/0155-types-backtick-typed-const-union-tag.sx b/examples/0155-types-backtick-typed-const-union-tag.sx index 476e65e..15fffa7 100644 --- a/examples/0155-types-backtick-typed-const-union-tag.sx +++ b/examples/0155-types-backtick-typed-const-union-tag.sx @@ -1,24 +1,24 @@ // Backtick raw identifier at the two remaining binding positions (issue 0089, -// attempt-4): a TYPED constant (`` `s2 : s64 : 5 ``) and a union TAG / field -// (`` `s2: s32 ``). The typed-const form previously slipped past the decl check -// without a name span (caret at 1:1); a bare `s2 : s64 : 5` is still rejected +// attempt-4): a TYPED constant (`` `i2 : i64 : 5 ``) and a union TAG / field +// (`` `i2: i32 ``). The typed-const form previously slipped past the decl check +// without a name span (caret at 1:1); a bare `i2 : i64 : 5` is still rejected // with the caret ON the name (see examples/1141). A union tag spelled with a // reserved name works and is accessible bare or backticked. // Regression (issue 0089 — attempt-4 typed const + union tag). #import "modules/std.sx"; // Typed constant whose name is a reserved type spelling. -`s2 : s64 : 5; +`i2 : i64 : 5; // Union whose tags are reserved type spellings. -Mix :: union { `s1: s32; `u8: f32; } +Mix :: union { `i1: i32; `u8: f32; } -main :: () -> s32 { - print("typed const = {}\n", `s2); +main :: () -> i32 { + print("typed const = {}\n", `i2); m : Mix = ---; - m.`s1 = 42; - print("union tick = {}\n", m.`s1); // backtick member access - print("union bare = {}\n", m.s1); // bare member access — same field + m.`i1 = 42; + print("union tick = {}\n", m.`i1); // backtick member access + print("union bare = {}\n", m.i1); // bare member access — same field return 0; } diff --git a/examples/0156-types-backtick-struct-const.sx b/examples/0156-types-backtick-struct-const.sx index 53466da..11cbdc9 100644 --- a/examples/0156-types-backtick-struct-const.sx +++ b/examples/0156-types-backtick-struct-const.sx @@ -1,7 +1,7 @@ // Backtick raw-identifier escape at a STRUCT-BODY constant — both the untyped // `` `name :: value `` and the typed `` `name : T : value `` forms. A struct // member constant is a binding site like any top-level const (examples/0153), -// so a reserved type spelling (`s2`, `u8`) needs the backtick to be used as the +// so a reserved type spelling (`i2`, `u8`) needs the backtick to be used as the // constant's name; the value is read back via `Holder.`name`. A *bare* // reserved-name struct const still errors with the caret on the name (see // examples/1142). The backtick is never part of the name's text. @@ -10,12 +10,12 @@ #import "modules/std.sx"; Holder :: struct { - `s2 :: 5; // untyped raw struct-body const - `u8 : s64 : 9; // typed raw struct-body const + `i2 :: 5; // untyped raw struct-body const + `u8 : i64 : 9; // typed raw struct-body const } -main :: () -> s32 { - print("untyped = {}\n", Holder.`s2); +main :: () -> i32 { + print("untyped = {}\n", Holder.`i2); print("typed = {}\n", Holder.`u8); return 0; } diff --git a/examples/0157-types-backtick-parameterized-raw-type.sx b/examples/0157-types-backtick-parameterized-raw-type.sx index 420dce1..10a4f1b 100644 --- a/examples/0157-types-backtick-parameterized-raw-type.sx +++ b/examples/0157-types-backtick-parameterized-raw-type.sx @@ -1,26 +1,26 @@ // Backtick raw identifier in PARAMETERIZED type position. A raw type reference -// (`` `s2 ``) flows through the SAME type-expression continuations as a bare +// (`` `i2 ``) flows through the SAME type-expression continuations as a bare // name, so a reserved-spelled GENERIC template can be instantiated -// (`` `s2(s64) ``) and the result composes under pointer/field wrappers -// (`` *`s2(s64) ``, a struct field typed `` `s2(s64) ``). A bare `s2` in type +// (`` `i2(i64) ``) and the result composes under pointer/field wrappers +// (`` *`i2(i64) ``, a struct field typed `` `i2(i64) ``). A bare `i2` in type // position is still the 2-bit signed int. Complements examples/0154 (nullary // raw type references). // Regression (issue 0089 — attempt-5: the raw type atom no longer parses as a // terminal `type_expr`; it reaches the parameterized + wrapper continuations). #import "modules/std.sx"; -`s2 :: struct($T: Type) { +`i2 :: struct($T: Type) { x: $T; } Wrapper :: struct { - inner: `s2(s64); // raw parameterized type as a struct field + inner: `i2(i64); // raw parameterized type as a struct field } -main :: () -> s32 { - v : `s2(s64); +main :: () -> i32 { + v : `i2(i64); v.x = 7; - p : *`s2(s64) = @v; // pointer to a raw parameterized type + p : *`i2(i64) = @v; // pointer to a raw parameterized type w : Wrapper = ---; w.inner.x = 12; print("val = {}\n", v.x); diff --git a/examples/0158-types-reserved-name-member-exempt.sx b/examples/0158-types-reserved-name-member-exempt.sx index 63d66f5..c085d38 100644 --- a/examples/0158-types-reserved-name-member-exempt.sx +++ b/examples/0158-types-reserved-name-member-exempt.sx @@ -1,14 +1,14 @@ // Reserved-name MEMBER positions are EXEMPT from the reserved-type-name rule: -// a bare reserved spelling (`s2`, `u8`, `s1`, …) is legal as a struct FIELD +// a bare reserved spelling (`i2`, `u8`, `i1`, …) is legal as a struct FIELD // name, a union TAG name, and a protocol METHOD-SIGNATURE name. These are // unambiguous — the name sits in a member slot and is reached via `obj.name` // (or dispatched by string), so it is never type-classified and never // mislowers. The backtick form is optional there and resolves to the same -// member. Backtick access (`obj.`s2`) and bare access (`obj.s2`) both work. +// member. Backtick access (`obj.`i2`) and bare access (`obj.i2`) both work. // // The exemption stops at member SIGNATURES: an `impl` method DEFINITION is a // real function, so its name is a declaration site (like a free function) and a -// reserved spelling still needs the backtick (`` `s2 :: (self) ``) — bare would +// reserved spelling still needs the backtick (`` `i2 :: (self) ``) — bare would // be type-classified and mislower (the issue-0076 protection). A bare reserved // VALUE binding / declaration name still errors (see examples/1119, 1141, 1142). // Regression (issue 0089 — attempt-7: pins the Agra-ruled member-name exemption). @@ -16,40 +16,40 @@ // Struct fields spelled with reserved type names — bare is legal. Holder :: struct { - s2: s64; - u8: s64; + i2: i64; + u8: i64; } // Union tags spelled with reserved type names — bare is legal. Tag :: union { - s1: s32; + i1: i32; u16: f64; } // Protocol method SIGNATURE spelled with a reserved type name — bare is legal. Speaker :: protocol { - s2 :: () -> s64; + i2 :: () -> i64; } -Dog :: struct { n: s64; } +Dog :: struct { n: i64; } impl Speaker for Dog { - `s2 :: (self: *Dog) -> s64 { self.n } // impl DEFINITION → backtick required + `i2 :: (self: *Dog) -> i64 { self.n } // impl DEFINITION → backtick required } -main :: () -> s32 { - h := Holder.{ s2 = 10, u8 = 20 }; - print("fields bare = {} {}\n", h.s2, h.u8); // bare member access - print("fields tick = {} {}\n", h.`s2, h.`u8); // backtick member access - h.s2 = 11; +main :: () -> i32 { + h := Holder.{ i2 = 10, u8 = 20 }; + print("fields bare = {} {}\n", h.i2, h.u8); // bare member access + print("fields tick = {} {}\n", h.`i2, h.`u8); // backtick member access + h.i2 = 11; h.`u8 = 21; // backtick write - print("fields set = {} {}\n", h.s2, h.u8); + print("fields set = {} {}\n", h.i2, h.u8); t : Tag = ---; - t.s1 = 5; - print("union = {} {}\n", t.s1, t.`s1); // bare + backtick — same tag + t.i1 = 5; + print("union = {} {}\n", t.i1, t.`i1); // bare + backtick — same tag items : List(Speaker) = .{}; items.append(Dog.{ n = 7 }); - print("dispatch = {}\n", items.items[0].s2()); // bare reserved-name method call + print("dispatch = {}\n", items.items[0].i2()); // bare reserved-name method call return 0; } diff --git a/examples/0159-types-float-numeric-limits.sx b/examples/0159-types-float-numeric-limits.sx index dc82d7c..f8360a1 100644 --- a/examples/0159-types-float-numeric-limits.sx +++ b/examples/0159-types-float-numeric-limits.sx @@ -26,13 +26,13 @@ // `bits` mirrors each float's raw IEEE-754 storage. f64 needs 64 bits, f32 32. // The f64 union's `bits` (u64) view reads the all-ones-ish positive patterns as -// their true magnitude; its `s` (s64) view pins the negative `f64.min` pattern +// their true magnitude; its `s` (i64) view pins the negative `f64.min` pattern // (0xFFEF…), whose unsigned form overflows the u64 literal parser, by comparing // the signed reinterpret to -4503599627370497. -Uf64 :: union { f: f64; bits: u64; s: s64; } +Uf64 :: union { f: f64; bits: u64; s: i64; } Uf32 :: union { f: f32; bits: u32; } -main :: () -> s32 { +main :: () -> i32 { o : Uf64 = ---; // Read `.true_min` (a subnormal) FIRST and through the union only — never via @@ -45,7 +45,7 @@ main :: () -> s32 { o.f = f64.max; print("f64.max {}\n", o.bits == 0x7FEFFFFFFFFFFFFF); // true // f64.min = -max; its bit pattern 0xFFEFFFFFFFFFFFFF overflows an unsigned u64 - // literal, so it is pinned directly via the SIGNED s64 view: -4503599627370497. + // literal, so it is pinned directly via the SIGNED i64 view: -4503599627370497. o.f = f64.min; print("f64.min {}\n", o.s == -4503599627370497); // true (bits 0xFFEFFFFFFFFFFFFF) o.f = f64.epsilon; diff --git a/examples/0160-types-float-numeric-limits-errors.sx b/examples/0160-types-float-numeric-limits-errors.sx index f008213..ff2df44 100644 --- a/examples/0160-types-float-numeric-limits-errors.sx +++ b/examples/0160-types-float-numeric-limits-errors.sx @@ -4,8 +4,8 @@ // type, or ANY accessor to a non-numeric type, is a clean compile error — never // a silent value, never the `.unresolved` sentinel reaching codegen. // -// - float-only accessor on an integer (`s32.epsilon`, `u8.inf`, -// `s64.true_min`) → a dedicated "applies only to float types" diagnostic +// - float-only accessor on an integer (`i32.epsilon`, `u8.inf`, +// `i64.true_min`) → a dedicated "applies only to float types" diagnostic // from the accessor intercept, located at the access; // - any accessor on a non-numeric builtin (`bool.nan`, `string.max`) → the // "numeric limits apply only to integer and float types" diagnostic; @@ -14,12 +14,12 @@ // Each case is accurate and located at the access; the program exits non-zero. #import "modules/std.sx"; -MyStruct :: struct { a: s64; } +MyStruct :: struct { a: i64; } -main :: () -> s32 { - a := s32.epsilon; +main :: () -> i32 { + a := i32.epsilon; b := u8.inf; - c := s64.true_min; + c := i64.true_min; d := bool.nan; e := string.max; f := MyStruct.epsilon; diff --git a/examples/0161-types-numeric-limit-value-shadow.sx b/examples/0161-types-numeric-limit-value-shadow.sx index dc6f1da..21424b1 100644 --- a/examples/0161-types-numeric-limit-value-shadow.sx +++ b/examples/0161-types-numeric-limit-value-shadow.sx @@ -1,9 +1,9 @@ // Numeric-limit accessor vs. a raw value binding that shadows a builtin type // name. A backtick raw identifier (F0.6) can legitimately bind a value whose -// spelling is a reserved numeric type name (`` `f64 ``, `` `s32 ``, `` `u8 ``). +// spelling is a reserved numeric type name (`` `f64 ``, `` `i32 ``, `` `u8 ``). // Field access on such a value is an ORDINARY field read — the numeric-limit // intercept (NL.1 integer `.min`/`.max`, NL.2 float `.epsilon`/… ) must NOT -// hijack it. An adjacent BARE `f64.epsilon` / `s32.max` / `u8.max` — which the +// hijack it. An adjacent BARE `f64.epsilon` / `i32.max` / `u8.max` — which the // parser classifies as a type receiver, not the raw value — STILL folds to the // numeric limit. Both behaviors coexist: the raw receiver reads the value, the // bare receiver folds the limit. @@ -11,59 +11,59 @@ // A raw value binding can reach the intercept through THREE sources, exactly // mirroring the ordinary identifier field-access path (scope / globals / module // consts). This example exercises all three: a GLOBAL `` `f32 ``, a MODULE-CONST -// `` `s16 ``, and LOCAL `` `f64 ``/`` `s32 ``/`` `u8 `` — each reads its field, +// `` `i16 ``, and LOCAL `` `f64 ``/`` `i32 ``/`` `u8 `` — each reads its field, // and the bare spelling of each STILL folds. // // Regression (issues 0092 local, 0093 global + module-const): the intercept // previously treated any identifier whose text matched a builtin numeric type // name as a TYPE receiver, silently shadowing the in-scope value binding -// (`` `f64.epsilon `` folded to 2^-52, `` `s32.max `` folded to 2147483647 — +// (`` `f64.epsilon `` folded to 2^-52, `` `i32.max `` folded to 2147483647 — // a silent wrong value). The attempt-3 fix guarded only lexical scope, so // GLOBAL and MODULE-CONST raw bindings still folded (issue 0093). #import "modules/std.sx"; -FBox :: struct { epsilon: s64; max: s64; min_positive: s64; } -IBox :: struct { max: s64; min: s64; } -UBox :: struct { max: s64; } +FBox :: struct { epsilon: i64; max: i64; min_positive: i64; } +IBox :: struct { max: i64; min: i64; } +UBox :: struct { max: i64; } // GLOBAL raw value binding whose spelling shadows the builtin `f32`. Reachable // via `program_index.global_names`, not lexical scope (issue 0093). `f32 := FBox.{ epsilon = 44, max = 55, min_positive = 66 }; -// MODULE-CONST raw value binding whose spelling shadows the builtin `s16`. +// MODULE-CONST raw value binding whose spelling shadows the builtin `i16`. // Reachable via `program_index.module_const_map` (issue 0093, const variant). -`s16 :: IBox.{ max = 99, min = -99 }; +`i16 :: IBox.{ max = 99, min = -99 }; -main :: () -> s32 { +main :: () -> i32 { // LOCAL raw value bindings whose spelling shadows a builtin numeric type name. `f64 := FBox.{ epsilon = 11, max = 22, min_positive = 33 }; - `s32 := IBox.{ max = 78, min = -78 }; + `i32 := IBox.{ max = 78, min = -78 }; `u8 := UBox.{ max = 7 }; // Raw receiver → ordinary field READ (the value), never the numeric limit. print("local f64: epsilon={} max={} min_positive={}\n", `f64.epsilon, `f64.max, `f64.min_positive); // 11 22 33 - print("local s32: max={} min={}\n", `s32.max, `s32.min); // 78 -78 + print("local i32: max={} min={}\n", `i32.max, `i32.min); // 78 -78 print("local u8: max={}\n", `u8.max); // 7 // GLOBAL raw receiver → ordinary field READ (issue 0093). print("global f32: epsilon={} max={} min_positive={}\n", `f32.epsilon, `f32.max, `f32.min_positive); // 44 55 66 // MODULE-CONST raw receiver → ordinary field READ (issue 0093). - print("const s16: max={} min={}\n", `s16.max, `s16.min); // 99 -99 + print("const i16: max={} min={}\n", `i16.max, `i16.min); // 99 -99 - // The value-field read carries the field type (s64 here): round-trips + // The value-field read carries the field type (i64 here): round-trips // through a typed binding, so a mistyped/boxed read would not type-check. - e : s64 = `f64.epsilon; + e : i64 = `f64.epsilon; print("typed val e={}\n", e); // 11 // Bare receiver (a type receiver, NOT the raw value) → STILL folds to the - // numeric limit, even though a LOCAL (`s32`/`u8`/`f64`), GLOBAL (`f32`), or - // MODULE-CONST (`s16`) value of the same spelling is bound. The bare receiver + // numeric limit, even though a LOCAL (`i32`/`u8`/`f64`), GLOBAL (`f32`), or + // MODULE-CONST (`i16`) value of the same spelling is bound. The bare receiver // is never blocked by any of the three value sources. - print("lim s32.max={} s32.min={}\n", s32.max, s32.min); // 2147483647 -2147483648 + print("lim i32.max={} i32.min={}\n", i32.max, i32.min); // 2147483647 -2147483648 print("lim u8.max={}\n", u8.max); // 255 - print("lim s16.max={} s16.min={}\n", s16.max, s16.min); // 32767 -32768 + print("lim i16.max={} i16.min={}\n", i16.max, i16.min); // 32767 -32768 // Bare float accessors still fold; the formatter is crude (issue 0090), so // pin the values by their defining properties rather than by printing. diff --git a/examples/0162-types-typed-module-const-roundtrip.sx b/examples/0162-types-typed-module-const-roundtrip.sx index 4e6c85a..43391a3 100644 --- a/examples/0162-types-typed-module-const-roundtrip.sx +++ b/examples/0162-types-typed-module-const-roundtrip.sx @@ -1,16 +1,16 @@ // Valid typed module-level constants compile, fold, and print correctly across // every initializer/annotation pairing the registrar accepts: -// - integer literal → integer (`K : s64 : 4`) — usable as an array count too +// - integer literal → integer (`K : i64 : 4`) — usable as an array count too // - integer literal → float (`W : f32 : 800`) // - float literal → float (`PI : f32 : 3.14159`) // - string literal → string (`S : string : "hi"`) // - null → pointer (`P : *void : null`) -// - integer EXPRESSION → integer (`KE : s64 : M + 2`) — usable as a count too +// - integer EXPRESSION → integer (`KE : i64 : M + 2`) — usable as a count too // - integer EXPRESSION → float (`WE : f32 : M + 2`) // - MIXED int+float EXPRESSION → float (`MF : f64 : M + 0.5`, both operand orders) -// - INTEGRAL float literal → integer (`KF : s64 : 4.0` → 4) — folds under the +// - INTEGRAL float literal → integer (`KF : i64 : 4.0` → 4) — folds under the // unified narrowing rule (F0.11), usable as a count too -// - INTEGRAL float EXPRESSION → integer (`KFE : s64 : M + 2.0` → 4) +// - INTEGRAL float EXPRESSION → integer (`KFE : i64 : M + 2.0` → 4) // // Companion to the negative example 1143: the issue-0088 fix rejects a typed // const whose initializer mismatches its annotation, and these correctly-typed @@ -25,21 +25,21 @@ M :: 2; -K : s64 : 4; +K : i64 : 4; W : f32 : 800; PI : f32 : 3.14159; S : string : "hi"; P : *void : null; -KE : s64 : M + 2; +KE : i64 : M + 2; WE : f32 : M + 2; MF : f64 : M + 0.5; MFR : f64 : 0.5 + M; -KF : s64 : 4.0; // integral float literal → folds to 4 -KFE : s64 : M + 2.0; // integral float expression → folds to 4 +KF : i64 : 4.0; // integral float literal → folds to 4 +KFE : i64 : M + 2.0; // integral float expression → folds to 4 main :: () { // Integer const: prints AND drives an array dimension (len 4). - a : [K]s64 = ---; + a : [K]i64 = ---; a[0] = 10; a[3] = 40; print("K={} len={} a0={} a3={}\n", K, a.len, a[0], a[3]); @@ -54,7 +54,7 @@ main :: () { print("P_is_null={}\n", P == null); // Integer const-EXPRESSION: prints AND drives an array dimension (len 4). - b : [KE]s64 = ---; + b : [KE]i64 = ---; print("KE={} len={} WE={}\n", KE, b.len, WE); // Mixed int+float const-EXPRESSION folds to the promoted float (2.5), @@ -63,6 +63,6 @@ main :: () { // Integral float const (literal + expression): folds to its integer under // the unified narrowing rule; `KF` also drives an array dimension (len 4). - cc : [KF]s64 = ---; + cc : [KF]i64 = ---; print("KF={} len={} KFE={}\n", KF, cc.len, KFE); } diff --git a/examples/0163-types-mixed-numeric-promotion.sx b/examples/0163-types-mixed-numeric-promotion.sx index f59d8df..3b73276 100644 --- a/examples/0163-types-mixed-numeric-promotion.sx +++ b/examples/0163-types-mixed-numeric-promotion.sx @@ -4,7 +4,7 @@ // `inferExprType` reports for the argument (not the lowered value's type), so it // exercises the binary-op inference arm directly — distinct from the typed-const // validation path. Before the attempt-3 fix, binary-op inference was LHS-biased: -// `n + 0.5` (int LHS) inferred `s64` and printed a truncated `2`, while `0.5 + n` +// `n + 0.5` (int LHS) inferred `i64` and printed a truncated `2`, while `0.5 + n` // (float LHS) inferred `f64` and printed `2.5`. The fix routes both through the // shared promotion rule (`Lowering.arithResultType`, the same one `lowerBinaryOp` // applies for the value), so an int operand with a float operand promotes to the @@ -15,7 +15,7 @@ #import "modules/std.sx"; main :: () { - n := 2; // runtime s64 + n := 2; // runtime i64 // Addition, both operand orders — both promote to f64 → 2.5. print("add: {} {}\n", n + 0.5, 0.5 + n); @@ -30,6 +30,6 @@ main :: () { half : f32 = 0.5; print("f32: {}\n", n + half); - // A pure-int expression is unaffected — stays s64, prints as an integer. + // A pure-int expression is unaffected — stays i64, prints as an integer. print("int: {}\n", n + 3); } diff --git a/examples/0164-types-reflection-any-tag.sx b/examples/0164-types-reflection-any-tag.sx index f343c5f..15db6ce 100644 --- a/examples/0164-types-reflection-any-tag.sx +++ b/examples/0164-types-reflection-any-tag.sx @@ -17,7 +17,7 @@ main :: () { // Any holding a VALUE — reflection names the value's type. - av : Any = 6; // 6 is s64 + av : Any = 6; // 6 is i64 print("type_name(av)={}\n", type_name(av)); print("type_is_unsigned(av)={}\n", type_is_unsigned(av)); print("print(av)={}\n", av); // formatter already used the tag diff --git a/examples/0165-types-nested-struct-field-assign.sx b/examples/0165-types-nested-struct-field-assign.sx index 0aa8880..34aeea9 100644 --- a/examples/0165-types-nested-struct-field-assign.sx +++ b/examples/0165-types-nested-struct-field-assign.sx @@ -4,10 +4,10 @@ // field-0 default. Positive companion to the missing-field diagnostic (1145). #import "modules/std.sx"; -Inner :: struct { a: s64; b: s64; } -Outer :: struct { inner: Inner; tag: s64; } +Inner :: struct { a: i64; b: i64; } +Outer :: struct { inner: Inner; tag: i64; } -bump :: (p: *s64) { p.* = p.* + 100; } +bump :: (p: *i64) { p.* = p.* + 100; } main :: () { o := Outer.{ inner = Inner.{ a = 1, b = 2 }, tag = 9 }; diff --git a/examples/0166-types-union-promoted-member-lvalue.sx b/examples/0166-types-union-promoted-member-lvalue.sx index d48dfff..a3f3e75 100644 --- a/examples/0166-types-union-promoted-member-lvalue.sx +++ b/examples/0166-types-union-promoted-member-lvalue.sx @@ -13,11 +13,11 @@ #import "modules/std.sx"; Vec2 :: union { - data: [2]s64; - struct { x: s64; y: s64; }; + data: [2]i64; + struct { x: i64; y: i64; }; } -bump :: (p: *s64) { +bump :: (p: *i64) { p.* = p.* + 1; } diff --git a/examples/0167-types-ptr-to-aggregate-field-store.sx b/examples/0167-types-ptr-to-aggregate-field-store.sx index 351e5eb..2a6f996 100644 --- a/examples/0167-types-ptr-to-aggregate-field-store.sx +++ b/examples/0167-types-ptr-to-aggregate-field-store.sx @@ -15,12 +15,12 @@ #import "modules/std.sx"; -Pair :: struct { a: *s64; b: *s64; } -Holder :: struct { pr: *Pair; sentinel: s64; } +Pair :: struct { a: *i64; b: *i64; } +Holder :: struct { pr: *Pair; sentinel: i64; } main :: () { - x : s64 = 7; - y : s64 = 9; + x : i64 = 7; + y : i64 = 9; pair : Pair = .{ a = @x, b = @y }; other : Pair = .{ a = @y, b = @x }; @@ -31,7 +31,7 @@ main :: () { print("single: a={} b={} sentinel={}\n", h.pr.a.*, h.pr.b.*, h.sentinel); // multi-assign: store into h.pr alongside a plain local; sentinel untouched. - dummy : s64 = 0; + dummy : i64 = 0; h.pr, dummy = @pair, 1; print("multi: a={} b={} sentinel={}\n", h.pr.a.*, h.pr.b.*, h.sentinel); diff --git a/examples/0168-types-integral-float-to-int.sx b/examples/0168-types-integral-float-to-int.sx index 5e8f9ad..3456276 100644 --- a/examples/0168-types-integral-float-to-int.sx +++ b/examples/0168-types-integral-float-to-int.sx @@ -9,14 +9,14 @@ // an array dimension directly, through a const, or via a type alias — a builtin // FLOAT numeric-limit leaf in an integral expression (`f64.max - f64.max` = 0), // and an integral float `%` (`6.0 % 4.0` = 2). The compile-time float evaluator -// is at parity with the integer one, so integer numeric-limit accessors (`s8.max`, +// is at parity with the integer one, so integer numeric-limit accessors (`i8.max`, // `[u8.max]` count) keep folding through the shared int folder, unregressed. // The escape hatch (`xx` / `cast`) still TRUNCATES any float, integral or not — // including a non-integral const expression (`xx (M + 0.5)` / `xx (F + 0.25)`). // // Companion to the negative example 1146 (non-integral floats error). // Regression (issue 0095): a typed local/param/field silently truncated a float -// initializer (`y : s64 = 1.5` → 1) with no diagnostic; a non-integral const +// initializer (`y : i64 = 1.5` → 1) with no diagnostic; a non-integral const // EXPRESSION (`M + 0.5`) and a non-integral float-const-LEAF expression // (`F + 0.25`) truncated even when written through an int binding; the rule now // folds an integral float (literal, int-const expr, or float-const leaf) and @@ -27,38 +27,38 @@ M :: 2; // int module const, for the INT-const-EXPRESSION cases F : f64 : 2.5; // float module const, for the FLOAT-const-LEAF cases Box :: struct { - n : s64 = 4.0; // integral float field default → folds to 4 - ne : s64 = M + 2.0; // integral int-const-EXPR field default → folds to 4 - nf : s64 = F + 1.5; // integral float-const-LEAF field default → folds to 4 - nd : s64 = 8.0 / 2.0; // integral float-DIVISION field default → folds to 4 + n : i64 = 4.0; // integral float field default → folds to 4 + ne : i64 = M + 2.0; // integral int-const-EXPR field default → folds to 4 + nf : i64 = F + 1.5; // integral float-const-LEAF field default → folds to 4 + nd : i64 = 8.0 / 2.0; // integral float-DIVISION field default → folds to 4 } -withDefault :: (x : s64 = 6.0) -> s64 { return x; } // param default → 6 -withFlt :: (x : s64 = F + 1.5) -> s64 { return x; } // float-const-leaf param default → 4 +withDefault :: (x : i64 = 6.0) -> i64 { return x; } // param default → 6 +withFlt :: (x : i64 = F + 1.5) -> i64 { return x; } // float-const-leaf param default → 4 -K : s64 : 8.0; // integral float module const → folds to 8 -KF : s64 : F + 1.5; // integral float-const-LEAF module const → folds to 4 -KD : s64 : 12.0 / 4.0; // integral float-DIVISION module const → folds to 3 +K : i64 : 8.0; // integral float module const → folds to 8 +KF : i64 : F + 1.5; // integral float-const-LEAF module const → folds to 4 +KD : i64 : 12.0 / 4.0; // integral float-DIVISION module const → folds to 3 -ArrFE :: [F + 1.5]s64; // array-dim type ALIAS over a float-const-leaf expr → [4]s64 +ArrFE :: [F + 1.5]i64; // array-dim type ALIAS over a float-const-leaf expr → [4]i64 // (the stateless registration path must agree with the - // direct form `a : [F + 1.5]s64` below — issue 0083). + // direct form `a : [F + 1.5]i64` below — issue 0083). main :: () { // Typed local: integral float folds (literal + int-const expr + float-const leaf). - z : s64 = 4.0; - ze : s64 = M + 2.0; - zf : s64 = F + 1.5; + z : i64 = 4.0; + ze : i64 = M + 2.0; + zf : i64 = F + 1.5; print("local={} localExpr={} localFlt={}\n", z, ze, zf); // Negative integral float folds to its (negative) integer. - neg : s64 = -2.0; + neg : i64 = -2.0; print("neg={}\n", neg); // Integral float DIVISION folds (the subtle case: integral operands, but the // `/` is float division). `6.0 / 2.0` = 3.0 → 3; the int folder refuses the // float `/` and the unified rule folds the integral result. - zd : s64 = 6.0 / 2.0; + zd : i64 = 6.0 / 2.0; print("localDiv={}\n", zd); // Struct field defaults fold (literal + int-const expr + float-const leaf + @@ -70,20 +70,20 @@ main :: () { print("param={} paramFlt={}\n", withDefault(), withFlt()); // Module consts fold (and an integral float const can drive an array dim: len 8). - a : [K]s64 = ---; + a : [K]i64 = ---; print("const={} constFlt={} len={}\n", K, KF, a.len); // Integral float-DIVISION const folds, and drives an array dimension directly // (`[6.0 / 2.0]` → len 3) through the SAME refuse-int-fold / fold-float rule. - ad2 : [6.0 / 2.0]s64 = ---; + ad2 : [6.0 / 2.0]i64 = ---; print("constDiv={} dimDiv={}\n", KD, ad2.len); // Array DIMENSION — the fifth site joins the unified rule: an integral // float-const-leaf expression folds to a count whether written DIRECTLY // (`[F + 1.5]` → 4), THROUGH a float-expr const (`[KF]`, KF = F + 1.5 = 4), // or via a type ALIAS (`ArrFE`, the stateless path agreeing with the direct). - ad : [F + 1.5]s64 = ---; - ak : [KF]s64 = ---; + ad : [F + 1.5]i64 = ---; + ak : [KF]i64 = ---; aa : ArrFE = ---; print("dim.direct={} dim.const={} dim.alias={}\n", ad.len, ak.len, aa.len); @@ -91,16 +91,16 @@ main :: () { // compile-time float evaluator is at parity with the integer one — a // `f64`/`f32` `.max`/`.min`/`.epsilon`/… leaf is recognised inside an // expression, not only as a direct value). `f64.max - f64.max` = 0.0 → 0. - lim : s64 = f64.max - f64.max; + lim : i64 = f64.max - f64.max; // Integral float `%` (parity with int `%`): `6.0 % 4.0` = 2.0 → 2. - fm : s64 = 6.0 % 4.0; + fm : i64 = 6.0 % 4.0; print("limit={} fmod={}\n", lim, fm); // Integer numeric-limit accessors (NL.1) are unregressed by the float-leaf - // parity work: they still fold at a binding (`s8.max` = 127) and as an array + // parity work: they still fold at a binding (`i8.max` = 127) and as an array // dimension count (`[u8.max]` = len 255), through the SAME int folder. - il : s64 = s8.max; - iarr : [u8.max]s64 = ---; + il : i64 = i8.max; + iarr : [u8.max]i64 = ---; print("intlimit={} intcount={}\n", il, iarr.len); // Explicit escape: `xx` / `cast` always truncate, integral or not — @@ -108,12 +108,12 @@ main :: () { // non-integral float-const-LEAF expression (`xx (F + 0.25)` → 2), a // non-integral numeric-limit expr (`xx (f64.true_min + 0.5)` → 0), and a // non-integral float `%` (`xx (5.5 % 2.0)` → 1). - e : s64 = xx 4.9; - c : s64 = cast(s64) 1.5; - xc : s64 = xx (M + 0.5); - xf : s64 = xx (F + 0.25); - xl : s64 = xx (f64.true_min + 0.5); - xm : s64 = xx (5.5 % 2.0); - xd : s64 = xx (5.0 / 2.0); // non-integral float DIVISION → truncates to 2 + e : i64 = xx 4.9; + c : i64 = cast(i64) 1.5; + xc : i64 = xx (M + 0.5); + xf : i64 = xx (F + 0.25); + xl : i64 = xx (f64.true_min + 0.5); + xm : i64 = xx (5.5 % 2.0); + xd : i64 = xx (5.0 / 2.0); // non-integral float DIVISION → truncates to 2 print("xx={} cast={} xxExpr={} xxFlt={} xxLimit={} xxMod={} xxDiv={}\n", e, c, xc, xf, xl, xm, xd); } diff --git a/examples/0169-types-value-shadow-field-narrowing.sx b/examples/0169-types-value-shadow-field-narrowing.sx index c2c3766..a3ba2b1 100644 --- a/examples/0169-types-value-shadow-field-narrowing.sx +++ b/examples/0169-types-value-shadow-field-narrowing.sx @@ -11,7 +11,7 @@ // compile-time constant: reading it after a reassignment yields the new value, // proving it can never be const-folded from the initializer literal. // -// Companion to 0161 (value-shadow field reads in NON-narrowing, s64-field +// Companion to 0161 (value-shadow field reads in NON-narrowing, i64-field // contexts). This file exercises the narrowing path 0161 does not: a FLOAT // field flowing into an integer binding. // @@ -27,32 +27,32 @@ FBox :: struct { epsilon: f64; } main :: () { - // Raw value-shadow of the builtin `f64`, FLOAT field → narrow into s64. + // Raw value-shadow of the builtin `f64`, FLOAT field → narrow into i64. // Ordinary field read + runtime float→int truncation: 11.0 → 11. `f64 := FBox.{ epsilon = 11.0 }; - x : s64 = `f64.epsilon; + x : i64 = `f64.epsilon; // A NON-integral field value truncates exactly the same way — a runtime // f64 has no compile-time value to fold, so 11.5 → 11 (NOT a non-integral // narrowing error, which would only fire on a compile-time-constant float). `f64b := FBox.{ epsilon = 11.5 }; - y : s64 = `f64b.epsilon; + y : i64 = `f64b.epsilon; // The value-shadowed read is identical to a plainly-named one: `b.epsilon` // narrows the same way, so the backtick spelling changes nothing. b := FBox.{ epsilon = 11.5 }; - yb : s64 = b.epsilon; + yb : i64 = b.epsilon; print("x={} y={} yb={}\n", x, y, yb); // 11 11 11 // The field is a RUNTIME value: reassign, then read → the new value, not // the initializer literal (so const-folding it would be unsound). `f64.epsilon = 4.0; - xm : s64 = `f64.epsilon; + xm : i64 = `f64.epsilon; print("xm={}\n", xm); // 4 // The bare builtin receiver (not raw-escaped) is UNAFFECTED — it still // folds the numeric limit. `f64.max - f64.max` = 0.0 is integral → 0. - lim : s64 = f64.max - f64.max; + lim : i64 = f64.max - f64.max; print("lim={}\n", lim); // 0 } diff --git a/examples/0170-types-anon-struct-field-distinct.sx b/examples/0170-types-anon-struct-field-distinct.sx index f6425bd..14d57ae 100644 --- a/examples/0170-types-anon-struct-field-distinct.sx +++ b/examples/0170-types-anon-struct-field-distinct.sx @@ -9,10 +9,10 @@ // 'B.inner'". Pins fail-before / pass-after. #import "modules/std.sx"; -A :: struct { inner: struct { x: s64; }; } -B :: struct { inner: struct { y: s64; z: s64; }; } +A :: struct { inner: struct { x: i64; }; } +B :: struct { inner: struct { y: i64; z: i64; }; } -main :: () -> s32 { +main :: () -> i32 { a := A.{ inner = .{ x = 1 } }; b := B.{ inner = .{ y = 2, z = 3 } }; print("{} {} {}\n", a.inner.x, b.inner.y, b.inner.z); diff --git a/examples/0171-types-undeclared-type-in-generic-struct-field.sx b/examples/0171-types-undeclared-type-in-generic-struct-field.sx index 82a9ad7..67b1493 100644 --- a/examples/0171-types-undeclared-type-in-generic-struct-field.sx +++ b/examples/0171-types-undeclared-type-in-generic-struct-field.sx @@ -22,8 +22,8 @@ Box :: struct($T: Type) { bad: MissingType; } -main :: () -> s32 { - b : Box(s64) = .{ good = 7, bad = 0 }; +main :: () -> i32 { + b : Box(i64) = .{ good = 7, bad = 0 }; print("{}\n", b.good); return 0; } diff --git a/examples/0172-types-value-param-as-field-type.sx b/examples/0172-types-value-param-as-field-type.sx index f4efaa7..2760659 100644 --- a/examples/0172-types-value-param-as-field-type.sx +++ b/examples/0172-types-value-param-as-field-type.sx @@ -22,7 +22,7 @@ Bad :: struct($N: u32) { x: N; } -main :: () -> s32 { +main :: () -> i32 { b : Bad(3) = .{ x = 1 }; print("{}\n", b.x); return 0; diff --git a/examples/0173-types-int-literal-default-s64.sx b/examples/0173-types-int-literal-default-i64.sx similarity index 75% rename from examples/0173-types-int-literal-default-s64.sx rename to examples/0173-types-int-literal-default-i64.sx index c67c5a1..68e7e89 100644 --- a/examples/0173-types-int-literal-default-s64.sx +++ b/examples/0173-types-int-literal-default-i64.sx @@ -1,32 +1,32 @@ -// Integer literals default to s64 regardless of context: an unannotated -// `x := ` local stays s64 even inside a function whose return +// Integer literals default to i64 regardless of context: an unannotated +// `x := ` local stays i64 even inside a function whose return // type is a narrower integer (the implicit-return target must not type the // body's declarations), and a large literal initializer keeps its value. // Also covers destructure decls (`a, b := ...`), which share the same rule. // Regression (issue 0111): these locals adopted the enclosing fn's return -// type (s32/s8), silently wrapping `big := 3000000000` to -1294967296. +// type (i32/i8), silently wrapping `big := 3000000000` to -1294967296. #import "modules/std.sx"; -f :: () -> s32 { +f :: () -> i32 { x := 0; print("f.x: {}\n", type_name(type_of(x))); 0 } -g :: () -> s8 { +g :: () -> i8 { x := 0; print("g.x: {}\n", type_name(type_of(x))); 0 } -big_host :: () -> s32 { +big_host :: () -> i32 { big := 3000000000; print("big: {} = {}\n", type_name(type_of(big)), big); 0 } -d_host :: () -> s32 { +d_host :: () -> i32 { a, b := (1, 2); print("a: {} b: {}\n", type_name(type_of(a)), type_name(type_of(b))); 0 diff --git a/examples/0174-types-int-literal-boundaries.sx b/examples/0174-types-int-literal-boundaries.sx index 24725ff..c7ce3cf 100644 --- a/examples/0174-types-int-literal-boundaries.sx +++ b/examples/0174-types-int-literal-boundaries.sx @@ -5,18 +5,18 @@ #import "modules/std.sx"; -clamp_s8 :: (v: s8) -> s8 { v } +clamp_i8 :: (v: i8) -> i8 { v } main :: () { - a : s8 = -128; - b : s8 = 127; + a : i8 = -128; + b : i8 = 127; c : u8 = 0; d : u8 = 255; e : u64 = 0x7FFFFFFFFFFFFFFF; f : u32 = 0xFFFFFFFF; - g : s16 = -32768; - h : s8 = xx 300; // explicit truncation stays legal - i := cast(s8) 300; // cast form too - j : s8 = clamp_s8(-5); + g : i16 = -32768; + h : i8 = xx 300; // explicit truncation stays legal + i := cast(i8) 300; // cast form too + j : i8 = clamp_i8(-5); print("{} {} {} {} {} {} {} {} {} {}\n", a, b, c, d, e, f, g, h, i, j); } diff --git a/examples/0175-types-negative-literal-global.sx b/examples/0175-types-negative-literal-global.sx index c8db467..16d1e09 100644 --- a/examples/0175-types-negative-literal-global.sx +++ b/examples/0175-types-negative-literal-global.sx @@ -2,14 +2,14 @@ // ints serialize directly, an integral negative float narrows into an // integer global (non-integral errors), and boundary values fit exactly. // Out-of-range negatives get the literal fits-check, not "non-constant". -// Regression (issue 0113): `g : s64 = -1;` was rejected as not a +// Regression (issue 0113): `g : i64 = -1;` was rejected as not a // compile-time constant (globalInitValue had no unary_op arm). #import "modules/std.sx"; -g1 : s64 = -1; -g2 : s64 = -4.0; -g3 : s8 = -128; +g1 : i64 = -1; +g2 : i64 = -4.0; +g3 : i8 = -128; main :: () { print("{} {} {}\n", g1, g2, g3); diff --git a/examples/0176-types-pointer-to-array-index.sx b/examples/0176-types-pointer-to-array-index.sx index ae8bef8..64c1d5b 100644 --- a/examples/0176-types-pointer-to-array-index.sx +++ b/examples/0176-types-pointer-to-array-index.sx @@ -10,7 +10,7 @@ #import "modules/std.sx"; main :: () { - k : [4]s64 = .[11, 22, 33, 44]; + k : [4]i64 = .[11, 22, 33, 44]; p := @k; print("read={}\n", p[2]); p[1] = 99; diff --git a/examples/0177-types-array-consts.sx b/examples/0177-types-array-consts.sx index d6245b3..63cf632 100644 --- a/examples/0177-types-array-consts.sx +++ b/examples/0177-types-array-consts.sx @@ -1,25 +1,25 @@ // Array-typed `::` constants are IMMUTABLE GLOBALS: one storage, reads // GEP it, the emitter marks it constant, dead-global elimination drops -// unused ones. Typed (`K : [4]s64 : .[...]`) and untyped (`A :: .[...]`, -// element type inferred — all ints s64; any float promotes the element +// unused ones. Typed (`K : [4]i64 : .[...]`) and untyped (`A :: .[...]`, +// element type inferred — all ints i64; any float promotes the element // type to f64 with ints converting exactly; bool/string homogeneous). // Element shapes cover nested aggregates. Reads are normal array values: // indexing, .len, by-value copies (independent of the const), passing to -// fixed-array params, and @-address (reads through *[4]s64 — issue 0117). +// fixed-array params, and @-address (reads through *[4]i64 — issue 0117). #import "modules/std.sx"; -K : [4]s64 : .[11, 22, 33, 44]; +K : [4]i64 : .[11, 22, 33, 44]; A :: .[1, 2, 3]; M :: .[1, 2.2, 3]; F : [2]f64 : .[1, 2.5]; S :: .["alpha", "beta"]; B :: .[true, false, true]; -P :: struct { x, y: s64; } +P :: struct { x, y: i64; } PTS : [2]P : .[P.{ x = 1, y = 2 }, P.{ x = 3, y = 4 }]; -GRID : [2][2]s64 : .[.[1, 2], .[3, 4]]; +GRID : [2][2]i64 : .[.[1, 2], .[3, 4]]; -sum :: (xs: [4]s64) -> s64 { xs[0] + xs[1] + xs[2] + xs[3] } +sum :: (xs: [4]i64) -> i64 { xs[0] + xs[1] + xs[2] + xs[3] } main :: () { print("typed={} untyped={} len={}\n", K[2], A[1], K.len); diff --git a/examples/0178-types-typed-struct-const.sx b/examples/0178-types-typed-struct-const.sx index 13bd115..c5ccaa4 100644 --- a/examples/0178-types-typed-struct-const.sx +++ b/examples/0178-types-typed-struct-const.sx @@ -5,7 +5,7 @@ #import "modules/std.sx"; -Color :: struct { r, g, b: s64; } +Color :: struct { r, g, b: i64; } W : Color : Color.{ r = 1, g = 2, b = 3 }; main :: () { diff --git a/examples/0179-types-const-aggregate-folds.sx b/examples/0179-types-const-aggregate-folds.sx index eaadd3b..59cf969 100644 --- a/examples/0179-types-const-aggregate-folds.sx +++ b/examples/0179-types-const-aggregate-folds.sx @@ -6,8 +6,8 @@ #import "modules/std.sx"; -Color :: struct { r, g, b: s64; } -K : [4]s64 : .[11, 22, 33, 44]; +Color :: struct { r, g, b: i64; } +K : [4]i64 : .[11, 22, 33, 44]; LIT :: Color.{ r = 5, g = 0, b = 0 }; N :: K[0] + K[3]; diff --git a/examples/0180-types-struct-const-globals.sx b/examples/0180-types-struct-const-globals.sx index e9aae2f..60a04ef 100644 --- a/examples/0180-types-struct-const-globals.sx +++ b/examples/0180-types-struct-const-globals.sx @@ -6,9 +6,9 @@ #import "modules/std.sx"; -Color :: struct { r, g, b: s64; } +Color :: struct { r, g, b: i64; } K :: 10; -A : [2]s64 : .[7, 8]; +A : [2]i64 : .[7, 8]; LIT :: Color.{ r = 255, g = 0, b = 0 }; EXPR :: Color.{ r = K + 1, g = K * 2, b = A[1] }; REF :: Color.{ r = LIT.r, g = 1, b = 2 }; diff --git a/examples/0181-types-struct-const-inline-fallback.sx b/examples/0181-types-struct-const-inline-fallback.sx index f721439..3aca610 100644 --- a/examples/0181-types-struct-const-inline-fallback.sx +++ b/examples/0181-types-struct-const-inline-fallback.sx @@ -6,9 +6,9 @@ #import "modules/std.sx"; -Color :: struct { r, g, b: s64; } -counter : s64 = 0; -bump :: () -> s64 { counter += 1; counter } +Color :: struct { r, g, b: i64; } +counter : i64 = 0; +bump :: () -> i64 { counter += 1; counter } CALL :: Color.{ r = bump(), g = 0, b = 0 }; main :: () { diff --git a/examples/0182-types-cast-compound-types.sx b/examples/0182-types-cast-compound-types.sx index aa28652..9ee5c21 100644 --- a/examples/0182-types-cast-compound-types.sx +++ b/examples/0182-types-cast-compound-types.sx @@ -1,7 +1,7 @@ // `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 = *s64;`), mirroring named types (`t : Type = f64;`). +// 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'". @@ -9,19 +9,19 @@ main :: () { x := 42; - p : *s64 = @x; - q : *s64 = cast(*s64) p; // no-op pointer cast + p : *i64 = @x; + q : *i64 = cast(*i64) p; // no-op pointer cast print("a: {}\n", q.*); - addr : s64 = xx p; - r : *s64 = cast(*s64) addr; // int → ptr through compound cast + addr : i64 = xx p; + r : *i64 = cast(*i64) addr; // int → ptr through compound cast print("b: {}\n", r.*); - mp : [*]s64 = cast([*]s64) p; // ptr → many-pointer + mp : [*]i64 = cast([*]i64) p; // ptr → many-pointer print("c: {}\n", mp[0]); - o : ?s32 = cast(?s32) 7; // optional wrap + o : ?i32 = cast(?i32) 7; // optional wrap print("d: {}\n", o ?? -1); arr := .[1, 2, 3]; - s : []s64 = cast([]s64) arr; // array → slice + s : []i64 = cast([]i64) arr; // array → slice print("e: {} {}\n", s.len, s[2]); - t : Type = *s64; // first-class compound Type value + t : Type = *i64; // first-class compound Type value print("f: {}\n", type_name(t)); } diff --git a/examples/0201-generics-generic-struct.sx b/examples/0201-generics-generic-struct.sx index 0191b93..2d56c6d 100644 --- a/examples/0201-generics-generic-struct.sx +++ b/examples/0201-generics-generic-struct.sx @@ -73,7 +73,7 @@ main :: () { // inline generic type Sx :: (user: $T) -> Type { return enum { - counter: s32; + counter: i32; user: T; }; } diff --git a/examples/0203-generics-infer-return-type.sx b/examples/0203-generics-infer-return-type.sx index 70bb404..5505fbb 100644 --- a/examples/0203-generics-infer-return-type.sx +++ b/examples/0203-generics-infer-return-type.sx @@ -11,6 +11,6 @@ nested :: () { return 0; } -main :: () -> s32 { +main :: () -> i32 { return xx (foo() + bar() + nested()); } diff --git a/examples/0205-generics-generic-method-dot-call.sx b/examples/0205-generics-generic-method-dot-call.sx index bdae350..debffdd 100644 --- a/examples/0205-generics-generic-method-dot-call.sx +++ b/examples/0205-generics-generic-method-dot-call.sx @@ -2,27 +2,27 @@ // // Covers three shapes: // 1. non-generic method: h.plain() -// 2. generic method, explicit type arg: h.sized(s32) +// 2. generic method, explicit type arg: h.sized(i32) // 3. generic method, inferred from val: h.taking(99) #import "modules/std.sx"; Holder :: struct { - n: s64; + n: i64; - plain :: (self: *Holder) -> s64 { self.n } - sized :: (self: *Holder, $T: Type) -> s64 { size_of(T) } + plain :: (self: *Holder) -> i64 { self.n } + sized :: (self: *Holder, $T: Type) -> i64 { size_of(T) } taking :: (self: *Holder, $T: Type, v: T) -> T { v } } -main :: () -> s32 { +main :: () -> i32 { h : *Holder = xx libc_malloc(size_of(Holder)); h.n = 7; print("plain: {}\n", h.plain()); - print("sized s32: {}\n", h.sized(s32)); - print("sized s64: {}\n", h.sized(s64)); - print("taking explicit: {}\n", h.taking(s32, 42)); + print("sized i32: {}\n", h.sized(i32)); + print("sized i64: {}\n", h.sized(i64)); + print("taking explicit: {}\n", h.taking(i32, 42)); print("taking inferred: {}\n", h.taking(99)); 0 } diff --git a/examples/0206-generics-generic-into-block.sx b/examples/0206-generics-generic-into-block.sx index c83e409..5288996 100644 --- a/examples/0206-generics-generic-into-block.sx +++ b/examples/0206-generics-generic-into-block.sx @@ -4,11 +4,11 @@ // dedicated `__invoke` `callconv(.c)` trampoline + Block literal // (via `#insert build_block_convert($args, $R);`). // -// This test exercises a closure shape (`Closure(s64, s64) -> void`) +// This test exercises a closure shape (`Closure(i64, i64) -> void`) // that has NO hand-rolled `Into(Block)` impl in // `library/modules/ffi/objc_block.sx`. Before step 5.2 lands, // `xx cl : Block` errors out with the "no Into(Block) for -// cl_s64_s64__void" focused diagnostic. After the generic impl +// cl_i64_i64__void" focused diagnostic. After the generic impl // lands, the same call resolves through the pack-shaped impl and // the per-shape trampoline ferries control back to the sx closure. // @@ -20,14 +20,14 @@ #import "modules/std.sx"; #import "modules/ffi/objc_block.sx"; -g_a: s64 = 0; -g_b: s64 = 0; +g_a: i64 = 0; +g_b: i64 = 0; -main :: () -> s32 { - cl := (a: s64, b: s64) => { g_a = a; g_b = b; }; +main :: () -> i32 { + cl := (a: i64, b: i64) => { g_a = a; g_b = b; }; blk : Block = xx cl; - invoke_fn : (*Block, s64, s64) -> void callconv(.c) = xx blk.invoke; + invoke_fn : (*Block, i64, i64) -> void callconv(.c) = xx blk.invoke; invoke_fn(@blk, 10, 20); if g_a != 10 { print("FAIL: g_a={}\n", g_a); return 1; } diff --git a/examples/0208-generics-value-param-type-function.sx b/examples/0208-generics-value-param-type-function.sx index fde668a..8e4fae2 100644 --- a/examples/0208-generics-value-param-type-function.sx +++ b/examples/0208-generics-value-param-type-function.sx @@ -1,9 +1,9 @@ // A type-RETURNING function with a value parameter (`$K: u32`) used as a TYPE -// annotation: `b : Make(N, s64)` where `Make :: ($K, $T) -> Type { return [K]T; }`. -// A named-const value arg (`Make(N, s64)`), a const-expression value arg -// (`Make(M + 1, s64)`), and the literal form (`Make(3, s64)`) all instantiate to -// the SAME type — the array copy `b : Make(3, s64) = a` type-checks only because -// the three spellings name one `[3]s64`. +// annotation: `b : Make(N, i64)` where `Make :: ($K, $T) -> Type { return [K]T; }`. +// A named-const value arg (`Make(N, i64)`), a const-expression value arg +// (`Make(M + 1, i64)`), and the literal form (`Make(3, i64)`) all instantiate to +// the SAME type — the array copy `b : Make(3, i64) = a` type-checks only because +// the three spellings name one `[3]i64`. // // Regression (issue 0083 / F0.4 attempt 6): the unknown-type checker walked the // value-param position as a type name ("unknown type 'N'"), and the @@ -19,14 +19,14 @@ M :: 2; Make :: ($K: u32, $T: Type) -> Type { return [K]T; } main :: () { - a : Make(N, s64) = ---; // named-const value param + a : Make(N, i64) = ---; // named-const value param a[0] = 10; a[1] = 20; a[2] = 30; print("named: len={} a0={} a2={}\n", a.len, a[0], a[2]); - e : Make(M + 1, s64) = ---; // const-expr value param (M + 1 == 3) + e : Make(M + 1, i64) = ---; // const-expr value param (M + 1 == 3) e[0] = 1; e[2] = 9; print("expr: len={} e2={}\n", e.len, e[2]); - b : Make(3, s64) = a; // same instantiation → array copy type-checks + b : Make(3, i64) = a; // same instantiation → array copy type-checks print("copy: len={} b2={}\n", b.len, b[2]); } diff --git a/examples/0209-generics-value-param-integral-float.sx b/examples/0209-generics-value-param-integral-float.sx index 01910e4..c244835 100644 --- a/examples/0209-generics-value-param-integral-float.sx +++ b/examples/0209-generics-value-param-integral-float.sx @@ -1,8 +1,8 @@ -// A generic value parameter (`$K: u32`) binds a literal (`Vec(3, s64)`) and an -// integral-float named const (`Vec(L, s64)` with `L : f64 : 4.0`) to the same +// A generic value parameter (`$K: u32`) binds a literal (`Vec(3, i64)`) and an +// integral-float named const (`Vec(L, i64)` with `L : f64 : 4.0`) to the same // integer a plain `4` would — the value-param arg folds through the shared // const-int evaluator, so the integral-float rule (F0.4 attempt 8, Agra ruling) -// reaches value params too. The folded value is the array length `[K]s64`. +// reaches value params too. The folded value is the array length `[K]i64`. // // The bind is range-checked against the declared `u32` (an out-of-range arg is a // clean compile error — see 1134); a valid in-range value binds normally. @@ -13,7 +13,7 @@ Vec :: struct ($K: u32, $T: Type) { data: [K]T; } L : f64 : 4.0; main :: () { - a : Vec(3, s64) = ---; // literal value param - b : Vec(L, s64) = ---; // integral-float named-const value param → 4 + a : Vec(3, i64) = ---; // literal value param + b : Vec(L, i64) = ---; // integral-float named-const value param → 4 print("a.len={} b.len={}\n", a.data.len, b.data.len); // 3 and 4 } diff --git a/examples/0210-generics-resolver-legacy-paths.sx b/examples/0210-generics-resolver-legacy-paths.sx index e85bc83..7cf53c7 100644 --- a/examples/0210-generics-resolver-legacy-paths.sx +++ b/examples/0210-generics-resolver-legacy-paths.sx @@ -1,7 +1,7 @@ // Resolver E1 lock: the bare-type-leaf cutover to the source-aware // `selectNominalLeaf` must NOT touch the NON-leaf type heads. A generic-struct -// instantiation (`Box(s32)`), a `Vector(N, T)` builtin, and a type-returning -// function (`Make(3, s64)`) are all resolved by `resolveTypeWithBindings` +// instantiation (`Box(i32)`), a `Vector(N, T)` builtin, and a type-returning +// function (`Make(3, i64)`) are all resolved by `resolveTypeWithBindings` // ABOVE the bare-name leaf switch (`resolveParameterizedWithBindings` / // `resolveTypeCallWithBindings` / the `Vector` builtin path), so they stay on // the legacy resolution and never reach `selectNominalLeaf`. Parameterized @@ -19,13 +19,13 @@ Make :: ($K: u32, $T: Type) -> Type { return [K]T; } N :: 3; main :: () { - b : Box(s32) = .{ value = 42 }; + b : Box(i32) = .{ value = 42 }; print("box: {}\n", b.value); v : Vector(4, f32) = .[1, 2, 3, 4]; print("vec: {} {}\n", v.x, v.w); - a : Make(N, s64) = ---; + a : Make(N, i64) = ---; a[0] = 10; a[2] = 30; print("typefn: len={} a0={} a2={}\n", a.len, a[0], a[2]); } diff --git a/examples/0211-generics-struct-alias-head-rich.sx b/examples/0211-generics-struct-alias-head-rich.sx index 761649a..acb189e 100644 --- a/examples/0211-generics-struct-alias-head-rich.sx +++ b/examples/0211-generics-struct-alias-head-rich.sx @@ -2,10 +2,10 @@ // and a generic struct, all re-exported by -facade.sx via alias decls. #import "modules/std.sx"; -helper :: () -> s64 { 7 } +helper :: () -> i64 { 7 } Thing :: struct { - v: s64; + v: i64; init :: () -> Thing { Thing.{ v = 42 } } } diff --git a/examples/0211-generics-struct-alias-head.sx b/examples/0211-generics-struct-alias-head.sx index 321a063..d8272e1 100644 --- a/examples/0211-generics-struct-alias-head.sx +++ b/examples/0211-generics-struct-alias-head.sx @@ -19,12 +19,12 @@ ChainAlias :: LocalAlias; main :: () { // Same-file alias: instantiation + field + method. - b := LocalAlias(s64).{ item = 3 }; + b := LocalAlias(i64).{ item = 3 }; print("field: {}\n", b.item); print("method: {}\n", b.get()); // Alias chain terminates at the template. - c := ChainAlias(s64).{ item = 11 }; + c := ChainAlias(i64).{ item = 11 }; print("chain: {}\n", c.item); // Alias as a type annotation head. @@ -36,7 +36,7 @@ main :: () { print("helper: {}\n", helper()); t := Thing.init(); print("thing: {}\n", t.v); - f := Box(s64).{ item = 7 }; + f := Box(i64).{ item = 7 }; print("facade: {}\n", f.get()); x : Box(string) = .{ item = "qq" }; print("facade-annot: {}\n", x.item); diff --git a/examples/0212-generics-array-arg-slice-param.sx b/examples/0212-generics-array-arg-slice-param.sx index f525fbb..9258015 100644 --- a/examples/0212-generics-array-arg-slice-param.sx +++ b/examples/0212-generics-array-arg-slice-param.sx @@ -10,7 +10,7 @@ #import "modules/std.sx"; -P :: struct { x: s64; y: s64; } +P :: struct { x: i64; y: i64; } first :: (xs: []$T) -> T { return xs[0]; @@ -20,8 +20,8 @@ last :: (xs: []$T) -> T { return xs[xs.len - 1]; } -main :: () -> s32 { - a : [3]s64 = ---; +main :: () -> i32 { + a : [3]i64 = ---; a[0] = 7; a[1] = 8; a[2] = 9; print("{}\n", first(a)); print("{}\n", last(a)); @@ -35,7 +35,7 @@ main :: () -> s32 { ps[1] = .{ x = 3, y = 4 }; print("{}\n", first(ps).y); - s : []s64 = a; + s : []i64 = a; print("{}\n", first(s)); return 0; } diff --git a/examples/0213-generics-namespaced-call-result.sx b/examples/0213-generics-namespaced-call-result.sx index 3d72697..b3638bf 100644 --- a/examples/0213-generics-namespaced-call-result.sx +++ b/examples/0213-generics-namespaced-call-result.sx @@ -5,9 +5,9 @@ m :: #import "0213-generics-namespaced-call-result/m.sx"; main :: () { - print("{}\n", m.pick(3, 9)); // s64 binding + print("{}\n", m.pick(3, 9)); // i64 binding print("{}\n", m.pick(1.5, 0.25)); // f64 binding v := m.double(21); - w : s64 = v + 0; // the concrete type flows onward + w : i64 = v + 0; // the concrete type flows onward print("{}\n", w); } diff --git a/examples/0300-closures-lambda.sx b/examples/0300-closures-lambda.sx index b77f201..59b5726 100644 --- a/examples/0300-closures-lambda.sx +++ b/examples/0300-closures-lambda.sx @@ -1,7 +1,7 @@ #import "modules/std.sx"; main :: () { - fx :: (s:s3) -> s3 { + fx :: (s:i3) -> i3 { s } diff --git a/examples/0301-closures-fn-pointers.sx b/examples/0301-closures-fn-pointers.sx index 0d805d4..84ebb49 100644 --- a/examples/0301-closures-fn-pointers.sx +++ b/examples/0301-closures-fn-pointers.sx @@ -1,15 +1,15 @@ #import "modules/std.sx"; -add :: (a: s32, b: s32) -> s32 { a + b } -mul :: (a: s32, b: s32) -> s32 { a * b } +add :: (a: i32, b: i32) -> i32 { a + b } +mul :: (a: i32, b: i32) -> i32 { a * b } -apply :: (f: (s32, s32) -> s32, x: s32, y: s32) -> s32 { +apply :: (f: (i32, i32) -> i32, x: i32, y: i32) -> i32 { f(x, y) } main :: () { // Store function in variable - fp : (s32, s32) -> s32 = add; + fp : (i32, i32) -> i32 = add; print("fp(3,4) = {}\n", fp(3, 4)); // Reassign to different function diff --git a/examples/0302-closures-closures.sx b/examples/0302-closures-closures.sx index 5439a0c..3b6a83e 100644 --- a/examples/0302-closures-closures.sx +++ b/examples/0302-closures-closures.sx @@ -3,45 +3,45 @@ // --- Closure Basics --- // Factory: returns a new closure each time -make_adder :: (n: s64) -> Closure(s64) -> s64 { - return closure((x: s64) -> s64 => x + n); +make_adder :: (n: i64) -> Closure(i64) -> i64 { + return closure((x: i64) -> i64 => x + n); } -// Higher-order function: accepts any Closure(s64) -> s64 -apply :: (f: Closure(s64) -> s64, x: s64) -> s64 { return f(x); } +// Higher-order function: accepts any Closure(i64) -> i64 +apply :: (f: Closure(i64) -> i64, x: i64) -> i64 { return f(x); } // Reduce: fold over a slice with a closure -reduce :: (arr: []s64, f: Closure(s64, s64) -> s64, init: s64) -> s64 { +reduce :: (arr: []i64, f: Closure(i64, i64) -> i64, init: i64) -> i64 { acc := init; - i : s64 = 0; + i : i64 = 0; while i < arr.len { acc = f(acc, arr[i]); i += 1; } return acc; } // Auto-promoted bare function -triple :: (x: s64) -> s64 { return x * 3; } +triple :: (x: i64) -> i64 { return x * 3; } // Struct with optional closure callback Widget :: struct { name: string; - on_update: ?Closure(s64) -> void; + on_update: ?Closure(i64) -> void; } main :: () { // 1. Basic closure with capture offset := 100; - add_offset := closure((x: s64) -> s64 => x + offset); + add_offset := closure((x: i64) -> i64 => x + offset); print("basic: {}\n", add_offset(42)); // 2. Capture by value (snapshot semantics) n := 10; - snap := closure((x: s64) -> s64 => x + n); + snap := closure((x: i64) -> i64 => x + n); n = 999; print("snapshot: {}\n", snap(5)); // 3. Block-body closure with control flow - clamp := closure((x: s64) -> s64 { + clamp := closure((x: i64) -> i64 { if x < 0 { return 0; } if x > 100 { return 100; } return x; @@ -65,26 +65,26 @@ main :: () { // 7. Closure passed to higher-order function factor := 4; - print("hof: {}\n", apply(closure((x: s64) -> s64 => x * factor), 10)); + print("hof: {}\n", apply(closure((x: i64) -> i64 => x * factor), 10)); // 8. Reduce with closure - nums : []s64 = .[1, 2, 3, 4, 5]; - total := reduce(nums, closure((acc: s64, x: s64) -> s64 => acc + x), 0); + nums : []i64 = .[1, 2, 3, 4, 5]; + total := reduce(nums, closure((acc: i64, x: i64) -> i64 => acc + x), 0); print("reduce: {}\n", total); // 9. Closure captures closure - inner := closure((x: s64) -> s64 => x + 10); - outer := closure((x: s64) -> s64 => inner(x) * 2); + inner := closure((x: i64) -> i64 => x + 10); + outer := closure((x: i64) -> i64 => inner(x) * 2); print("compose: {}\n", outer(5)); // 10. Multiple closures from same scope base := 100; - cl_add := closure((x: s64) -> s64 => x + base); - cl_mul := closure((x: s64) -> s64 => x * base); + cl_add := closure((x: i64) -> i64 => x + base); + cl_mul := closure((x: i64) -> i64 => x * base); print("multi: {} {}\n", cl_add(5), cl_mul(5)); // 11. Optional closures - w1 := Widget.{ name = "slider", on_update = closure((val: s64) { + w1 := Widget.{ name = "slider", on_update = closure((val: i64) { print("widget: {} = {}\n", "slider", val); }) }; w2 := Widget.{ name = "label", on_update = null }; diff --git a/examples/0303-closures-closure-returning-protocol.sx b/examples/0303-closures-closure-returning-protocol.sx index fed5344..e39b281 100644 --- a/examples/0303-closures-closure-returning-protocol.sx +++ b/examples/0303-closures-closure-returning-protocol.sx @@ -4,12 +4,12 @@ #import "modules/std.sx"; MyProtocol :: protocol { - get_value :: () -> s64; + get_value :: () -> i64; } -MyImpl :: struct { value: s64; } +MyImpl :: struct { value: i64; } impl MyProtocol for MyImpl { - get_value :: (self: *MyImpl) -> s64 { self.value } + get_value :: (self: *MyImpl) -> i64 { self.value } } make_thing :: () -> MyProtocol { diff --git a/examples/0304-closures-enum-arg-through-closure-field.sx b/examples/0304-closures-enum-arg-through-closure-field.sx index 756426d..badf661 100644 --- a/examples/0304-closures-enum-arg-through-closure-field.sx +++ b/examples/0304-closures-enum-arg-through-closure-field.sx @@ -9,9 +9,9 @@ Ctx :: struct { on: Closure(Fmt) -> void; } -main :: () -> s32 { +main :: () -> i32 { c : Ctx = .{ on = (f: Fmt) => { - n : s64 = xx f; + n : i64 = xx f; print("cl f = {}\n", n); }}; c.on(.b); diff --git a/examples/0305-closures-closure-field-call-via-self-ptr.sx b/examples/0305-closures-closure-field-call-via-self-ptr.sx index 87eab7e..905ad55 100644 --- a/examples/0305-closures-closure-field-call-via-self-ptr.sx +++ b/examples/0305-closures-closure-field-call-via-self-ptr.sx @@ -27,9 +27,9 @@ Holder :: struct { } } -ticks : s32 = 0; +ticks : i32 = 0; -main :: () -> s32 { +main :: () -> i32 { h : Holder = .{}; h.set(() => { ticks += 1; }); diff --git a/examples/0306-closures-closure-env-routes-through-context-allocator.sx b/examples/0306-closures-closure-env-routes-through-context-allocator.sx index 1d5b4cb..44b6c16 100644 --- a/examples/0306-closures-closure-env-routes-through-context-allocator.sx +++ b/examples/0306-closures-closure-env-routes-through-context-allocator.sx @@ -12,7 +12,7 @@ #import "modules/std.sx"; Tracer :: struct { - count: s64; + count: i64; init :: () -> *Tracer { t : *Tracer = xx libc_malloc(size_of(Tracer)); @@ -22,7 +22,7 @@ Tracer :: struct { } impl Allocator for Tracer { - alloc_bytes :: (self: *Tracer, size: s64) -> *void { + alloc_bytes :: (self: *Tracer, size: i64) -> *void { self.count += 1; return libc_malloc(size); } @@ -31,15 +31,15 @@ impl Allocator for Tracer { } } -main :: () -> s32 { +main :: () -> i32 { tracer := Tracer.init(); push Context.{ allocator = xx tracer, data = null } { // Capturing closure. lowerLambda allocates an env struct on the // stack, copies the captures in, then heap-copies the env via // `allocViaContext` — which dispatches through the installed // tracer's `alloc`. - captured : s64 = 100; - add_capture := closure((y: s64) -> s64 => y + captured); + captured : i64 = 100; + add_capture := closure((y: i64) -> i64 => y + captured); _ = add_capture(1); } print("Tracer.count = {}\n", tracer.count); diff --git a/examples/0307-closures-closure-contextual-params.sx b/examples/0307-closures-closure-contextual-params.sx index f9b5eb3..183047d 100644 --- a/examples/0307-closures-closure-contextual-params.sx +++ b/examples/0307-closures-closure-contextual-params.sx @@ -2,27 +2,27 @@ // params. An untyped lambda `(a, b, c) => ...` takes each param's type // positionally from the expected `Closure(T0, T1, T2) -> R` signature, in both // assignment and argument position. (Previously only the first param — or -// all-same-typed params — resolved; trailing params silently defaulted to s64.) +// all-same-typed params — resolved; trailing params silently defaulted to i64.) #import "modules/std.sx"; // argument-position: lambda typed from the parameter's closure type. -apply2 :: (f: Closure(s64, string) -> s64, x: s64, s: string) -> s64 { +apply2 :: (f: Closure(i64, string) -> i64, x: i64, s: string) -> i64 { return f(x, s); } -apply3 :: (f: Closure(s64, s64, string) -> s64, a: s64, b: s64, c: string) -> s64 { +apply3 :: (f: Closure(i64, i64, string) -> i64, a: i64, b: i64, c: string) -> i64 { return f(a, b, c); } -main :: () -> s32 { - // assignment-position, mixed (s64, string) params — `b` is string. - cb : Closure(s64, string) -> s64 = (a, b) => a + b.len; +main :: () -> i32 { + // assignment-position, mixed (i64, string) params — `b` is string. + cb : Closure(i64, string) -> i64 = (a, b) => a + b.len; print("cb={}\n", cb(10, "hello")); // 10 + 5 = 15 // argument-position, 2 params. print("r={}\n", apply2((a, b) => a + b.len, 10, "hello")); // 15 - // argument-position, 3 params (s64, s64, string). + // argument-position, 3 params (i64, i64, string). print("q={}\n", apply3((a, b, c) => a + b + c.len, 1, 2, "xyz")); // 1+2+3 = 6 0 } diff --git a/examples/0308-closures-arrow-inferred-return.sx b/examples/0308-closures-arrow-inferred-return.sx index f5935a6..4fd5ba2 100644 --- a/examples/0308-closures-arrow-inferred-return.sx +++ b/examples/0308-closures-arrow-inferred-return.sx @@ -9,14 +9,14 @@ #import "modules/std.sx"; -dbl :: (x: s32) => x * 2; // top-level arrow, inferred return -inc :: (x: s32) { return x + 1; } // top-level block, inferred via `return` +dbl :: (x: i32) => x * 2; // top-level arrow, inferred return +inc :: (x: i32) { return x + 1; } // top-level block, inferred via `return` main :: () { print("{}\n", dbl(7)); // 14 print("{}\n", inc(41)); // 42 - tripl :: (x: s32) => x * 3; // local arrow, inferred return + tripl :: (x: i32) => x * 3; // local arrow, inferred return print("{}\n", tripl(4)); // 12 half :: (x: f32) => x / 2.0; // inferred float return diff --git a/examples/0309-closures-literal-as-bare-fn-param.sx b/examples/0309-closures-literal-as-bare-fn-param.sx index 0205eb1..e9cb793 100644 --- a/examples/0309-closures-literal-as-bare-fn-param.sx +++ b/examples/0309-closures-literal-as-bare-fn-param.sx @@ -7,11 +7,11 @@ #import "modules/std.sx"; -apply :: (f: (s64) -> s64) -> s64 { return f(5); } -twice :: (f: (s64) -> s64, x: s64) -> s64 { return f(f(x)); } +apply :: (f: (i64) -> i64) -> i64 { return f(5); } +twice :: (f: (i64) -> i64, x: i64) -> i64 { return f(f(x)); } main :: () { - print("block={}\n", apply(closure((x: s64) -> s64 { return x * 2; }))); // 10 - print("arrow={}\n", apply(closure((x: s64) -> s64 => x * 2))); // 10 - print("twice={}\n", twice(closure((x: s64) -> s64 => x + 3), 1)); // ((1+3)+3) = 7 + print("block={}\n", apply(closure((x: i64) -> i64 { return x * 2; }))); // 10 + print("arrow={}\n", apply(closure((x: i64) -> i64 => x * 2))); // 10 + print("twice={}\n", twice(closure((x: i64) -> i64 => x + 3), 1)); // ((1+3)+3) = 7 } diff --git a/examples/0310-closures-closure-literal-in-defer.sx b/examples/0310-closures-closure-literal-in-defer.sx index ac8f5f3..c7df699 100644 --- a/examples/0310-closures-closure-literal-in-defer.sx +++ b/examples/0310-closures-closure-literal-in-defer.sx @@ -10,13 +10,13 @@ run :: () { defer { - cb := (n: s32) -> s32 { return n * 2; }; + cb := (n: i32) -> i32 { return n * 2; }; print("defer closure: {}\n", cb(21)); // 42, at scope exit } print("body\n"); } -main :: () -> s32 { +main :: () -> i32 { run(); return 0; } diff --git a/examples/0400-protocols-impl-for-builtin.sx b/examples/0400-protocols-impl-for-builtin.sx index aa57b3b..fe7899f 100644 --- a/examples/0400-protocols-impl-for-builtin.sx +++ b/examples/0400-protocols-impl-for-builtin.sx @@ -1,4 +1,4 @@ -// impl Protocol for built-in scalar types (f32, s64, bool, u32, ...) — +// impl Protocol for built-in scalar types (f32, i64, bool, u32, ...) — // both static dispatch (`f32.lerp(...)`) and protocol-boxed dispatch via // `#inline` erasure. diff --git a/examples/0401-protocols-protocol-in-wrapper-struct.sx b/examples/0401-protocols-protocol-in-wrapper-struct.sx index 5790c01..fb0c598 100644 --- a/examples/0401-protocols-protocol-in-wrapper-struct.sx +++ b/examples/0401-protocols-protocol-in-wrapper-struct.sx @@ -5,12 +5,12 @@ #import "modules/std.sx"; Sizable :: protocol { - size :: () -> s64; + size :: () -> i64; } -Widget :: struct { value: s64; } +Widget :: struct { value: i64; } impl Sizable for Widget { - size :: (self: *Widget) -> s64 { self.value } + size :: (self: *Widget) -> i64 { self.value } } // Wrapper struct with a protocol field (like ViewChild) diff --git a/examples/0402-protocols-protocol-list-from-fn.sx b/examples/0402-protocols-protocol-list-from-fn.sx index b497df5..a6f916c 100644 --- a/examples/0402-protocols-protocol-list-from-fn.sx +++ b/examples/0402-protocols-protocol-list-from-fn.sx @@ -5,12 +5,12 @@ #import "modules/std.sx"; Sizable :: protocol { - size :: () -> s64; + size :: () -> i64; } -Leaf :: struct { value: s64; } +Leaf :: struct { value: i64; } impl Sizable for Leaf { - size :: (self: *Leaf) -> s64 { self.value } + size :: (self: *Leaf) -> i64 { self.value } } add :: (items: *List(Sizable), w: Leaf) { diff --git a/examples/0403-protocols-protocol-dispatch-via-fn-arg.sx b/examples/0403-protocols-protocol-dispatch-via-fn-arg.sx index 49a2bdc..3816e46 100644 --- a/examples/0403-protocols-protocol-dispatch-via-fn-arg.sx +++ b/examples/0403-protocols-protocol-dispatch-via-fn-arg.sx @@ -5,12 +5,12 @@ #import "modules/std.sx"; Sizable :: protocol { - size :: () -> s64; + size :: () -> i64; } -Leaf :: struct { value: s64; } +Leaf :: struct { value: i64; } impl Sizable for Leaf { - size :: (self: *Leaf) -> s64 { self.value } + size :: (self: *Leaf) -> i64 { self.value } } add :: (items: *List(Sizable), w: Leaf) { diff --git a/examples/0404-protocols-dot-shorthand-protocol-field.sx b/examples/0404-protocols-dot-shorthand-protocol-field.sx index 01080d6..2832aff 100644 --- a/examples/0404-protocols-dot-shorthand-protocol-field.sx +++ b/examples/0404-protocols-dot-shorthand-protocol-field.sx @@ -5,26 +5,26 @@ #import "modules/std.sx"; Drawable :: protocol { - draw :: () -> s32; + draw :: () -> i32; name :: () -> string; - layout :: (x: s32) -> s32; - handle :: (event: s32) -> bool; + layout :: (x: i32) -> i32; + handle :: (event: i32) -> bool; } -Circle :: struct { radius: s32; } +Circle :: struct { radius: i32; } impl Drawable for Circle { - draw :: (self: *Circle) -> s32 { self.radius } + draw :: (self: *Circle) -> i32 { self.radius } name :: (self: *Circle) -> string { "circle" } - layout :: (self: *Circle, x: s32) -> s32 { x + self.radius } - handle :: (self: *Circle, event: s32) -> bool { event > 0 } + layout :: (self: *Circle, x: i32) -> i32 { x + self.radius } + handle :: (self: *Circle, event: i32) -> bool { event > 0 } } -Square :: struct { side: s32; } +Square :: struct { side: i32; } impl Drawable for Square { - draw :: (self: *Square) -> s32 { self.side * self.side } + draw :: (self: *Square) -> i32 { self.side * self.side } name :: (self: *Square) -> string { "square" } - layout :: (self: *Square, x: s32) -> s32 { x + self.side } - handle :: (self: *Square, event: s32) -> bool { event > 1 } + layout :: (self: *Square, x: i32) -> i32 { x + self.side } + handle :: (self: *Square, event: i32) -> bool { event > 1 } } Rect :: struct { diff --git a/examples/0405-protocols-enum-through-protocol-dispatch.sx b/examples/0405-protocols-enum-through-protocol-dispatch.sx index 9b9495d..5aef554 100644 --- a/examples/0405-protocols-enum-through-protocol-dispatch.sx +++ b/examples/0405-protocols-enum-through-protocol-dispatch.sx @@ -12,17 +12,17 @@ Proto :: protocol { Impl :: struct {} impl Proto for Impl { take_fmt :: (self: *Impl, f: Fmt) { - n : s64 = xx f; + n : i64 = xx f; print("proto f = {}\n", n); } } -take :: (f: Fmt) -> s64 { - n : s64 = xx f; +take :: (f: Fmt) -> i64 { + n : i64 = xx f; n } -main :: () -> s32 { +main :: () -> i32 { print("direct a={} b={}\n", take(.a), take(.b)); p : Proto = xx @Impl.{}; diff --git a/examples/0406-protocols-protocol-real-pointer-return.sx b/examples/0406-protocols-protocol-real-pointer-return.sx index ecfaa52..5e78213 100644 --- a/examples/0406-protocols-protocol-real-pointer-return.sx +++ b/examples/0406-protocols-protocol-real-pointer-return.sx @@ -20,7 +20,7 @@ impl Proto for Impl { } } -main :: () -> s32 { +main :: () -> i32 { imp : Impl = .{}; p : Proto = xx @imp; raw : *u8 = p.get(); diff --git a/examples/0407-protocols-protocol-typeparam-parse.sx b/examples/0407-protocols-protocol-typeparam-parse.sx index 0f9a493..4789e6e 100644 --- a/examples/0407-protocols-protocol-typeparam-parse.sx +++ b/examples/0407-protocols-protocol-typeparam-parse.sx @@ -6,15 +6,15 @@ #import "modules/std.sx"; -MyTag :: struct { value: s64 = 0; } +MyTag :: struct { value: i64 = 0; } -impl Into(MyTag) for s64 { - convert :: (self: s64) -> MyTag { +impl Into(MyTag) for i64 { + convert :: (self: i64) -> MyTag { .{ value = self } } } -main :: () -> s32 { +main :: () -> i32 { print("ok\n"); 0 } diff --git a/examples/0408-protocols-optional-protocol.sx b/examples/0408-protocols-optional-protocol.sx index 5aa0c45..2cb845a 100644 --- a/examples/0408-protocols-optional-protocol.sx +++ b/examples/0408-protocols-optional-protocol.sx @@ -7,15 +7,15 @@ #import "modules/std.sx"; GPU :: protocol { - ping :: () -> s64; + ping :: () -> i64; } Impl :: struct {} impl GPU for Impl { - ping :: (self: *Impl) -> s64 { 42 } + ping :: (self: *Impl) -> i64 { 42 } } -main :: () -> s32 { +main :: () -> i32 { g : ?GPU = null; if g != null { print("BAD: g not null at start\n"); diff --git a/examples/0409-protocols-protocol-void-pointer-return.sx b/examples/0409-protocols-protocol-void-pointer-return.sx index f14fb9e..3be09c8 100644 --- a/examples/0409-protocols-protocol-void-pointer-return.sx +++ b/examples/0409-protocols-protocol-void-pointer-return.sx @@ -9,12 +9,12 @@ // `sizeof(target_type)` bytes from every `*void` return, mistaking // real pointers for Self-encoded boxes. Result was that // `alloc.alloc_bytes(64)` through an Allocator protocol value returned the -// first 4 bytes of malloc'd memory interpreted as `s32` (= 0 → null). +// first 4 bytes of malloc'd memory interpreted as `i32` (= 0 → null). #import "modules/std.sx"; #import "modules/std/mem.sx"; -main :: () -> s32 { +main :: () -> i32 { gpa := GPA.init(); alloc : Allocator = xx gpa; diff --git a/examples/0410-protocols-impl-visibility-impl.sx b/examples/0410-protocols-impl-visibility-impl.sx index d54e5af..cd61dd0 100644 --- a/examples/0410-protocols-impl-visibility-impl.sx +++ b/examples/0410-protocols-impl-visibility-impl.sx @@ -3,8 +3,8 @@ #import "modules/std.sx"; #import "./0410-protocols-impl-visibility-types.sx"; -impl Into(Wrap) for s64 { - convert :: (self: s64) -> Wrap { +impl Into(Wrap) for i64 { + convert :: (self: i64) -> Wrap { .{ v = self * 10 } } } diff --git a/examples/0410-protocols-impl-visibility-types.sx b/examples/0410-protocols-impl-visibility-types.sx index 5657465..40ec310 100644 --- a/examples/0410-protocols-impl-visibility-types.sx +++ b/examples/0410-protocols-impl-visibility-types.sx @@ -1,2 +1,2 @@ // Shared type for 179-impl-visibility — Wrap struct. -Wrap :: struct { v: s64 = 0; } +Wrap :: struct { v: i64 = 0; } diff --git a/examples/0410-protocols-impl-visibility-user.sx b/examples/0410-protocols-impl-visibility-user.sx index 9355bc3..8564795 100644 --- a/examples/0410-protocols-impl-visibility-user.sx +++ b/examples/0410-protocols-impl-visibility-user.sx @@ -3,7 +3,7 @@ #import "modules/std.sx"; #import "./0410-protocols-impl-visibility-types.sx"; -run_user :: () -> s32 { +run_user :: () -> i32 { w : Wrap = xx 7; print("user: w.v = {}\n", w.v); 0 diff --git a/examples/0410-protocols-impl-visibility.sx b/examples/0410-protocols-impl-visibility.sx index 139059a..f81c9a0 100644 --- a/examples/0410-protocols-impl-visibility.sx +++ b/examples/0410-protocols-impl-visibility.sx @@ -4,7 +4,7 @@ // transitively import the impl's defining module. // // Setup: -// - 179-impl-visibility-impl.sx declares an `impl Into(Wrap) for s64`. +// - 179-impl-visibility-impl.sx declares an `impl Into(Wrap) for i64`. // - 179-impl-visibility-user.sx tries `xx 7 : Wrap` but only // imports the shared types — NOT the impl module. // - The xx at the user-file site must produce a "no visible xx @@ -18,4 +18,4 @@ #import "./0410-protocols-impl-visibility-impl.sx"; #import "./0410-protocols-impl-visibility-user.sx"; -main :: () -> s32 { run_user() } +main :: () -> i32 { run_user() } diff --git a/examples/0411-protocols-impl-duplicate-impl-a.sx b/examples/0411-protocols-impl-duplicate-impl-a.sx index f6dd90e..ddd8e60 100644 --- a/examples/0411-protocols-impl-duplicate-impl-a.sx +++ b/examples/0411-protocols-impl-duplicate-impl-a.sx @@ -1,9 +1,9 @@ -// Helper A — one of two conflicting impls for the same (s64, Wrap) pair. +// Helper A — one of two conflicting impls for the same (i64, Wrap) pair. #import "modules/std.sx"; #import "./0411-protocols-impl-duplicate-types.sx"; -impl Into(Wrap) for s64 { - convert :: (self: s64) -> Wrap { +impl Into(Wrap) for i64 { + convert :: (self: i64) -> Wrap { .{ v = self * 10 } } } diff --git a/examples/0411-protocols-impl-duplicate-impl-b.sx b/examples/0411-protocols-impl-duplicate-impl-b.sx index 6441e48..cd32e77 100644 --- a/examples/0411-protocols-impl-duplicate-impl-b.sx +++ b/examples/0411-protocols-impl-duplicate-impl-b.sx @@ -1,9 +1,9 @@ -// Helper B — second conflicting impl for the same (s64, Wrap) pair. +// Helper B — second conflicting impl for the same (i64, Wrap) pair. #import "modules/std.sx"; #import "./0411-protocols-impl-duplicate-types.sx"; -impl Into(Wrap) for s64 { - convert :: (self: s64) -> Wrap { +impl Into(Wrap) for i64 { + convert :: (self: i64) -> Wrap { .{ v = self + 100 } } } diff --git a/examples/0411-protocols-impl-duplicate-types.sx b/examples/0411-protocols-impl-duplicate-types.sx index 4e4722e..9cb02da 100644 --- a/examples/0411-protocols-impl-duplicate-types.sx +++ b/examples/0411-protocols-impl-duplicate-types.sx @@ -1,2 +1,2 @@ // Shared type for 180-impl-duplicate. -Wrap :: struct { v: s64 = 0; } +Wrap :: struct { v: i64 = 0; } diff --git a/examples/0411-protocols-impl-duplicate.sx b/examples/0411-protocols-impl-duplicate.sx index 52fd198..aa0a433 100644 --- a/examples/0411-protocols-impl-duplicate.sx +++ b/examples/0411-protocols-impl-duplicate.sx @@ -5,8 +5,8 @@ // not silently pick one or the other. // // Setup: -// - 180-impl-duplicate-impl-a.sx: `impl Into(Wrap) for s64` (mul by 10). -// - 180-impl-duplicate-impl-b.sx: `impl Into(Wrap) for s64` (add 100). +// - 180-impl-duplicate-impl-a.sx: `impl Into(Wrap) for i64` (mul by 10). +// - 180-impl-duplicate-impl-b.sx: `impl Into(Wrap) for i64` (add 100). // - Main imports both; the `xx 7 : Wrap` site must error. // // Expected exit = 1, expected output = the focused diagnostic naming @@ -19,7 +19,7 @@ #import "./0411-protocols-impl-duplicate-impl-a.sx"; #import "./0411-protocols-impl-duplicate-impl-b.sx"; -main :: () -> s32 { +main :: () -> i32 { w : Wrap = xx 7; print("w.v = {}\n", w.v); 0 diff --git a/examples/0412-protocols-impl-duplicate-same-file.sx b/examples/0412-protocols-impl-duplicate-same-file.sx index 0efc0fe..1adff81 100644 --- a/examples/0412-protocols-impl-duplicate-same-file.sx +++ b/examples/0412-protocols-impl-duplicate-same-file.sx @@ -1,4 +1,4 @@ -// Duplicate impl detection (same-file) — two `impl Into(MyA) for s64` +// Duplicate impl detection (same-file) — two `impl Into(MyA) for i64` // declarations in the same file produce a "duplicate impl" diagnostic // at registration time, not silently shadow one with the other. Sibling // case to `examples/180-impl-duplicate.sx` which covers the @@ -6,14 +6,14 @@ #import "modules/std.sx"; -MyA :: struct { v: s64 = 0; } +MyA :: struct { v: i64 = 0; } -impl Into(MyA) for s64 { - convert :: (self: s64) -> MyA { .{ v = self } } +impl Into(MyA) for i64 { + convert :: (self: i64) -> MyA { .{ v = self } } } -impl Into(MyA) for s64 { - convert :: (self: s64) -> MyA { .{ v = self * 2 } } +impl Into(MyA) for i64 { + convert :: (self: i64) -> MyA { .{ v = self * 2 } } } -main :: () -> s32 { 0 } +main :: () -> i32 { 0 } diff --git a/examples/0413-protocols-parameterized-protocol-value.sx b/examples/0413-protocols-parameterized-protocol-value.sx index 1107bce..7683636 100644 --- a/examples/0413-protocols-parameterized-protocol-value.sx +++ b/examples/0413-protocols-parameterized-protocol-value.sx @@ -1,20 +1,20 @@ -// Phase 4.2 — parameterized protocol as a runtime VALUE type. `VL(s64)` is a +// Phase 4.2 — parameterized protocol as a runtime VALUE type. `VL(i64)` is a // 16-byte protocol value {ctx, vtable} (a plain protocol was already, but a // parameterized one used to resolve to a 0-field stub). A conforming struct // `xx`-erases into it, and method dispatch uses the bound type-arg -// (`get -> T` becomes `get -> s64` for `VL(s64)`). +// (`get -> T` becomes `get -> i64` for `VL(i64)`). #import "modules/std.sx"; VL :: protocol(T: Type) { get :: () -> T; } -IntCell :: struct { v: s64; } +IntCell :: struct { v: i64; } StrCell :: struct { s: string; } -impl VL(s64) for IntCell { get :: (self: *IntCell) -> s64 => self.v; } +impl VL(i64) for IntCell { get :: (self: *IntCell) -> i64 => self.v; } impl VL(string) for StrCell { get :: (self: *StrCell) -> string => self.s; } -main :: () -> s32 { - a : VL(s64) = xx IntCell.{ v = 42 }; - print("a.get={}\n", a.get()); // 42 (T = s64) +main :: () -> i32 { + a : VL(i64) = xx IntCell.{ v = 42 }; + print("a.get={}\n", a.get()); // 42 (T = i64) b : VL(string) = xx StrCell.{ s = "hi" }; print("b.get={}\n", b.get()); // hi (T = string) diff --git a/examples/0414-protocols-generic-struct-protocol-erase.sx b/examples/0414-protocols-generic-struct-protocol-erase.sx index a2045ec..a4a887a 100644 --- a/examples/0414-protocols-generic-struct-protocol-erase.sx +++ b/examples/0414-protocols-generic-struct-protocol-erase.sx @@ -2,16 +2,16 @@ // - A generic-struct impl method `self: *Box` now resolves `self.field` to the // concrete INSTANCE (the template name binds to the instance type), so // `self.x` works (was "field not found on type 'Box'"). -// - `xx c` erases a generic-struct instance (`Combined__s64_s64`) to a -// parameterized protocol (`VL(s64)`) via the generic +// - `xx c` erases a generic-struct instance (`Combined__i64_i64`) to a +// parameterized protocol (`VL(i64)`) via the generic // `impl VL($R) for Combined($R, ..$Ts)`: the thunk monomorphizes the // template method for the instance and dispatch works (was a trap). #import "modules/std.sx"; VL :: protocol(T: Type) { get :: () -> T; } -IntCell :: struct { v: s64; } -impl VL(s64) for IntCell { get :: (self: *IntCell) -> s64 => self.v; } +IntCell :: struct { v: i64; } +impl VL(i64) for IntCell { get :: (self: *IntCell) -> i64 => self.v; } Combined :: struct($R: Type, ..$Ts: []Type) { sources: (..VL(Ts)); @@ -19,14 +19,14 @@ Combined :: struct($R: Type, ..$Ts: []Type) { } impl VL($R) for Combined($R, ..$Ts) { get :: (self: *Combined) -> $R => self.value; } -make :: (..sources: VL) -> VL(s64) { - c : Combined(s64, ..sources.T) = ---; +make :: (..sources: VL) -> VL(i64) { + c : Combined(i64, ..sources.T) = ---; c.value = 99; c.sources = (..sources); - return xx c; // Combined__s64_s64 -> VL(s64) + return xx c; // Combined__i64_i64 -> VL(i64) } -main :: () -> s32 { +main :: () -> i32 { r := make(IntCell.{ v = 1 }); print("{}\n", r.get()); // 99 (dispatch through the erased Combined) 0 diff --git a/examples/0415-protocols-protocols.sx b/examples/0415-protocols-protocols.sx index 6f4a4e0..e2cc747 100644 --- a/examples/0415-protocols-protocols.sx +++ b/examples/0415-protocols-protocols.sx @@ -4,7 +4,7 @@ #import "modules/std/test.sx"; pkg :: #import "tests/fixtures/testpkg"; -Point :: struct { x, y: s32; } +Point :: struct { x, y: i32; } Color :: enum { red; green; blue; } @@ -16,7 +16,7 @@ Shape :: enum { Overlay :: union { f: f32; - i: s32; + i: i32; } Vec2 :: union { @@ -25,17 +25,17 @@ Vec2 :: union { } Defaults :: struct { - a: s32; - b: s32 = 99; - c: s32 = ---; + a: i32; + b: i32 = 99; + c: i32 = ---; } OptNode :: struct { - value: s32; - next: ?s32; + value: i32; + next: ?i32; } -OptInner :: struct { val: s32; } +OptInner :: struct { val: i32; } OptOuter :: struct { inner: ?OptInner; } @@ -49,23 +49,23 @@ WindowFlags :: enum flags u32 { vsync :: 64; resizable :: 4; hidden :: 128; } // --- Top-level functions --- -add :: (a: s32, b: s32) -> s32 { a + b } +add :: (a: i32, b: i32) -> i32 { a + b } -mul :: (a: s32, b: s32) -> s32 { a * b } +mul :: (a: i32, b: i32) -> i32 { a * b } identity :: (x: $T) -> T { x } -pair_add :: (a: $T, b: $U) -> s64 { - cast(s64) a + cast(s64) b +pair_add :: (a: $T, b: $U) -> i64 { + cast(i64) a + cast(i64) b } -typed_sum :: (..args: []s32) -> s32 { +typed_sum :: (..args: []i32) -> i32 { result := 0; for args (it) { result = result + it; } result } -apply :: (f: (s32, s32) -> s32, x: s32, y: s32) -> s32 { +apply :: (f: (i32, i32) -> i32, x: i32, y: i32) -> i32 { f(x, y) } @@ -73,11 +73,11 @@ void_return :: () { return; } -implicit_return :: (x: s32) -> s32 { +implicit_return :: (x: i32) -> i32 { x * 2 } -early_return :: (x: s32) -> s32 { +early_return :: (x: i32) -> i32 { if x > 10 { return 99; } x } @@ -86,7 +86,7 @@ vec3 :: (x: f32, y: f32, z: f32) -> Vector(3, f32) { .[x, y, z] } -point_sum :: (p: Point) -> s32 { p.x + p.y } +point_sum :: (p: Point) -> i32 { p.x + p.y } // #run compile-time constants @@ -100,19 +100,19 @@ CT_CHAIN :: #run add(CT_VAL, 5); // #run compile-time optional tests // #run compile-time optional tests -ct_opt_coalesce :: () -> s32 { - x: ?s32 = 42; - y: ?s32 = null; +ct_opt_coalesce :: () -> i32 { + x: ?i32 = 42; + y: ?i32 = null; return (x ?? 0) + (y ?? 99); } -ct_opt_unwrap :: () -> s32 { - x: ?s32 = 77; +ct_opt_unwrap :: () -> i32 { + x: ?i32 = 77; return x!; } -ct_opt_guard :: () -> s32 { - x: ?s32 = 10; +ct_opt_guard :: () -> i32 { + x: ?i32 = 10; if x == null { return -1; } return x; } @@ -141,7 +141,7 @@ SmokeErr :: error { Empty, BadDigit, Overflow } // value-carrying, named set: raise three tags or succeed // value-carrying, named set: raise three tags or succeed -sm_parse :: (n: s32) -> (s32, !SmokeErr) { +sm_parse :: (n: i32) -> (i32, !SmokeErr) { if n < 0 { raise error.BadDigit; } if n == 0 { raise error.Empty; } if n > 99 { raise error.Overflow; } @@ -159,7 +159,7 @@ sm_check :: (ok: bool) -> ! { // multi-value, inferred set: `try` propagates; the SCC pass absorbs SmokeErr // multi-value, inferred set: `try` propagates; the SCC pass absorbs SmokeErr -sm_pair :: (a: s32, b: s32) -> (s32, s32, !) { +sm_pair :: (a: i32, b: i32) -> (i32, i32, !) { x := try sm_parse(a); y := try sm_parse(b); return (x, y); @@ -168,7 +168,7 @@ sm_pair :: (a: s32, b: s32) -> (s32, s32, !) { // `catch` block that diverges (logs the tag, then returns a fallback) // `catch` block that diverges (logs the tag, then returns a fallback) -sm_or_default :: (n: s32) -> s32 { +sm_or_default :: (n: i32) -> i32 { return sm_parse(n) catch (e) { print(" logged {}\n", e); return -1; @@ -178,7 +178,7 @@ sm_or_default :: (n: s32) -> s32 { // `onfail` + `defer` interleave: cleanup runs only on the error path // `onfail` + `defer` interleave: cleanup runs only on the error path -sm_acquire :: (fail: bool) -> (s32, !) { +sm_acquire :: (fail: bool) -> (i32, !) { defer print(" smoke defer A\n"); onfail print(" smoke onfail B\n"); if fail { raise error.Acquire; } @@ -188,7 +188,7 @@ sm_acquire :: (fail: bool) -> (s32, !) { // `or`-chain: try a, fall to try b; propagate if both fail // `or`-chain: try a, fall to try b; propagate if both fail -sm_first :: (a: s32, b: s32) -> (s32, !) { +sm_first :: (a: i32, b: i32) -> (i32, !) { v := try sm_parse(a) or try sm_parse(b); return v; } @@ -198,52 +198,52 @@ sm_first :: (a: s32, b: s32) -> (s32, !) { // --- Foreign function binding --- libc :: #library "c"; -c_abs :: (n: s32) -> s32 #foreign libc "abs"; +c_abs :: (n: i32) -> i32 #foreign libc "abs"; // --- Protocol declarations (Phase 1: static dispatch only) --- Counter :: protocol { inc :: (); - get :: () -> s32; + get :: () -> i32; } Summable :: protocol { - sum :: () -> s32; + sum :: () -> i32; } -SimpleCounter :: struct { val: s32; } +SimpleCounter :: struct { val: i32; } impl Counter for SimpleCounter { inc :: (self: *SimpleCounter) { self.val += 1; } - get :: (self: *SimpleCounter) -> s32 { self.val } + get :: (self: *SimpleCounter) -> i32 { self.val } } impl Summable for Point { - sum :: (self: *Point) -> s32 { self.x + self.y } + sum :: (self: *Point) -> i32 { self.x + self.y } } // Phase 2: #inline protocol for dynamic dispatch // Phase 2: #inline protocol for dynamic dispatch Adder :: protocol #inline { - add :: (n: s32); - value :: () -> s32; + add :: (n: i32); + value :: () -> i32; } Accumulator :: struct { - total: s32; + total: i32; } impl Adder for Accumulator { - add :: (self: *Accumulator, n: s32) { self.total += n; } - value :: (self: *Accumulator) -> s32 { self.total } + add :: (self: *Accumulator, n: i32) { self.total += n; } + value :: (self: *Accumulator) -> i32 { self.total } } -Doubler :: struct { val: s32; } +Doubler :: struct { val: i32; } impl Adder for Doubler { - add :: (self: *Doubler, n: s32) { self.val = self.val + n + n; } - value :: (self: *Doubler) -> s32 { self.val } + add :: (self: *Doubler, n: i32) { self.val = self.val + n + n; } + value :: (self: *Doubler) -> i32 { self.val } } // Phase 4: default methods @@ -257,7 +257,7 @@ Repeater :: protocol { } } -Printer :: struct { count: s32; } +Printer :: struct { count: i32; } impl Repeater for Printer { say :: (self: *Printer, msg: string) { @@ -270,18 +270,18 @@ impl Repeater for Printer { // P4 edge: Chained default→default calls Chained :: protocol { - base :: (msg: string) -> s32; - wrap :: (msg: string) -> s32 { + base :: (msg: string) -> i32; + wrap :: (msg: string) -> i32 { self.base(msg) + 1 } - double_wrap :: (msg: string) -> s32 { + double_wrap :: (msg: string) -> i32 { self.wrap(msg) + self.wrap(msg) } } -ChainImpl :: struct { val: s32; } +ChainImpl :: struct { val: i32; } impl Chained for ChainImpl { - base :: (self: *ChainImpl, msg: string) -> s32 { + base :: (self: *ChainImpl, msg: string) -> i32 { self.val += 1; msg.len } @@ -310,8 +310,8 @@ impl Cloneable for Point { } } -impl Eq for s64 { - eq :: (self: *s64, other: s64) -> bool { +impl Eq for i64 { + eq :: (self: *i64, other: i64) -> bool { self.* == other } } @@ -324,11 +324,11 @@ are_equal :: ($T: Type/Eq, a: T, b: T) -> bool { } Hashable :: protocol { - hash :: () -> s64; + hash :: () -> i64; } impl Hashable for Point { - hash :: (self: *Point) -> s64 { + hash :: (self: *Point) -> i64 { xx self.x * 31 + xx self.y } } @@ -341,7 +341,7 @@ eq_and_hash :: ($T: Type/Eq/Hashable, a: T, b: T) -> bool { // P6.4: inline constraint syntax ($T/Protocol) // P6.4: inline constraint syntax ($T/Protocol) -sum_of_inline :: (a: $T/Summable, b: T) -> s32 { +sum_of_inline :: (a: $T/Summable, b: T) -> i32 { a.sum() + b.sum() } @@ -354,7 +354,7 @@ Pair :: struct ($T: Type) { } impl Summable for Pair($T) { - sum :: (self: *Pair(T)) -> s32 { + sum :: (self: *Pair(T)) -> i32 { xx self.a + xx self.b } } @@ -381,10 +381,10 @@ Phys :: struct { // Init block test struct Builder :: struct { - total: s32; - count: s32; + total: i32; + count: i32; - add :: (self: *Builder, val: s32) { + add :: (self: *Builder, val: i32) { self.total += val; self.count += 1; } @@ -393,9 +393,9 @@ Builder :: struct { // Global variable for address-of test // Global variable for address-of test -g_smoke_val : s32 = 42; +g_smoke_val : i32 = 42; -write_to_ptr :: (p: *s32) { +write_to_ptr :: (p: *i32) { p.* = 99; } @@ -433,7 +433,7 @@ main :: () { // P2.2: pass protocol value to function { - use_adder :: (a: Adder, n: s32) -> s32 { + use_adder :: (a: Adder, n: i32) -> i32 { a.add(n); a.value() } @@ -467,7 +467,7 @@ main :: () { // P3.2: vtable protocol passed to function { - use_counter :: (c: Counter) -> s32 { + use_counter :: (c: Counter) -> i32 { c.inc(); c.inc(); c.get() @@ -574,14 +574,14 @@ main :: () { // P7.1: impl for generic struct { - p := Pair(s32).{ a = 10, b = 20 }; + p := Pair(i32).{ a = 10, b = 20 }; print("P7.1: {}\n", p.sum()); } // P7.2: generic struct impl with different type arg { - p1 := Pair(s32).{ a = 3, b = 7 }; - p2 := Pair(s64).{ a = 100, b = 200 }; + p1 := Pair(i32).{ a = 3, b = 7 }; + p2 := Pair(i64).{ a = 100, b = 200 }; print("P7.2: {} {}\n", p1.sum(), p2.sum()); } @@ -603,14 +603,14 @@ main :: () { // P2.7: xx on inline struct literal (no intermediate variable) { - use_adder :: (a: Adder) -> s32 { a.add(10); a.value() } + use_adder :: (a: Adder) -> i32 { a.add(10); a.value() } result := use_adder(xx Accumulator.{ total = 5 }); print("P2.7: {}\n", result); } // P3.3: xx on inline struct literal with vtable protocol { - use_counter :: (c: Counter) -> s32 { c.inc(); c.inc(); c.get() } + use_counter :: (c: Counter) -> i32 { c.inc(); c.inc(); c.get() } result := use_counter(xx SimpleCounter.{ val = 100 }); print("P3.3: {}\n", result); } diff --git a/examples/0416-protocols-auto-type-erasure.sx b/examples/0416-protocols-auto-type-erasure.sx index 813ac65..f26d8e0 100644 --- a/examples/0416-protocols-auto-type-erasure.sx +++ b/examples/0416-protocols-auto-type-erasure.sx @@ -4,45 +4,45 @@ #import "modules/std/test.sx"; pkg :: #import "tests/fixtures/testpkg"; -Point :: struct { x, y: s32; } +Point :: struct { x, y: i32; } -add :: (a: s32, b: s32) -> s32 { a + b } +add :: (a: i32, b: i32) -> i32 { a + b } Counter :: protocol { inc :: (); - get :: () -> s32; + get :: () -> i32; } Summable :: protocol { - sum :: () -> s32; + sum :: () -> i32; } -SimpleCounter :: struct { val: s32; } +SimpleCounter :: struct { val: i32; } impl Counter for SimpleCounter { inc :: (self: *SimpleCounter) { self.val += 1; } - get :: (self: *SimpleCounter) -> s32 { self.val } + get :: (self: *SimpleCounter) -> i32 { self.val } } impl Summable for Point { - sum :: (self: *Point) -> s32 { self.x + self.y } + sum :: (self: *Point) -> i32 { self.x + self.y } } // Phase 2: #inline protocol for dynamic dispatch // Phase 2: #inline protocol for dynamic dispatch Adder :: protocol #inline { - add :: (n: s32); - value :: () -> s32; + add :: (n: i32); + value :: () -> i32; } Accumulator :: struct { - total: s32; + total: i32; } impl Adder for Accumulator { - add :: (self: *Accumulator, n: s32) { self.total += n; } - value :: (self: *Accumulator) -> s32 { self.total } + add :: (self: *Accumulator, n: i32) { self.total += n; } + value :: (self: *Accumulator) -> i32 { self.total } } main :: () { @@ -52,7 +52,7 @@ main :: () { // AE1: function argument — concrete passed where protocol expected (no xx) { - use_counter :: (c: Counter) -> s32 { c.inc(); c.inc(); c.get() } + use_counter :: (c: Counter) -> i32 { c.inc(); c.inc(); c.get() } sc := SimpleCounter.{ val = 10 }; result := use_counter(sc); print("AE1: {}\n", result); @@ -69,14 +69,14 @@ main :: () { // AE3: struct literal passed directly (no xx) { - use_counter :: (c: Counter) -> s32 { c.inc(); c.inc(); c.get() } + use_counter :: (c: Counter) -> i32 { c.inc(); c.inc(); c.get() } result := use_counter(SimpleCounter.{ val = 100 }); print("AE3: {}\n", result); } // AE4: explicit xx still works (not broken) { - use_counter :: (c: Counter) -> s32 { c.inc(); c.get() } + use_counter :: (c: Counter) -> i32 { c.inc(); c.get() } result := use_counter(xx SimpleCounter.{ val = 50 }); print("AE4: {}\n", result); } diff --git a/examples/0500-packs-varargs.sx b/examples/0500-packs-varargs.sx index bc66b57..b8bf036 100644 --- a/examples/0500-packs-varargs.sx +++ b/examples/0500-packs-varargs.sx @@ -1,6 +1,6 @@ #import "modules/std.sx"; -sum :: (..args: []s32) -> s32 { +sum :: (..args: []i32) -> i32 { result := 0; for args (it) { result = result + it; @@ -8,7 +8,7 @@ sum :: (..args: []s32) -> s32 { result } -print_all :: (..args: []s32) { +print_all :: (..args: []i32) { for args (it) { out(int_to_string(it)); out(" "); @@ -16,13 +16,13 @@ print_all :: (..args: []s32) { out("\n"); } -main :: () -> s32 { +main :: () -> i32 { out(int_to_string(sum(10, 20, 30))); out("\n"); print_all(1, 2, 3, 4, 5); - arr : [3]s32 = .[10, 20, 30]; + arr : [3]i32 = .[10, 20, 30]; out(int_to_string(sum(..arr))); out("\n"); diff --git a/examples/0501-packs-any-varargs.sx b/examples/0501-packs-any-varargs.sx index f6ac8ca..cd96bfe 100644 --- a/examples/0501-packs-any-varargs.sx +++ b/examples/0501-packs-any-varargs.sx @@ -1,8 +1,8 @@ #import "modules/std.sx"; Point :: struct { - x: s32; - y: s32; + x: i32; + y: i32; } // Print all arguments — accepts any type, dispatches via type-switch @@ -10,7 +10,7 @@ print_any :: (..args: []Any) { for args (it) { type := type_of(it); if type == { - case int: out(int_to_string(cast(s32) it)); + case int: out(int_to_string(cast(i32) it)); case string: out(cast(string) it); case bool: out(bool_to_string(cast(bool) it)); case float: out(float_to_string(cast(f64) it)); @@ -28,11 +28,11 @@ print_any :: (..args: []Any) { out("\n"); } -count :: (..args: []Any) -> s32 { +count :: (..args: []Any) -> i32 { args.len } -main :: () -> s32 { +main :: () -> i32 { print_any(42, "hello", true, 3.14); // Test with struct diff --git a/examples/0502-packs-pack-parse.sx b/examples/0502-packs-pack-parse.sx index a3b5eaf..2ebc37d 100644 --- a/examples/0502-packs-pack-parse.sx +++ b/examples/0502-packs-pack-parse.sx @@ -12,11 +12,11 @@ #import "modules/std.sx"; -foo :: (..$args) -> s64 { +foo :: (..$args) -> i64 { return 0; } -main :: () -> s32 { +main :: () -> i32 { print("pack parse ok\n"); return 0; } diff --git a/examples/0503-packs-pack-type-rep.sx b/examples/0503-packs-pack-type-rep.sx index 582d84e..51e6cba 100644 --- a/examples/0503-packs-pack-type-rep.sx +++ b/examples/0503-packs-pack-type-rep.sx @@ -17,7 +17,7 @@ takes_cb :: (cb: Closure(..$args) -> $R) -> void { } -main :: () -> s32 { +main :: () -> i32 { print("pack type rep ok\n"); return 0; } diff --git a/examples/0504-packs-pack-impl-match.sx b/examples/0504-packs-pack-impl-match.sx index 6f55795..99ebf53 100644 --- a/examples/0504-packs-pack-impl-match.sx +++ b/examples/0504-packs-pack-impl-match.sx @@ -15,10 +15,10 @@ // `$args` and `$R` to the concrete source closure's tail types // and return; monomorphisation proceeds against those bindings. // -// The `Closure(s32, bool) -> bool` shape is not covered by +// The `Closure(i32, bool) -> bool` shape is not covered by // stdlib's hand-rolled impls (only `Closure() -> void` and // `Closure(bool) -> void`) and not covered by 96-block-multi-arg's -// `Closure(s32, *void) -> void` impl, so the pack impl is the +// `Closure(i32, *void) -> void` impl, so the pack impl is the // only candidate. #import "modules/std.sx"; @@ -38,8 +38,8 @@ impl Into(Block) for Closure(..$args) -> $R { } } -main :: () -> s32 { - cl := (a: s32, b: bool) => true; +main :: () -> i32 { + cl := (a: i32, b: bool) => true; b : *Block = xx cl; print("pack impl match ok\n"); return 0; diff --git a/examples/0505-packs-pack-typed-index.sx b/examples/0505-packs-pack-typed-index.sx index a944582..205d4eb 100644 --- a/examples/0505-packs-pack-typed-index.sx +++ b/examples/0505-packs-pack-typed-index.sx @@ -20,11 +20,11 @@ #import "modules/std.sx"; -Point :: struct { x: s64; y: s64; } +Point :: struct { x: i64; y: i64; } -get_x :: (..$args) -> s64 => args[0].x; +get_x :: (..$args) -> i64 => args[0].x; -main :: () -> s32 { +main :: () -> i32 { p := Point.{ x = 7, y = 9 }; n := get_x(p); print("{}\n", n); diff --git a/examples/0506-packs-pack-if-return.sx b/examples/0506-packs-pack-if-return.sx index fb770f8..fdb09e3 100644 --- a/examples/0506-packs-pack-if-return.sx +++ b/examples/0506-packs-pack-if-return.sx @@ -25,14 +25,14 @@ #import "modules/std.sx"; -maybe :: (..$args) -> s64 { +maybe :: (..$args) -> i64 { if args.len > 0 { return 42; } return -1; } -main :: () -> s32 { +main :: () -> i32 { print("{}\n", maybe()); // expect -1 print("{}\n", maybe(99)); // expect 42 return 0; diff --git a/examples/0507-packs-pack-mono-dedup.sx b/examples/0507-packs-pack-mono-dedup.sx index 82cdf2e..3513d29 100644 --- a/examples/0507-packs-pack-mono-dedup.sx +++ b/examples/0507-packs-pack-mono-dedup.sx @@ -5,9 +5,9 @@ // the distinct mono symbols: // // call @count__pack(ctx) -// call @count__pack_s64(ctx, 1) -// call @count__pack_s64(ctx, 2) ← shares with the 1-arg s64 call -// call @count__pack_s64_s64_s64(ctx, 1, 2, 3) +// call @count__pack_i64(ctx, 1) +// call @count__pack_i64(ctx, 2) ← shares with the 1-arg i64 call +// call @count__pack_i64_i64_i64(ctx, 1, 2, 3) // call @count__pack_string_bool(ctx, ..) // // Before step 2b, each call inlined a fresh copy of the body into @@ -17,9 +17,9 @@ #import "modules/std.sx"; -count :: (..$args) -> s64 => args.len; +count :: (..$args) -> i64 => args.len; -main :: () -> s32 { +main :: () -> i32 { a := count(); b := count(1); c := count(2); diff --git a/examples/0508-packs-pack-generic-ret.sx b/examples/0508-packs-pack-generic-ret.sx index 9e863ef..c8f1bfb 100644 --- a/examples/0508-packs-pack-generic-ret.sx +++ b/examples/0508-packs-pack-generic-ret.sx @@ -15,9 +15,9 @@ first :: (..$args) -> $R => args[0]; -main :: () -> s32 { - a : s64 = first(42); - b : s64 = first(99); +main :: () -> i32 { + a : i64 = first(42); + b : i64 = first(99); print("{} {}\n", a, b); return 0; } diff --git a/examples/0509-packs-pack-hetero-ret.sx b/examples/0509-packs-pack-hetero-ret.sx index d1d6883..212a746 100644 --- a/examples/0509-packs-pack-hetero-ret.sx +++ b/examples/0509-packs-pack-hetero-ret.sx @@ -8,7 +8,7 @@ // Exercises: // - generic `$R` inference for non-zeroth pack indices. // - heterogeneous mixed-type call args binding into distinct -// types per position (s64, f64, string). +// types per position (i64, f64, string). // - `pack_arg_types` type-only binding for `inferExprType` // pre-mono-scope: without it, the synthesized-ident detour // loses the type because the scope isn't set up yet during @@ -18,7 +18,7 @@ foo :: (..$args) -> $R => args[2]; -main :: () -> s32 { +main :: () -> i32 { a := foo(42, 3.2, "hello"); print("{}\n", a); return 0; diff --git a/examples/0510-packs-pack-index-oob.sx b/examples/0510-packs-pack-index-oob.sx index 043268f..8812027 100644 --- a/examples/0510-packs-pack-index-oob.sx +++ b/examples/0510-packs-pack-index-oob.sx @@ -13,8 +13,8 @@ foo :: (..$args) -> $R => args[2]; -main :: () -> s32 { - n : s64 = foo(99); +main :: () -> i32 { + n : i64 = foo(99); print("{}\n", n); return 0; } diff --git a/examples/0511-packs-pack-bare-args.sx b/examples/0511-packs-pack-bare-args.sx index 07ed348..3f8285c 100644 --- a/examples/0511-packs-pack-bare-args.sx +++ b/examples/0511-packs-pack-bare-args.sx @@ -8,16 +8,16 @@ #import "modules/std.sx"; -log_count :: (items: []Any) -> s64 { +log_count :: (items: []Any) -> i64 { return items.len; } // Slice variadic: `args` is a runtime []Any, forwarded directly. -forward :: (..args: []Any) -> s64 { +forward :: (..args: []Any) -> i64 { return log_count(args); } -main :: () -> s32 { +main :: () -> i32 { print("{}\n", forward(1, "hi", 2.5)); return 0; } diff --git a/examples/0512-packs-pack-runtime-index.sx b/examples/0512-packs-pack-runtime-index.sx index d68ec05..489ab20 100644 --- a/examples/0512-packs-pack-runtime-index.sx +++ b/examples/0512-packs-pack-runtime-index.sx @@ -11,9 +11,9 @@ #import "modules/std.sx"; -count_anys :: (..$args) -> s64 { - total : s64 = 0; - i : s64 = 0; +count_anys :: (..$args) -> i64 { + total : i64 = 0; + i : i64 = 0; while i < args.len { x : Any = args[i]; // ERROR: runtime index into a comptime-only pack _ = x; @@ -23,7 +23,7 @@ count_anys :: (..$args) -> s64 { return total; } -main :: () -> s32 { +main :: () -> i32 { print("{}\n", count_anys(10, "hi", 2.5, true)); return 0; } diff --git a/examples/0513-packs-pack-mixed-comptime.sx b/examples/0513-packs-pack-mixed-comptime.sx index a49adf9..0dea3c6 100644 --- a/examples/0513-packs-pack-mixed-comptime.sx +++ b/examples/0513-packs-pack-mixed-comptime.sx @@ -5,7 +5,7 @@ // comptime param with the trailing pack — they fall through // to the inline `lowerComptimeCall` path. The inline path // doesn't bind non-string comptime params as runtime locals, -// so a body that uses both `$tag` (s32) AND `..$args` fails +// so a body that uses both `$tag` (i32) AND `..$args` fails // at the bare-name lookup of `tag`. // // Next commit relaxes `isPackFn` to accept "exactly one @@ -18,11 +18,11 @@ #import "modules/std.sx"; -tagged :: ($tag: s32, ..$args) -> s64 { +tagged :: ($tag: i32, ..$args) -> i64 { return tag * 100 + args.len; } -main :: () -> s32 { +main :: () -> i32 { print("{}\n", tagged(7, 1, 2, 3)); // 7*100 + 3 = 703 print("{}\n", tagged(9)); // 9*100 + 0 = 900 return 0; diff --git a/examples/0514-packs-pack-type-position.sx b/examples/0514-packs-pack-type-position.sx index f1f1912..efc73a1 100644 --- a/examples/0514-packs-pack-type-position.sx +++ b/examples/0514-packs-pack-type-position.sx @@ -29,11 +29,11 @@ swap_take :: (..$args) -> $args[0] { return args[0]; } -main :: () -> s32 { +main :: () -> i32 { // Heterogeneous call shapes — each picks a different concrete // pair, gets its own mono. - a : s64 = swap_take(42, "ignored"); // $args[0] = s64, $args[1] = string - b : string = swap_take("first", 99); // $args[0] = string, $args[1] = s64 + a : i64 = swap_take(42, "ignored"); // $args[0] = i64, $args[1] = string + b : string = swap_take("first", 99); // $args[0] = string, $args[1] = i64 print("{} {}\n", a, b); return 0; } diff --git a/examples/0515-packs-pack-type-position-three.sx b/examples/0515-packs-pack-type-position-three.sx index 20688ce..0587fed 100644 --- a/examples/0515-packs-pack-type-position-three.sx +++ b/examples/0515-packs-pack-type-position-three.sx @@ -6,15 +6,15 @@ // - Three distinct call shapes get three distinct monos. // - The return-type slot is correctly substituted per-mono so // the inferred caller type matches what the body actually -// returns (string / s64 / bool here). +// returns (string / i64 / bool here). #import "modules/std.sx"; third :: (..$args) -> $args[2] => args[2]; -main :: () -> s32 { - a := third(1, 2, "third"); // (s64, s64, string) → "third" - b := third(true, 3.14, 99); // (bool, f64, s64) → 99 +main :: () -> i32 { + a := third(1, 2, "third"); // (i64, i64, string) → "third" + b := third(true, 3.14, 99); // (bool, f64, i64) → 99 c := third("a", "b", false); // (string, string, bool) → false print("{} {} {}\n", a, b, c); return 0; diff --git a/examples/0516-packs-pack-type-fnptr.sx b/examples/0516-packs-pack-type-fnptr.sx index dcd14e8..f3da54d 100644 --- a/examples/0516-packs-pack-type-fnptr.sx +++ b/examples/0516-packs-pack-type-fnptr.sx @@ -16,15 +16,15 @@ #import "modules/std.sx"; // Two concrete handlers that match the per-mono fn-pointer shape. -double_s64 :: (env: *void, x: s64) -> s64 => x * 2; +double_i64 :: (env: *void, x: i64) -> i64 => x * 2; via_fnptr :: (..$args) -> $args[1] { - fp : (*void, $args[0]) -> $args[1] = double_s64; + fp : (*void, $args[0]) -> $args[1] = double_i64; return fp(null, args[0]); } -main :: () -> s32 { - n := via_fnptr(7, 0); // (s64, s64) → fp : (*void, s64) -> s64 +main :: () -> i32 { + n := via_fnptr(7, 0); // (i64, i64) → fp : (*void, i64) -> i64 print("{}\n", n); return 0; } diff --git a/examples/0517-packs-pack-reflection-intrinsics.sx b/examples/0517-packs-pack-reflection-intrinsics.sx index 23d5c53..bbc5547 100644 --- a/examples/0517-packs-pack-reflection-intrinsics.sx +++ b/examples/0517-packs-pack-reflection-intrinsics.sx @@ -15,7 +15,7 @@ // // `has_impl`'s protocol arg accepts both shapes: // - plain protocol name: `has_impl(Allocator, CAllocator)`. -// - parameterised call: `has_impl(Wrap(s64), s32)` — the args +// - parameterised call: `has_impl(Wrap(i64), i32)` — the args // match the impl's protocol type-args exactly. #import "modules/std.sx"; @@ -27,23 +27,23 @@ Wrap :: protocol(Target: Type) { wrap :: () -> Target; } -impl Wrap(s64) for s32 { - wrap :: (self: s32) -> s64 => xx self; +impl Wrap(i64) for i32 { + wrap :: (self: i32) -> i64 => xx self; } -main :: () -> s32 { +main :: () -> i32 { // type_name — display names. - print("{} {} {}\n", type_name(s64), type_name(string), type_name(bool)); + print("{} {} {}\n", type_name(i64), type_name(string), type_name(bool)); // type_eq — structural equality on TypeIds. print("{} {} {} {}\n", - type_eq(s64, s64), - type_eq(s64, string), - type_eq(*s64, *s64), - type_eq(*s64, *s32)); + type_eq(i64, i64), + type_eq(i64, string), + type_eq(*i64, *i64), + type_eq(*i64, *i32)); // inline-if folds type_eq at lower time. - inline if type_eq(s64, s64) { + inline if type_eq(i64, i64) { print("inline-if folded: same\n"); } else { print("inline-if folded: different\n"); @@ -51,12 +51,12 @@ main :: () -> s32 { // has_impl — plain protocol (Allocator is unary). print("Allocator/CAllocator: {}\n", has_impl(Allocator, CAllocator)); - print("Allocator/s64: {}\n", has_impl(Allocator, s64)); + print("Allocator/i64: {}\n", has_impl(Allocator, i64)); // has_impl — parameterised protocol (Wrap takes a Target type arg). - print("Wrap(s64)/s32: {}\n", has_impl(Wrap(s64), s32)); - print("Wrap(s64)/bool: {}\n", has_impl(Wrap(s64), bool)); - print("Wrap(bool)/s32: {}\n", has_impl(Wrap(bool), s32)); + print("Wrap(i64)/i32: {}\n", has_impl(Wrap(i64), i32)); + print("Wrap(i64)/bool: {}\n", has_impl(Wrap(i64), bool)); + print("Wrap(bool)/i32: {}\n", has_impl(Wrap(bool), i32)); return 0; } diff --git a/examples/0518-packs-pack-value-dispatch.sx b/examples/0518-packs-pack-value-dispatch.sx index 9e6c78b..b74832f 100644 --- a/examples/0518-packs-pack-value-dispatch.sx +++ b/examples/0518-packs-pack-value-dispatch.sx @@ -8,7 +8,7 @@ // 1. `type_name($args[0])` — the value-form Type goes through the // reflection intrinsic, picking up the per-mono concrete type. // -// 2. `inline if type_eq($args[0], s64) { ... }` — compile-time +// 2. `inline if type_eq($args[0], i64) { ... }` — compile-time // branch over the pack element's type. The fold via // `tryConstBoolCondition` reads $args[0] via `resolveTypeArg`, // which the step-4 work taught to walk `pack_arg_types`. @@ -22,20 +22,20 @@ show :: (..$args) -> string => type_name($args[0]); describe :: (..$args) -> string { - inline if type_eq($args[0], s64) { return "got s64"; } + inline if type_eq($args[0], i64) { return "got i64"; } inline if type_eq($args[0], string) { return "got string"; } inline if type_eq($args[0], bool) { return "got bool"; } return "got other"; } -main :: () -> s32 { +main :: () -> i32 { // type_name picks up the per-mono first-arg type. - print("{}\n", show(42)); // s64 + print("{}\n", show(42)); // i64 print("{}\n", show("hi")); // string print("{}\n", show(3.14)); // f64 // inline-if + type_eq picks the right branch per mono. - print("{}\n", describe(42)); // got s64 + print("{}\n", describe(42)); // got i64 print("{}\n", describe("hello")); // got string print("{}\n", describe(true)); // got bool print("{}\n", describe(3.14)); // got other diff --git a/examples/0519-packs-pack-bare-value.sx b/examples/0519-packs-pack-bare-value.sx index 675a43d..385d1fa 100644 --- a/examples/0519-packs-pack-bare-value.sx +++ b/examples/0519-packs-pack-bare-value.sx @@ -21,12 +21,12 @@ #import "modules/std.sx"; -len_of :: (..$args) -> s64 { +len_of :: (..$args) -> i64 { list := $args; return list.len; } -main :: () -> s32 { +main :: () -> i32 { print("{}\n", len_of()); print("{}\n", len_of(42)); print("{}\n", len_of(1, 2, 3)); diff --git a/examples/0520-packs-pack-dynamic-type-name.sx b/examples/0520-packs-pack-dynamic-type-name.sx index 0118081..b833daf 100644 --- a/examples/0520-packs-pack-dynamic-type-name.sx +++ b/examples/0520-packs-pack-dynamic-type-name.sx @@ -1,8 +1,8 @@ // Variadic heterogeneous type packs — step 4A final-slice // follow-up. `type_name()` where the argument is // NOT a static type expression (e.g. `list[i]` indexing into -// a `$args`-derived `[]Type` slice) silently folded to "s64" -// because `resolveTypeArg`'s catch-all `else => .s64` lied — +// a `$args`-derived `[]Type` slice) silently folded to "i64" +// because `resolveTypeArg`'s catch-all `else => .i64` lied — // the kind of silent unimplemented arm the project's REJECTED // PATTERNS forbid. // @@ -22,7 +22,7 @@ walk :: (..$args) -> string { list := $args; s := ""; - i : s64 = 0; + i : i64 = 0; while i < list.len { s = concat(s, type_name(list[i])); i = i + 1; diff --git a/examples/0521-packs-pack-builder-smoke.sx b/examples/0521-packs-pack-builder-smoke.sx index 6976062..33ae3b4 100644 --- a/examples/0521-packs-pack-builder-smoke.sx +++ b/examples/0521-packs-pack-builder-smoke.sx @@ -27,7 +27,7 @@ describe :: (..$args) -> string { list := $args; s := "["; - i : s64 = 0; + i : i64 = 0; while i < list.len { if i > 0 { s = concat(s, ", "); } s = concat(s, type_name(list[i])); @@ -39,9 +39,9 @@ describe :: (..$args) -> string { run_all :: () { print("{}\n", describe()); // [] - print("{}\n", describe(42)); // [s64] - print("{}\n", describe(42, "hi")); // [s64, string] - print("{}\n", describe(true, 3.14, "x", 99)); // [bool, f64, string, s64] + print("{}\n", describe(42)); // [i64] + print("{}\n", describe(42, "hi")); // [i64, string] + print("{}\n", describe(true, 3.14, "x", 99)); // [bool, f64, string, i64] } #run run_all(); diff --git a/examples/0522-packs-pack-bare-args-cross-call.sx b/examples/0522-packs-pack-bare-args-cross-call.sx index a5c90ad..554fd95 100644 --- a/examples/0522-packs-pack-bare-args-cross-call.sx +++ b/examples/0522-packs-pack-bare-args-cross-call.sx @@ -24,7 +24,7 @@ describe :: (args: []Any) -> string { s := "["; - i : s64 = 0; + i : i64 = 0; while i < args.len { if i > 0 { s = concat(s, ", "); } s = concat(s, type_name(args[i])); diff --git a/examples/0523-packs-new-form-variadic-cross-module.sx b/examples/0523-packs-new-form-variadic-cross-module.sx index 0cb1c21..4595729 100644 --- a/examples/0523-packs-new-form-variadic-cross-module.sx +++ b/examples/0523-packs-new-form-variadic-cross-module.sx @@ -19,7 +19,7 @@ #import "modules/std.sx"; -main :: () -> s32 { +main :: () -> i32 { print("{}\n", path_join()); print("{}\n", path_join("a")); print("{}\n", path_join("a", "b")); diff --git a/examples/0525-packs-pack-fn-comptime-return.sx b/examples/0525-packs-pack-fn-comptime-return.sx index 4f849f1..cd85ff6 100644 --- a/examples/0525-packs-pack-fn-comptime-return.sx +++ b/examples/0525-packs-pack-fn-comptime-return.sx @@ -19,10 +19,10 @@ #import "modules/std.sx"; -foo :: (..$args) -> s64 { return 42; } +foo :: (..$args) -> i64 { return 42; } -main :: () -> s32 { - n : s64 = foo(1, "hello"); +main :: () -> i32 { + n : i64 = foo(1, "hello"); print("{}\n", n); return 0; } diff --git a/examples/0526-packs-protocol-pack.sx b/examples/0526-packs-protocol-pack.sx index 7171aee..96565ec 100644 --- a/examples/0526-packs-protocol-pack.sx +++ b/examples/0526-packs-protocol-pack.sx @@ -19,16 +19,16 @@ Show :: protocol(T: Type) { get :: (self: *Self) -> T; } -IntBox :: struct { v: s64; } +IntBox :: struct { v: i64; } StrBox :: struct { s: string; } -impl Show(s64) for IntBox { get :: (self: *IntBox) -> s64 => self.v; } +impl Show(i64) for IntBox { get :: (self: *IntBox) -> i64 => self.v; } impl Show(string) for StrBox { get :: (self: *StrBox) -> string => self.s; } -howmany :: (..xs: Show) -> s64 { +howmany :: (..xs: Show) -> i64 { return xs.len; } -main :: () -> s32 { +main :: () -> i32 { a := IntBox.{ v = 42 }; b := IntBox.{ v = 7 }; c := StrBox.{ s = "cool" }; diff --git a/examples/0527-packs-pack-non-conform.sx b/examples/0527-packs-pack-non-conform.sx index a93deaf..2b7331b 100644 --- a/examples/0527-packs-pack-non-conform.sx +++ b/examples/0527-packs-pack-non-conform.sx @@ -7,16 +7,16 @@ Show :: protocol(T: Type) { get :: (self: *Self) -> T; } -IntBox :: struct { v: s64; } -impl Show(s64) for IntBox { get :: (self: *IntBox) -> s64 => self.v; } +IntBox :: struct { v: i64; } +impl Show(i64) for IntBox { get :: (self: *IntBox) -> i64 => self.v; } -Naked :: struct { x: s64; } // intentionally NOT `impl Show` +Naked :: struct { x: i64; } // intentionally NOT `impl Show` -howmany :: (..xs: Show) -> s64 { +howmany :: (..xs: Show) -> i64 { return xs.len; } -main :: () -> s32 { +main :: () -> i32 { a := IntBox.{ v = 1 }; n := Naked.{ x = 2 }; print("{}\n", howmany(a, n)); // `n` does not conform to Show diff --git a/examples/0528-packs-protocol-pack-methods.sx b/examples/0528-packs-protocol-pack-methods.sx index e0af2d7..b9667e3 100644 --- a/examples/0528-packs-protocol-pack-methods.sx +++ b/examples/0528-packs-protocol-pack-methods.sx @@ -9,19 +9,19 @@ #import "modules/std.sx"; Greeter :: protocol { - greet :: () -> s64; + greet :: () -> i64; } -Dog :: struct { age: s64; } -Cat :: struct { lives: s64; } -impl Greeter for Dog { greet :: (self: *Dog) -> s64 => self.age; } -impl Greeter for Cat { greet :: (self: *Cat) -> s64 => self.lives * 100; } +Dog :: struct { age: i64; } +Cat :: struct { lives: i64; } +impl Greeter for Dog { greet :: (self: *Dog) -> i64 => self.age; } +impl Greeter for Cat { greet :: (self: *Cat) -> i64 => self.lives * 100; } -pair_sum :: (..xs: Greeter) -> s64 { +pair_sum :: (..xs: Greeter) -> i64 { return xs[0].greet() + xs[1].greet(); } -main :: () -> s32 { +main :: () -> i32 { d := Dog.{ age = 3 }; c := Cat.{ lives = 9 }; print("dog+cat={}\n", pair_sum(d, c)); // 3 + 900 = 903 (heterogeneous) diff --git a/examples/0529-packs-protocol-pack-parameterized.sx b/examples/0529-packs-protocol-pack-parameterized.sx index e6508e5..d38eabf 100644 --- a/examples/0529-packs-protocol-pack-parameterized.sx +++ b/examples/0529-packs-protocol-pack-parameterized.sx @@ -13,17 +13,17 @@ Box :: protocol(T: Type) { get :: () -> T; } -IntCell :: struct { v: s64; } +IntCell :: struct { v: i64; } StrCell :: struct { s: string; } -impl Box(s64) for IntCell { get :: (self: *IntCell) -> s64 => self.v; } +impl Box(i64) for IntCell { get :: (self: *IntCell) -> i64 => self.v; } impl Box(string) for StrCell { get :: (self: *StrCell) -> string => self.s; } describe :: (..xs: Box) -> void { - // xs[0] : Box(s64), xs[1] : Box(string) — different type-args per position. + // xs[0] : Box(i64), xs[1] : Box(string) — different type-args per position. print("first={} second={}\n", xs[0].get(), xs[1].get()); } -main :: () -> s32 { +main :: () -> i32 { describe(IntCell.{ v = 11 }, StrCell.{ s = "hi" }); describe(StrCell.{ s = "x" }, IntCell.{ v = 99 }); 0 diff --git a/examples/0530-packs-pack-interface-only.sx b/examples/0530-packs-pack-interface-only.sx index a2c904f..7889c47 100644 --- a/examples/0530-packs-pack-interface-only.sx +++ b/examples/0530-packs-pack-interface-only.sx @@ -9,14 +9,14 @@ Box :: protocol(T: Type) { get :: () -> T; } -IntCell :: struct { v: s64; } -impl Box(s64) for IntCell { get :: (self: *IntCell) -> s64 => self.v; } +IntCell :: struct { v: i64; } +impl Box(i64) for IntCell { get :: (self: *IntCell) -> i64 => self.v; } -leak :: (..xs: Box) -> s64 { +leak :: (..xs: Box) -> i64 { return xs[0].v; // `v` is not part of Box — error } -main :: () -> s32 { +main :: () -> i32 { print("{}\n", leak(IntCell.{ v = 5 })); 0 } diff --git a/examples/0531-packs-pack-value-projection.sx b/examples/0531-packs-pack-value-projection.sx index c02ce54..36bb057 100644 --- a/examples/0531-packs-pack-value-projection.sx +++ b/examples/0531-packs-pack-value-projection.sx @@ -11,18 +11,18 @@ Box :: protocol(T: Type) { get :: () -> T; } -IntCell :: struct { v: s64; } +IntCell :: struct { v: i64; } StrCell :: struct { s: string; } -impl Box(s64) for IntCell { get :: (self: *IntCell) -> s64 => self.v; } +impl Box(i64) for IntCell { get :: (self: *IntCell) -> i64 => self.v; } impl Box(string) for StrCell { get :: (self: *StrCell) -> string => self.s; } show :: (..xs: Box) -> void { - vals := xs.get; // tuple (s64, string) + vals := xs.get; // tuple (i64, string) print("0={} 1={}\n", vals.0, vals.1); } -main :: () -> s32 { +main :: () -> i32 { show(IntCell.{ v = 42 }, StrCell.{ s = "hi" }); - show(StrCell.{ s = "x" }, IntCell.{ v = 7 }); // order swapped → (string, s64) + show(StrCell.{ s = "x" }, IntCell.{ v = 7 }); // order swapped → (string, i64) 0 } diff --git a/examples/0532-packs-pack-spread-call.sx b/examples/0532-packs-pack-spread-call.sx index 3769cc7..72944b9 100644 --- a/examples/0532-packs-pack-spread-call.sx +++ b/examples/0532-packs-pack-spread-call.sx @@ -6,20 +6,20 @@ #import "modules/std.sx"; Box :: protocol(T: Type) { - get :: () -> s64; + get :: () -> i64; } -IntCell :: struct { v: s64; } -Dbl :: struct { n: s64; } -impl Box(s64) for IntCell { get :: (self: *IntCell) -> s64 => self.v; } -impl Box(s64) for Dbl { get :: (self: *Dbl) -> s64 => self.n * 2; } +IntCell :: struct { v: i64; } +Dbl :: struct { n: i64; } +impl Box(i64) for IntCell { get :: (self: *IntCell) -> i64 => self.v; } +impl Box(i64) for Dbl { get :: (self: *Dbl) -> i64 => self.n * 2; } -add2 :: (a: s64, b: s64) -> s64 { return a + b; } -add3 :: (a: s64, b: s64, c: s64) -> s64 { return a + b + c; } +add2 :: (a: i64, b: i64) -> i64 { return a + b; } +add3 :: (a: i64, b: i64, c: i64) -> i64 { return a + b + c; } -via2 :: (..xs: Box) -> s64 { return add2(..xs.get); } -via3 :: (..xs: Box) -> s64 { return add3(..xs.get); } +via2 :: (..xs: Box) -> i64 { return add2(..xs.get); } +via3 :: (..xs: Box) -> i64 { return add3(..xs.get); } -main :: () -> s32 { +main :: () -> i32 { print("two={}\n", via2(IntCell.{ v = 10 }, Dbl.{ n = 5 })); // 10 + 10 = 20 print("three={}\n", via3(Dbl.{ n = 1 }, IntCell.{ v = 2 }, Dbl.{ n = 3 })); // 2 + 2 + 6 = 10 0 diff --git a/examples/0533-packs-pack-tuple-materialize.sx b/examples/0533-packs-pack-tuple-materialize.sx index 39080d4..7a9faf0 100644 --- a/examples/0533-packs-pack-tuple-materialize.sx +++ b/examples/0533-packs-pack-tuple-materialize.sx @@ -8,18 +8,18 @@ Box :: protocol(T: Type) { get :: () -> T; } -IntCell :: struct { v: s64; } +IntCell :: struct { v: i64; } StrCell :: struct { s: string; } -impl Box(s64) for IntCell { get :: (self: *IntCell) -> s64 => self.v; } +impl Box(i64) for IntCell { get :: (self: *IntCell) -> i64 => self.v; } impl Box(string) for StrCell { get :: (self: *StrCell) -> string => self.s; } snapshot :: (..xs: Box) -> void { - t := (..xs.get); // tuple (s64, string) materialized from the pack + t := (..xs.get); // tuple (i64, string) materialized from the pack print("0={} 1={}\n", t.0, t.1); } -main :: () -> s32 { +main :: () -> i32 { snapshot(IntCell.{ v = 42 }, StrCell.{ s = "hi" }); - snapshot(StrCell.{ s = "x" }, IntCell.{ v = 7 }); // order swapped → (string, s64) + snapshot(StrCell.{ s = "x" }, IntCell.{ v = 7 }); // order swapped → (string, i64) 0 } diff --git a/examples/0534-packs-pack-type-projection.sx b/examples/0534-packs-pack-type-projection.sx index 78ddfa5..e09df90 100644 --- a/examples/0534-packs-pack-type-projection.sx +++ b/examples/0534-packs-pack-type-projection.sx @@ -10,29 +10,29 @@ Box :: protocol(T: Type) { get :: () -> T; } -IntCell :: struct { v: s64; } +IntCell :: struct { v: i64; } StrCell :: struct { s: string; } -Dbl :: struct { n: s64; } -impl Box(s64) for IntCell { get :: (self: *IntCell) -> s64 => self.v; } +Dbl :: struct { n: i64; } +impl Box(i64) for IntCell { get :: (self: *IntCell) -> i64 => self.v; } impl Box(string) for StrCell { get :: (self: *StrCell) -> string => self.s; } -impl Box(s64) for Dbl { get :: (self: *Dbl) -> s64 => self.n * 2; } +impl Box(i64) for Dbl { get :: (self: *Dbl) -> i64 => self.n * 2; } -// Tuple type `(..xs.T)` — heterogeneous (s64, string), matched by the +// Tuple type `(..xs.T)` — heterogeneous (i64, string), matched by the // value-projection `(..xs.get)`. snap :: (..xs: Box) -> void { t : (..xs.T) = (..xs.get); print("0={} 1={}\n", t.0, t.1); } -// Closure signature `Closure(..xs.T) -> s64` — here `Closure(s64, s64) -> s64`. +// Closure signature `Closure(..xs.T) -> i64` — here `Closure(i64, i64) -> i64`. // The closure literal's params are contextually typed from the projection. -fold :: (..xs: Box) -> s64 { - cb : Closure(..xs.T) -> s64 = (a, b) => a + b; +fold :: (..xs: Box) -> i64 { + cb : Closure(..xs.T) -> i64 = (a, b) => a + b; return cb(xs[0].get(), xs[1].get()); } -main :: () -> s32 { - snap(IntCell.{ v = 42 }, StrCell.{ s = "hi" }); // (s64, string) +main :: () -> i32 { + snap(IntCell.{ v = 42 }, StrCell.{ s = "hi" }); // (i64, string) print("fold={}\n", fold(IntCell.{ v = 10 }, Dbl.{ n = 5 })); // 10 + 10 = 20 0 } diff --git a/examples/0535-packs-slice-of-protocol-variadic.sx b/examples/0535-packs-slice-of-protocol-variadic.sx index 704b9d0..33be461 100644 --- a/examples/0535-packs-slice-of-protocol-variadic.sx +++ b/examples/0535-packs-slice-of-protocol-variadic.sx @@ -10,7 +10,7 @@ #import "modules/std.sx"; Show :: protocol { show :: () -> string; } -A :: struct { x: s64; } +A :: struct { x: i64; } B :: struct { s: string; } impl Show for A { show :: (self: *A) -> string => "A"; } impl Show for B { show :: (self: *B) -> string => "B"; } @@ -24,7 +24,7 @@ each :: (..xs: []Show) -> void { } } -main :: () -> s32 { +main :: () -> i32 { each(A.{ x = 1 }, B.{ s = "hi" }, A.{ x = 3 }); // heterogeneous, erased to Show each(); // empty is fine (len 0) 0 diff --git a/examples/0536-packs-pack-as-value.sx b/examples/0536-packs-pack-as-value.sx index 59dc137..46ca0e4 100644 --- a/examples/0536-packs-pack-as-value.sx +++ b/examples/0536-packs-pack-as-value.sx @@ -9,14 +9,14 @@ Show :: protocol { show :: () -> string; } A :: struct {} impl Show for A { show :: (self: *A) -> string => "A"; } -sink :: (v: s64) -> void { _ = v; } +sink :: (v: i64) -> void { _ = v; } storage :: (..xs: Show) -> void { y := xs; _ = y; } // A: store call :: (..xs: Show) -> void { sink(xs); } // B: pass to a call -ret :: (..xs: Show) -> s64 { return xs; } // C: return +ret :: (..xs: Show) -> i64 { return xs; } // C: return iter :: (..xs: Show) -> void { for xs (x) { _ = x; } } // D: runtime iterate -main :: () -> s32 { +main :: () -> i32 { storage(A.{}); call(A.{}); _ = ret(A.{}); diff --git a/examples/0537-packs-pack-xx-to-slice.sx b/examples/0537-packs-pack-xx-to-slice.sx index 07ac6d4..9fed452 100644 --- a/examples/0537-packs-pack-xx-to-slice.sx +++ b/examples/0537-packs-pack-xx-to-slice.sx @@ -11,21 +11,21 @@ B :: struct { s: string; } impl Show for A { show :: (self: *A) -> string => "A"; } impl Show for B { show :: (self: *B) -> string => "B"; } -count_any :: (items: []Any) -> s64 { return items.len; } +count_any :: (items: []Any) -> i64 { return items.len; } -show_all :: (items: []Show) -> s64 { +show_all :: (items: []Show) -> i64 { i := 0; while i < items.len { print("{}\n", items[i].show()); i = i + 1; } return items.len; } // `..$args` pack → []Any via `xx`. -fwd_any :: (..$args) -> s64 { return count_any(xx args); } +fwd_any :: (..$args) -> i64 { return count_any(xx args); } // `..xs: Show` pack → []Show via `xx`. -fwd_show :: (..xs: Show) -> s64 { return show_all(xx xs); } +fwd_show :: (..xs: Show) -> i64 { return show_all(xx xs); } -main :: () -> s32 { +main :: () -> i32 { print("any={}\n", fwd_any(1, "hi", 2.5)); // 3 print("show={}\n", fwd_show(A.{}, B.{ s = "x" }, A.{})); // A B A, 3 0 diff --git a/examples/0538-packs-generic-struct-pack-field.sx b/examples/0538-packs-generic-struct-pack-field.sx index ff7fa0c..0a34c46 100644 --- a/examples/0538-packs-generic-struct-pack-field.sx +++ b/examples/0538-packs-generic-struct-pack-field.sx @@ -10,9 +10,9 @@ Box :: struct($R: Type, ..$Ts: []Type) { pair: (..$Ts); // tuple of the pack's element types } -main :: () -> s32 { - // Box(s64, s32, string): R=s64, Ts=[s32, string], pair: (s32, string). - a : Box(s64, s32, string) = ---; +main :: () -> i32 { + // Box(i64, i32, string): R=i64, Ts=[i32, string], pair: (i32, string). + a : Box(i64, i32, string) = ---; a.r = 7; a.pair = (42, "hi"); // whole-tuple field store print("a: r={} 0={} 1={}\n", a.r, a.pair.0, a.pair.1); diff --git a/examples/0539-packs-combined-pack-field.sx b/examples/0539-packs-combined-pack-field.sx index 8769e3e..b8f85ea 100644 --- a/examples/0539-packs-combined-pack-field.sx +++ b/examples/0539-packs-combined-pack-field.sx @@ -8,9 +8,9 @@ #import "modules/std.sx"; VL :: protocol(T: Type) { get :: () -> T; } -IntCell :: struct { v: s64; } +IntCell :: struct { v: i64; } StrCell :: struct { s: string; } -impl VL(s64) for IntCell { get :: (self: *IntCell) -> s64 => self.v; } +impl VL(i64) for IntCell { get :: (self: *IntCell) -> i64 => self.v; } impl VL(string) for StrCell { get :: (self: *StrCell) -> string => self.s; } Combined :: struct($R: Type, ..$Ts: []Type) { @@ -18,10 +18,10 @@ Combined :: struct($R: Type, ..$Ts: []Type) { value: $R; } -main :: () -> s32 { - // Combined(s64, s64, string): R=s64, Ts=[s64, string], - // sources: (VL(s64), VL(string)). - c : Combined(s64, s64, string) = ---; +main :: () -> i32 { + // Combined(i64, i64, string): R=i64, Ts=[i64, string], + // sources: (VL(i64), VL(string)). + c : Combined(i64, i64, string) = ---; c.sources = (xx IntCell.{ v = 10 }, xx StrCell.{ s = "hi" }); c.value = 99; print("{} {} {}\n", c.sources.0.get(), c.sources.1.get(), c.value); // 10 hi 99 diff --git a/examples/0540-packs-pack-type-arg-spread.sx b/examples/0540-packs-pack-type-arg-spread.sx index f9f4480..16339d3 100644 --- a/examples/0540-packs-pack-type-arg-spread.sx +++ b/examples/0540-packs-pack-type-arg-spread.sx @@ -1,27 +1,27 @@ // Phase 6 — pack-spread in a parameterized-type's arg list: // `Combined($R, ..sources.T)`. Inside a pack-fn, `..sources.T` projects each // source's protocol type-arg and spreads them into the generic struct's pack -// type-param `..$Ts`, so `Combined(s64, ..sources.T)` for a single `VL(s64)` -// source instantiates `Combined(s64, s64)` (field `sources: (VL(s64))`). +// type-param `..$Ts`, so `Combined(i64, ..sources.T)` for a single `VL(i64)` +// source instantiates `Combined(i64, i64)` (field `sources: (VL(i64))`). #import "modules/std.sx"; VL :: protocol(T: Type) { get :: () -> T; } -IntCell :: struct { v: s64; } -impl VL(s64) for IntCell { get :: (self: *IntCell) -> s64 => self.v; } +IntCell :: struct { v: i64; } +impl VL(i64) for IntCell { get :: (self: *IntCell) -> i64 => self.v; } Combined :: struct($R: Type, ..$Ts: []Type) { sources: (..VL(Ts)); value: $R; } -make :: (..sources: VL) -> s64 { - c : Combined(s64, ..sources.T) = ---; // instantiate with the spread type-arg - c.sources.0 = xx sources[0]; // erase the concrete source to VL(s64) +make :: (..sources: VL) -> i64 { + c : Combined(i64, ..sources.T) = ---; // instantiate with the spread type-arg + c.sources.0 = xx sources[0]; // erase the concrete source to VL(i64) return c.sources.0.get(); } -main :: () -> s32 { +main :: () -> i32 { print("{}\n", make(IntCell.{ v = 7 })); // 7 0 } diff --git a/examples/0541-packs-pack-to-protocol-tuple.sx b/examples/0541-packs-pack-to-protocol-tuple.sx index df2e15f..49765ec 100644 --- a/examples/0541-packs-pack-to-protocol-tuple.sx +++ b/examples/0541-packs-pack-to-protocol-tuple.sx @@ -6,9 +6,9 @@ #import "modules/std.sx"; VL :: protocol(T: Type) { get :: () -> T; } -IntCell :: struct { v: s64; } +IntCell :: struct { v: i64; } StrCell :: struct { s: string; } -impl VL(s64) for IntCell { get :: (self: *IntCell) -> s64 => self.v; } +impl VL(i64) for IntCell { get :: (self: *IntCell) -> i64 => self.v; } impl VL(string) for StrCell { get :: (self: *StrCell) -> string => self.s; } Combined :: struct($R: Type, ..$Ts: []Type) { @@ -17,12 +17,12 @@ Combined :: struct($R: Type, ..$Ts: []Type) { } build :: (..sources: VL) -> void { - c : Combined(s64, ..sources.T) = ---; + c : Combined(i64, ..sources.T) = ---; c.sources = (..sources); // pack → tuple, per-element erase print("{} {}\n", c.sources.0.get(), c.sources.1.get()); } -main :: () -> s32 { +main :: () -> i32 { build(IntCell.{ v = 10 }, StrCell.{ s = "hi" }); // 10 hi 0 } diff --git a/examples/0542-packs-mapper-projection-spread.sx b/examples/0542-packs-mapper-projection-spread.sx index f634d31..1b2829e 100644 --- a/examples/0542-packs-mapper-projection-spread.sx +++ b/examples/0542-packs-mapper-projection-spread.sx @@ -5,14 +5,14 @@ #import "modules/std.sx"; VL :: protocol(T: Type) { get :: () -> T; } -IntCell :: struct { v: s64; } -impl VL(s64) for IntCell { get :: (self: *IntCell) -> s64 => self.v; } +IntCell :: struct { v: i64; } +impl VL(i64) for IntCell { get :: (self: *IntCell) -> i64 => self.v; } -apply :: (mapper: Closure(s64, s64) -> s64, ..sources: VL) -> s64 { - return mapper(..sources.get); // (a, b) => a + b applied to (s0.get(), s1.get()) +apply :: (mapper: Closure(i64, i64) -> i64, ..sources: VL) -> i64 { + return mapper(..sources.get); // (a, b) => a + b applied to (i0.get(), i1.get()) } -main :: () -> s32 { +main :: () -> i32 { print("{}\n", apply((a, b) => a + b, IntCell.{ v = 40 }, IntCell.{ v = 2 })); // 42 0 } diff --git a/examples/0543-packs-canonical-map.sx b/examples/0543-packs-canonical-map.sx index 51920db..2b18574 100644 --- a/examples/0543-packs-canonical-map.sx +++ b/examples/0543-packs-canonical-map.sx @@ -3,18 +3,18 @@ // - `mapper: Closure(..sources.T) -> $R` types the lambda's params from the // projected pack element types, and its body (`a + b`) drives `$R`. // - `$R` is inferred at the call site from the lowered mapper's closure ret, -// bound into the mono (`-> VL($R)` ⇒ `VL(s64)`, `Combined($R, ..)` ⇒ -// `Combined(s64, ..)`), and folded into the mangle. +// bound into the mono (`-> VL($R)` ⇒ `VL(i64)`, `Combined($R, ..)` ⇒ +// `Combined(i64, ..)`), and folded into the mangle. // - `(..sources)` materializes the pack into the `(..VL(Ts))` field (per-element // erase) and `mapper(..sources.get)` projects+spreads; `xx c` erases the -// generic-struct instance to `VL(s64)` via the generic impl's monomorphized +// generic-struct instance to `VL(i64)` via the generic impl's monomorphized // thunk. #import "modules/std.sx"; VL :: protocol(T: Type) { get :: () -> T; } -IntCell :: struct { v: s64; } -impl VL(s64) for IntCell { get :: (self: *IntCell) -> s64 => self.v; } +IntCell :: struct { v: i64; } +impl VL(i64) for IntCell { get :: (self: *IntCell) -> i64 => self.v; } Combined :: struct($R: Type, ..$Ts: []Type) { sources: (..VL(Ts)); @@ -29,7 +29,7 @@ map :: (mapper: Closure(..sources.T) -> $R, ..sources: VL) -> VL($R) { return xx c; } -main :: () -> s32 { +main :: () -> i32 { r := map((a, b) => a + b, IntCell.{ v = 40 }, IntCell.{ v = 2 }); print("{}\n", r.get()); // 42 0 diff --git a/examples/0544-packs-imported-pack-fn-fixed-param-source-pin.sx b/examples/0544-packs-imported-pack-fn-fixed-param-source-pin.sx index ec2385f..113246d 100644 --- a/examples/0544-packs-imported-pack-fn-fixed-param-source-pin.sx +++ b/examples/0544-packs-imported-pack-fn-fixed-param-source-pin.sx @@ -14,7 +14,7 @@ #import "modules/std.sx"; #import "0544-packs-imported-pack-fn-fixed-param-source-pin/lib.sx"; -main :: () -> s32 { +main :: () -> i32 { x := make(); print("plain {}\n", use_plain(x)); print("pack {}\n", use_pack(x, 1, 2)); diff --git a/examples/0544-packs-imported-pack-fn-fixed-param-source-pin/dep.sx b/examples/0544-packs-imported-pack-fn-fixed-param-source-pin/dep.sx index 8cefe6c..270e9b2 100644 --- a/examples/0544-packs-imported-pack-fn-fixed-param-source-pin/dep.sx +++ b/examples/0544-packs-imported-pack-fn-fixed-param-source-pin/dep.sx @@ -1,3 +1,3 @@ // `Needs` lives two flat-import hops away from `main` (main -> lib -> dep), so // it is NOT bare-visible at the call site under non-transitive visibility. -Needs :: struct { v: s64; } +Needs :: struct { v: i64; } diff --git a/examples/0544-packs-imported-pack-fn-fixed-param-source-pin/lib.sx b/examples/0544-packs-imported-pack-fn-fixed-param-source-pin/lib.sx index 5519bed..e4643b8 100644 --- a/examples/0544-packs-imported-pack-fn-fixed-param-source-pin/lib.sx +++ b/examples/0544-packs-imported-pack-fn-fixed-param-source-pin/lib.sx @@ -9,8 +9,8 @@ make :: () -> Needs => Needs.{ v = 7 }; // Control: a plain (non-pack) fn with the same fixed param already resolves in // its defining module — the cross-module call-arg typing path is source-pinned. -use_plain :: (n: Needs) -> s64 => n.v; +use_plain :: (n: Needs) -> i64 => n.v; // Pack fn: the fixed-prefix param `n: Needs` is bound during pack // monomorphization. Its type must resolve under this module's source. -use_pack :: (n: Needs, ..$args) -> s64 => n.v + args[0]; +use_pack :: (n: Needs, ..$args) -> i64 => n.v + args[0]; diff --git a/examples/0545-packs-inline-for-element.sx b/examples/0545-packs-inline-for-element.sx index df15b6d..fdb5499 100644 --- a/examples/0545-packs-inline-for-element.sx +++ b/examples/0545-packs-inline-for-element.sx @@ -12,7 +12,7 @@ #import "modules/std.sx"; Show :: protocol { show :: () -> string; } -IntBox :: struct { v: s64; } +IntBox :: struct { v: i64; } StrBox :: struct { s: string; } impl Show for IntBox { show :: (self: *IntBox) -> string { int_to_string(self.v) } } impl Show for StrBox { show :: (self: *StrBox) -> string { self.s } } diff --git a/examples/0546-packs-fn-alias-rich.sx b/examples/0546-packs-fn-alias-rich.sx index 0f6c797..4b91afa 100644 --- a/examples/0546-packs-fn-alias-rich.sx +++ b/examples/0546-packs-fn-alias-rich.sx @@ -1,6 +1,6 @@ // Companion of 0546: the authoring module for the fn-alias re-exports. #import "modules/std.sx"; -helper :: () -> s64 { 7 } +helper :: () -> i64 { 7 } first_of :: (xs: []$T) -> T { xs[0] } -my_pack :: (..$args) -> s64 { args[0] + args[1] } +my_pack :: (..$args) -> i64 { args[0] + args[1] } diff --git a/examples/0546-packs-fn-alias.sx b/examples/0546-packs-fn-alias.sx index cb1838d..acd11c7 100644 --- a/examples/0546-packs-fn-alias.sx +++ b/examples/0546-packs-fn-alias.sx @@ -10,7 +10,7 @@ s :: #import "modules/std.sx"; r :: #import "0546-packs-fn-alias-rich.sx"; -pack_sum :: (..$args) -> s64 { +pack_sum :: (..$args) -> i64 { args[0] + args[1] } sum_alias :: pack_sum; // same-file pack alias (the 0121 repro) @@ -26,7 +26,7 @@ main :: () { print("pack: {}\n", sum_alias(3, 4)); print("plain: {}\n", helper2()); arr := .[10, 20, 30]; - xs : []s64 = arr; + xs : []i64 = arr; print("generic: {}\n", head_of(xs)); print("ns-pack: {}\n", sum2(20, 22)); my_print("std-print: {} {}\n", 1, "two"); diff --git a/examples/0600-comptime-run.sx b/examples/0600-comptime-run.sx index 2ef6afc..378860c 100644 --- a/examples/0600-comptime-run.sx +++ b/examples/0600-comptime-run.sx @@ -2,7 +2,7 @@ // this will bake x to be 7 as a global constant x :: #run compute(5); -compute :: (v: s32) -> s32 => v + 2; +compute :: (v: i32) -> i32 => v + 2; main :: () { //test diff --git a/examples/0601-comptime-meta.sx b/examples/0601-comptime-meta.sx index 03c4683..4d29289 100644 --- a/examples/0601-comptime-meta.sx +++ b/examples/0601-comptime-meta.sx @@ -1,7 +1,7 @@ #import "modules/std.sx"; #import "modules/math"; -test :: () -> s32 { +test :: () -> i32 { 0 } @@ -26,4 +26,4 @@ main :: () { // f64 // 3.200000 // Vector(4,f32) -// () -> s32 \ No newline at end of file +// () -> i32 \ No newline at end of file diff --git a/examples/0602-comptime-interp-cast-ptr-cmp.sx b/examples/0602-comptime-interp-cast-ptr-cmp.sx index 84e2a5f..308d33f 100644 --- a/examples/0602-comptime-interp-cast-ptr-cmp.sx +++ b/examples/0602-comptime-interp-cast-ptr-cmp.sx @@ -1,6 +1,6 @@ // `cast(T) val` inside a conditional, evaluated by the IR interpreter // during a post-link callback. The `cast` syntax lowers the type arg -// (`s64`) as a `placeholder` IR op; the interpreter treats placeholders +// (`i64`) as a `placeholder` IR op; the interpreter treats placeholders // as undef so the comparison runs through unchanged. #import "modules/std.sx"; @@ -8,13 +8,13 @@ libc :: #library "c"; popen :: (cmd: [:0]u8, mode: [:0]u8) -> *void #foreign libc; -puts :: (s: [:0]u8) -> s32 #foreign libc; +puts :: (s: [:0]u8) -> i32 #foreign libc; -R :: struct { x: s32; } +R :: struct { x: i32; } bug :: (cmd: [:0]u8) -> ?R { f := popen(cmd, "r"); - if cast(s64) f == 0 { return null; } + if cast(i64) f == 0 { return null; } R.{ x = 1 } } diff --git a/examples/0603-comptime-interp-variadic-any.sx b/examples/0603-comptime-interp-variadic-any.sx index 75115e4..6a12a51 100644 --- a/examples/0603-comptime-interp-variadic-any.sx +++ b/examples/0603-comptime-interp-variadic-any.sx @@ -8,7 +8,7 @@ #import "modules/std.sx"; #import "modules/build.sx"; -puts :: (s: [:0]u8) -> s32 #foreign libc; +puts :: (s: [:0]u8) -> i32 #foreign libc; cb :: () -> bool { a := format("{}", "x"); diff --git a/examples/0604-comptime-typed-store-widths.sx b/examples/0604-comptime-typed-store-widths.sx index b75453b..58af7ea 100644 --- a/examples/0604-comptime-typed-store-widths.sx +++ b/examples/0604-comptime-typed-store-widths.sx @@ -21,24 +21,24 @@ #import "modules/std.sx"; SENTINEL :u8: 0xAA; // 170 — neighbor pattern -BUF_SIZE :s64: 32; -TARGET :s64: 8; // offset where the typed store lands +BUF_SIZE :i64: 32; +TARGET :i64: 8; // offset where the typed store lands // ── per-width helpers ─────────────────────────────────────────────── fill :: (buf: [*]u8) { - i : s64 = 0; + i : i64 = 0; while i < BUF_SIZE { buf[i] = SENTINEL; i += 1; } } -sum_bytes :: (buf: [*]u8) -> s64 { - s : s64 = 0; - i : s64 = 0; +sum_bytes :: (buf: [*]u8) -> i64 { + s : i64 = 0; + i : i64 = 0; while i < BUF_SIZE { s += xx buf[i]; i += 1; } s } -run_u8 :: () -> s64 { +run_u8 :: () -> i64 { buf : [*]u8 = xx libc_malloc(BUF_SIZE); fill(buf); p : *u8 = xx @buf[TARGET]; @@ -48,7 +48,7 @@ run_u8 :: () -> s64 { s } -run_u16 :: () -> s64 { +run_u16 :: () -> i64 { buf : [*]u8 = xx libc_malloc(BUF_SIZE); fill(buf); p : *u16 = xx @buf[TARGET]; @@ -58,7 +58,7 @@ run_u16 :: () -> s64 { s } -run_u32 :: () -> s64 { +run_u32 :: () -> i64 { buf : [*]u8 = xx libc_malloc(BUF_SIZE); fill(buf); p : *u32 = xx @buf[TARGET]; @@ -68,7 +68,7 @@ run_u32 :: () -> s64 { s } -run_u64 :: () -> s64 { +run_u64 :: () -> i64 { buf : [*]u8 = xx libc_malloc(BUF_SIZE); fill(buf); p : *u64 = xx @buf[TARGET]; @@ -78,47 +78,47 @@ run_u64 :: () -> s64 { s } -run_s8 :: () -> s64 { +run_i8 :: () -> i64 { buf : [*]u8 = xx libc_malloc(BUF_SIZE); fill(buf); - p : *s8 = xx @buf[TARGET]; + p : *i8 = xx @buf[TARGET]; p.* = 0x42; s := sum_bytes(buf); libc_free(xx buf); s } -run_s16 :: () -> s64 { +run_i16 :: () -> i64 { buf : [*]u8 = xx libc_malloc(BUF_SIZE); fill(buf); - p : *s16 = xx @buf[TARGET]; + p : *i16 = xx @buf[TARGET]; p.* = 0x0102; s := sum_bytes(buf); libc_free(xx buf); s } -run_s32 :: () -> s64 { +run_i32 :: () -> i64 { buf : [*]u8 = xx libc_malloc(BUF_SIZE); fill(buf); - p : *s32 = xx @buf[TARGET]; + p : *i32 = xx @buf[TARGET]; p.* = 0x01020304; s := sum_bytes(buf); libc_free(xx buf); s } -run_s64 :: () -> s64 { +run_i64 :: () -> i64 { buf : [*]u8 = xx libc_malloc(BUF_SIZE); fill(buf); - p : *s64 = xx @buf[TARGET]; + p : *i64 = xx @buf[TARGET]; p.* = 0x0102030405060708; s := sum_bytes(buf); libc_free(xx buf); s } -run_bool :: () -> s64 { +run_bool :: () -> i64 { buf : [*]u8 = xx libc_malloc(BUF_SIZE); fill(buf); p : *bool = xx @buf[TARGET]; @@ -128,7 +128,7 @@ run_bool :: () -> s64 { s } -run_f32 :: () -> s64 { +run_f32 :: () -> i64 { buf : [*]u8 = xx libc_malloc(BUF_SIZE); fill(buf); p : *f32 = xx @buf[TARGET]; @@ -138,7 +138,7 @@ run_f32 :: () -> s64 { s } -run_f64 :: () -> s64 { +run_f64 :: () -> i64 { buf : [*]u8 = xx libc_malloc(BUF_SIZE); fill(buf); p : *f64 = xx @buf[TARGET]; @@ -156,32 +156,32 @@ EXP_U8 :: #run run_u8(); EXP_U16 :: #run run_u16(); EXP_U32 :: #run run_u32(); EXP_U64 :: #run run_u64(); -EXP_S8 :: #run run_s8(); -EXP_S16 :: #run run_s16(); -EXP_S32 :: #run run_s32(); -EXP_S64 :: #run run_s64(); +EXP_S8 :: #run run_i8(); +EXP_S16 :: #run run_i16(); +EXP_S32 :: #run run_i32(); +EXP_S64 :: #run run_i64(); EXP_BOOL :: #run run_bool(); EXP_F32 :: #run run_f32(); EXP_F64 :: #run run_f64(); // ── runtime comparison ────────────────────────────────────────────── -check :: (label: string, got: s64, want: s64) -> bool { +check :: (label: string, got: i64, want: i64) -> bool { if got == want { return true; } print("FAIL {}: comptime={} runtime={}\n", label, want, got); false } -main :: () -> s32 { +main :: () -> i32 { ok := true; if !check("u8", run_u8(), EXP_U8) { ok = false; } if !check("u16", run_u16(), EXP_U16) { ok = false; } if !check("u32", run_u32(), EXP_U32) { ok = false; } if !check("u64", run_u64(), EXP_U64) { ok = false; } - if !check("s8", run_s8(), EXP_S8) { ok = false; } - if !check("s16", run_s16(), EXP_S16) { ok = false; } - if !check("s32", run_s32(), EXP_S32) { ok = false; } - if !check("s64", run_s64(), EXP_S64) { ok = false; } + if !check("i8", run_i8(), EXP_S8) { ok = false; } + if !check("i16", run_i16(), EXP_S16) { ok = false; } + if !check("i32", run_i32(), EXP_S32) { ok = false; } + if !check("i64", run_i64(), EXP_S64) { ok = false; } if !check("bool", run_bool(), EXP_BOOL) { ok = false; } if !check("f32", run_f32(), EXP_F32) { ok = false; } if !check("f64", run_f64(), EXP_F64) { ok = false; } diff --git a/examples/0605-comptime-aggregate-global.sx b/examples/0605-comptime-aggregate-global.sx index f61e8c4..8c6336a 100644 --- a/examples/0605-comptime-aggregate-global.sx +++ b/examples/0605-comptime-aggregate-global.sx @@ -14,8 +14,8 @@ // comptime expression's return shape (here, `Point`). Point :: struct { - x: s32; - y: s32; + x: i32; + y: i32; } make_point :: () -> Point { @@ -24,7 +24,7 @@ make_point :: () -> Point { POINT :: #run make_point(); -main :: () -> s32 { +main :: () -> i32 { print("POINT.x = {}\n", POINT.x); print("POINT.y = {}\n", POINT.y); return 0; diff --git a/examples/0606-comptime-string-global.sx b/examples/0606-comptime-string-global.sx index abbe65d..773557c 100644 --- a/examples/0606-comptime-string-global.sx +++ b/examples/0606-comptime-string-global.sx @@ -19,7 +19,7 @@ build_greeting :: () -> string { GREETING :: #run build_greeting(); -main :: () -> s32 { +main :: () -> i32 { print("greeting = '{}'\n", GREETING); print("greeting.len = {}\n", GREETING.len); return 0; diff --git a/examples/0607-comptime-nested-comptime-return.sx b/examples/0607-comptime-nested-comptime-return.sx index 2bfaeb1..7abf144 100644 --- a/examples/0607-comptime-nested-comptime-return.sx +++ b/examples/0607-comptime-nested-comptime-return.sx @@ -1,4 +1,4 @@ -// Nested comptime call + return — a comptime fn (`$x: s32`) whose +// Nested comptime call + return — a comptime fn (`$x: i32`) whose // body contains BOTH a nested comptime call (`print`) AND a // `return X;` statement must lower cleanly. The wrapper fn built // by `createComptimeFunction` saves/restores `inline_return_target` @@ -7,7 +7,7 @@ // stale-frame inline-return slot and tripped a null-pointer store // at `storeAtRawPtr`. // -// Repro: comptime fn (`$x: s32`) whose body has BOTH a nested +// Repro: comptime fn (`$x: i32`) whose body has BOTH a nested // comptime call (`print`) AND a `return X;` statement. Pre-fix: // interp panics. Post-fix: prints "inside" then "n=42". // @@ -19,12 +19,12 @@ #import "modules/std.sx"; -helper :: ($x: s32) -> s64 { +helper :: ($x: i32) -> i64 { print("inside\n"); return 42; } -main :: () -> s32 { +main :: () -> i32 { n := helper(7); print("n={}\n", n); return 0; diff --git a/examples/0608-comptime-comptime.sx b/examples/0608-comptime-comptime.sx index 36d95a3..f3c0d16 100644 --- a/examples/0608-comptime-comptime.sx +++ b/examples/0608-comptime-comptime.sx @@ -4,9 +4,9 @@ #import "modules/std/test.sx"; pkg :: #import "tests/fixtures/testpkg"; -add :: (a: s32, b: s32) -> s32 { a + b } +add :: (a: i32, b: i32) -> i32 { a + b } -mul :: (a: s32, b: s32) -> s32 { a * b } +mul :: (a: i32, b: i32) -> i32 { a * b } // #run compile-time constants CT_VAL :: #run add(10, 15); @@ -18,19 +18,19 @@ CT_CHAIN :: #run add(CT_VAL, 5); // #run compile-time optional tests // #run compile-time optional tests -ct_opt_coalesce :: () -> s32 { - x: ?s32 = 42; - y: ?s32 = null; +ct_opt_coalesce :: () -> i32 { + x: ?i32 = 42; + y: ?i32 = null; return (x ?? 0) + (y ?? 99); } -ct_opt_unwrap :: () -> s32 { - x: ?s32 = 77; +ct_opt_unwrap :: () -> i32 { + x: ?i32 = 77; return x!; } -ct_opt_guard :: () -> s32 { - x: ?s32 = 10; +ct_opt_guard :: () -> i32 { + x: ?i32 = 10; if x == null { return -1; } return x; } diff --git a/examples/0700-modules-import.sx b/examples/0700-modules-import.sx index 9599e00..e3835ce 100644 --- a/examples/0700-modules-import.sx +++ b/examples/0700-modules-import.sx @@ -3,7 +3,7 @@ std :: #import "modules/std.sx"; //flat #import "modules/math"; -main :: () -> s32 { +main :: () -> i32 { { defer std.print("after hello"); //expect stdout : hello there diff --git a/examples/0701-modules-c-import.sx b/examples/0701-modules-c-import.sx index 86d512d..589f5d0 100644 --- a/examples/0701-modules-c-import.sx +++ b/examples/0701-modules-c-import.sx @@ -5,7 +5,7 @@ #source "vendors/test_c/test.c"; }; -main :: () -> s32 { +main :: () -> i32 { a := add_numbers(10, 20); b := multiply(5, 6); print("add_numbers(10, 20) = {}\n", a); diff --git a/examples/0702-modules-c-import-ns.sx b/examples/0702-modules-c-import-ns.sx index 6a1a654..fb39d58 100644 --- a/examples/0702-modules-c-import-ns.sx +++ b/examples/0702-modules-c-import-ns.sx @@ -1,7 +1,7 @@ #import "modules/std.sx"; tc :: #import "tests/fixtures/test_c.sx"; -main :: () -> s32 { +main :: () -> i32 { a := tc.add_numbers(10, 20); b := tc.multiply(5, 6); print("tc.add_numbers(10, 20) = {}\n", a); diff --git a/examples/0703-modules-into-impl-helper.sx b/examples/0703-modules-into-impl-helper.sx index b8b916e..f7aefb7 100644 --- a/examples/0703-modules-into-impl-helper.sx +++ b/examples/0703-modules-into-impl-helper.sx @@ -3,10 +3,10 @@ #import "modules/std.sx"; -Wrap :: struct { v: s64 = 0; } +Wrap :: struct { v: i64 = 0; } -impl Into(Wrap) for s64 { - convert :: (self: s64) -> Wrap { +impl Into(Wrap) for i64 { + convert :: (self: i64) -> Wrap { .{ v = self * 10 } } } diff --git a/examples/0703-modules-into-import-scope.sx b/examples/0703-modules-into-import-scope.sx index 88cd97a..888270b 100644 --- a/examples/0703-modules-into-import-scope.sx +++ b/examples/0703-modules-into-import-scope.sx @@ -6,7 +6,7 @@ #import "modules/std.sx"; #import "./0703-modules-into-impl-helper.sx"; -main :: () -> s32 { +main :: () -> i32 { w : Wrap = xx 3; print("w.v = {}\n", w.v); 0 diff --git a/examples/0704-modules-inline-if-import-in-body.sx b/examples/0704-modules-inline-if-import-in-body.sx index 4ef6166..672c647 100644 --- a/examples/0704-modules-inline-if-import-in-body.sx +++ b/examples/0704-modules-inline-if-import-in-body.sx @@ -14,7 +14,7 @@ inline if OS == .android { #import "modules/std.sx"; - g_android_only : s32 = 0; + g_android_only : i32 = 0; } main :: () { print("ok\n"); } diff --git a/examples/0705-modules-inline-if-hoist-toplevel.sx b/examples/0705-modules-inline-if-hoist-toplevel.sx index 64547a7..7e73ed0 100644 --- a/examples/0705-modules-inline-if-hoist-toplevel.sx +++ b/examples/0705-modules-inline-if-hoist-toplevel.sx @@ -16,9 +16,9 @@ inline if OS == .android { #import "modules/std.sx"; - g_value : s64 = 99; + g_value : i64 = 99; } else { - g_value : s64 = 42; + g_value : i64 = 42; } main :: () { print("{}\n", g_value); } diff --git a/examples/0706-modules-import-non-transitive.sx b/examples/0706-modules-import-non-transitive.sx index 69ea6b5..2b13808 100644 --- a/examples/0706-modules-import-non-transitive.sx +++ b/examples/0706-modules-import-non-transitive.sx @@ -10,7 +10,7 @@ #import "modules/std.sx"; #import "0706-modules-import-non-transitive/b.sx"; -main :: () -> s32 { +main :: () -> i32 { print("b_only_fn: {}\n", b_only_fn()); print("c_only_fn direct: {}\n", c_only_fn()); print("c_only_const direct: {}\n", c_only_const); diff --git a/examples/0706-modules-import-non-transitive/b.sx b/examples/0706-modules-import-non-transitive/b.sx index 10d8b1c..b5d8418 100644 --- a/examples/0706-modules-import-non-transitive/b.sx +++ b/examples/0706-modules-import-non-transitive/b.sx @@ -1,5 +1,5 @@ #import "c.sx"; -b_only_fn :: () -> s32 { +b_only_fn :: () -> i32 { c_only_fn() + c_only_const } diff --git a/examples/0706-modules-import-non-transitive/c.sx b/examples/0706-modules-import-non-transitive/c.sx index 6cd80ac..8467556 100644 --- a/examples/0706-modules-import-non-transitive/c.sx +++ b/examples/0706-modules-import-non-transitive/c.sx @@ -1,2 +1,2 @@ -c_only_fn :: () -> s32 { 42 } +c_only_fn :: () -> i32 { 42 } c_only_const :: 7; diff --git a/examples/0707-modules-import-dir-scan-order.sx b/examples/0707-modules-import-dir-scan-order.sx index be2d588..ec2bceb 100644 --- a/examples/0707-modules-import-dir-scan-order.sx +++ b/examples/0707-modules-import-dir-scan-order.sx @@ -19,7 +19,7 @@ #import "modules/std.sx"; #import "0707-modules-import-dir-scan-order"; -main :: () -> s32 { +main :: () -> i32 { e := make_my(); if e == { case .a: { print("a\n"); } diff --git a/examples/0707-modules-import-dir-scan-order/types.sx b/examples/0707-modules-import-dir-scan-order/types.sx index 077fea5..67bd025 100644 --- a/examples/0707-modules-import-dir-scan-order/types.sx +++ b/examples/0707-modules-import-dir-scan-order/types.sx @@ -1,4 +1,4 @@ MyEnum :: enum { a; - b: s32; + b: i32; } diff --git a/examples/0708-modules-xx-any-pack-cross-module.sx b/examples/0708-modules-xx-any-pack-cross-module.sx index 06859da..3875ae3 100644 --- a/examples/0708-modules-xx-any-pack-cross-module.sx +++ b/examples/0708-modules-xx-any-pack-cross-module.sx @@ -7,7 +7,7 @@ #import "modules/std.sx"; #import "0708-modules-xx-any-pack-cross-module/fmt.sx"; -main :: () -> s32 { +main :: () -> i32 { print("{}", build(3)); return 0; } diff --git a/examples/0708-modules-xx-any-pack-cross-module/fmt.sx b/examples/0708-modules-xx-any-pack-cross-module/fmt.sx index d811447..024fff0 100644 --- a/examples/0708-modules-xx-any-pack-cross-module/fmt.sx +++ b/examples/0708-modules-xx-any-pack-cross-module/fmt.sx @@ -8,9 +8,9 @@ #import "modules/std.sx"; -build :: (n: s32) -> string { +build :: (n: i32) -> string { result := "items:\n"; - i : s32 = 0; + i : i32 = 0; while i < n { line := format(" item {}\n", xx i); // <-- the xx-to-Any pack arg result = concat(result, line); diff --git a/examples/0709-modules-issue-0056-diamond-param-impl.sx b/examples/0709-modules-issue-0056-diamond-param-impl.sx index ffcf6f9..597407d 100644 --- a/examples/0709-modules-issue-0056-diamond-param-impl.sx +++ b/examples/0709-modules-issue-0056-diamond-param-impl.sx @@ -2,11 +2,11 @@ // module reached through more than one import path must register exactly once. // // main ─┬─ issue-0056/mid_a ─┐ -// └─ issue-0056/mid_b ─┴─ issue-0056/common (holds `impl Into(Wrapped) for s64`) +// └─ issue-0056/mid_b ─┴─ issue-0056/common (holds `impl Into(Wrapped) for i64`) // // Impl blocks are anonymous (no `declName`), so before the fix the diamond // dedup in imports.zig appended the cached node once per path and the second -// registration tripped: `duplicate impl 'Into' for source 's64'`. Now the flat +// registration tripped: `duplicate impl 'Into' for source 'i64'`. Now the flat // decl list also dedups by node identity, so this builds and prints 7. #import "modules/std.sx"; // `Wrapped` lives in the shared `common.sx`; bare-import visibility is @@ -15,7 +15,7 @@ #import "0709-modules-issue-0056/mid_a.sx"; #import "0709-modules-issue-0056/mid_b.sx"; -main :: () -> s32 { +main :: () -> i32 { w : Wrapped = xx 7; print("{}\n", w.v); 0 diff --git a/examples/0709-modules-issue-0056/common.sx b/examples/0709-modules-issue-0056/common.sx index 6c18d61..811df7c 100644 --- a/examples/0709-modules-issue-0056/common.sx +++ b/examples/0709-modules-issue-0056/common.sx @@ -3,10 +3,10 @@ // Impl blocks are anonymous (`declName() == null`), so the diamond-import // dedup in imports.zig (`mergeFlat`) skips them and appends the node once per // path — `registerParamImpl` then trips its same-file duplicate check. -Wrapped :: struct { v: s64; } +Wrapped :: struct { v: i64; } -impl Into(Wrapped) for s64 { - convert :: (self: s64) -> Wrapped { +impl Into(Wrapped) for i64 { + convert :: (self: i64) -> Wrapped { return .{ v = self }; } } diff --git a/examples/0709-modules-issue-0056/mid_a.sx b/examples/0709-modules-issue-0056/mid_a.sx index 5155134..c83d34b 100644 --- a/examples/0709-modules-issue-0056/mid_a.sx +++ b/examples/0709-modules-issue-0056/mid_a.sx @@ -1,3 +1,3 @@ #import "common.sx"; -mid_a_marker :: () -> s64 { 1 } +mid_a_marker :: () -> i64 { 1 } diff --git a/examples/0709-modules-issue-0056/mid_b.sx b/examples/0709-modules-issue-0056/mid_b.sx index 11be773..1afe797 100644 --- a/examples/0709-modules-issue-0056/mid_b.sx +++ b/examples/0709-modules-issue-0056/mid_b.sx @@ -1,3 +1,3 @@ #import "common.sx"; -mid_b_marker :: () -> s64 { 2 } +mid_b_marker :: () -> i64 { 2 } diff --git a/examples/0711-modules-sha256-vectors.sx b/examples/0711-modules-sha256-vectors.sx index 2d5138d..1469f9b 100644 --- a/examples/0711-modules-sha256-vectors.sx +++ b/examples/0711-modules-sha256-vectors.sx @@ -26,7 +26,7 @@ check :: (label: string, got: [64]u8, want: string) { // Digest of `total` bytes of 'a', streamed in 1000-byte chunks so peak // memory stays O(chunk) for the 1,000,000 case. `total == 0` yields the // empty-input digest (the loop body never runs). -hash_a :: (total: s64) -> [64]u8 { +hash_a :: (total: i64) -> [64]u8 { chunk : [1000]u8 = ---; k := 0; while k < 1000 { chunk[k] = 97; k += 1; } // 97 = 'a' diff --git a/examples/0712-modules-sha256-streaming.sx b/examples/0712-modules-sha256-streaming.sx index 9408eff..17eac70 100644 --- a/examples/0712-modules-sha256-streaming.sx +++ b/examples/0712-modules-sha256-streaming.sx @@ -45,7 +45,7 @@ stream_by_byte :: (data: string) -> [64]u8 { } // Absorb `data` as two updates split at `at` (views into the buffer). -stream_split :: (data: string, at: s64) -> [64]u8 { +stream_split :: (data: string, at: i64) -> [64]u8 { h := init(); h.update(string.{ ptr = @data[0], len = at }); h.update(string.{ ptr = @data[at], len = data.len - at }); diff --git a/examples/0713-modules-json-writer.sx b/examples/0713-modules-json-writer.sx index 911e7ea..09f4fa0 100644 --- a/examples/0713-modules-json-writer.sx +++ b/examples/0713-modules-json-writer.sx @@ -2,8 +2,8 @@ // // Builds a representative value — a nested object holding a string with // every escape kind (quote, newline, tab, backslash, a raw control byte), -// integers spanning zero / a small negative / a small positive / s64 MIN -// (-9223372036854775808) / s64 MAX (9223372036854775807), a bool, null, an +// integers spanning zero / a small negative / a small positive / i64 MIN +// (-9223372036854775808) / i64 MAX (9223372036854775807), a bool, null, an // array, and a nested object — then serializes it two ways and asserts the // EXACT bytes: // @@ -54,10 +54,10 @@ build :: (alloc: Allocator) -> Value { obj.put("n", .int_(0 - 7), alloc); // small negative int obj.put("zero", .int_(0), alloc); // zero obj.put("pos", .int_(7), alloc); // small positive int - // s64 MIN: its magnitude (9223372036854775808) is not a representable - // positive s64 literal, so build it from MAX-positive minus one. + // i64 MIN: its magnitude (9223372036854775808) is not a representable + // positive i64 literal, so build it from MAX-positive minus one. obj.put("min", .int_(0 - 9223372036854775807 - 1), alloc); - obj.put("max", .int_(9223372036854775807), alloc); // s64 MAX + obj.put("max", .int_(9223372036854775807), alloc); // i64 MAX obj.put("ok", .bool_(true), alloc); obj.put("nil", .null_, alloc); obj.put("xs", .array(xs), alloc); diff --git a/examples/0714-modules-json-reader.sx b/examples/0714-modules-json-reader.sx index a20a47f..ecfd050 100644 --- a/examples/0714-modules-json-reader.sx +++ b/examples/0714-modules-json-reader.sx @@ -32,7 +32,7 @@ report :: (label: string, ok: bool) { } // Half-open containment [lo, hi). -in_range :: (x: s64, lo: s64, hi: s64) -> bool { +in_range :: (x: i64, lo: i64, hi: i64) -> bool { return x >= lo and x < hi; } @@ -86,10 +86,10 @@ main :: () -> ! { report("nested-pair", sub.items[0].key == "k" and sub.items[0].val.str == "v"); // ── 2. Heap discipline: view vs decoded ────────────────────────── - base : s64 = xx src.ptr; + base : i64 = xx src.ptr; stop := base + src.len; - p_plain : s64 = xx o.items[0].val.str.ptr; // "plain": no escape -> VIEW into src - p_esc : s64 = xx o.items[1].val.str.ptr; // "a\nb": escaped -> DECODED into arena + p_plain : i64 = xx o.items[0].val.str.ptr; // "plain": no escape -> VIEW into src + p_esc : i64 = xx o.items[1].val.str.ptr; // "a\nb": escaped -> DECODED into arena report("plain-is-view", in_range(p_plain, base, stop)); report("escaped-allocated", !in_range(p_esc, base, stop)); @@ -120,10 +120,10 @@ main :: () -> ! { report("uni-A", u[0] == 0x41); // U+0041 -> 1 byte report("uni-e1", u[1] == 0xC3); // U+00E9 -> 2 bytes report("uni-e2", u[2] == 0xA9); - report("uni-s0", u[3] == 0xF0); // U+1F600 (surrogate pair) -> 4 bytes - report("uni-s1", u[4] == 0x9F); - report("uni-s2", u[5] == 0x98); - report("uni-s3", u[6] == 0x80); + report("uni-i0", u[3] == 0xF0); // U+1F600 (surrogate pair) -> 4 bytes + report("uni-i1", u[4] == 0x9F); + report("uni-i2", u[5] == 0x98); + report("uni-i3", u[6] == 0x80); // ── 6. Malformed inputs each surface the right error variant ───── report("err-truncated", raises("{\"a\":", error.UnexpectedEnd, xx arena)); diff --git a/examples/0715-modules-json-suite.sx b/examples/0715-modules-json-suite.sx index 4819c0a..6d67660 100644 --- a/examples/0715-modules-json-suite.sx +++ b/examples/0715-modules-json-suite.sx @@ -7,7 +7,7 @@ // PART A — ROUND-TRIP. Build a representative document covering EVERY // value kind (nested object + array, a string carrying every escape // kind `\" \\ \b \f \n \r \t` and a `\u00XX` control, integers 0 / -// small-negative / s64 MIN (-9223372036854775808) / s64 MAX +// small-negative / i64 MIN (-9223372036854775808) / i64 MAX // (9223372036854775807), bool, null) through an explicit Arena, then // `build -> write -> parse -> write`: assert the writer's EXACT bytes, // assert `parse` then re-`write` reproduces them (idempotent), and @@ -36,7 +36,7 @@ report :: (label: string, ok: bool) { } // Half-open containment [lo, hi). -in_range :: (x: s64, lo: s64, hi: s64) -> bool { +in_range :: (x: i64, lo: i64, hi: i64) -> bool { return x >= lo and x < hi; } @@ -84,7 +84,7 @@ build :: (alloc: Allocator) -> Value { obj.put("esc", .str(esc), alloc); obj.put("zero", .int_(0), alloc); obj.put("neg", .int_(0 - 7), alloc); - // s64 MIN: |MIN| is not a representable positive s64 literal, so build + // i64 MIN: |MIN| is not a representable positive i64 literal, so build // it as MAX-positive minus one. obj.put("min", .int_(0 - 9223372036854775807 - 1), alloc); obj.put("max", .int_(9223372036854775807), alloc); @@ -203,7 +203,7 @@ main :: () -> ! { report("err-esc-surrogate", raises("\"\\uD83D\\u0041\"", error.BadEscape, a)); // BadNumber: leading zero, lone minus, fraction, exponent, and an - // integer just past s64 MAX (overflow). + // integer just past i64 MAX (overflow). report("err-num-leadzero", raises("01", error.BadNumber, a)); report("err-num-lonedash", raises("-", error.BadNumber, a)); report("err-num-fraction", raises("1.5", error.BadNumber, a)); diff --git a/examples/0717-modules-cli-parse.sx b/examples/0717-modules-cli-parse.sx index 033f8a7..f4b4e7d 100644 --- a/examples/0717-modules-cli-parse.sx +++ b/examples/0717-modules-cli-parse.sx @@ -26,7 +26,7 @@ report :: (label: string, ok: bool) { } // Half-open containment [lo, hi) — used to prove a view points into argv. -in_range :: (x: s64, lo: s64, hi: s64) -> bool { +in_range :: (x: i64, lo: i64, hi: i64) -> bool { return x >= lo and x < hi; } @@ -69,13 +69,13 @@ main :: () -> ! { // ── 2. Heap discipline: flag value is a VIEW into argv ──────────── // "dist" is argv[3]; its bytes must lie inside that very element. - src : s64 = xx argv[3].ptr; + src : i64 = xx argv[3].ptr; stop := src + argv[3].len; - pview : s64 = xx p.value_of("out").ptr; + pview : i64 = xx p.value_of("out").ptr; report("value-is-view", in_range(pview, src, stop) or pview == src); // group/command are argv[0]/argv[1] verbatim (same pointer, no copy). - g0 : s64 = xx argv[0].ptr; - gp : s64 = xx p.group.ptr; + g0 : i64 = xx argv[0].ptr; + gp : i64 = xx p.group.ptr; report("group-is-view", gp == g0); // ── 3. Dispatch to a different command in the table ────────────── diff --git a/examples/0720-modules-qualified-own-import.sx b/examples/0720-modules-qualified-own-import.sx index 3275ec6..57e8444 100644 --- a/examples/0720-modules-qualified-own-import.sx +++ b/examples/0720-modules-qualified-own-import.sx @@ -18,7 +18,7 @@ report :: (label: string, ok: bool) { if ok { print("{}: ok\n", label); } else { print("{}: FAIL\n", label); } } -main :: () -> s32 { +main :: () -> i32 { // 14 * 3 = 42, computed by calc.compute -> triple(base()), both of which // live in calc.sx's own flat import. report("qualified-own-import", calc.compute() == 42); diff --git a/examples/0720-modules-qualified-own-import/calc.sx b/examples/0720-modules-qualified-own-import/calc.sx index 34e628e..ec3f270 100644 --- a/examples/0720-modules-qualified-own-import/calc.sx +++ b/examples/0720-modules-qualified-own-import/calc.sx @@ -5,4 +5,4 @@ // visible — issue 0100 F1. #import "util.sx"; -compute :: () -> s64 { return triple(base()); } +compute :: () -> i64 { return triple(base()); } diff --git a/examples/0720-modules-qualified-own-import/util.sx b/examples/0720-modules-qualified-own-import/util.sx index 7c696cb..25b9063 100644 --- a/examples/0720-modules-qualified-own-import/util.sx +++ b/examples/0720-modules-qualified-own-import/util.sx @@ -1,2 +1,2 @@ -triple :: (x: s64) -> s64 { return x * 3; } -base :: () -> s64 { return 14; } +triple :: (x: i64) -> i64 { return x * 3; } +base :: () -> i64 { return 14; } diff --git a/examples/0721-modules-qualified-terminating-callee.sx b/examples/0721-modules-qualified-terminating-callee.sx index 2ce832b..346c52f 100644 --- a/examples/0721-modules-qualified-terminating-callee.sx +++ b/examples/0721-modules-qualified-terminating-callee.sx @@ -20,7 +20,7 @@ report :: (label: string, ok: bool) { if ok { print("{}: ok\n", label); } else { print("{}: FAIL\n", label); } } -main :: () -> s32 { +main :: () -> i32 { // Qualified callee whose body terminates via a constant-folded `if true`. x := m.foo(); // Caller statements AFTER the call must still be emitted (not dead). diff --git a/examples/0721-modules-qualified-terminating-callee/helper.sx b/examples/0721-modules-qualified-terminating-callee/helper.sx index d90cc7b..21a731f 100644 --- a/examples/0721-modules-qualified-terminating-callee/helper.sx +++ b/examples/0721-modules-qualified-terminating-callee/helper.sx @@ -1,3 +1,3 @@ // Lives in m.sx's OWN flat import — reachable from `foo` but not from the // top-level consumer that imports m.sx under a qualified namespace. -helper :: () -> s64 { return 7; } +helper :: () -> i64 { return 7; } diff --git a/examples/0721-modules-qualified-terminating-callee/m.sx b/examples/0721-modules-qualified-terminating-callee/m.sx index e2f7ba1..0775d52 100644 --- a/examples/0721-modules-qualified-terminating-callee/m.sx +++ b/examples/0721-modules-qualified-terminating-callee/m.sx @@ -4,7 +4,7 @@ // alias must be transparent to the caller's lowering state — issue 0100 F2. #import "helper.sx"; -foo :: () -> s64 { +foo :: () -> i64 { if true { return helper(); } return 0; } diff --git a/examples/0722-modules-flat-same-name-own.sx b/examples/0722-modules-flat-same-name-own.sx index 911e594..697d81f 100644 --- a/examples/0722-modules-flat-same-name-own.sx +++ b/examples/0722-modules-flat-same-name-own.sx @@ -11,7 +11,7 @@ report :: (label: string, ok: bool) { if ok { print("{}: ok\n", label); } else { print("{}: FAIL\n", label); } } -main :: () -> s32 { +main :: () -> i32 { report("from_a binds a.greet", from_a() == 1); report("from_b binds b.greet", from_b() == 2); 0 diff --git a/examples/0722-modules-flat-same-name-own/a.sx b/examples/0722-modules-flat-same-name-own/a.sx index 07aa08f..306eb75 100644 --- a/examples/0722-modules-flat-same-name-own/a.sx +++ b/examples/0722-modules-flat-same-name-own/a.sx @@ -1,5 +1,5 @@ // a.sx authors `greet`. Its own `from_a` calls `greet` bare — under fix-0102c // that binds a.sx's OWN author (own-author wins), even though b.sx also // authors `greet` and the first-wins merge keeps only one in the merged scope. -greet :: () -> s64 { return 1; } -from_a :: () -> s64 { return greet(); } +greet :: () -> i64 { return 1; } +from_a :: () -> i64 { return greet(); } diff --git a/examples/0722-modules-flat-same-name-own/b.sx b/examples/0722-modules-flat-same-name-own/b.sx index 0c684d2..2e9e304 100644 --- a/examples/0722-modules-flat-same-name-own/b.sx +++ b/examples/0722-modules-flat-same-name-own/b.sx @@ -1,4 +1,4 @@ // b.sx authors its OWN `greet`. `from_b`'s bare `greet` must bind b.sx's // author (2), not the first-wins winner from a.sx. -greet :: () -> s64 { return 2; } -from_b :: () -> s64 { return greet(); } +greet :: () -> i64 { return 2; } +from_b :: () -> i64 { return greet(); } diff --git a/examples/0723-modules-flat-vs-namespaced.sx b/examples/0723-modules-flat-vs-namespaced.sx index ac63e62..c5c2bf6 100644 --- a/examples/0723-modules-flat-vs-namespaced.sx +++ b/examples/0723-modules-flat-vs-namespaced.sx @@ -10,7 +10,7 @@ report :: (label: string, ok: bool) { if ok { print("{}: ok\n", label); } else { print("{}: FAIL\n", label); } } -main :: () -> s32 { +main :: () -> i32 { report("bare binds flat", value() == 10); report("nm.value binds named", nm.value() == 20); 0 diff --git a/examples/0723-modules-flat-vs-namespaced/flat.sx b/examples/0723-modules-flat-vs-namespaced/flat.sx index 7dc0cfd..2446a21 100644 --- a/examples/0723-modules-flat-vs-namespaced/flat.sx +++ b/examples/0723-modules-flat-vs-namespaced/flat.sx @@ -1,3 +1,3 @@ // Flat-imported author of `value`. A bare `value()` in the consumer binds THIS // one — the only bare (flat) author of the name. -value :: () -> s64 { return 10; } +value :: () -> i64 { return 10; } diff --git a/examples/0723-modules-flat-vs-namespaced/named.sx b/examples/0723-modules-flat-vs-namespaced/named.sx index 132a422..1fb45e5 100644 --- a/examples/0723-modules-flat-vs-namespaced/named.sx +++ b/examples/0723-modules-flat-vs-namespaced/named.sx @@ -1,4 +1,4 @@ // Namespaced-imported author of `value`. Reachable only as `nm.value`; it never // enters the flat merge, so it neither shadows the flat author nor makes the // bare call ambiguous. -value :: () -> s64 { return 20; } +value :: () -> i64 { return 20; } diff --git a/examples/0724-modules-flat-same-name-ambiguous.sx b/examples/0724-modules-flat-same-name-ambiguous.sx index 7a623f0..d83c2b6 100644 --- a/examples/0724-modules-flat-same-name-ambiguous.sx +++ b/examples/0724-modules-flat-same-name-ambiguous.sx @@ -6,7 +6,7 @@ #import "0724-modules-flat-same-name-ambiguous/a.sx"; #import "0724-modules-flat-same-name-ambiguous/b.sx"; -main :: () -> s32 { +main :: () -> i32 { print("{}\n", dup()); 0 } diff --git a/examples/0724-modules-flat-same-name-ambiguous/a.sx b/examples/0724-modules-flat-same-name-ambiguous/a.sx index cb94ede..eb2b6c0 100644 --- a/examples/0724-modules-flat-same-name-ambiguous/a.sx +++ b/examples/0724-modules-flat-same-name-ambiguous/a.sx @@ -1,3 +1,3 @@ // One of two flat authors of `dup`. A consumer that flat-imports BOTH and calls // `dup` bare cannot pick between them. -dup :: () -> s64 { return 1; } +dup :: () -> i64 { return 1; } diff --git a/examples/0724-modules-flat-same-name-ambiguous/b.sx b/examples/0724-modules-flat-same-name-ambiguous/b.sx index 6bd821b..816b855 100644 --- a/examples/0724-modules-flat-same-name-ambiguous/b.sx +++ b/examples/0724-modules-flat-same-name-ambiguous/b.sx @@ -1,2 +1,2 @@ // The second flat author of `dup`. -dup :: () -> s64 { return 2; } +dup :: () -> i64 { return 2; } diff --git a/examples/0725-modules-flat-dir-same-name.sx b/examples/0725-modules-flat-dir-same-name.sx index 910716e..dd47ba1 100644 --- a/examples/0725-modules-flat-dir-same-name.sx +++ b/examples/0725-modules-flat-dir-same-name.sx @@ -10,7 +10,7 @@ report :: (label: string, ok: bool) { if ok { print("{}: ok\n", label); } else { print("{}: FAIL\n", label); } } -main :: () -> s32 { +main :: () -> i32 { report("caller1 binds d1.tag", caller1() == 100); report("caller2 binds d2.tag", caller2() == 200); 0 diff --git a/examples/0725-modules-flat-dir-same-name/d1/one.sx b/examples/0725-modules-flat-dir-same-name/d1/one.sx index 47db691..b767692 100644 --- a/examples/0725-modules-flat-dir-same-name/d1/one.sx +++ b/examples/0725-modules-flat-dir-same-name/d1/one.sx @@ -1,3 +1,3 @@ // d1's author of `tag`. `caller1` (also in d1) binds d1's own `tag` (100). -tag :: () -> s64 { return 100; } -caller1 :: () -> s64 { return tag(); } +tag :: () -> i64 { return 100; } +caller1 :: () -> i64 { return tag(); } diff --git a/examples/0725-modules-flat-dir-same-name/d2/two.sx b/examples/0725-modules-flat-dir-same-name/d2/two.sx index 026037d..128d5b8 100644 --- a/examples/0725-modules-flat-dir-same-name/d2/two.sx +++ b/examples/0725-modules-flat-dir-same-name/d2/two.sx @@ -1,4 +1,4 @@ // d2's author of `tag`. `caller2` (also in d2) binds d2's own `tag` (200), // even though d1's `tag` is the first-wins merge winner. -tag :: () -> s64 { return 200; } -caller2 :: () -> s64 { return tag(); } +tag :: () -> i64 { return 200; } +caller2 :: () -> i64 { return tag(); } diff --git a/examples/0726-modules-flat-same-name-variadic.sx b/examples/0726-modules-flat-same-name-variadic.sx index 55f84ee..ba75593 100644 --- a/examples/0726-modules-flat-same-name-variadic.sx +++ b/examples/0726-modules-flat-same-name-variadic.sx @@ -14,7 +14,7 @@ report :: (label: string, ok: bool) { if ok { print("{}: ok\n", label); } else { print("{}: FAIL\n", label); } } -main :: () -> s32 { +main :: () -> i32 { report("from_a combine fixed", from_a_combine() == 30); report("from_b combine variadic", from_b_combine() == 10); report("from_a pick variadic", from_a_pick() == 6); diff --git a/examples/0726-modules-flat-same-name-variadic/a.sx b/examples/0726-modules-flat-same-name-variadic/a.sx index 730fc59..d1b037a 100644 --- a/examples/0726-modules-flat-same-name-variadic/a.sx +++ b/examples/0726-modules-flat-same-name-variadic/a.sx @@ -1,11 +1,11 @@ // a.sx is the first-wins winner for both names. `combine` is FIXED arity; // `pick` is VARIADIC. `from_a_*` call them bare — a authors the winner, so // they resolve through the existing path and pack against a's own shapes. -combine :: (x: s64, y: s64) -> s64 { return x + y; } -pick :: (..xs: []s64) -> s64 { +combine :: (x: i64, y: i64) -> i64 { return x + y; } +pick :: (..xs: []i64) -> i64 { result := 0; for xs (it) { result = result + it; } result } -from_a_combine :: () -> s64 { return combine(10, 20); } -from_a_pick :: () -> s64 { return pick(1, 2, 3); } +from_a_combine :: () -> i64 { return combine(10, 20); } +from_a_pick :: () -> i64 { return pick(1, 2, 3); } diff --git a/examples/0726-modules-flat-same-name-variadic/b.sx b/examples/0726-modules-flat-same-name-variadic/b.sx index 9dbce24..e504e41 100644 --- a/examples/0726-modules-flat-same-name-variadic/b.sx +++ b/examples/0726-modules-flat-same-name-variadic/b.sx @@ -2,11 +2,11 @@ // `combine` is VARIADIC, `pick` is FIXED. Each `from_b_*` bare call must pack // against b's OWN author's signature (the F1 fix) — combine sums its variadic // pack, pick subtracts its two fixed args. -combine :: (..xs: []s64) -> s64 { +combine :: (..xs: []i64) -> i64 { result := 0; for xs (it) { result = result + it; } result } -pick :: (a: s64, b: s64) -> s64 { return b - a; } -from_b_combine :: () -> s64 { return combine(1, 2, 3, 4); } -from_b_pick :: () -> s64 { return pick(2, 7); } +pick :: (a: i64, b: i64) -> i64 { return b - a; } +from_b_combine :: () -> i64 { return combine(1, 2, 3, 4); } +from_b_pick :: () -> i64 { return pick(2, 7); } diff --git a/examples/0727-modules-user-ns-m0.sx b/examples/0727-modules-user-ns-m0.sx index 5740500..cecd569 100644 --- a/examples/0727-modules-user-ns-m0.sx +++ b/examples/0727-modules-user-ns-m0.sx @@ -12,7 +12,7 @@ report :: (label: string, ok: bool) { if ok { print("{}: ok\n", label); } else { print("{}: FAIL\n", label); } } -main :: () -> s32 { +main :: () -> i32 { report("call_a binds a.ping", call_a() == 1); report("call_b binds b.ping", call_b() == 2); report("__m0.ping binds m.ping", __m0.ping() == 99); diff --git a/examples/0727-modules-user-ns-m0/a.sx b/examples/0727-modules-user-ns-m0/a.sx index f46b7f6..fb3c407 100644 --- a/examples/0727-modules-user-ns-m0/a.sx +++ b/examples/0727-modules-user-ns-m0/a.sx @@ -1,3 +1,3 @@ // Flat author of `ping`; `call_a` binds a.sx's own `ping` (1). -ping :: () -> s64 { return 1; } -call_a :: () -> s64 { return ping(); } +ping :: () -> i64 { return 1; } +call_a :: () -> i64 { return ping(); } diff --git a/examples/0727-modules-user-ns-m0/b.sx b/examples/0727-modules-user-ns-m0/b.sx index af3fbfc..4dbfd1b 100644 --- a/examples/0727-modules-user-ns-m0/b.sx +++ b/examples/0727-modules-user-ns-m0/b.sx @@ -1,3 +1,3 @@ // Second flat author of `ping`; `call_b` binds b.sx's own `ping` (2). -ping :: () -> s64 { return 2; } -call_b :: () -> s64 { return ping(); } +ping :: () -> i64 { return 2; } +call_b :: () -> i64 { return ping(); } diff --git a/examples/0727-modules-user-ns-m0/m.sx b/examples/0727-modules-user-ns-m0/m.sx index db250e1..78cfd92 100644 --- a/examples/0727-modules-user-ns-m0/m.sx +++ b/examples/0727-modules-user-ns-m0/m.sx @@ -1,3 +1,3 @@ // Imported under a user namespace literally named `__m0`. Reached as // `__m0.ping` (99); coexists with the flat `ping` collision. -ping :: () -> s64 { return 99; } +ping :: () -> i64 { return 99; } diff --git a/examples/0728-modules-flat-same-name-paramtype.sx b/examples/0728-modules-flat-same-name-paramtype.sx index 2810bb9..b7ed518 100644 --- a/examples/0728-modules-flat-same-name-paramtype.sx +++ b/examples/0728-modules-flat-same-name-paramtype.sx @@ -1,6 +1,6 @@ // fix-0102c F2 (issue 0102): two flat FILE imports each author a same-name free // function `apply` with a DIFFERENT parameter TYPE — a.sx takes a value -// (`x: s64`), b.sx takes a pointer (`x: *s64`). The first-wins import merge +// (`x: i64`), b.sx takes a pointer (`x: *i64`). The first-wins import merge // keeps a.sx's value-typed `apply`, but each module's bare call must type its // arguments against ITS OWN author. b.sx's `from_b` passes a local `v` to its // pointer-param `apply` via implicit address-of; before the fix the arg was @@ -15,7 +15,7 @@ report :: (label: string, ok: bool) { if ok { print("{}: ok\n", label); } else { print("{}: FAIL\n", label); } } -main :: () -> s32 { +main :: () -> i32 { report("from_a binds a.apply (value param)", from_a() == 11); report("from_b binds b.apply (pointer param)", from_b() == 42); 0 diff --git a/examples/0728-modules-flat-same-name-paramtype/a.sx b/examples/0728-modules-flat-same-name-paramtype/a.sx index 4b15eb4..b16b8bb 100644 --- a/examples/0728-modules-flat-same-name-paramtype/a.sx +++ b/examples/0728-modules-flat-same-name-paramtype/a.sx @@ -1,5 +1,5 @@ // a.sx authors `apply` taking a VALUE. It is imported first, so it is the // first-wins merge winner. `from_a` calls `apply` bare on a value local — its // own author wins (own == winner → existing path, byte-for-byte unchanged). -apply :: (x: s64) -> s64 { return x + 1; } -from_a :: () -> s64 { v : s64 = 10; return apply(v); } +apply :: (x: i64) -> i64 { return x + 1; } +from_a :: () -> i64 { v : i64 = 10; return apply(v); } diff --git a/examples/0728-modules-flat-same-name-paramtype/b.sx b/examples/0728-modules-flat-same-name-paramtype/b.sx index ebaa0ec..9c4d4a5 100644 --- a/examples/0728-modules-flat-same-name-paramtype/b.sx +++ b/examples/0728-modules-flat-same-name-paramtype/b.sx @@ -3,5 +3,5 @@ // mutates `v` in place (×2 → 42). Before the fix, `v` was typed against a.sx's // value-param winner, lowered as a value, then the resolved pointer-param // author was called with that value forced to a pointer (segfault). -apply :: (x: *s64) { x.* = x.* * 2; } -from_b :: () -> s64 { v : s64 = 21; apply(v); return v; } +apply :: (x: *i64) { x.* = x.* * 2; } +from_b :: () -> i64 { v : i64 = 21; apply(v); return v; } diff --git a/examples/0729-modules-flat-same-name-foreign.sx b/examples/0729-modules-flat-same-name-foreign.sx index 1fcb5b1..ffe07ba 100644 --- a/examples/0729-modules-flat-same-name-foreign.sx +++ b/examples/0729-modules-flat-same-name-foreign.sx @@ -8,7 +8,7 @@ #import "0729-modules-flat-same-name-foreign/a.sx"; #import "0729-modules-flat-same-name-foreign/b.sx"; -main :: () -> s32 { +main :: () -> i32 { print("absval = {}\n", absval(-7)); 0 } diff --git a/examples/0729-modules-flat-same-name-foreign/a.sx b/examples/0729-modules-flat-same-name-foreign/a.sx index 13b27f3..5a6138b 100644 --- a/examples/0729-modules-flat-same-name-foreign/a.sx +++ b/examples/0729-modules-flat-same-name-foreign/a.sx @@ -2,4 +2,4 @@ // flat-importing BOTH must NOT see this as an ambiguous bare-call collision — // foreign authors are never rerouted by the bare-call resolver, so the call // falls to the existing first-wins foreign dispatch. -absval :: (n: s32) -> s32 #foreign libc "abs"; +absval :: (n: i32) -> i32 #foreign libc "abs"; diff --git a/examples/0729-modules-flat-same-name-foreign/b.sx b/examples/0729-modules-flat-same-name-foreign/b.sx index 527122e..c3ca491 100644 --- a/examples/0729-modules-flat-same-name-foreign/b.sx +++ b/examples/0729-modules-flat-same-name-foreign/b.sx @@ -1,2 +1,2 @@ // The second flat author of `absval` — the identical `#foreign` libc binding. -absval :: (n: s32) -> s32 #foreign libc "abs"; +absval :: (n: i32) -> i32 #foreign libc "abs"; diff --git a/examples/0730-modules-flat-same-name-default-arg.sx b/examples/0730-modules-flat-same-name-default-arg.sx index 98da771..fe196a8 100644 --- a/examples/0730-modules-flat-same-name-default-arg.sx +++ b/examples/0730-modules-flat-same-name-default-arg.sx @@ -13,7 +13,7 @@ report :: (label: string, ok: bool) { if ok { print("{}: ok\n", label); } else { print("{}: FAIL\n", label); } } -main :: () -> s32 { +main :: () -> i32 { report("from_a binds a.cfg default (10)", from_a() == 10); report("from_b binds b.cfg default (20)", from_b() == 20); 0 diff --git a/examples/0730-modules-flat-same-name-default-arg/a.sx b/examples/0730-modules-flat-same-name-default-arg/a.sx index 7d2fa02..589c071 100644 --- a/examples/0730-modules-flat-same-name-default-arg/a.sx +++ b/examples/0730-modules-flat-same-name-default-arg/a.sx @@ -1,5 +1,5 @@ // a.sx authors `cfg` defaulting to 10. Imported first, so it is the first-wins // merge winner. `from_a` calls `cfg()` with the arg omitted — own == winner → // existing default-expansion path, byte-for-byte unchanged. -cfg :: (n: s64 = 10) -> s64 { return n; } -from_a :: () -> s64 { return cfg(); } +cfg :: (n: i64 = 10) -> i64 { return n; } +from_a :: () -> i64 { return cfg(); } diff --git a/examples/0730-modules-flat-same-name-default-arg/b.sx b/examples/0730-modules-flat-same-name-default-arg/b.sx index 909827c..4a2521a 100644 --- a/examples/0730-modules-flat-same-name-default-arg/b.sx +++ b/examples/0730-modules-flat-same-name-default-arg/b.sx @@ -1,5 +1,5 @@ // b.sx authors its OWN `cfg` defaulting to 20. `from_b`'s `cfg()` omits the // arg; the omitted trailing default must come from b.sx's author (20), not the // first-wins winner from a.sx (10). -cfg :: (n: s64 = 20) -> s64 { return n; } -from_b :: () -> s64 { return cfg(); } +cfg :: (n: i64 = 20) -> i64 { return n; } +from_b :: () -> i64 { return cfg(); } diff --git a/examples/0731-modules-flat-same-name-closure.sx b/examples/0731-modules-flat-same-name-closure.sx index 53c11a9..2d25d38 100644 --- a/examples/0731-modules-flat-same-name-closure.sx +++ b/examples/0731-modules-flat-same-name-closure.sx @@ -1,7 +1,7 @@ // fix-0102d site 2 (issue 0102): two flat FILE imports each author a same-name // free function `pick` (a.sx returns 1, b.sx returns 2). Each module takes // `pick` as a function VALUE — both as `closure(pick)` and as a bare-name -// fn-pointer binding (`g : () -> s64 = pick`). The captured FuncId must be the +// fn-pointer binding (`g : () -> i64 = pick`). The captured FuncId must be the // RESOLVED author's (own-author wins), not the first-wins winner's. Before the // fix, b.sx's `closure(pick)` / `pick`-as-value both captured a.sx's winner // (1). Regression: per-source function-value conversion (closure + func_ref). @@ -13,7 +13,7 @@ report :: (label: string, ok: bool) { if ok { print("{}: ok\n", label); } else { print("{}: FAIL\n", label); } } -main :: () -> s32 { +main :: () -> i32 { report("from_a closure binds a.pick (1)", from_a_closure() == 1); report("from_b closure binds b.pick (2)", from_b_closure() == 2); report("from_a fn-value binds a.pick (1)", from_a_value() == 1); diff --git a/examples/0731-modules-flat-same-name-closure/a.sx b/examples/0731-modules-flat-same-name-closure/a.sx index 5420616..5ac1526 100644 --- a/examples/0731-modules-flat-same-name-closure/a.sx +++ b/examples/0731-modules-flat-same-name-closure/a.sx @@ -1,6 +1,6 @@ // a.sx authors `pick` returning 1. Imported first → first-wins winner. // `from_a_closure` / `from_a_value` take a.sx's own author (own == winner → // existing path, byte-for-byte unchanged). -pick :: () -> s64 { return 1; } -from_a_closure :: () -> s64 { f := closure(pick); return f(); } -from_a_value :: () -> s64 { g : () -> s64 = pick; return g(); } +pick :: () -> i64 { return 1; } +from_a_closure :: () -> i64 { f := closure(pick); return f(); } +from_a_value :: () -> i64 { g : () -> i64 = pick; return g(); } diff --git a/examples/0731-modules-flat-same-name-closure/b.sx b/examples/0731-modules-flat-same-name-closure/b.sx index b70cd11..a68b815 100644 --- a/examples/0731-modules-flat-same-name-closure/b.sx +++ b/examples/0731-modules-flat-same-name-closure/b.sx @@ -1,6 +1,6 @@ // b.sx authors its OWN `pick` returning 2. Taking `pick` as a value — -// `closure(pick)` or `g : () -> s64 = pick` — must capture b.sx's author (2), +// `closure(pick)` or `g : () -> i64 = pick` — must capture b.sx's author (2), // not the first-wins winner from a.sx (1). -pick :: () -> s64 { return 2; } -from_b_closure :: () -> s64 { f := closure(pick); return f(); } -from_b_value :: () -> s64 { g : () -> s64 = pick; return g(); } +pick :: () -> i64 { return 2; } +from_b_closure :: () -> i64 { f := closure(pick); return f(); } +from_b_value :: () -> i64 { g : () -> i64 = pick; return g(); } diff --git a/examples/0732-modules-flat-same-name-ufcs.sx b/examples/0732-modules-flat-same-name-ufcs.sx index e817480..501de42 100644 --- a/examples/0732-modules-flat-same-name-ufcs.sx +++ b/examples/0732-modules-flat-same-name-ufcs.sx @@ -12,7 +12,7 @@ report :: (label: string, ok: bool) { if ok { print("{}: ok\n", label); } else { print("{}: FAIL\n", label); } } -main :: () -> s32 { +main :: () -> i32 { report("from_a v.bump() binds a.bump (+1)", from_a_ufcs() == 11); report("from_b v.bump() binds b.bump (+100)", from_b_ufcs() == 110); 0 diff --git a/examples/0732-modules-flat-same-name-ufcs/a.sx b/examples/0732-modules-flat-same-name-ufcs/a.sx index 0300f8c..25f2713 100644 --- a/examples/0732-modules-flat-same-name-ufcs/a.sx +++ b/examples/0732-modules-flat-same-name-ufcs/a.sx @@ -1,5 +1,5 @@ // a.sx authors `bump` adding 1. Imported first → first-wins winner. `from_a`'s // `v.bump()` resolves a.sx's own author (own == winner → existing UFCS path, // byte-for-byte unchanged). -bump :: ufcs (x: s64) -> s64 { return x + 1; } -from_a_ufcs :: () -> s64 { v : s64 = 10; return v.bump(); } +bump :: ufcs (x: i64) -> i64 { return x + 1; } +from_a_ufcs :: () -> i64 { v : i64 = 10; return v.bump(); } diff --git a/examples/0732-modules-flat-same-name-ufcs/b.sx b/examples/0732-modules-flat-same-name-ufcs/b.sx index 37f1d78..746f0e4 100644 --- a/examples/0732-modules-flat-same-name-ufcs/b.sx +++ b/examples/0732-modules-flat-same-name-ufcs/b.sx @@ -1,4 +1,4 @@ // b.sx authors its OWN `bump` adding 100. `from_b`'s `v.bump()` must dispatch // b.sx's author (+100 → 110), not the first-wins winner from a.sx (+1). -bump :: ufcs (x: s64) -> s64 { return x + 100; } -from_b_ufcs :: () -> s64 { v : s64 = 10; return v.bump(); } +bump :: ufcs (x: i64) -> i64 { return x + 100; } +from_b_ufcs :: () -> i64 { v : i64 = 10; return v.bump(); } diff --git a/examples/0733-modules-flat-same-name-comptime-run.sx b/examples/0733-modules-flat-same-name-comptime-run.sx index 9b7d24c..94f2050 100644 --- a/examples/0733-modules-flat-same-name-comptime-run.sx +++ b/examples/0733-modules-flat-same-name-comptime-run.sx @@ -14,7 +14,7 @@ report :: (label: string, ok: bool) { if ok { print("{}: ok\n", label); } else { print("{}: FAIL\n", label); } } -main :: () -> s32 { +main :: () -> i32 { report("a.sx #run binds a.compute (7)", get_a() == 7); report("b.sx #run binds b.compute (70)", get_b() == 70); 0 diff --git a/examples/0733-modules-flat-same-name-comptime-run/a.sx b/examples/0733-modules-flat-same-name-comptime-run/a.sx index a2e9489..b539fa6 100644 --- a/examples/0733-modules-flat-same-name-comptime-run/a.sx +++ b/examples/0733-modules-flat-same-name-comptime-run/a.sx @@ -1,6 +1,6 @@ // a.sx authors `compute` returning 7 and evaluates it at comptime. Imported // first → first-wins winner; own == winner, but the #run must still lower in // a.sx's source context so the bare `compute` resolves at all (not ambiguous). -compute :: () -> s64 { return 7; } +compute :: () -> i64 { return 7; } A_VAL :: #run compute(); -get_a :: () -> s64 { return A_VAL; } +get_a :: () -> i64 { return A_VAL; } diff --git a/examples/0733-modules-flat-same-name-comptime-run/b.sx b/examples/0733-modules-flat-same-name-comptime-run/b.sx index c64d1c6..b04ea70 100644 --- a/examples/0733-modules-flat-same-name-comptime-run/b.sx +++ b/examples/0733-modules-flat-same-name-comptime-run/b.sx @@ -1,6 +1,6 @@ // b.sx authors its OWN `compute` returning 70. Its `#run compute()` must bind // b.sx's author (70) — own-author wins in b.sx's source context — not the // first-wins winner from a.sx (7). -compute :: () -> s64 { return 70; } +compute :: () -> i64 { return 70; } B_VAL :: #run compute(); -get_b :: () -> s64 { return B_VAL; } +get_b :: () -> i64 { return B_VAL; } diff --git a/examples/0734-modules-flat-same-name-ufcs-ambiguous.sx b/examples/0734-modules-flat-same-name-ufcs-ambiguous.sx index ca2bb7c..aaf4c5f 100644 --- a/examples/0734-modules-flat-same-name-ufcs-ambiguous.sx +++ b/examples/0734-modules-flat-same-name-ufcs-ambiguous.sx @@ -9,8 +9,8 @@ #import "0734-modules-flat-same-name-ufcs-ambiguous/a.sx"; #import "0734-modules-flat-same-name-ufcs-ambiguous/b.sx"; -main :: () -> s32 { - v : s64 = 10; +main :: () -> i32 { + v : i64 = 10; print("{}\n", v.dup()); 0 } diff --git a/examples/0734-modules-flat-same-name-ufcs-ambiguous/a.sx b/examples/0734-modules-flat-same-name-ufcs-ambiguous/a.sx index 1ba8402..11dcb0b 100644 --- a/examples/0734-modules-flat-same-name-ufcs-ambiguous/a.sx +++ b/examples/0734-modules-flat-same-name-ufcs-ambiguous/a.sx @@ -1,2 +1,2 @@ // a.sx authors `dup` (+1). One of two distinct flat authors of `dup`. -dup :: ufcs (x: s64) -> s64 { return x + 1; } +dup :: ufcs (x: i64) -> i64 { return x + 1; } diff --git a/examples/0734-modules-flat-same-name-ufcs-ambiguous/b.sx b/examples/0734-modules-flat-same-name-ufcs-ambiguous/b.sx index 211c152..385d50d 100644 --- a/examples/0734-modules-flat-same-name-ufcs-ambiguous/b.sx +++ b/examples/0734-modules-flat-same-name-ufcs-ambiguous/b.sx @@ -1,3 +1,3 @@ // b.sx authors its OWN `dup` (+2) — the second distinct flat author. Main // imports both and authors neither, so `v.dup()` from main is ambiguous. -dup :: ufcs (x: s64) -> s64 { return x + 2; } +dup :: ufcs (x: i64) -> i64 { return x + 2; } diff --git a/examples/0735-modules-flat-same-name-fn-value-winner.sx b/examples/0735-modules-flat-same-name-fn-value-winner.sx index 639298e..00834a7 100644 --- a/examples/0735-modules-flat-same-name-fn-value-winner.sx +++ b/examples/0735-modules-flat-same-name-fn-value-winner.sx @@ -1,7 +1,7 @@ // fix-0102d site 2 / attempt-2 (issue 0102): the first-wins winner's body is // independently BROKEN (references an undefined symbol) and is never used. A // shadow author from a later flat import takes its OWN `pick` as a function -// VALUE (`g : () -> s64 = pick`). The value must bind the shadow (own-author +// VALUE (`g : () -> i64 = pick`). The value must bind the shadow (own-author // wins) and the broken winner must NOT be lowered — a rerouted fn value never // uses the winner. Before the fix the fn-value site eagerly lazily-lowered the // name-keyed winner BEFORE the resolver rerouted, surfacing the winner's @@ -11,7 +11,7 @@ #import "0735-modules-flat-same-name-fn-value-winner/a.sx"; #import "0735-modules-flat-same-name-fn-value-winner/b.sx"; -main :: () -> s32 { +main :: () -> i32 { print("from_b_value = {}\n", from_b_value()); 0 } diff --git a/examples/0735-modules-flat-same-name-fn-value-winner/a.sx b/examples/0735-modules-flat-same-name-fn-value-winner/a.sx index c279dbf..b5a6ae3 100644 --- a/examples/0735-modules-flat-same-name-fn-value-winner/a.sx +++ b/examples/0735-modules-flat-same-name-fn-value-winner/a.sx @@ -1,4 +1,4 @@ // a.sx authors `pick` (imported first → the first-wins name-keyed winner) but // its body references an undefined symbol, so lowering a.pick AT ALL is an // error. Nothing uses a.pick — taking b.pick as a value must not pre-lower it. -pick :: () -> s64 { return missing_from_a(); } +pick :: () -> i64 { return missing_from_a(); } diff --git a/examples/0735-modules-flat-same-name-fn-value-winner/b.sx b/examples/0735-modules-flat-same-name-fn-value-winner/b.sx index 3ddcb3e..37a2b4c 100644 --- a/examples/0735-modules-flat-same-name-fn-value-winner/b.sx +++ b/examples/0735-modules-flat-same-name-fn-value-winner/b.sx @@ -1,7 +1,7 @@ // b.sx authors its OWN `pick` (returns 2) and takes it as a function VALUE. The // value binds b.pick (own-author wins), never the broken winner from a.sx. -pick :: () -> s64 { return 2; } -from_b_value :: () -> s64 { - g : () -> s64 = pick; +pick :: () -> i64 { return 2; } +from_b_value :: () -> i64 { + g : () -> i64 = pick; return g(); } diff --git a/examples/0736-modules-namespaced-only-bare-not-visible.sx b/examples/0736-modules-namespaced-only-bare-not-visible.sx index 6c3a595..d61ce82 100644 --- a/examples/0736-modules-namespaced-only-bare-not-visible.sx +++ b/examples/0736-modules-namespaced-only-bare-not-visible.sx @@ -6,7 +6,7 @@ // records namespaced edges, so the bare call silently resolved.) m :: #import "0736-modules-namespaced-only-bare-not-visible/a.sx"; -main :: () -> s32 { +main :: () -> i32 { x := secret(); 0 } diff --git a/examples/0736-modules-namespaced-only-bare-not-visible/a.sx b/examples/0736-modules-namespaced-only-bare-not-visible/a.sx index 088e199..c9aeecb 100644 --- a/examples/0736-modules-namespaced-only-bare-not-visible/a.sx +++ b/examples/0736-modules-namespaced-only-bare-not-visible/a.sx @@ -1 +1 @@ -secret :: () -> s64 { 7 } +secret :: () -> i64 { 7 } diff --git a/examples/0737-modules-insert-bare-not-visible.sx b/examples/0737-modules-insert-bare-not-visible.sx index b32cdb7..0a74171 100644 --- a/examples/0737-modules-insert-bare-not-visible.sx +++ b/examples/0737-modules-insert-bare-not-visible.sx @@ -9,7 +9,7 @@ // the body's defining module — not because `#insert` is exempt.) m :: #import "0737-modules-insert-bare-not-visible/a.sx"; -main :: () -> s32 { +main :: () -> i32 { #insert secret(); 0 } diff --git a/examples/0738-modules-comptime-arg-caller-context.sx b/examples/0738-modules-comptime-arg-caller-context.sx index d8a192b..4a9f897 100644 --- a/examples/0738-modules-comptime-arg-caller-context.sx +++ b/examples/0738-modules-comptime-arg-caller-context.sx @@ -18,7 +18,7 @@ m :: #import "0738-modules-comptime-arg-caller-context/emit.sx"; caller_name :: () -> string { return "world"; } -main :: () -> s32 { +main :: () -> i32 { m.emit(caller_name()); return 0; } diff --git a/examples/0739-modules-comptime-pack-arg-caller-context.sx b/examples/0739-modules-comptime-pack-arg-caller-context.sx index 3a84c3e..862ea91 100644 --- a/examples/0739-modules-comptime-pack-arg-caller-context.sx +++ b/examples/0739-modules-comptime-pack-arg-caller-context.sx @@ -13,13 +13,13 @@ // still resolves in `std.sx`, so the defining-context pin stays intact. // // Two pack positions lock that EVERY pack arg is stamped, not just the first. -// s64 values only — accepted by print at runtime today (no 0107/0108 coupling). +// i64 values only — accepted by print at runtime today (no 0107/0108 coupling). std :: #import "modules/std.sx"; -caller_num :: () -> s64 { return 42; } -caller_two :: () -> s64 { return 7; } +caller_num :: () -> i64 { return 42; } +caller_two :: () -> i64 { return 7; } -main :: () -> s32 { +main :: () -> i32 { std.print("{} {}\n", caller_num(), caller_two()); return 0; } diff --git a/examples/0740-modules-flat-same-name-ufcs-typing.sx b/examples/0740-modules-flat-same-name-ufcs-typing.sx index ba37859..d041197 100644 --- a/examples/0740-modules-flat-same-name-ufcs-typing.sx +++ b/examples/0740-modules-flat-same-name-ufcs-typing.sx @@ -1,17 +1,17 @@ // Regression (issue 0102, Phase C): value-receiver free-function UFCS under a // flat same-name collision must be TYPED as the author lowering dispatches. // a.sx (imported first → first-wins winner) authors `tag -> string`; b.sx -// authors its OWN `tag -> s64`. In b.sx, `v.tag()` dispatches b.tag (s64), but +// authors its OWN `tag -> i64`. In b.sx, `v.tag()` dispatches b.tag (i64), but // before the fix the call PLAN typed it as a.tag (string, first-wins) — so the -// pack-fn `print` boxed the raw s64 110 as a string pointer and dereferenced +// pack-fn `print` boxed the raw i64 110 as a string pointer and dereferenced // 0x6e → segfault. `CallResolver.plan` now selects the SAME author the lowering // call-path binds, so plan-typing and dispatch can't disagree (fix-0102 F2). #import "modules/std.sx"; #import "0740-modules-flat-same-name-ufcs-typing/a.sx"; #import "0740-modules-flat-same-name-ufcs-typing/b.sx"; -main :: () -> s32 { +main :: () -> i32 { show_a(); // a-side: own == winner → string, byte-for-byte unchanged - show_b(); // b-side: shadow author → s64, typed + dispatched as b.tag + show_b(); // b-side: shadow author → i64, typed + dispatched as b.tag 0 } diff --git a/examples/0740-modules-flat-same-name-ufcs-typing/a.sx b/examples/0740-modules-flat-same-name-ufcs-typing/a.sx index 45db425..5b17e4c 100644 --- a/examples/0740-modules-flat-same-name-ufcs-typing/a.sx +++ b/examples/0740-modules-flat-same-name-ufcs-typing/a.sx @@ -2,5 +2,5 @@ // a.sx authors `tag` returning a string; imported first → first-wins winner. // `show_a`'s `v.tag()` is the caller's OWN author (own == winner → existing UFCS // path, byte-for-byte unchanged): typed AND dispatched as a.tag (string). -tag :: ufcs (x: s64) -> string { return "a-string"; } -show_a :: () { v : s64 = 10; print("a: v.tag() = {}\n", v.tag()); } +tag :: ufcs (x: i64) -> string { return "a-string"; } +show_a :: () { v : i64 = 10; print("a: v.tag() = {}\n", v.tag()); } diff --git a/examples/0740-modules-flat-same-name-ufcs-typing/b.sx b/examples/0740-modules-flat-same-name-ufcs-typing/b.sx index 423098e..d89a41e 100644 --- a/examples/0740-modules-flat-same-name-ufcs-typing/b.sx +++ b/examples/0740-modules-flat-same-name-ufcs-typing/b.sx @@ -1,7 +1,7 @@ #import "modules/std.sx"; -// b.sx authors its OWN `tag` returning s64. `show_b`'s `v.tag()` must be both -// dispatched AND typed as b.tag (s64 = 110), not the first-wins winner from a.sx +// b.sx authors its OWN `tag` returning i64. `show_b`'s `v.tag()` must be both +// dispatched AND typed as b.tag (i64 = 110), not the first-wins winner from a.sx // (string). `print` types each arg from the call plan, so a mistype here boxes -// the s64 as a string pointer → segfault before the fix. -tag :: ufcs (x: s64) -> s64 { return x + 100; } -show_b :: () { v : s64 = 10; print("b: v.tag() = {}\n", v.tag()); } +// the i64 as a string pointer → segfault before the fix. +tag :: ufcs (x: i64) -> i64 { return x + 100; } +show_b :: () { v : i64 = 10; print("b: v.tag() = {}\n", v.tag()); } diff --git a/examples/0741-modules-flat-same-name-bare-pack-winner.sx b/examples/0741-modules-flat-same-name-bare-pack-winner.sx index 11f1e3a..b53a2d9 100644 --- a/examples/0741-modules-flat-same-name-bare-pack-winner.sx +++ b/examples/0741-modules-flat-same-name-bare-pack-winner.sx @@ -11,7 +11,7 @@ #import "0741-modules-flat-same-name-bare-pack-winner/a.sx"; #import "0741-modules-flat-same-name-bare-pack-winner/b.sx"; -main :: () -> s32 { +main :: () -> i32 { show_a(); // a-side: own == winner (the pack) → returns 1, byte-for-byte unchanged show_b(); // b-side: selected own plain author → returns 2, not the pack winner 0 diff --git a/examples/0741-modules-flat-same-name-bare-pack-winner/a.sx b/examples/0741-modules-flat-same-name-bare-pack-winner/a.sx index 50fb7a7..7a105e2 100644 --- a/examples/0741-modules-flat-same-name-bare-pack-winner/a.sx +++ b/examples/0741-modules-flat-same-name-bare-pack-winner/a.sx @@ -2,5 +2,5 @@ // a.sx authors `f` as a comptime pack; imported first → first-wins winner. // `show_a`'s bare `f()` is the caller's OWN author (own == winner → existing // pack path, byte-for-byte unchanged): dispatched as a.f (the pack → 1). -f :: (..$args) -> s64 { return 1; } +f :: (..$args) -> i64 { return 1; } show_a :: () { print("a: f() = {}\n", f()); } diff --git a/examples/0741-modules-flat-same-name-bare-pack-winner/b.sx b/examples/0741-modules-flat-same-name-bare-pack-winner/b.sx index 45f3a70..44e61a4 100644 --- a/examples/0741-modules-flat-same-name-bare-pack-winner/b.sx +++ b/examples/0741-modules-flat-same-name-bare-pack-winner/b.sx @@ -2,5 +2,5 @@ // b.sx authors its OWN plain `f`. `show_b`'s bare `f()` must dispatch b.f (2), // not the first-wins pack winner from a.sx (1). The selector picks b.f; the // early pack/comptime dispatch must NOT hijack it with the winner. -f :: () -> s64 { return 2; } +f :: () -> i64 { return 2; } show_b :: () { print("b: f() = {}\n", f()); } diff --git a/examples/0742-modules-namespaced-only-bare-const-not-visible.sx b/examples/0742-modules-namespaced-only-bare-const-not-visible.sx index 1f07c4f..07bc235 100644 --- a/examples/0742-modules-namespaced-only-bare-const-not-visible.sx +++ b/examples/0742-modules-namespaced-only-bare-const-not-visible.sx @@ -6,10 +6,10 @@ // joins over the FLAT import edges (`flat_import_graph`), and a namespaced // alias is not a flat edge. Before the fix the bare const leaked through the // global `module_const_map` first-match (and its float-fold fallback) straight -// into the `[VAL]s32` dimension, so the array silently got length 3. +// into the `[VAL]i32` dimension, so the array silently got length 3. dep :: #import "0742-modules-namespaced-only-bare-const-not-visible/dep.sx"; -main :: () -> s32 { - arr : [DEP_LEN]s32 = ---; +main :: () -> i32 { + arr : [DEP_LEN]i32 = ---; 0 } diff --git a/examples/0743-modules-namespaced-only-bare-type-not-visible.sx b/examples/0743-modules-namespaced-only-bare-type-not-visible.sx index cee0f1c..2de9276 100644 --- a/examples/0743-modules-namespaced-only-bare-type-not-visible.sx +++ b/examples/0743-modules-namespaced-only-bare-type-not-visible.sx @@ -10,7 +10,7 @@ // spelling (its member resolution lands fully in Phase F). dep :: #import "0743-modules-namespaced-only-bare-type-not-visible/dep.sx"; -main :: () -> s32 { +main :: () -> i32 { s : Secret = .{ x = 5, y = 6 }; s.x } diff --git a/examples/0743-modules-namespaced-only-bare-type-not-visible/dep.sx b/examples/0743-modules-namespaced-only-bare-type-not-visible/dep.sx index 6835705..1cdb975 100644 --- a/examples/0743-modules-namespaced-only-bare-type-not-visible/dep.sx +++ b/examples/0743-modules-namespaced-only-bare-type-not-visible/dep.sx @@ -1,4 +1,4 @@ Secret :: struct { - x: s32; - y: s32; + x: i32; + y: i32; } diff --git a/examples/0744-modules-namespaced-only-bare-enum-not-visible.sx b/examples/0744-modules-namespaced-only-bare-enum-not-visible.sx index 86b6071..4d12b24 100644 --- a/examples/0744-modules-namespaced-only-bare-enum-not-visible.sx +++ b/examples/0744-modules-namespaced-only-bare-enum-not-visible.sx @@ -7,7 +7,7 @@ // bare enum leaked through the global `findByName` first-match. dep :: #import "0744-modules-namespaced-only-bare-enum-not-visible/dep.sx"; -main :: () -> s32 { +main :: () -> i32 { c : Color = .green; if c == .green { 0 } else { 9 } } diff --git a/examples/0745-modules-flat-value-shadows-ns-only-type.sx b/examples/0745-modules-flat-value-shadows-ns-only-type.sx index 342dbea..d4f778f 100644 --- a/examples/0745-modules-flat-value-shadows-ns-only-type.sx +++ b/examples/0745-modules-flat-value-shadows-ns-only-type.sx @@ -9,7 +9,7 @@ #import "0745-modules-flat-value-shadows-ns-only-type/flatval.sx"; nst :: #import "0745-modules-flat-value-shadows-ns-only-type/nstype.sx"; -main :: () -> s32 { +main :: () -> i32 { s : Secret = .{ x = 5, y = 6 }; s.x } diff --git a/examples/0745-modules-flat-value-shadows-ns-only-type/flatval.sx b/examples/0745-modules-flat-value-shadows-ns-only-type/flatval.sx index 2f53a35..04d58ca 100644 --- a/examples/0745-modules-flat-value-shadows-ns-only-type/flatval.sx +++ b/examples/0745-modules-flat-value-shadows-ns-only-type/flatval.sx @@ -1,2 +1,2 @@ // A flat-visible VALUE/FUNCTION named `Secret` (not a type). -Secret :: () -> s32 { 0 } +Secret :: () -> i32 { 0 } diff --git a/examples/0745-modules-flat-value-shadows-ns-only-type/nstype.sx b/examples/0745-modules-flat-value-shadows-ns-only-type/nstype.sx index 6835705..1cdb975 100644 --- a/examples/0745-modules-flat-value-shadows-ns-only-type/nstype.sx +++ b/examples/0745-modules-flat-value-shadows-ns-only-type/nstype.sx @@ -1,4 +1,4 @@ Secret :: struct { - x: s32; - y: s32; + x: i32; + y: i32; } diff --git a/examples/0746-modules-local-type-shadows-ns-only-type.sx b/examples/0746-modules-local-type-shadows-ns-only-type.sx index 126fb69..3ceb5dc 100644 --- a/examples/0746-modules-local-type-shadows-ns-only-type.sx +++ b/examples/0746-modules-local-type-shadows-ns-only-type.sx @@ -6,8 +6,8 @@ // visibility gate just because the namespaced import shares the name. dep :: #import "0746-modules-local-type-shadows-ns-only-type/dep.sx"; -main :: () -> s32 { - Secret :: struct { z: s32; } +main :: () -> i32 { + Secret :: struct { z: i32; } s : Secret = .{ z = 7 }; s.z } diff --git a/examples/0746-modules-local-type-shadows-ns-only-type/dep.sx b/examples/0746-modules-local-type-shadows-ns-only-type/dep.sx index 6835705..1cdb975 100644 --- a/examples/0746-modules-local-type-shadows-ns-only-type/dep.sx +++ b/examples/0746-modules-local-type-shadows-ns-only-type/dep.sx @@ -1,4 +1,4 @@ Secret :: struct { - x: s32; - y: s32; + x: i32; + y: i32; } diff --git a/examples/0747-modules-namespaced-only-bare-alias-not-visible.sx b/examples/0747-modules-namespaced-only-bare-alias-not-visible.sx index d1389a0..413491c 100644 --- a/examples/0747-modules-namespaced-only-bare-alias-not-visible.sx +++ b/examples/0747-modules-namespaced-only-bare-alias-not-visible.sx @@ -2,7 +2,7 @@ // of 0743 (bare named type) and 0742 (bare const). A type ALIAS is a `const_decl` // whose value resolved to a type, so it never registers a `findByName` named-type // entry; the source-aware leaf must still treat it as a TYPE author (R4). `dep.sx` -// is imported only as `dep :: #import`, so its top-level `Secret :: s32` alias is +// is imported only as `dep :: #import`, so its top-level `Secret :: i32` alias is // reachable ONLY as `dep.Secret`. A BARE `Secret` in a type position must NOT // resolve: bare-TYPE visibility joins over the FLAT import edges, and a namespaced // alias is not a flat edge. Before the fix the ns-only alias was NOT a recognised @@ -10,7 +10,7 @@ // diagnostic (the value silently came out 0). Regression (issue R4). dep :: #import "0747-modules-namespaced-only-bare-alias-not-visible/dep.sx"; -main :: () -> s32 { +main :: () -> i32 { x : Secret = 7; x } diff --git a/examples/0747-modules-namespaced-only-bare-alias-not-visible/dep.sx b/examples/0747-modules-namespaced-only-bare-alias-not-visible/dep.sx index d6bda5f..ba7e234 100644 --- a/examples/0747-modules-namespaced-only-bare-alias-not-visible/dep.sx +++ b/examples/0747-modules-namespaced-only-bare-alias-not-visible/dep.sx @@ -1 +1 @@ -Secret :: s32; +Secret :: i32; diff --git a/examples/0748-modules-flat-alias-shadows-ns-only-type.sx b/examples/0748-modules-flat-alias-shadows-ns-only-type.sx index fa075a6..6b13743 100644 --- a/examples/0748-modules-flat-alias-shadows-ns-only-type.sx +++ b/examples/0748-modules-flat-alias-shadows-ns-only-type.sx @@ -2,17 +2,17 @@ // namespaced-only import authors a same-name NAMED type — the alias↔named-type // analog of 0745/0746 (R4, FALSE-REJECTION direction). `dep.sx` is namespaced // (`ns :: #import`) and authors a top-level `Secret` STRUCT; `main` authors its -// OWN top-level alias `Secret :: s32`. A bare `Secret` must resolve to MAIN's -// alias (`s32`), NOT be poisoned by the invisible same-name struct: the alias is +// OWN top-level alias `Secret :: i32`. A bare `Secret` must resolve to MAIN's +// alias (`i32`), NOT be poisoned by the invisible same-name struct: the alias is // the only flat-visible TYPE author. Before the fix the leaf saw the global // `findByName` struct and, finding no NAMED-type author in `main` (an alias is a // `const_decl`, not a named type), wrongly rejected the bare reference as "not // visible". Regression (issue R4). ns :: #import "0748-modules-flat-alias-shadows-ns-only-type/dep.sx"; -Secret :: s32; +Secret :: i32; -main :: () -> s32 { +main :: () -> i32 { x : Secret = 42; x } diff --git a/examples/0748-modules-flat-alias-shadows-ns-only-type/dep.sx b/examples/0748-modules-flat-alias-shadows-ns-only-type/dep.sx index 6835705..1cdb975 100644 --- a/examples/0748-modules-flat-alias-shadows-ns-only-type/dep.sx +++ b/examples/0748-modules-flat-alias-shadows-ns-only-type/dep.sx @@ -1,4 +1,4 @@ Secret :: struct { - x: s32; - y: s32; + x: i32; + y: i32; } diff --git a/examples/0749-modules-namespaced-only-bare-param-alias-not-visible.sx b/examples/0749-modules-namespaced-only-bare-param-alias-not-visible.sx index 73d9017..8a797af 100644 --- a/examples/0749-modules-namespaced-only-bare-param-alias-not-visible.sx +++ b/examples/0749-modules-namespaced-only-bare-param-alias-not-visible.sx @@ -1,6 +1,6 @@ // Bare PARAMETERIZED-struct alias visibility under a NAMESPACED-only import — // the generic-struct sibling of 0747 (plain alias) and 0743 (named type). A -// generic-struct instantiation alias (`Secret :: Box(s32)`) registers ONLY a +// generic-struct instantiation alias (`Secret :: Box(i32)`) registers ONLY a // named struct type in the TypeTable; its raw import fact stays `.const_decl`, // so before the fix it was NOT recognised as a type author and a BARE `Secret` // leaked to the registered struct with NO diagnostic (the value silently came @@ -11,7 +11,7 @@ // (attempt-5 R4-parameterized-alias-leak). dep :: #import "0749-modules-namespaced-only-bare-param-alias-not-visible/dep.sx"; -main :: () -> s32 { +main :: () -> i32 { s : Secret = .{ value = 42 }; s.value } diff --git a/examples/0749-modules-namespaced-only-bare-param-alias-not-visible/dep.sx b/examples/0749-modules-namespaced-only-bare-param-alias-not-visible/dep.sx index 434c566..cca40d6 100644 --- a/examples/0749-modules-namespaced-only-bare-param-alias-not-visible/dep.sx +++ b/examples/0749-modules-namespaced-only-bare-param-alias-not-visible/dep.sx @@ -2,4 +2,4 @@ Box :: struct($T: Type) { value: T; } -Secret :: Box(s32); +Secret :: Box(i32); diff --git a/examples/0750-modules-forward-alias-source-aware.sx b/examples/0750-modules-forward-alias-source-aware.sx index 4f08b91..9bd940d 100644 --- a/examples/0750-modules-forward-alias-source-aware.sx +++ b/examples/0750-modules-forward-alias-source-aware.sx @@ -20,12 +20,12 @@ B :: u64; ns :: #import "0750-modules-forward-alias-source-aware/dep.sx"; -main :: () -> s32 { - n : s64 = 300; +main :: () -> i32 { + n : i64 = 300; a : A = xx n; b : B = xx n; - print("forward A (u64=300): {}\n", cast(s64) a); - print("direct B (u64=300): {}\n", cast(s64) b); + print("forward A (u64=300): {}\n", cast(i64) a); + print("direct B (u64=300): {}\n", cast(i64) b); print("ns.width(): {}\n", ns.width()); return 0; } diff --git a/examples/0750-modules-forward-alias-source-aware/dep.sx b/examples/0750-modules-forward-alias-source-aware/dep.sx index 5e98c96..d8c0e01 100644 --- a/examples/0750-modules-forward-alias-source-aware/dep.sx +++ b/examples/0750-modules-forward-alias-source-aware/dep.sx @@ -5,6 +5,6 @@ // which is exactly what the source-aware forward-alias fixpoint must ignore. B :: u8; -width :: () -> s32 { +width :: () -> i32 { return 8; } diff --git a/examples/0751-modules-forward-alias-ns-before.sx b/examples/0751-modules-forward-alias-ns-before.sx index c72bf4b..a08a294 100644 --- a/examples/0751-modules-forward-alias-ns-before.sx +++ b/examples/0751-modules-forward-alias-ns-before.sx @@ -25,12 +25,12 @@ ns :: #import "0751-modules-forward-alias-ns-before/dep.sx"; A :: B; B :: u64; -main :: () -> s32 { - n : s64 = 300; +main :: () -> i32 { + n : i64 = 300; a : A = xx n; b : B = xx n; - print("forward A (u64=300): {}\n", cast(s64) a); - print("direct B (u64=300): {}\n", cast(s64) b); + print("forward A (u64=300): {}\n", cast(i64) a); + print("direct B (u64=300): {}\n", cast(i64) b); print("ns.width(): {}\n", ns.width()); return 0; } diff --git a/examples/0751-modules-forward-alias-ns-before/dep.sx b/examples/0751-modules-forward-alias-ns-before/dep.sx index da12c43..c32428d 100644 --- a/examples/0751-modules-forward-alias-ns-before/dep.sx +++ b/examples/0751-modules-forward-alias-ns-before/dep.sx @@ -6,6 +6,6 @@ // (and so populates the global map) BEFORE the importer's own `A :: B`. B :: u8; -width :: () -> s32 { +width :: () -> i32 { return 8; } diff --git a/examples/0752-modules-same-name-struct-distinct-fields.sx b/examples/0752-modules-same-name-struct-distinct-fields.sx index 0cf5951..deb6d3f 100644 --- a/examples/0752-modules-same-name-struct-distinct-fields.sx +++ b/examples/0752-modules-same-name-struct-distinct-fields.sx @@ -8,7 +8,7 @@ #import "0752-modules-same-name-struct-distinct-fields/a.sx"; #import "0752-modules-same-name-struct-distinct-fields/b.sx"; -main :: () -> s32 { +main :: () -> i32 { print("a={} b={}\n", a_box(), b_box()); 0 } diff --git a/examples/0752-modules-same-name-struct-distinct-fields/a.sx b/examples/0752-modules-same-name-struct-distinct-fields/a.sx index 85a97f3..19d1fde 100644 --- a/examples/0752-modules-same-name-struct-distinct-fields/a.sx +++ b/examples/0752-modules-same-name-struct-distinct-fields/a.sx @@ -1,3 +1,3 @@ -// Module A authors its OWN `Box` (one `s64` field `x`). -Box :: struct { x: s64; } +// Module A authors its OWN `Box` (one `i64` field `x`). +Box :: struct { x: i64; } a_box :: () -> Box { return Box.{ x = 7 }; } diff --git a/examples/0752-modules-same-name-struct-distinct-fields/b.sx b/examples/0752-modules-same-name-struct-distinct-fields/b.sx index 2663433..56acf77 100644 --- a/examples/0752-modules-same-name-struct-distinct-fields/b.sx +++ b/examples/0752-modules-same-name-struct-distinct-fields/b.sx @@ -1,5 +1,5 @@ // Module B authors a DIFFERENT `Box` (two fields `p`, `q`) — a same-name shadow // of A's `Box`. Pre-0105 the two collapsed last-wins in the type table, so one // module's field set vanished; now each `Box` is a distinct nominal type. -Box :: struct { p: s64; q: s64; } +Box :: struct { p: i64; q: i64; } b_box :: () -> Box { return Box.{ p = 3, q = 4 }; } diff --git a/examples/0753-modules-same-name-struct-same-fields.sx b/examples/0753-modules-same-name-struct-same-fields.sx index 6b547d7..a388e72 100644 --- a/examples/0753-modules-same-name-struct-same-fields.sx +++ b/examples/0753-modules-same-name-struct-same-fields.sx @@ -9,7 +9,7 @@ #import "0753-modules-same-name-struct-same-fields/a.sx"; #import "0753-modules-same-name-struct-same-fields/b.sx"; -main :: () -> s32 { +main :: () -> i32 { print("a={} b={}\n", a_pair(), b_pair()); 0 } diff --git a/examples/0753-modules-same-name-struct-same-fields/a.sx b/examples/0753-modules-same-name-struct-same-fields/a.sx index 9642a1b..ae208bf 100644 --- a/examples/0753-modules-same-name-struct-same-fields/a.sx +++ b/examples/0753-modules-same-name-struct-same-fields/a.sx @@ -1,3 +1,3 @@ // Module A authors `Pair { x, y }`. -Pair :: struct { x: s64; y: s64; } +Pair :: struct { x: i64; y: i64; } a_pair :: () -> Pair { return Pair.{ x = 1, y = 2 }; } diff --git a/examples/0753-modules-same-name-struct-same-fields/b.sx b/examples/0753-modules-same-name-struct-same-fields/b.sx index 2b8c35c..874b4ff 100644 --- a/examples/0753-modules-same-name-struct-same-fields/b.sx +++ b/examples/0753-modules-same-name-struct-same-fields/b.sx @@ -1,5 +1,5 @@ // Module B authors `Pair { x, y }` with the SAME field shape as A's. The two // still get distinct nominal identities (not collapsed): each keeps its own // TypeId / per-source author, so both register and format independently. -Pair :: struct { x: s64; y: s64; } +Pair :: struct { x: i64; y: i64; } b_pair :: () -> Pair { return Pair.{ x = 5, y = 6 }; } diff --git a/examples/0754-modules-same-name-struct-own-wins.sx b/examples/0754-modules-same-name-struct-own-wins.sx index a410d22..d7ae47a 100644 --- a/examples/0754-modules-same-name-struct-own-wins.sx +++ b/examples/0754-modules-same-name-struct-own-wins.sx @@ -6,9 +6,9 @@ #import "modules/std.sx"; #import "0754-modules-same-name-struct-own-wins/dep.sx"; -Widget :: struct { m: s64; } +Widget :: struct { m: i64; } -main :: () -> s32 { +main :: () -> i32 { w := Widget.{ m = 5 }; print("own={} dep={}\n", w, dep_widget()); 0 diff --git a/examples/0754-modules-same-name-struct-own-wins/dep.sx b/examples/0754-modules-same-name-struct-own-wins/dep.sx index aead1df..fc29042 100644 --- a/examples/0754-modules-same-name-struct-own-wins/dep.sx +++ b/examples/0754-modules-same-name-struct-own-wins/dep.sx @@ -1,5 +1,5 @@ // A flat-imported module authors its OWN `Widget { a }`. The importing file // (`main`) ALSO authors a `Widget` — its own author must win there (0105 case 3), // while this module's `Widget` stays a distinct type used by `dep_widget`. -Widget :: struct { a: s64; } +Widget :: struct { a: i64; } dep_widget :: () -> Widget { return Widget.{ a = 9 }; } diff --git a/examples/0755-modules-same-name-struct-ambiguous.sx b/examples/0755-modules-same-name-struct-ambiguous.sx index e70c414..10e5b6d 100644 --- a/examples/0755-modules-same-name-struct-ambiguous.sx +++ b/examples/0755-modules-same-name-struct-ambiguous.sx @@ -7,7 +7,7 @@ #import "0755-modules-same-name-struct-ambiguous/a.sx"; #import "0755-modules-same-name-struct-ambiguous/b.sx"; -main :: () -> s32 { +main :: () -> i32 { t : Thing = .{ a = 1 }; 0 } diff --git a/examples/0755-modules-same-name-struct-ambiguous/a.sx b/examples/0755-modules-same-name-struct-ambiguous/a.sx index 98bf0f6..a93508c 100644 --- a/examples/0755-modules-same-name-struct-ambiguous/a.sx +++ b/examples/0755-modules-same-name-struct-ambiguous/a.sx @@ -1,2 +1,2 @@ // One of two flat-imported authors of a same-name `Thing`. -Thing :: struct { a: s64; } +Thing :: struct { a: i64; } diff --git a/examples/0755-modules-same-name-struct-ambiguous/b.sx b/examples/0755-modules-same-name-struct-ambiguous/b.sx index 57a4e04..143578b 100644 --- a/examples/0755-modules-same-name-struct-ambiguous/b.sx +++ b/examples/0755-modules-same-name-struct-ambiguous/b.sx @@ -1,3 +1,3 @@ // The second flat-imported author of a same-name `Thing`. With both visible and // no own author in `main`, a bare `Thing` reference is genuinely ambiguous. -Thing :: struct { b: s64; } +Thing :: struct { b: i64; } diff --git a/examples/0756-modules-same-name-alias-per-source.sx b/examples/0756-modules-same-name-alias-per-source.sx index 55bfbb9..d9a2629 100644 --- a/examples/0756-modules-same-name-alias-per-source.sx +++ b/examples/0756-modules-same-name-alias-per-source.sx @@ -1,5 +1,5 @@ // issue 0105 case 5 — same-name type ALIAS, per-source visibility. Two -// flat-imported modules each alias `Id` to a DIFFERENT type (A: `s32`, B: +// flat-imported modules each alias `Id` to a DIFFERENT type (A: `i32`, B: // `f64`). Each module's bare `Id` resolves against its OWN source alias, so A's // `x : Id` is a 32-bit integer (prints 100) and B's `x : Id` is a float (prints // 2.5) — proving aliases are source-keyed, never folded last-wins. @@ -7,7 +7,7 @@ #import "0756-modules-same-name-alias-per-source/a.sx"; #import "0756-modules-same-name-alias-per-source/b.sx"; -main :: () -> s32 { +main :: () -> i32 { print("a={} b={}\n", a_val(), b_val()); 0 } diff --git a/examples/0756-modules-same-name-alias-per-source/a.sx b/examples/0756-modules-same-name-alias-per-source/a.sx index 6ae65d3..5348673 100644 --- a/examples/0756-modules-same-name-alias-per-source/a.sx +++ b/examples/0756-modules-same-name-alias-per-source/a.sx @@ -1,4 +1,4 @@ -// Module A aliases `Id` to `s32`. A bare `Id` in this module resolves to A's +// Module A aliases `Id` to `i32`. A bare `Id` in this module resolves to A's // alias regardless of B's same-name alias (per-source alias visibility). -Id :: s32; -a_val :: () -> s64 { x : Id = 100; y : s64 = xx x; return y; } +Id :: i32; +a_val :: () -> i64 { x : Id = 100; y : i64 = xx x; return y; } diff --git a/examples/0756-modules-same-name-alias-per-source/b.sx b/examples/0756-modules-same-name-alias-per-source/b.sx index c8309ab..f46452f 100644 --- a/examples/0756-modules-same-name-alias-per-source/b.sx +++ b/examples/0756-modules-same-name-alias-per-source/b.sx @@ -1,5 +1,5 @@ // Module B aliases the SAME name `Id` to a DIFFERENT type `f64`. A bare `Id` in -// this module resolves to B's `f64` alias, not A's `s32` — each module's alias +// this module resolves to B's `f64` alias, not A's `i32` — each module's alias // is keyed to its own source, so the two never collide last-wins. Id :: f64; b_val :: () -> f64 { x : Id = 2; return x + 0.5; } diff --git a/examples/0757-modules-same-name-struct-self-ref.sx b/examples/0757-modules-same-name-struct-self-ref.sx index bca1f60..77f7b2f 100644 --- a/examples/0757-modules-same-name-struct-self-ref.sx +++ b/examples/0757-modules-same-name-struct-self-ref.sx @@ -10,7 +10,7 @@ #import "0757-modules-same-name-struct-self-ref/a.sx"; #import "0757-modules-same-name-struct-self-ref/b.sx"; -main :: () -> s32 { +main :: () -> i32 { print("a={} b={}\n", a_box(), b_chain()); 0 } diff --git a/examples/0757-modules-same-name-struct-self-ref/a.sx b/examples/0757-modules-same-name-struct-self-ref/a.sx index 73db8d2..e98b2ac 100644 --- a/examples/0757-modules-same-name-struct-self-ref/a.sx +++ b/examples/0757-modules-same-name-struct-self-ref/a.sx @@ -1,3 +1,3 @@ // Module A authors its OWN `Box` (one field `x`) — the FIRST same-name author. -Box :: struct { x: s64; } +Box :: struct { x: i64; } a_box :: () -> Box { return Box.{ x = 7 }; } diff --git a/examples/0757-modules-same-name-struct-self-ref/b.sx b/examples/0757-modules-same-name-struct-self-ref/b.sx index d2b558c..bf8e0af 100644 --- a/examples/0757-modules-same-name-struct-self-ref/b.sx +++ b/examples/0757-modules-same-name-struct-self-ref/b.sx @@ -3,8 +3,8 @@ // first under the bare name), so `next.*.y` failed with "field 'y' not found on // type 'Box'". The shadow's slot is now reserved BEFORE its fields resolve, so // `*Box` binds to B's OWN nominal TypeId and the deref sees B's `y`. -Box :: struct { y: s64; next: *Box; } -b_chain :: () -> s64 { +Box :: struct { y: i64; next: *Box; } +b_chain :: () -> i64 { tail := Box.{ y = 42, next = null }; head := Box.{ y = 1, next = @tail }; // Walk the self-referential link; reads B's own `y`, not A's `x`. diff --git a/examples/0758-modules-same-name-struct-mutual-ref.sx b/examples/0758-modules-same-name-struct-mutual-ref.sx index 2595b6c..d9ce602 100644 --- a/examples/0758-modules-same-name-struct-mutual-ref.sx +++ b/examples/0758-modules-same-name-struct-mutual-ref.sx @@ -9,7 +9,7 @@ #import "0758-modules-same-name-struct-mutual-ref/a.sx"; #import "0758-modules-same-name-struct-mutual-ref/b.sx"; -main :: () -> s32 { +main :: () -> i32 { print("b={}\n", b_test()); 0 } diff --git a/examples/0758-modules-same-name-struct-mutual-ref/a.sx b/examples/0758-modules-same-name-struct-mutual-ref/a.sx index f4869d4..c5d78c9 100644 --- a/examples/0758-modules-same-name-struct-mutual-ref/a.sx +++ b/examples/0758-modules-same-name-struct-mutual-ref/a.sx @@ -1,3 +1,3 @@ // Module A authors its OWN `Box` and `Node` (the FIRST same-name authors). -Box :: struct { x: s64; } -Node :: struct { n: s64; } +Box :: struct { x: i64; } +Node :: struct { n: i64; } diff --git a/examples/0758-modules-same-name-struct-mutual-ref/b.sx b/examples/0758-modules-same-name-struct-mutual-ref/b.sx index eb71b20..f166585 100644 --- a/examples/0758-modules-same-name-struct-mutual-ref/b.sx +++ b/examples/0758-modules-same-name-struct-mutual-ref/b.sx @@ -2,9 +2,9 @@ // B's `Box` has a FORWARD ref to B's `Node` (declared after it), and B's `Node` // back-refs B's `Box`. Both forward and mutual refs must resolve to B's OWN // nominal TypeIds, not the first same-name authors in A. -Box :: struct { y: s64; peer: *Node; } -Node :: struct { m: s64; owner: *Box; } -b_test :: () -> s64 { +Box :: struct { y: i64; peer: *Node; } +Node :: struct { m: i64; owner: *Box; } +b_test :: () -> i64 { nd := Node.{ m = 99, owner = null }; bx := Box.{ y = 7, peer = @nd }; // Reads B's Node.m (99); pre-fix the forward ref bound to A's Node (which has diff --git a/examples/0759-modules-undeclared-type-in-import.sx b/examples/0759-modules-undeclared-type-in-import.sx index 0bc9c14..90fdd2b 100644 --- a/examples/0759-modules-undeclared-type-in-import.sx +++ b/examples/0759-modules-undeclared-type-in-import.sx @@ -16,7 +16,7 @@ #import "0759-modules-undeclared-type-in-import/lib.sx"; -main :: () -> s32 { +main :: () -> i32 { print("thing.x = {}\n", make_thing()); return 0; } diff --git a/examples/0759-modules-undeclared-type-in-import/lib.sx b/examples/0759-modules-undeclared-type-in-import/lib.sx index 3806618..156e735 100644 --- a/examples/0759-modules-undeclared-type-in-import/lib.sx +++ b/examples/0759-modules-undeclared-type-in-import/lib.sx @@ -3,11 +3,11 @@ // `UnknownTypeChecker` trusts it and never walks it, so the type leaf is the // sole guard against the silently-fabricated empty-struct stub. Thing :: struct { - x: s32; + x: i32; y: Coordnate; } -make_thing :: () -> s32 { +make_thing :: () -> i32 { t : Thing = ---; t.x = 42; return t.x; diff --git a/examples/0760-modules-imported-generic-value-param-as-field-type.sx b/examples/0760-modules-imported-generic-value-param-as-field-type.sx index b6d1336..66eca6a 100644 --- a/examples/0760-modules-imported-generic-value-param-as-field-type.sx +++ b/examples/0760-modules-imported-generic-value-param-as-field-type.sx @@ -11,7 +11,7 @@ #import "modules/std.sx"; #import "0760-modules-imported-generic-value-param-as-field-type/lib.sx"; -main :: () -> s32 { +main :: () -> i32 { b : Bad(3) = .{ x = 1 }; print("{}\n", b.x); return 0; diff --git a/examples/0761-modules-imported-generic-undeclared-field.sx b/examples/0761-modules-imported-generic-undeclared-field.sx index 1ab06bb..ec78f91 100644 --- a/examples/0761-modules-imported-generic-undeclared-field.sx +++ b/examples/0761-modules-imported-generic-undeclared-field.sx @@ -12,8 +12,8 @@ #import "modules/std.sx"; #import "0761-modules-imported-generic-undeclared-field/lib.sx"; -main :: () -> s32 { - b : Bad(s32) = .{ x = 1, y = 2 }; +main :: () -> i32 { + b : Bad(i32) = .{ x = 1, y = 2 }; print("{}\n", b.x); return 0; } diff --git a/examples/0762-modules-imported-generic-caller-local-field-leak.sx b/examples/0762-modules-imported-generic-caller-local-field-leak.sx index 5975d99..8b05a28 100644 --- a/examples/0762-modules-imported-generic-caller-local-field-leak.sx +++ b/examples/0762-modules-imported-generic-caller-local-field-leak.sx @@ -2,7 +2,7 @@ // only as a BLOCK-LOCAL must NOT bind that caller-local type — a block-local is // visible only within its OWN source. `lib.sx` defines // `Bad :: struct($T) { x: T; y: LocalOnly; }`; `main` declares `LocalOnly` only -// inside its own body before instantiating `Bad(s32)`. The imported template's +// inside its own body before instantiating `Bad(i32)`. The imported template's // module cannot see a caller block-local, so `y: LocalOnly` is undeclared in the // lib file. // @@ -17,9 +17,9 @@ #import "modules/std.sx"; #import "0762-modules-imported-generic-caller-local-field-leak/lib.sx"; -main :: () -> s32 { - LocalOnly :: struct { v: s32; } - b : Bad(s32) = .{ x = 1, y = .{ v = 9 } }; +main :: () -> i32 { + LocalOnly :: struct { v: i32; } + b : Bad(i32) = .{ x = 1, y = .{ v = 9 } }; print("{} {}\n", b.x, b.y.v); return 0; } diff --git a/examples/0763-modules-import-type-non-transitive.sx b/examples/0763-modules-import-type-non-transitive.sx index 9699b0a..5894479 100644 --- a/examples/0763-modules-import-type-non-transitive.sx +++ b/examples/0763-modules-import-type-non-transitive.sx @@ -13,7 +13,7 @@ #import "modules/std.sx"; #import "0763-modules-import-type-non-transitive/b.sx"; -main :: () -> s32 { +main :: () -> i32 { x : COnly = .{ v = 5 }; print("{}\n", x.v); 0 diff --git a/examples/0763-modules-import-type-non-transitive/c.sx b/examples/0763-modules-import-type-non-transitive/c.sx index 3d28f1f..082395d 100644 --- a/examples/0763-modules-import-type-non-transitive/c.sx +++ b/examples/0763-modules-import-type-non-transitive/c.sx @@ -1 +1 @@ -COnly :: struct { v: s64 = 0; } +COnly :: struct { v: i64 = 0; } diff --git a/examples/0764-modules-import-generic-head-non-transitive.sx b/examples/0764-modules-import-generic-head-non-transitive.sx index ca31cc7..ad9acce 100644 --- a/examples/0764-modules-import-generic-head-non-transitive.sx +++ b/examples/0764-modules-import-generic-head-non-transitive.sx @@ -1,12 +1,12 @@ // `#import` is non-transitive for a PARAMETERIZED TYPE HEAD (a generic-struct -// constructor like `Box(s64)`), exactly like a bare leaf type (0763) and like +// constructor like `Box(i64)`), exactly like a bare leaf type (0763) and like // values/functions (0706): when A imports B and B imports C, A must NOT see C's // top-level generic type `Box`. This file imports `b.sx` (which imports `c.sx`) -// and instantiates C's generic `Box(s64)` directly — the compiler rejects the +// and instantiates C's generic `Box(i64)` directly — the compiler rejects the // head with a "type ... is not visible; #import the module that declares it" // diagnostic, BEFORE instantiating the template. // -// `b.sx` ↔ `c.sx` together still compile: `b_make`'s `Box(s64)` resolves because +// `b.sx` ↔ `c.sx` together still compile: `b_make`'s `Box(i64)` resolves because // b.sx directly imports c.sx (the head is one flat hop away there, two from a // file that imports b.sx). // @@ -17,8 +17,8 @@ #import "modules/std.sx"; #import "0764-modules-import-generic-head-non-transitive/b.sx"; -main :: () -> s32 { - x : Box(s64) = .{ v = 3 }; +main :: () -> i32 { + x : Box(i64) = .{ v = 3 }; print("{}\n", x.v); 0 } diff --git a/examples/0764-modules-import-generic-head-non-transitive/b.sx b/examples/0764-modules-import-generic-head-non-transitive/b.sx index 0830392..133e4cf 100644 --- a/examples/0764-modules-import-generic-head-non-transitive/b.sx +++ b/examples/0764-modules-import-generic-head-non-transitive/b.sx @@ -1,8 +1,8 @@ #import "c.sx"; -// b.sx directly imports c.sx, so it CAN instantiate `Box(s64)` — proving the +// b.sx directly imports c.sx, so it CAN instantiate `Box(i64)` — proving the // generic head is only one flat hop away here, two hops from a file that // imports b.sx. -b_make :: () -> Box(s64) { +b_make :: () -> Box(i64) { .{ v = 99 } } diff --git a/examples/0765-modules-import-reflection-type-non-transitive.sx b/examples/0765-modules-import-reflection-type-non-transitive.sx index 84db8a2..8f0efb4 100644 --- a/examples/0765-modules-import-reflection-type-non-transitive.sx +++ b/examples/0765-modules-import-reflection-type-non-transitive.sx @@ -18,7 +18,7 @@ #import "modules/std.sx"; #import "0765-modules-import-reflection-type-non-transitive/b.sx"; -main :: () -> s32 { +main :: () -> i32 { print("{}\n", size_of(Nums)); print("{}\n", size_of(*COnly)); xs := Nums.[1, 2]; diff --git a/examples/0765-modules-import-reflection-type-non-transitive/b.sx b/examples/0765-modules-import-reflection-type-non-transitive/b.sx index eb3cfb4..355abf1 100644 --- a/examples/0765-modules-import-reflection-type-non-transitive/b.sx +++ b/examples/0765-modules-import-reflection-type-non-transitive/b.sx @@ -3,11 +3,11 @@ // b.sx directly imports c.sx, so it CAN name these types in reflection / // type-arg / array-literal positions — the type is one flat hop away here, // two from a file that imports b.sx. -b_sizes :: () -> s64 { +b_sizes :: () -> i64 { size_of(Nums) + size_of(*COnly) } -b_arr :: () -> s64 { +b_arr :: () -> i64 { xs := Nums.[1, 2]; xs[0] + xs[1] } diff --git a/examples/0765-modules-import-reflection-type-non-transitive/c.sx b/examples/0765-modules-import-reflection-type-non-transitive/c.sx index dcacacc..e3674f0 100644 --- a/examples/0765-modules-import-reflection-type-non-transitive/c.sx +++ b/examples/0765-modules-import-reflection-type-non-transitive/c.sx @@ -1,3 +1,3 @@ -Nums :: [2]s64; +Nums :: [2]i64; -COnly :: struct { v: s64 = 0; } +COnly :: struct { v: i64 = 0; } diff --git a/examples/0766-modules-reflection-type-direct-ok.sx b/examples/0766-modules-reflection-type-direct-ok.sx index 991fd5d..d1d48a7 100644 --- a/examples/0766-modules-reflection-type-direct-ok.sx +++ b/examples/0766-modules-reflection-type-direct-ok.sx @@ -7,7 +7,7 @@ #import "modules/std.sx"; #import "0766-modules-reflection-type-direct-ok/c.sx"; -main :: () -> s32 { +main :: () -> i32 { print("{}\n", size_of(Nums)); print("{}\n", size_of(*COnly)); xs := Nums.[1, 2]; diff --git a/examples/0766-modules-reflection-type-direct-ok/c.sx b/examples/0766-modules-reflection-type-direct-ok/c.sx index dcacacc..e3674f0 100644 --- a/examples/0766-modules-reflection-type-direct-ok/c.sx +++ b/examples/0766-modules-reflection-type-direct-ok/c.sx @@ -1,3 +1,3 @@ -Nums :: [2]s64; +Nums :: [2]i64; -COnly :: struct { v: s64 = 0; } +COnly :: struct { v: i64 = 0; } diff --git a/examples/0767-modules-ambiguous-bare-type-forms.sx b/examples/0767-modules-ambiguous-bare-type-forms.sx index 5d817fb..94cc1cd 100644 --- a/examples/0767-modules-ambiguous-bare-type-forms.sx +++ b/examples/0767-modules-ambiguous-bare-type-forms.sx @@ -8,7 +8,7 @@ // // - reflection / type-arg slot `size_of(Thing)` // - typed array/vector-literal `Nums.[1, 2]` -// - parameterized generic head `Box(s64)` +// - parameterized generic head `Box(i64)` // - type-as-value `t : Type = Thing` // - type-category match arm `case Thing:` // @@ -21,7 +21,7 @@ #import "0767-modules-ambiguous-bare-type-forms/a.sx"; #import "0767-modules-ambiguous-bare-type-forms/b.sx"; -describe :: ($T: Type) -> s32 { +describe :: ($T: Type) -> i32 { r := if T == { case Thing: 1; else: 0; @@ -29,11 +29,11 @@ describe :: ($T: Type) -> s32 { r } -main :: () -> s32 { +main :: () -> i32 { sz := size_of(Thing); xs := Nums.[1, 2]; - x : Box(s64) = .{ v = 3 }; + x : Box(i64) = .{ v = 3 }; t : Type = Thing; - d := describe(s64); + d := describe(i64); 0 } diff --git a/examples/0767-modules-ambiguous-bare-type-forms/a.sx b/examples/0767-modules-ambiguous-bare-type-forms/a.sx index 41387e4..f4ba60c 100644 --- a/examples/0767-modules-ambiguous-bare-type-forms/a.sx +++ b/examples/0767-modules-ambiguous-bare-type-forms/a.sx @@ -1,6 +1,6 @@ // One of two flat-imported authors of same-name types `Thing` / `Box` / `Nums`. // With both modules flat-visible from a file that authors none itself, every // bare reference to these names is genuinely ambiguous. -Thing :: struct { a: s64; } +Thing :: struct { a: i64; } Box :: struct($T: Type) { v: T; } -Nums :: [2]s64; +Nums :: [2]i64; diff --git a/examples/0767-modules-ambiguous-bare-type-forms/b.sx b/examples/0767-modules-ambiguous-bare-type-forms/b.sx index 8502874..37b1953 100644 --- a/examples/0767-modules-ambiguous-bare-type-forms/b.sx +++ b/examples/0767-modules-ambiguous-bare-type-forms/b.sx @@ -2,6 +2,6 @@ // distinct shapes (`Thing` a separate nominal identity, `Box` a separate generic // template, `Nums` aliased to a different element width) make each bare // reference a real collision the importing source cannot disambiguate. -Thing :: struct { a: s64; } +Thing :: struct { a: i64; } Box :: struct($T: Type) { v: T; } -Nums :: [2]s32; +Nums :: [2]i32; diff --git a/examples/0768-modules-own-wins-nonleaf-bare-type.sx b/examples/0768-modules-own-wins-nonleaf-bare-type.sx index d1f6533..b917959 100644 --- a/examples/0768-modules-own-wins-nonleaf-bare-type.sx +++ b/examples/0768-modules-own-wins-nonleaf-bare-type.sx @@ -1,13 +1,13 @@ // Own-wins (0754 / issue 0105 case 3) holds at EVERY non-leaf bare-type site, // not just the nominal leaf annotation. `main` flat-imports `dep.sx` (which -// authors a same-name `Widget { a, b }` = 16 bytes and `Nums :: [2]s32` = 8 -// bytes) AND authors its OWN `Widget { a }` = 8 bytes and `Nums :: [2]s64` = 16 +// authors a same-name `Widget { a, b }` = 16 bytes and `Nums :: [2]i32` = 8 +// bytes) AND authors its OWN `Widget { a }` = 8 bytes and `Nums :: [2]i64` = 16 // bytes. Each bare reference below must resolve to MAIN's own author — the gate's // source-keyed `.resolved` author — NOT whichever same-name flat import a global // `findByName` / `struct_template_map` pick would return: // // - reflection / type-arg slot `size_of(Widget)` → 8 (own) -// - typed array-literal head `Nums.[…]` / size_of → 16 (own [2]s64) +// - typed array-literal head `Nums.[…]` / size_of → 16 (own [2]i64) // - type-as-value `t : Type = Widget` // - type-category match arm `case Widget:` → own identity // @@ -21,10 +21,10 @@ #import "modules/std.sx"; #import "0768-modules-own-wins-nonleaf-bare-type/dep.sx"; -Widget :: struct { a: s64; } -Nums :: [2]s64; +Widget :: struct { a: i64; } +Nums :: [2]i64; -describe :: ($T: Type) -> s32 { +describe :: ($T: Type) -> i32 { r := if T == { case Widget: 111; else: 222; @@ -32,7 +32,7 @@ describe :: ($T: Type) -> s32 { r } -main :: () -> s32 { +main :: () -> i32 { print("reflection={}\n", size_of(Widget)); xs := Nums.[1, 2]; print("array={}\n", size_of(Nums)); diff --git a/examples/0768-modules-own-wins-nonleaf-bare-type/dep.sx b/examples/0768-modules-own-wins-nonleaf-bare-type/dep.sx index 45b36b4..37048d2 100644 --- a/examples/0768-modules-own-wins-nonleaf-bare-type/dep.sx +++ b/examples/0768-modules-own-wins-nonleaf-bare-type/dep.sx @@ -1,8 +1,8 @@ // A flat-imported module authors its OWN `Widget { a, b }` (16 bytes) and -// `Nums :: [2]s32` (8 bytes). The importing file (`main`) ALSO authors a -// same-name `Widget { a }` (8 bytes) and `Nums :: [2]s64` (16 bytes) — its own +// `Nums :: [2]i32` (8 bytes). The importing file (`main`) ALSO authors a +// same-name `Widget { a }` (8 bytes) and `Nums :: [2]i64` (16 bytes) — its own // authors must win at EVERY bare-type site there (own-wins, 0754), while this // module's distinct types stay live via `dep_sizes`. -Widget :: struct { a: s64; b: s64; } -Nums :: [2]s32; -dep_sizes :: () -> s64 { return size_of(Widget) + size_of(Nums); } +Widget :: struct { a: i64; b: i64; } +Nums :: [2]i32; +dep_sizes :: () -> i64 { return size_of(Widget) + size_of(Nums); } diff --git a/examples/0769-modules-ambiguous-type-fn-head.sx b/examples/0769-modules-ambiguous-type-fn-head.sx index af9e506..0e25e55 100644 --- a/examples/0769-modules-ambiguous-type-fn-head.sx +++ b/examples/0769-modules-ambiguous-type-fn-head.sx @@ -1,21 +1,21 @@ -// A type-returning FUNCTION head (`Make(s64)` where `Make :: ($T) -> Type`) is +// A type-returning FUNCTION head (`Make(i64)` where `Make :: ($T) -> Type`) is // NON-transitive AND ambiguity-checked, exactly like the parameterized generic- // struct / protocol heads (0767) and the nominal leaf (0755). `main` flat-imports // two modules that each author a same-name `Make` type-fn with a different body -// and authors none itself, so the bare `Make(s64)` head is a genuine collision — +// and authors none itself, so the bare `Make(i64)` head is a genuine collision — // it must emit the LOUD "type 'Make' is ambiguous" diagnostic and poison, NEVER // silently instantiate whichever single author `fn_ast_map` happens to hold. // // Regression (Phase E4 attempt-6, finding #2): before `headFnLeak` did bare-call // ambiguity selection it only checked `isNameVisible` (both authors ARE visible), -// so two flat `Make` type-fns silently instantiated one author — `size_of(Make(s64))` +// so two flat `Make` type-fns silently instantiated one author — `size_of(Make(i64))` // printed 16 (a.sx's two-field body) at exit 0 instead of the ambiguity diagnostic. #import "modules/std.sx"; #import "0769-modules-ambiguous-type-fn-head/a.sx"; #import "0769-modules-ambiguous-type-fn-head/b.sx"; -main :: () -> s32 { - print("size={}\n", size_of(Make(s64))); +main :: () -> i32 { + print("size={}\n", size_of(Make(i64))); 0 } diff --git a/examples/0769-modules-ambiguous-type-fn-head/a.sx b/examples/0769-modules-ambiguous-type-fn-head/a.sx index a621761..c437e97 100644 --- a/examples/0769-modules-ambiguous-type-fn-head/a.sx +++ b/examples/0769-modules-ambiguous-type-fn-head/a.sx @@ -1,6 +1,6 @@ // One of two flat-imported authors of a same-name type-returning function // `Make :: ($T) -> Type`. Its body returns a two-field struct; b.sx's returns a -// one-field struct, so a bare `Make(s64)` head is a genuine collision the +// one-field struct, so a bare `Make(i64)` head is a genuine collision the // importing source cannot disambiguate. Make :: ($T: Type) -> Type { return struct { x: T; y: T; }; diff --git a/examples/0769-modules-ambiguous-type-fn-head/b.sx b/examples/0769-modules-ambiguous-type-fn-head/b.sx index d495e71..e58fe7f 100644 --- a/examples/0769-modules-ambiguous-type-fn-head/b.sx +++ b/examples/0769-modules-ambiguous-type-fn-head/b.sx @@ -1,5 +1,5 @@ // The second flat-imported author of same-name type-fn `Make`. Its distinct -// one-field body makes a bare `Make(s64)` head ambiguous against a.sx's. +// one-field body makes a bare `Make(i64)` head ambiguous against a.sx's. Make :: ($T: Type) -> Type { return struct { x: T; }; } diff --git a/examples/0770-modules-type-fn-head-non-transitive.sx b/examples/0770-modules-type-fn-head-non-transitive.sx index 5919d7c..6c8cb78 100644 --- a/examples/0770-modules-type-fn-head-non-transitive.sx +++ b/examples/0770-modules-type-fn-head-non-transitive.sx @@ -1,9 +1,9 @@ -// A type-returning FUNCTION head (`Make(s64)` where `Make :: ($T) -> Type`) is +// A type-returning FUNCTION head (`Make(i64)` where `Make :: ($T) -> Type`) is // NON-transitive even when a DIRECT flat import authors the same name as a // NON-function. `main` flat-imports `b.sx`; `b.sx` declares `Make :: 123` (a // value const, not a type-fn) AND flat-imports `c.sx`, whose `Make` IS the // type-returning function. The only TYPE-FN author of `Make` is two flat hops -// away (main → b → c), so the bare `Make(s64)` head must emit the +// away (main → b → c), so the bare `Make(i64)` head must emit the // "type 'Make' is not visible" diagnostic and poison — the visible 1-hop // `Make :: 123` const must NOT vouch for it. // @@ -11,13 +11,13 @@ // nonfn): before `headFnLeak` decided visibility from the ELIGIBLE FUNCTION // authors it used the module-scope NAME predicate (`isNameVisible`), which the // visible non-fn `Make :: 123` satisfied — so the global `fn_ast_map` type-fn -// silently instantiated and `size_of(Make(s64))` printed 8 at exit 0 instead of +// silently instantiated and `size_of(Make(i64))` printed 8 at exit 0 instead of // the visibility diagnostic. #import "modules/std.sx"; #import "0770-modules-type-fn-head-non-transitive/b.sx"; -main :: () -> s32 { - print("size={}\n", size_of(Make(s64))); +main :: () -> i32 { + print("size={}\n", size_of(Make(i64))); 0 } diff --git a/examples/0771-modules-type-fn-head-ordinary-fn-no-vouch.sx b/examples/0771-modules-type-fn-head-ordinary-fn-no-vouch.sx index 1e45410..44df318 100644 --- a/examples/0771-modules-type-fn-head-ordinary-fn-no-vouch.sx +++ b/examples/0771-modules-type-fn-head-ordinary-fn-no-vouch.sx @@ -1,17 +1,17 @@ -// A type-returning FUNCTION head (`Make(s64)` where `Make :: ($T) -> Type`) is +// A type-returning FUNCTION head (`Make(i64)` where `Make :: ($T) -> Type`) is // NON-transitive even when a DIRECT flat import authors the same name as an // ORDINARY (non-type-returning) function. `main` flat-imports `b.sx`; `b.sx` -// declares `Make :: () -> s32` (a plain function, NOT a type-fn) AND flat-imports +// declares `Make :: () -> i32` (a plain function, NOT a type-fn) AND flat-imports // `c.sx`, whose `Make` IS the type-returning function. The only TYPE-FN author of -// `Make` is two flat hops away (main → b → c), so the bare `Make(s64)` head must +// `Make` is two flat hops away (main → b → c), so the bare `Make(i64)` head must // emit the "type 'Make' is not visible" diagnostic and poison — the visible 1-hop -// ordinary `Make :: () -> s32` must NOT vouch for it. +// ordinary `Make :: () -> i32` must NOT vouch for it. // // Regression (Phase E4 attempt-8, finding E4-type-fn-head-hidden-by-visible- // nontypefn): attempt-7's `headFnLeak` decided visibility from any FUNCTION // author (`fnDeclOfRaw != null`), so the visible ordinary `Make` function (which // CANNOT be the type head being instantiated) still vouched — the global -// `fn_ast_map` type-fn silently instantiated and `size_of(Make(s64))` printed 8 +// `fn_ast_map` type-fn silently instantiated and `size_of(Make(i64))` printed 8 // at exit 0 instead of the visibility diagnostic. The fix narrows the author view // to TYPE-FUNCTIONS (`typeFnAuthor`: a `fn_decl` with ≥1 `$`-param), the same // discriminator every instantiation site uses to recognize a type-fn head. @@ -19,7 +19,7 @@ #import "modules/std.sx"; #import "0771-modules-type-fn-head-ordinary-fn-no-vouch/b.sx"; -main :: () -> s32 { - print("size={}\n", size_of(Make(s64))); +main :: () -> i32 { + print("size={}\n", size_of(Make(i64))); 0 } diff --git a/examples/0771-modules-type-fn-head-ordinary-fn-no-vouch/b.sx b/examples/0771-modules-type-fn-head-ordinary-fn-no-vouch/b.sx index 91e5229..a6abb03 100644 --- a/examples/0771-modules-type-fn-head-ordinary-fn-no-vouch/b.sx +++ b/examples/0771-modules-type-fn-head-ordinary-fn-no-vouch/b.sx @@ -1,7 +1,7 @@ // The directly-imported (1-hop) author of the NAME `Make` — but as an ORDINARY -// function (`() -> s32`), NOT a type-returning function. It flat-imports c.sx +// function (`() -> i32`), NOT a type-returning function. It flat-imports c.sx // (where the real `Make` type-fn lives, two hops from a file that imports b.sx). // A same-name ordinary function must not vouch for the 2-hop type-fn head: it has -// zero `$`-params, so it cannot be the type head `Make(s64)` is instantiating. +// zero `$`-params, so it cannot be the type head `Make(i64)` is instantiating. #import "c.sx"; -Make :: () -> s32 { return 7; } +Make :: () -> i32 { return 7; } diff --git a/examples/0772-modules-qualified-generic-head-author.sx b/examples/0772-modules-qualified-generic-head-author.sx index b5707c8..eb601f8 100644 --- a/examples/0772-modules-qualified-generic-head-author.sx +++ b/examples/0772-modules-qualified-generic-head-author.sx @@ -2,28 +2,28 @@ // AUTHORED by `ns`'s module — not the global same-name template that happened to // win the last-wins `struct_template_map`. `main` imports two namespaces that // each author a same-name generic `Box($T)` with a DIFFERENT layout (a: one -// field, b: two fields). `a.Box(s64)` and `b.Box(s64)` must resolve to their OWN +// field, b: two fields). `a.Box(i64)` and `b.Box(i64)` must resolve to their OWN // module's template (sizes 8 and 16) and be DISTINCT types, so a field unique to // b's layout (`y`) is reachable only through `b.Box`. // -// This is the ambiguity escape hatch made real: when a bare `Box(s64)` is +// This is the ambiguity escape hatch made real: when a bare `Box(i64)` is // ambiguous (two flat same-name authors), the diagnostic tells the user to // "qualify the reference"; that advice only works if `ns.Box(..)` actually // selects ns's author. // // Regression (Phase E4): before qualified generic-head selection, the head was // stripped to the bare name and read from the global `struct_template_map`, so -// `a.Box(s64)` and `b.Box(s64)` both instantiated the last-wins template (both +// `a.Box(i64)` and `b.Box(i64)` both instantiated the last-wins template (both // size 16) — the namespace qualifier was ignored. #import "modules/std.sx"; a :: #import "0772-modules-qualified-generic-head-author/a.sx"; b :: #import "0772-modules-qualified-generic-head-author/b.sx"; -main :: () -> s32 { - pa : a.Box(s64) = .{ x = 1 }; - pb : b.Box(s64) = .{ x = 10, y = 20 }; - print("a={} b={}\n", size_of(a.Box(s64)), size_of(b.Box(s64))); +main :: () -> i32 { + pa : a.Box(i64) = .{ x = 1 }; + pb : b.Box(i64) = .{ x = 10, y = 20 }; + print("a={} b={}\n", size_of(a.Box(i64)), size_of(b.Box(i64))); print("pa.x={} pb.x={} pb.y={}\n", pa.x, pb.x, pb.y); 0 } diff --git a/examples/0772-modules-qualified-generic-head-author/a.sx b/examples/0772-modules-qualified-generic-head-author/a.sx index 37242c9..632b8e2 100644 --- a/examples/0772-modules-qualified-generic-head-author/a.sx +++ b/examples/0772-modules-qualified-generic-head-author/a.sx @@ -1,2 +1,2 @@ -// Author A's generic `Box` — one s64 field (size 8). +// Author A's generic `Box` — one i64 field (size 8). Box :: struct($T: Type) { x: T; } diff --git a/examples/0772-modules-qualified-generic-head-author/b.sx b/examples/0772-modules-qualified-generic-head-author/b.sx index 1167771..8d06fd2 100644 --- a/examples/0772-modules-qualified-generic-head-author/b.sx +++ b/examples/0772-modules-qualified-generic-head-author/b.sx @@ -1,3 +1,3 @@ -// Author B's generic `Box` — two s64 fields (size 16). Same template NAME as +// Author B's generic `Box` — two i64 fields (size 16). Same template NAME as // A's, different layout: the qualified head must select by namespace author. Box :: struct($T: Type) { x: T; y: T; } diff --git a/examples/0773-modules-qualified-generic-alias-author.sx b/examples/0773-modules-qualified-generic-alias-author.sx index a43a579..88d1915 100644 --- a/examples/0773-modules-qualified-generic-alias-author.sx +++ b/examples/0773-modules-qualified-generic-alias-author.sx @@ -2,7 +2,7 @@ // instantiate the template AUTHORED by `ns`'s module — not the global same-name // template that won the last-wins `struct_template_map`. Two namespaces each // author a same-name generic `Box($T)` with a DIFFERENT layout (a: one field, -// b: two fields). `ABox :: a.Box(s64)` and `BBox :: b.Box(s64)` must register +// b: two fields). `ABox :: a.Box(i64)` and `BBox :: b.Box(i64)` must register // aliases over their OWN module's template (sizes 8 and 16) and stay DISTINCT, // so the field unique to b's layout (`y`) is reachable only through `BBox`. // @@ -16,10 +16,10 @@ a :: #import "0773-modules-qualified-generic-alias-author/a.sx"; b :: #import "0773-modules-qualified-generic-alias-author/b.sx"; -ABox :: a.Box(s64); -BBox :: b.Box(s64); +ABox :: a.Box(i64); +BBox :: b.Box(i64); -main :: () -> s32 { +main :: () -> i32 { ab : ABox = .{ x = 1 }; bb : BBox = .{ x = 10, y = 20 }; print("alias a={} b={}\n", size_of(ABox), size_of(BBox)); diff --git a/examples/0773-modules-qualified-generic-alias-author/a.sx b/examples/0773-modules-qualified-generic-alias-author/a.sx index 37242c9..632b8e2 100644 --- a/examples/0773-modules-qualified-generic-alias-author/a.sx +++ b/examples/0773-modules-qualified-generic-alias-author/a.sx @@ -1,2 +1,2 @@ -// Author A's generic `Box` — one s64 field (size 8). +// Author A's generic `Box` — one i64 field (size 8). Box :: struct($T: Type) { x: T; } diff --git a/examples/0773-modules-qualified-generic-alias-author/b.sx b/examples/0773-modules-qualified-generic-alias-author/b.sx index e5583af..f93f339 100644 --- a/examples/0773-modules-qualified-generic-alias-author/b.sx +++ b/examples/0773-modules-qualified-generic-alias-author/b.sx @@ -1,3 +1,3 @@ -// Author B's generic `Box` — two s64 fields (size 16). Same template NAME as +// Author B's generic `Box` — two i64 fields (size 16). Same template NAME as // A's, different layout: the qualified alias head must select by namespace author. Box :: struct($T: Type) { x: T; y: T; } diff --git a/examples/0774-modules-bare-generic-head-visible-author.sx b/examples/0774-modules-bare-generic-head-visible-author.sx index 91a789e..3cc6a5a 100644 --- a/examples/0774-modules-bare-generic-head-visible-author.sx +++ b/examples/0774-modules-bare-generic-head-visible-author.sx @@ -1,5 +1,5 @@ -// A BARE generic struct head (`Box(s64)`) and a BARE generic alias -// (`ABox :: Box(s64)`) must instantiate the template authored by the single +// A BARE generic struct head (`Box(i64)`) and a BARE generic alias +// (`ABox :: Box(i64)`) must instantiate the template authored by the single // bare-VISIBLE author — this file's own author or a DIRECT (1-hop) flat import — // NOT the global last-wins `struct_template_map`, which a NON-visible 2-flat-hop // same-name template can win. @@ -7,8 +7,8 @@ // `b.sx` declares a one-field `Box($T)` (size 8) and itself flat-imports `c.sx`, // which declares a two-field `Box($T)` (size 16). This file flat-imports ONLY // `b.sx`, so `b.Box` is one flat hop away (visible) and `c.Box` is two hops away -// (NOT bare-visible, mirrors 0764/0706). The bare head `Box(s64)` and the bare -// alias `ABox :: Box(s64)` must both select `b.Box` (size 8). +// (NOT bare-visible, mirrors 0764/0706). The bare head `Box(i64)` and the bare +// alias `ABox :: Box(i64)` must both select `b.Box` (size 8). // // Regression (Phase E4 finding #1): before the bare head/alias consulted the // source-keyed visible author, both fell through the `.unregistered` gate arm to @@ -18,11 +18,11 @@ #import "modules/std.sx"; #import "0774-modules-bare-generic-head-visible-author/b.sx"; -ABox :: Box(s64); +ABox :: Box(i64); -main :: () -> s32 { - x : Box(s64) = .{ x = 1 }; +main :: () -> i32 { + x : Box(i64) = .{ x = 1 }; a : ABox = .{ x = 2 }; - print("size={} alias={} x={} a={}\n", size_of(Box(s64)), size_of(ABox), x.x, a.x); + print("size={} alias={} x={} a={}\n", size_of(Box(i64)), size_of(ABox), x.x, a.x); 0 } diff --git a/examples/0774-modules-bare-generic-head-visible-author/b.sx b/examples/0774-modules-bare-generic-head-visible-author/b.sx index 4f460a1..1ce13f8 100644 --- a/examples/0774-modules-bare-generic-head-visible-author/b.sx +++ b/examples/0774-modules-bare-generic-head-visible-author/b.sx @@ -1,11 +1,11 @@ // The bare-VISIBLE author: a one-field generic `Box` (size 8). `b.sx` itself -// flat-imports `c.sx`, so `b_make`'s `Box(s64)` resolves here (the head is one +// flat-imports `c.sx`, so `b_make`'s `Box(i64)` resolves here (the head is one // flat hop away in this module) — but a file that imports b.sx reaches `c.Box` // only at two hops, so it must NOT win the bare head in the importer. Box :: struct($T: Type) { x: T; } #import "c.sx"; -b_make :: () -> Box(s64) { +b_make :: () -> Box(i64) { .{ x = 99 } } diff --git a/examples/0775-modules-qualified-generic-missing-member.sx b/examples/0775-modules-qualified-generic-missing-member.sx index 1cee944..50cc8ce 100644 --- a/examples/0775-modules-qualified-generic-missing-member.sx +++ b/examples/0775-modules-qualified-generic-missing-member.sx @@ -1,10 +1,10 @@ -// A QUALIFIED generic head `a.Box(s64)` where namespace `a` exists but authors +// A QUALIFIED generic head `a.Box(i64)` where namespace `a` exists but authors // NO member named `Box` must DIAGNOSE the missing member — never silently fall // back to the bare last-wins `struct_template_map` and instantiate an unrelated // module's same-name `Box`. // // `a.sx` authors only `Other` (no `Box`); `b.sx` authors a generic `Box($T)`. -// The qualified reference `a.Box(s64)` must report that `a` has no member `Box`, +// The qualified reference `a.Box(i64)` must report that `a` has no member `Box`, // NOT resolve to `b.Box`. // // Regression (Phase E4 finding #2): before the qualified head path diagnosed the @@ -16,8 +16,8 @@ a :: #import "0775-modules-qualified-generic-missing-member/a.sx"; b :: #import "0775-modules-qualified-generic-missing-member/b.sx"; -main :: () -> s32 { - x : a.Box(s64) = .{ x = 1, y = 2 }; +main :: () -> i32 { + x : a.Box(i64) = .{ x = 1, y = 2 }; print("{}\n", x.x); 0 } diff --git a/examples/0775-modules-qualified-generic-missing-member/a.sx b/examples/0775-modules-qualified-generic-missing-member/a.sx index 29be4b5..dc78289 100644 --- a/examples/0775-modules-qualified-generic-missing-member/a.sx +++ b/examples/0775-modules-qualified-generic-missing-member/a.sx @@ -1,3 +1,3 @@ // Namespace `a` authors ONLY `Other` — no `Box`. A qualified `a.Box(..)` head // must diagnose the missing member, not resolve to another module's `Box`. -Other :: struct { z: s64; } +Other :: struct { z: i64; } diff --git a/examples/0776-modules-bare-generic-static-method-visible-author.sx b/examples/0776-modules-bare-generic-static-method-visible-author.sx index e9a14f4..3e234f0 100644 --- a/examples/0776-modules-bare-generic-static-method-visible-author.sx +++ b/examples/0776-modules-bare-generic-static-method-visible-author.sx @@ -1,5 +1,5 @@ // A BARE generic struct head used as a STATIC-METHOD-CALL target -// (`Box(s64).make(7)`) must instantiate — and call the method of — the template +// (`Box(i64).make(7)`) must instantiate — and call the method of — the template // authored by the single bare-VISIBLE author, NOT the global last-wins // `struct_template_map` (and its name-keyed `Box.make`), which a NON-visible // 2-flat-hop same-name template can win. @@ -8,20 +8,20 @@ // flat-imports `c.sx`, which declares a two-field `Box($T)` (size 16) with its // own `make`. This file flat-imports ONLY `b.sx`, so `b.Box` is one flat hop away // (visible) and `c.Box` is two hops away (NOT bare-visible, mirrors -// 0764/0774/0706). The static-method head `Box(s64).make(7)` must select `b.Box` +// 0764/0774/0706). The static-method head `Box(i64).make(7)` must select `b.Box` // (size 8) for BOTH the instantiated type layout and the method body. // // Regression (Phase E4 finding #1, static-method site): before the static-method -// head consulted the source-keyed visible author, `size_of(Box(s64))` correctly -// picked the visible `b.Box` (8) but `Box(s64).make(7)` instantiated the global +// head consulted the source-keyed visible author, `size_of(Box(i64))` correctly +// picked the visible `b.Box` (8) but `Box(i64).make(7)` instantiated the global // last-wins `c.Box` and ran `c.Box.make`, returning a 16-byte value. Fail-before // printed `size=8 xtype=16 x=7`. #import "modules/std.sx"; #import "0776-modules-bare-generic-static-method-visible-author/b.sx"; -main :: () -> s32 { - x := Box(s64).make(7); - print("size={} xtype={} x={}\n", size_of(Box(s64)), size_of(type_of(x)), x.x); +main :: () -> i32 { + x := Box(i64).make(7); + print("size={} xtype={} x={}\n", size_of(Box(i64)), size_of(type_of(x)), x.x); 0 } diff --git a/examples/0777-modules-bare-generic-instance-method-visible-author.sx b/examples/0777-modules-bare-generic-instance-method-visible-author.sx index 718443d..2da5127 100644 --- a/examples/0777-modules-bare-generic-instance-method-visible-author.sx +++ b/examples/0777-modules-bare-generic-instance-method-visible-author.sx @@ -9,7 +9,7 @@ // one flat hop away (visible) and `c.Box` is two hops (NOT bare-visible). // // Regression (Phase E4 finding #1, instance-method site): the static head -// `Box(s64).make(7)` already selected `b.Box` for the layout (size 8), but the +// `Box(i64).make(7)` already selected `b.Box` for the layout (size 8), but the // instance method `x.tag()` resolved by bare template name in `fn_ast_map`, so it // ran `c.Box.tag` (returning 7+16=23) on the b instance. Fail-before printed // `size=8 tag=23`; with body-author ≡ layout-author it runs b's `tag` (7+8=15). @@ -17,8 +17,8 @@ #import "modules/std.sx"; #import "0777-modules-bare-generic-instance-method-visible-author/b.sx"; -main :: () -> s32 { - x := Box(s64).make(7); +main :: () -> i32 { + x := Box(i64).make(7); print("size={} tag={}\n", size_of(type_of(x)), x.tag()); 0 } diff --git a/examples/0778-modules-bare-generic-instance-by-value-receiver.sx b/examples/0778-modules-bare-generic-instance-by-value-receiver.sx index 8d2f895..2003788 100644 --- a/examples/0778-modules-bare-generic-instance-by-value-receiver.sx +++ b/examples/0778-modules-bare-generic-instance-by-value-receiver.sx @@ -13,8 +13,8 @@ #import "modules/std.sx"; #import "0778-modules-bare-generic-instance-by-value-receiver/b.sx"; -main :: () -> s32 { - x := Box(s64).make(5); +main :: () -> i32 { + x := Box(i64).make(5); print("size={} dbl={}\n", size_of(type_of(x)), x.dbl()); 0 } diff --git a/examples/0779-modules-qualified-generic-static-method-author.sx b/examples/0779-modules-qualified-generic-static-method-author.sx index 1d273e6..436f460 100644 --- a/examples/0779-modules-qualified-generic-static-method-author.sx +++ b/examples/0779-modules-qualified-generic-static-method-author.sx @@ -1,23 +1,23 @@ -// A QUALIFIED generic static-method head (`a.Box(s64).make(7)`) must instantiate +// A QUALIFIED generic static-method head (`a.Box(i64).make(7)`) must instantiate // — and call the `make` of — the template AUTHORED by namespace `a`, for BOTH // the type layout and the method body. Two namespaces each author a same-name // generic `Box($T)` with a DIFFERENT layout and a DIFFERENT `make` (a: one field; -// b: two fields, sets `y = v+100`). `a.Box(s64).make(7)` and `b.Box(s64).make(9)` +// b: two fields, sets `y = v+100`). `a.Box(i64).make(7)` and `b.Box(i64).make(9)` // must select their OWN module's author. // // Regression (Phase E4 finding #2, qualified static-method site): the static-head // path only handled an IDENTIFIER inner callee (`Box(..)`), so the qualified // inner callee `a.Box(..)` (a `.field_access`) was not routed through -// `qualifiedStructTemplate` — `a.Box(s64).make(7)` resolved to nothing +// `qualifiedStructTemplate` — `a.Box(i64).make(7)` resolved to nothing // (unresolved, exit 1). #import "modules/std.sx"; a :: #import "0779-modules-qualified-generic-static-method-author/a.sx"; b :: #import "0779-modules-qualified-generic-static-method-author/b.sx"; -main :: () -> s32 { - xa := a.Box(s64).make(7); - xb := b.Box(s64).make(9); +main :: () -> i32 { + xa := a.Box(i64).make(7); + xb := b.Box(i64).make(9); print("a.x={} b.x={} b.y={} sizes={} {}\n", xa.x, xb.x, xb.y, size_of(type_of(xa)), size_of(type_of(xb))); 0 } diff --git a/examples/0779-modules-qualified-generic-static-method-author/a.sx b/examples/0779-modules-qualified-generic-static-method-author/a.sx index 97775a2..609ba4a 100644 --- a/examples/0779-modules-qualified-generic-static-method-author/a.sx +++ b/examples/0779-modules-qualified-generic-static-method-author/a.sx @@ -1,4 +1,4 @@ -// Author A's generic `Box` — one s64 field (size 8). Its `make` sets only `x`. +// Author A's generic `Box` — one i64 field (size 8). Its `make` sets only `x`. Box :: struct($T: Type) { x: T; diff --git a/examples/0779-modules-qualified-generic-static-method-author/b.sx b/examples/0779-modules-qualified-generic-static-method-author/b.sx index 3f12a38..5be96d8 100644 --- a/examples/0779-modules-qualified-generic-static-method-author/b.sx +++ b/examples/0779-modules-qualified-generic-static-method-author/b.sx @@ -1,4 +1,4 @@ -// Author B's generic `Box` — two s64 fields (size 16). Same template NAME as +// Author B's generic `Box` — two i64 fields (size 16). Same template NAME as // A's, different layout AND different `make` (sets `y = value + 100`). The // qualified static head must select by namespace author for both. Box :: struct($T: Type) { diff --git a/examples/0780-modules-bare-generic-instance-param-typed-author.sx b/examples/0780-modules-bare-generic-instance-param-typed-author.sx index 20858b0..9f862a7 100644 --- a/examples/0780-modules-bare-generic-instance-param-typed-author.sx +++ b/examples/0780-modules-bare-generic-instance-param-typed-author.sx @@ -13,8 +13,8 @@ #import "modules/std.sx"; #import "0780-modules-bare-generic-instance-param-typed-author/b.sx"; -main :: () -> s32 { - x := Box(s64).make(7); +main :: () -> i32 { + x := Box(i64).make(7); print("combine={}\n", x.combine(3)); 0 } diff --git a/examples/0782-modules-bare-generic-instance-ambiguous-authors.sx b/examples/0782-modules-bare-generic-instance-ambiguous-authors.sx index 24a5dee..de682c8 100644 --- a/examples/0782-modules-bare-generic-instance-ambiguous-authors.sx +++ b/examples/0782-modules-bare-generic-instance-ambiguous-authors.sx @@ -1,18 +1,18 @@ -// A BARE generic static-method head `Box(s64).make(7)` whose name has ≥2 DISTINCT +// A BARE generic static-method head `Box(i64).make(7)` whose name has ≥2 DISTINCT // directly-visible (1-hop flat) same-name authors is AMBIGUOUS — the head must // diagnose the ambiguity (consistent with the leaf / 0755 / 0767) BEFORE any // instantiation or method lookup, never silently pick a global last-wins author. // // `p.sx` and `q.sx` each author a generic `Box($T)` and are BOTH flat-imported // here, so a bare `Box` reference has two visible authors and cannot be resolved -// without qualification. The fix is to `p.Box(s64)` / `q.Box(s64)` (0779). +// without qualification. The fix is to `p.Box(i64)` / `q.Box(i64)` (0779). #import "modules/std.sx"; #import "0782-modules-bare-generic-instance-ambiguous-authors/p.sx"; #import "0782-modules-bare-generic-instance-ambiguous-authors/q.sx"; -main :: () -> s32 { - x := Box(s64).make(7); +main :: () -> i32 { + x := Box(i64).make(7); print("{}\n", x.x); 0 } diff --git a/examples/0782-modules-bare-generic-instance-ambiguous-authors/p.sx b/examples/0782-modules-bare-generic-instance-ambiguous-authors/p.sx index 5d47595..ae6ca03 100644 --- a/examples/0782-modules-bare-generic-instance-ambiguous-authors/p.sx +++ b/examples/0782-modules-bare-generic-instance-ambiguous-authors/p.sx @@ -1,4 +1,4 @@ -// Author P's generic `Box` — one s64 field. Flat-imported alongside q.sx's +// Author P's generic `Box` — one i64 field. Flat-imported alongside q.sx's // same-name `Box`, so a bare `Box` reference is ambiguous. Box :: struct($T: Type) { x: T; diff --git a/examples/0782-modules-bare-generic-instance-ambiguous-authors/q.sx b/examples/0782-modules-bare-generic-instance-ambiguous-authors/q.sx index 246e610..52e3184 100644 --- a/examples/0782-modules-bare-generic-instance-ambiguous-authors/q.sx +++ b/examples/0782-modules-bare-generic-instance-ambiguous-authors/q.sx @@ -1,4 +1,4 @@ -// Author Q's generic `Box` — two s64 fields. Flat-imported alongside p.sx's +// Author Q's generic `Box` — two i64 fields. Flat-imported alongside p.sx's // same-name `Box`, so a bare `Box` reference is ambiguous. Box :: struct($T: Type) { x: T; diff --git a/examples/0783-modules-qualified-generic-alias-instance-dispatch.sx b/examples/0783-modules-qualified-generic-alias-instance-dispatch.sx index e77a1d0..c126ceb 100644 --- a/examples/0783-modules-qualified-generic-alias-instance-dispatch.sx +++ b/examples/0783-modules-qualified-generic-alias-instance-dispatch.sx @@ -1,8 +1,8 @@ -// A generic-struct ALIAS whose RHS is a qualified head (`ABox :: a.Box(s64)`) +// A generic-struct ALIAS whose RHS is a qualified head (`ABox :: a.Box(i64)`) // must make an ALIAS-typed receiver (`x: ABox`) a first-class dispatch instance: // `x.tag()` runs the author `a`'s body with `a`'s bindings — never a dead end. // Two namespaces author a same-name generic `Box($T)` with a DIFFERENT layout and -// a DIFFERENT `tag`; the alias over `a.Box(s64)` must dispatch `a.Box.tag`. +// a DIFFERENT `tag`; the alias over `a.Box(i64)` must dispatch `a.Box.tag`. // // Regression (Phase E4 Counter-2): the alias registration cloned the layout into // a fresh type named `ABox` but did NOT mirror the instance template/bindings/ @@ -14,9 +14,9 @@ a :: #import "0783-modules-qualified-generic-alias-instance-dispatch/a.sx"; b :: #import "0783-modules-qualified-generic-alias-instance-dispatch/b.sx"; -ABox :: a.Box(s64); +ABox :: a.Box(i64); -main :: () -> s32 { +main :: () -> i32 { x : ABox = .{ x = 5 }; print("size={} tag={}\n", size_of(ABox), x.tag()); 0 diff --git a/examples/0783-modules-qualified-generic-alias-instance-dispatch/a.sx b/examples/0783-modules-qualified-generic-alias-instance-dispatch/a.sx index d5c62ff..6c115c7 100644 --- a/examples/0783-modules-qualified-generic-alias-instance-dispatch/a.sx +++ b/examples/0783-modules-qualified-generic-alias-instance-dispatch/a.sx @@ -1,5 +1,5 @@ -// Author A's generic `Box` — one s64 field (size 8). Its `tag` returns -// `self.x + 1`. The alias `ABox :: a.Box(s64)` must dispatch to THIS `tag`. +// Author A's generic `Box` — one i64 field (size 8). Its `tag` returns +// `self.x + 1`. The alias `ABox :: a.Box(i64)` must dispatch to THIS `tag`. Box :: struct($T: Type) { x: T; diff --git a/examples/0783-modules-qualified-generic-alias-instance-dispatch/b.sx b/examples/0783-modules-qualified-generic-alias-instance-dispatch/b.sx index 7480fa0..d8c3487 100644 --- a/examples/0783-modules-qualified-generic-alias-instance-dispatch/b.sx +++ b/examples/0783-modules-qualified-generic-alias-instance-dispatch/b.sx @@ -1,4 +1,4 @@ -// Author B's generic `Box` — two s64 fields (size 16) whose `tag` returns +// Author B's generic `Box` — two i64 fields (size 16) whose `tag` returns // `self.x + 2`. Same template NAME as A's, different layout/body; it wins the // global last-wins `fn_ast_map["Box.tag"]`, so the alias over `a.Box` must NOT // dispatch to it. diff --git a/examples/0785-modules-qualified-generic-static-missing-member.sx b/examples/0785-modules-qualified-generic-static-missing-member.sx index 4ffdc77..f2b679f 100644 --- a/examples/0785-modules-qualified-generic-static-missing-member.sx +++ b/examples/0785-modules-qualified-generic-static-missing-member.sx @@ -1,19 +1,19 @@ -// A QUALIFIED generic static-method head `a.Box(s64).make(7)` where namespace `a` +// A QUALIFIED generic static-method head `a.Box(i64).make(7)` where namespace `a` // exists but authors NO member named `Box` must DIAGNOSE the missing member — // never silently fall back to the bare last-wins `struct_template_map` and // instantiate an unrelated module's same-name `Box` (parallels 0775 for the // static-method head). // // `a.sx` authors only `Other` (no `Box`); `b.sx` authors a generic `Box($T)`. -// The qualified static head `a.Box(s64).make(7)` must report that `a` has no +// The qualified static head `a.Box(i64).make(7)` must report that `a` has no // member `Box`, NOT resolve to `b.Box.make`. #import "modules/std.sx"; a :: #import "0785-modules-qualified-generic-static-missing-member/a.sx"; b :: #import "0785-modules-qualified-generic-static-missing-member/b.sx"; -main :: () -> s32 { - x := a.Box(s64).make(7); +main :: () -> i32 { + x := a.Box(i64).make(7); print("{}\n", x.x); 0 } diff --git a/examples/0785-modules-qualified-generic-static-missing-member/a.sx b/examples/0785-modules-qualified-generic-static-missing-member/a.sx index 802423f..0b67877 100644 --- a/examples/0785-modules-qualified-generic-static-missing-member/a.sx +++ b/examples/0785-modules-qualified-generic-static-missing-member/a.sx @@ -1,5 +1,5 @@ // Namespace A authors only `Other` — NO `Box`. The qualified static head -// `a.Box(s64).make(..)` must diagnose the missing member, not fall to b's `Box`. +// `a.Box(i64).make(..)` must diagnose the missing member, not fall to b's `Box`. Other :: struct($T: Type) { v: T; diff --git a/examples/0786-modules-same-name-const-own.sx b/examples/0786-modules-same-name-const-own.sx index fc71d2d..655e98a 100644 --- a/examples/0786-modules-same-name-const-own.sx +++ b/examples/0786-modules-same-name-const-own.sx @@ -8,7 +8,7 @@ #import "0786-modules-same-name-const-own/a.sx"; #import "0786-modules-same-name-const-own/b.sx"; -main :: () -> s32 { +main :: () -> i32 { print("a={} b={}\n", a_k(), b_k()); 0 } diff --git a/examples/0786-modules-same-name-const-own/a.sx b/examples/0786-modules-same-name-const-own/a.sx index 66c7c26..8de39a6 100644 --- a/examples/0786-modules-same-name-const-own/a.sx +++ b/examples/0786-modules-same-name-const-own/a.sx @@ -1,3 +1,3 @@ // Module A authors its OWN value const `K` (1) and reads it bare. K :: 1; -a_k :: () -> s64 { return K; } +a_k :: () -> i64 { return K; } diff --git a/examples/0786-modules-same-name-const-own/b.sx b/examples/0786-modules-same-name-const-own/b.sx index 16ae78a..bbb6f37 100644 --- a/examples/0786-modules-same-name-const-own/b.sx +++ b/examples/0786-modules-same-name-const-own/b.sx @@ -2,4 +2,4 @@ // `K`. Each `K` is selected per declaring source, so B's `b_k` reads B's value // while A's `a_k` reads A's, never the global last-wins const. K :: 2; -b_k :: () -> s64 { return K; } +b_k :: () -> i64 { return K; } diff --git a/examples/0787-modules-same-name-const-ambiguous.sx b/examples/0787-modules-same-name-const-ambiguous.sx index 438e2ad..d772a8f 100644 --- a/examples/0787-modules-same-name-const-ambiguous.sx +++ b/examples/0787-modules-same-name-const-ambiguous.sx @@ -8,7 +8,7 @@ #import "0787-modules-same-name-const-ambiguous/a.sx"; #import "0787-modules-same-name-const-ambiguous/b.sx"; -main :: () -> s32 { +main :: () -> i32 { print("K={}\n", K); 0 } diff --git a/examples/0788-modules-same-name-const-expr-chain-dim.sx b/examples/0788-modules-same-name-const-expr-chain-dim.sx index 1ce3b97..32534fe 100644 --- a/examples/0788-modules-same-name-const-expr-chain-dim.sx +++ b/examples/0788-modules-same-name-const-expr-chain-dim.sx @@ -12,7 +12,7 @@ #import "0788-modules-same-name-const-expr-chain-dim/a.sx"; #import "0788-modules-same-name-const-expr-chain-dim/b.sx"; -main :: () -> s32 { +main :: () -> i32 { print("a_len={} a_val={} b_len={} b_val={}\n", a_len(), a_val(), b_len(), b_val()); 0 } diff --git a/examples/0788-modules-same-name-const-expr-chain-dim/a.sx b/examples/0788-modules-same-name-const-expr-chain-dim/a.sx index a806828..0d458ae 100644 --- a/examples/0788-modules-same-name-const-expr-chain-dim/a.sx +++ b/examples/0788-modules-same-name-const-expr-chain-dim/a.sx @@ -2,8 +2,8 @@ // read and the array dimension must resolve `K` through A's `M`. M :: 1; K :: M + 1; -a_val :: () -> s64 { return K; } -a_len :: () -> s64 { +a_val :: () -> i64 { return K; } +a_len :: () -> i64 { arr : [K]u8 = ---; return arr.len; } diff --git a/examples/0788-modules-same-name-const-expr-chain-dim/b.sx b/examples/0788-modules-same-name-const-expr-chain-dim/b.sx index a6a45c9..8bec19a 100644 --- a/examples/0788-modules-same-name-const-expr-chain-dim/b.sx +++ b/examples/0788-modules-same-name-const-expr-chain-dim/b.sx @@ -3,8 +3,8 @@ // so the dimension fold gives B's length 11 — never A's via the global map. M :: 10; K :: M + 1; -b_val :: () -> s64 { return K; } -b_len :: () -> s64 { +b_val :: () -> i64 { return K; } +b_len :: () -> i64 { arr : [K]u8 = ---; return arr.len; } diff --git a/examples/0789-modules-same-name-const-leaf-author-pin.sx b/examples/0789-modules-same-name-const-leaf-author-pin.sx index 0e5eddf..40cd3f7 100644 --- a/examples/0789-modules-same-name-const-leaf-author-pin.sx +++ b/examples/0789-modules-same-name-const-leaf-author-pin.sx @@ -11,12 +11,12 @@ #import "0789-modules-same-name-const-leaf-author-pin/a.sx"; #import "0789-modules-same-name-const-leaf-author-pin/b.sx"; -read_dim :: () -> s64 { +read_dim :: () -> i64 { arr : [K]u8 = ---; return arr.len; } -main :: () -> s32 { +main :: () -> i32 { print("val={} len={}\n", K, read_dim()); 0 } diff --git a/examples/0790-modules-same-name-const-cross-cycle-guard.sx b/examples/0790-modules-same-name-const-cross-cycle-guard.sx index 28d42e9..188b4d6 100644 --- a/examples/0790-modules-same-name-const-cross-cycle-guard.sx +++ b/examples/0790-modules-same-name-const-cross-cycle-guard.sx @@ -9,7 +9,7 @@ #import "modules/std.sx"; #import "0790-modules-same-name-const-cross-cycle-guard/b.sx"; -main :: () -> s32 { +main :: () -> i32 { arr : [M]u8 = ---; print("m={} len={}\n", M, arr.len); 0 diff --git a/examples/0791-modules-same-name-const-multi-level-cross-module.sx b/examples/0791-modules-same-name-const-multi-level-cross-module.sx index 7116c0b..d7468b9 100644 --- a/examples/0791-modules-same-name-const-multi-level-cross-module.sx +++ b/examples/0791-modules-same-name-const-multi-level-cross-module.sx @@ -13,7 +13,7 @@ #import "0791-modules-same-name-const-multi-level-cross-module/b.sx"; #import "0791-modules-same-name-const-multi-level-cross-module/c.sx"; -main :: () -> s32 { +main :: () -> i32 { print("big={} bk={}\n", BIG, K); 0 } diff --git a/examples/0792-modules-same-name-const-struct-field-dim.sx b/examples/0792-modules-same-name-const-struct-field-dim.sx index ac314cd..1188798 100644 --- a/examples/0792-modules-same-name-const-struct-field-dim.sx +++ b/examples/0792-modules-same-name-const-struct-field-dim.sx @@ -9,7 +9,7 @@ #import "0792-modules-same-name-const-struct-field-dim/a.sx"; #import "0792-modules-same-name-const-struct-field-dim/b.sx"; -main :: () -> s32 { +main :: () -> i32 { print("a_sz={} b_sz={}\n", a_sz(), b_sz()); 0 } diff --git a/examples/0792-modules-same-name-const-struct-field-dim/a.sx b/examples/0792-modules-same-name-const-struct-field-dim/a.sx index d25b22a..5d51ee9 100644 --- a/examples/0792-modules-same-name-const-struct-field-dim/a.sx +++ b/examples/0792-modules-same-name-const-struct-field-dim/a.sx @@ -2,4 +2,4 @@ // by A's `K`. `size_of(Box)` folds the field dimension against A's `K` (= 2). K :: 2; Box :: struct { arr: [K]u8; } -a_sz :: () -> s64 { return size_of(Box); } +a_sz :: () -> i64 { return size_of(Box); } diff --git a/examples/0792-modules-same-name-const-struct-field-dim/b.sx b/examples/0792-modules-same-name-const-struct-field-dim/b.sx index 2435256..b67a499 100644 --- a/examples/0792-modules-same-name-const-struct-field-dim/b.sx +++ b/examples/0792-modules-same-name-const-struct-field-dim/b.sx @@ -3,4 +3,4 @@ // differs from A's — never collapsed to a global last-wins `K`. K :: 7; Box :: struct { arr: [K]u8; } -b_sz :: () -> s64 { return size_of(Box); } +b_sz :: () -> i64 { return size_of(Box); } diff --git a/examples/0793-modules-same-name-const-type-infer.sx b/examples/0793-modules-same-name-const-type-infer.sx index f540f4e..4205a10 100644 --- a/examples/0793-modules-same-name-const-type-infer.sx +++ b/examples/0793-modules-same-name-const-type-infer.sx @@ -1,8 +1,8 @@ // issue 0105 / F4 — same-name VALUE const TYPE inference is source-aware. Two // flat-imported modules each declare a top-level `K` with a DIFFERENT declared -// TYPE (A: `s32`, B: `f64`) and an inferred-return function that reads `K` bare. +// TYPE (A: `i32`, B: `f64`) and an inferred-return function that reads `K` bare. // The inferred return type must come from each module's OWN `K` (own-wins), not -// the global last-wins const TYPE: `a_k` infers A's `s32` and yields the integer +// the global last-wins const TYPE: `a_k` infers A's `i32` and yields the integer // `1` (printed `1`, not `1.000000`), while `b_k` infers B's `f64` and yields // `2.500000`. Selection routes through the source-aware `selectModuleConst`, the // same author selector emission/folding use — type inference must agree. @@ -10,7 +10,7 @@ #import "0793-modules-same-name-const-type-infer/a.sx"; #import "0793-modules-same-name-const-type-infer/b.sx"; -main :: () -> s32 { +main :: () -> i32 { print("a={} b={}\n", a_k(), b_k()); 0 } diff --git a/examples/0793-modules-same-name-const-type-infer/a.sx b/examples/0793-modules-same-name-const-type-infer/a.sx index 3d02899..0f85979 100644 --- a/examples/0793-modules-same-name-const-type-infer/a.sx +++ b/examples/0793-modules-same-name-const-type-infer/a.sx @@ -1,5 +1,5 @@ -// Module A authors its OWN `K` declared `s32`. Its inferred-return `a_k` reads -// `K` bare; the inferred return type must be A's `s32`, so the value prints as +// Module A authors its OWN `K` declared `i32`. Its inferred-return `a_k` reads +// `K` bare; the inferred return type must be A's `i32`, so the value prints as // the integer `1`, never coerced to B's `f64`. -K : s32 : 1; +K : i32 : 1; a_k :: () { return K; } diff --git a/examples/0794-modules-same-name-const-type-ambiguous.sx b/examples/0794-modules-same-name-const-type-ambiguous.sx index e5634d8..b64444e 100644 --- a/examples/0794-modules-same-name-const-type-ambiguous.sx +++ b/examples/0794-modules-same-name-const-type-ambiguous.sx @@ -1,5 +1,5 @@ // issue 0105 / F4 — same-name VALUE const with DIFFERENT declared TYPES across -// two flat-imported modules (A: `s32`, B: `f64`), referenced bare at a mixed-type +// two flat-imported modules (A: `i32`, B: `f64`), referenced bare at a mixed-type // site. A bare `K` here is genuinely ambiguous — there are ≥2 flat-visible same- // name authors — so it must diagnose loudly (exit 1), exactly as the same-typed // 0787 does. The type-inference change must NOT mask the ambiguity (inferring @@ -9,7 +9,7 @@ #import "0794-modules-same-name-const-type-ambiguous/a.sx"; #import "0794-modules-same-name-const-type-ambiguous/b.sx"; -main :: () -> s32 { +main :: () -> i32 { print("K={}\n", K); 0 } diff --git a/examples/0794-modules-same-name-const-type-ambiguous/a.sx b/examples/0794-modules-same-name-const-type-ambiguous/a.sx index a4460aa..debbfb4 100644 --- a/examples/0794-modules-same-name-const-type-ambiguous/a.sx +++ b/examples/0794-modules-same-name-const-type-ambiguous/a.sx @@ -1,2 +1,2 @@ -// Module A authors `K` declared `s32`. -K : s32 : 1; +// Module A authors `K` declared `i32`. +K : i32 : 1; diff --git a/examples/0795-modules-same-name-enum-ambiguous.sx b/examples/0795-modules-same-name-enum-ambiguous.sx index 923230a..2225420 100644 --- a/examples/0795-modules-same-name-enum-ambiguous.sx +++ b/examples/0795-modules-same-name-enum-ambiguous.sx @@ -20,7 +20,7 @@ #import "0795-modules-same-name-enum-ambiguous/a.sx"; #import "0795-modules-same-name-enum-ambiguous/b.sx"; -describe :: ($T: Type) -> s32 { +describe :: ($T: Type) -> i32 { r := if T == { case Dir: 1; else: 0; @@ -28,10 +28,10 @@ describe :: ($T: Type) -> s32 { r } -main :: () -> s32 { +main :: () -> i32 { sz := size_of(Dir); d : Dir = .north; t : Type = Dir; - k := describe(s64); + k := describe(i64); 0 } diff --git a/examples/0796-modules-same-name-enum-own-wins.sx b/examples/0796-modules-same-name-enum-own-wins.sx index 203a895..a224614 100644 --- a/examples/0796-modules-same-name-enum-own-wins.sx +++ b/examples/0796-modules-same-name-enum-own-wins.sx @@ -15,7 +15,7 @@ Dir :: enum { north; south; } -main :: () -> s32 { +main :: () -> i32 { d : Dir = .north; print("own={} dep={}\n", d, dep_dir()); 0 diff --git a/examples/0797-modules-same-name-union-ambiguous.sx b/examples/0797-modules-same-name-union-ambiguous.sx index 96f5ef5..cc4493f 100644 --- a/examples/0797-modules-same-name-union-ambiguous.sx +++ b/examples/0797-modules-same-name-union-ambiguous.sx @@ -19,7 +19,7 @@ #import "0797-modules-same-name-union-ambiguous/a.sx"; #import "0797-modules-same-name-union-ambiguous/b.sx"; -describe :: ($T: Type) -> s32 { +describe :: ($T: Type) -> i32 { r := if T == { case Pair: 1; else: 0; @@ -27,10 +27,10 @@ describe :: ($T: Type) -> s32 { r } -main :: () -> s32 { +main :: () -> i32 { sz := size_of(Pair); u : Pair = ---; t : Type = Pair; - k := describe(s64); + k := describe(i64); 0 } diff --git a/examples/0797-modules-same-name-union-ambiguous/a.sx b/examples/0797-modules-same-name-union-ambiguous/a.sx index bfc2243..97f6a95 100644 --- a/examples/0797-modules-same-name-union-ambiguous/a.sx +++ b/examples/0797-modules-same-name-union-ambiguous/a.sx @@ -1,4 +1,4 @@ // One of two flat-imported authors of a same-name `Pair` union. With both modules // flat-visible from a file that authors none itself, every bare reference to the // name is genuinely ambiguous. -Pair :: union { f: f32; i: s32; } +Pair :: union { f: f32; i: i32; } diff --git a/examples/0797-modules-same-name-union-ambiguous/b.sx b/examples/0797-modules-same-name-union-ambiguous/b.sx index 56b52d7..8f399cc 100644 --- a/examples/0797-modules-same-name-union-ambiguous/b.sx +++ b/examples/0797-modules-same-name-union-ambiguous/b.sx @@ -1,4 +1,4 @@ // The second flat-imported author of a same-name `Pair` union. A separate nominal // identity from a.sx's `Pair`, so each bare reference is a real collision the // importing source cannot disambiguate. -Pair :: union { f: f32; i: s32; } +Pair :: union { f: f32; i: i32; } diff --git a/examples/0798-modules-same-name-union-own-wins.sx b/examples/0798-modules-same-name-union-own-wins.sx index 96c1921..1bb9419 100644 --- a/examples/0798-modules-same-name-union-own-wins.sx +++ b/examples/0798-modules-same-name-union-own-wins.sx @@ -13,9 +13,9 @@ #import "modules/std.sx"; #import "0798-modules-same-name-union-own-wins/dep.sx"; -Pair :: union { m: s32; } +Pair :: union { m: i32; } -main :: () -> s32 { +main :: () -> i32 { p : Pair = ---; p.m = 5; print("own={} dep={}\n", p.m, dep_pair()); diff --git a/examples/0798-modules-same-name-union-own-wins/dep.sx b/examples/0798-modules-same-name-union-own-wins/dep.sx index 56b59a5..6ad9c51 100644 --- a/examples/0798-modules-same-name-union-own-wins/dep.sx +++ b/examples/0798-modules-same-name-union-own-wins/dep.sx @@ -2,8 +2,8 @@ // ALSO authors a `Pair` — its own author must win there (own-wins), while this // module's `Pair` stays a DISTINCT nominal type used by `dep_pair`. The field sets // are disjoint, so a cross-binding to the wrong `Pair` is a hard compile error. -Pair :: union { a: s32; } -dep_pair :: () -> s32 { +Pair :: union { a: i32; } +dep_pair :: () -> i32 { p : Pair = ---; p.a = 9; return p.a; diff --git a/examples/0799-types-self-ref-recursive-enum-union.sx b/examples/0799-types-self-ref-recursive-enum-union.sx index 4a674d0..e5ee03f 100644 --- a/examples/0799-types-self-ref-recursive-enum-union.sx +++ b/examples/0799-types-self-ref-recursive-enum-union.sx @@ -16,12 +16,12 @@ // genuine 8-byte-pointer nominal types and the recursive walks read through. #import "modules/std.sx"; -Node :: union { next: *Node; value: s32; } -Tree :: enum { leaf: s32; branch: *Tree; } -A :: union { b: *B; tag: s32; } -B :: union { a: *A; val: s32; } +Node :: union { next: *Node; value: i32; } +Tree :: enum { leaf: i32; branch: *Tree; } +A :: union { b: *B; tag: i32; } +B :: union { a: *A; val: i32; } -main :: () -> s32 { +main :: () -> i32 { // Self-ref union: two-hop walk to the tail cell's value. n2 : Node = ---; n2.value = 7; diff --git a/examples/0800-memory-list.sx b/examples/0800-memory-list.sx index 17ac33b..d8774e9 100644 --- a/examples/0800-memory-list.sx +++ b/examples/0800-memory-list.sx @@ -1,7 +1,7 @@ #import "modules/std.sx"; main :: () { - list : List(s32) = .{}; + list : List(i32) = .{}; list.append(1); diff --git a/examples/0801-memory-slices.sx b/examples/0801-memory-slices.sx index c534a78..cf113e4 100644 --- a/examples/0801-memory-slices.sx +++ b/examples/0801-memory-slices.sx @@ -1,7 +1,7 @@ #import "modules/std.sx"; main :: () { - arr : [5]s32 = .[3, 1, 4, 1, 5]; + arr : [5]i32 = .[3, 1, 4, 1, 5]; print("arr.len = {}\n", arr.len); // subslice array @@ -16,7 +16,7 @@ main :: () { print("arr[2..] = {}\n", tail); // slice of slice - sl : []s32 = .[10, 20, 30, 40, 50]; + sl : []i32 = .[10, 20, 30, 40, 50]; mid := sl[1..4]; print("sl[1..4] = {}\n", mid); rest := mid[1..]; diff --git a/examples/0802-memory-pointers.sx b/examples/0802-memory-pointers.sx index 43d463a..e3ff395 100644 --- a/examples/0802-memory-pointers.sx +++ b/examples/0802-memory-pointers.sx @@ -21,8 +21,8 @@ main :: () { np : *Vec2 = null; // many-pointer indexing - arr : [5]s32 = .[10, 20, 30, 40, 50]; - mp : [*]s32 = @arr[0]; + arr : [5]i32 = .[10, 20, 30, 40, 50]; + mp : [*]i32 = @arr[0]; print("mp[0] = {}\n", mp[0]); print("mp[2] = {}\n", mp[2]); } diff --git a/examples/0804-memory-xx-target-in-field-assign.sx b/examples/0804-memory-xx-target-in-field-assign.sx index e681887..606edc2 100644 --- a/examples/0804-memory-xx-target-in-field-assign.sx +++ b/examples/0804-memory-xx-target-in-field-assign.sx @@ -5,12 +5,12 @@ #import "modules/std.sx"; Foo :: struct { - pixel_w: s32; + pixel_w: i32; dpi: f32; - last_perf: s64; + last_perf: i64; delta_time: f32; } -FC :: struct { a: f32; b: f32; c: s32; d: s32; e: f32; f: f32; } +FC :: struct { a: f32; b: f32; c: i32; d: i32; e: f32; f: f32; } // If-then-else RHS in a function whose return type is not f32. calc_bool :: (self: *Foo, wf: f32) -> bool { @@ -20,7 +20,7 @@ calc_bool :: (self: *Foo, wf: f32) -> bool { // Binary-op RHS in a struct-returning function. The xx casts must target f32, // not the FC return-struct shape. -begin :: (self: *Foo, current: s64, freq: s64) -> FC { +begin :: (self: *Foo, current: i64, freq: i64) -> FC { if self.last_perf > 0 { self.delta_time = xx (current - self.last_perf) / xx freq; } diff --git a/examples/0805-memory-xx-userspace.sx b/examples/0805-memory-xx-userspace.sx index d7e341f..217c1ad 100644 --- a/examples/0805-memory-xx-userspace.sx +++ b/examples/0805-memory-xx-userspace.sx @@ -5,15 +5,15 @@ #import "modules/std.sx"; -MyString :: struct { tag: s64 = 0; } +MyString :: struct { tag: i64 = 0; } -impl Into(MyString) for s64 { - convert :: (self: s64) -> MyString { +impl Into(MyString) for i64 { + convert :: (self: i64) -> MyString { .{ tag = self } } } -main :: () -> s32 { +main :: () -> i32 { x : MyString = xx 42; print("tag = {}\n", x.tag); 0 diff --git a/examples/0806-memory-static-method-inline-xx-protocol-arg.sx b/examples/0806-memory-static-method-inline-xx-protocol-arg.sx index 17a576e..df9c4c3 100644 --- a/examples/0806-memory-static-method-inline-xx-protocol-arg.sx +++ b/examples/0806-memory-static-method-inline-xx-protocol-arg.sx @@ -1,6 +1,6 @@ // Inline `xx` cast as the first argument to a struct static method must // flow the leading param's type into the cast — otherwise an `xx ptr` -// targeting a protocol param falls back to s64 and the call frame is +// targeting a protocol param falls back to i64 and the call frame is // corrupted, SIGTRAPping when the body dispatches through the field. // // Three call shapes that must all succeed: @@ -15,7 +15,7 @@ Box :: struct { parent: Allocator; first_ptr: *void; - init :: (parent_alloc: Allocator, size: s64) -> *Box { + init :: (parent_alloc: Allocator, size: i64) -> *Box { self : *Box = xx libc_malloc(size_of(Box)); self.parent = parent_alloc; self.first_ptr = self.parent.alloc_bytes(size); @@ -23,14 +23,14 @@ Box :: struct { } } -make_box :: (parent_alloc: Allocator, size: s64) -> *Box { +make_box :: (parent_alloc: Allocator, size: i64) -> *Box { self : *Box = xx libc_malloc(size_of(Box)); self.parent = parent_alloc; self.first_ptr = self.parent.alloc_bytes(size); self } -main :: () -> s32 { +main :: () -> i32 { g_gpa : GPA = .{ alloc_count = 0 }; a : Allocator = xx @g_gpa; diff --git a/examples/0807-memory-xx-recover-then-dispatch.sx b/examples/0807-memory-xx-recover-then-dispatch.sx index 58f3e9b..6b49e60 100644 --- a/examples/0807-memory-xx-recover-then-dispatch.sx +++ b/examples/0807-memory-xx-recover-then-dispatch.sx @@ -6,7 +6,7 @@ #import "modules/std.sx"; #import "modules/std/mem.sx"; // `Allocator` is non-transitive: name it, import it. -main :: () -> s32 { +main :: () -> i32 { gpa := GPA.init(); a : Allocator = xx gpa; diff --git a/examples/0808-memory-xx-value-routes-through-context-allocator.sx b/examples/0808-memory-xx-value-routes-through-context-allocator.sx index 802ab8e..b9d1b8f 100644 --- a/examples/0808-memory-xx-value-routes-through-context-allocator.sx +++ b/examples/0808-memory-xx-value-routes-through-context-allocator.sx @@ -12,7 +12,7 @@ #import "modules/std/mem.sx"; // `Allocator` is non-transitive: name it, import it. Tracer :: struct { - count: s64; + count: i64; init :: () -> *Tracer { t : *Tracer = xx libc_malloc(size_of(Tracer)); @@ -22,7 +22,7 @@ Tracer :: struct { } impl Allocator for Tracer { - alloc_bytes :: (self: *Tracer, size: s64) -> *void { + alloc_bytes :: (self: *Tracer, size: i64) -> *void { self.count += 1; return libc_malloc(size); } @@ -31,9 +31,9 @@ impl Allocator for Tracer { } } -ByValue :: struct { x: s64; y: s64; } +ByValue :: struct { x: i64; y: i64; } -main :: () -> s32 { +main :: () -> i32 { tracer := Tracer.init(); push Context.{ allocator = xx tracer, data = null } { // Struct-literal operand: rvalue → heap-copy through context.allocator. diff --git a/examples/0809-memory-xx-lvalue-borrows.sx b/examples/0809-memory-xx-lvalue-borrows.sx index fd023f9..c46ca76 100644 --- a/examples/0809-memory-xx-lvalue-borrows.sx +++ b/examples/0809-memory-xx-lvalue-borrows.sx @@ -10,7 +10,7 @@ #import "modules/std.sx"; #import "modules/std/mem.sx"; -main :: () -> s32 { +main :: () -> i32 { gpa := GPA.init(); tracker := TrackingAllocator.init(xx gpa); // value, stack-local diff --git a/examples/0810-memory-slice-ptr.sx b/examples/0810-memory-slice-ptr.sx index 85be704..b0ad523 100644 --- a/examples/0810-memory-slice-ptr.sx +++ b/examples/0810-memory-slice-ptr.sx @@ -11,7 +11,7 @@ main :: () { // ======================================================== print("=== 17. Slice Ptr ===\n"); { - sarr : [5]s32 = .[10, 20, 30, 40, 50]; + sarr : [5]i32 = .[10, 20, 30, 40, 50]; ssl := sarr[1..4]; sp := ssl.ptr; print("sl-ptr[0]: {}\n", sp[0]); diff --git a/examples/0811-modules-same-name-error-set-ambiguous.sx b/examples/0811-modules-same-name-error-set-ambiguous.sx index 5a5ad32..2e27cfd 100644 --- a/examples/0811-modules-same-name-error-set-ambiguous.sx +++ b/examples/0811-modules-same-name-error-set-ambiguous.sx @@ -23,7 +23,7 @@ #import "0811-modules-same-name-error-set-ambiguous/a.sx"; #import "0811-modules-same-name-error-set-ambiguous/b.sx"; -describe :: ($T: Type) -> s32 { +describe :: ($T: Type) -> i32 { r := if T == { case IoErr: 1; else: 0; @@ -35,10 +35,10 @@ fail_io :: () -> !IoErr { raise error.Disk; } -main :: () -> s32 { +main :: () -> i32 { sz := size_of(IoErr); e : IoErr = error.Disk; t : Type = IoErr; - k := describe(s64); + k := describe(i64); 0 } diff --git a/examples/0812-modules-same-name-error-set-own-wins.sx b/examples/0812-modules-same-name-error-set-own-wins.sx index 65bb834..31fb72f 100644 --- a/examples/0812-modules-same-name-error-set-own-wins.sx +++ b/examples/0812-modules-same-name-error-set-own-wins.sx @@ -20,7 +20,7 @@ IoErr :: error { Disk } -main :: () -> s32 { +main :: () -> i32 { e : IoErr = error.Disk; d := dep_err(); print("own={} dep={}\n", e, d); diff --git a/examples/0813-modules-same-name-error-set-lambda-own-wins.sx b/examples/0813-modules-same-name-error-set-lambda-own-wins.sx index 4b7e177..0977ab8 100644 --- a/examples/0813-modules-same-name-error-set-lambda-own-wins.sx +++ b/examples/0813-modules-same-name-error-set-lambda-own-wins.sx @@ -19,7 +19,7 @@ IoErr :: error { Disk } -main :: () -> s32 { +main :: () -> i32 { fail_own := closure(() -> !IoErr { raise error.Disk; }); fail_own() catch (e) { if e == error.Disk { print("own=Disk\n"); } diff --git a/examples/0814-modules-same-name-error-set-lambda-ambiguous.sx b/examples/0814-modules-same-name-error-set-lambda-ambiguous.sx index a9157d7..cf6aff1 100644 --- a/examples/0814-modules-same-name-error-set-lambda-ambiguous.sx +++ b/examples/0814-modules-same-name-error-set-lambda-ambiguous.sx @@ -21,7 +21,7 @@ #import "0814-modules-same-name-error-set-lambda-ambiguous/a.sx"; #import "0814-modules-same-name-error-set-lambda-ambiguous/b.sx"; -main :: () -> s32 { +main :: () -> i32 { fail_io := closure(() -> !IoErr { return; }); return 0; } diff --git a/examples/0815-route-all-new-surfaces-ambiguous.sx b/examples/0815-route-all-new-surfaces-ambiguous.sx index 078e69b..98e5f82 100644 --- a/examples/0815-route-all-new-surfaces-ambiguous.sx +++ b/examples/0815-route-all-new-surfaces-ambiguous.sx @@ -10,7 +10,7 @@ // - wrapper-alias element `BoxPtr :: *Box` (engine wrapper aliasing) // - union body-builder child `WrapU :: union { b: Box }` (C1, registerUnionDecl) // - enum body-builder child `WrapE :: enum { V: Box }` (C1, registerEnumDecl) -// - tuple-literal element `size_of((Box, s32))` (O1/K5) +// - tuple-literal element `size_of((Box, i32))` (O1/K5) // - inline-anonymous body child `x : union { b: Box }` (inline-anon engine arm) // // Fail-before (pre-E6b-R): each of these resolved `Box` through the stateless @@ -24,12 +24,12 @@ BoxPtr :: *Box; -WrapU :: union { b: Box; n: s32; } +WrapU :: union { b: Box; n: i32; } WrapE :: enum { V: Box; } -main :: () -> s32 { - sz := size_of((Box, s32)); - x : union { b: Box; n: s32 } = ---; +main :: () -> i32 { + sz := size_of((Box, i32)); + x : union { b: Box; n: i32 } = ---; 0 } diff --git a/examples/0815-route-all-new-surfaces-ambiguous/a.sx b/examples/0815-route-all-new-surfaces-ambiguous/a.sx index 0942b88..5f6fe69 100644 --- a/examples/0815-route-all-new-surfaces-ambiguous/a.sx +++ b/examples/0815-route-all-new-surfaces-ambiguous/a.sx @@ -3,4 +3,4 @@ // name is genuinely ambiguous — at EVERY use surface, including the ones E6b-R // newly routed through the source-aware engine (wrapper aliases, tuple-literal // elements, enum/union body-builder child types, inline-anonymous types). -Box :: struct { x: s32; } +Box :: struct { x: i32; } diff --git a/examples/0815-route-all-new-surfaces-ambiguous/b.sx b/examples/0815-route-all-new-surfaces-ambiguous/b.sx index 2c8e08f..e721ab8 100644 --- a/examples/0815-route-all-new-surfaces-ambiguous/b.sx +++ b/examples/0815-route-all-new-surfaces-ambiguous/b.sx @@ -1,4 +1,4 @@ // The second flat-imported author of a same-name `Box` struct. A separate nominal // identity from a.sx's `Box`, so each bare reference is a real collision the // importing source cannot disambiguate. -Box :: struct { x: s32; } +Box :: struct { x: i32; } diff --git a/examples/0816-route-all-new-surfaces-own-wins.sx b/examples/0816-route-all-new-surfaces-own-wins.sx index 4d0bf7b..18e9c8e 100644 --- a/examples/0816-route-all-new-surfaces-own-wins.sx +++ b/examples/0816-route-all-new-surfaces-own-wins.sx @@ -17,11 +17,11 @@ #import "modules/std.sx"; #import "0816-route-all-new-surfaces-own-wins/dep.sx"; -Box :: struct { m: s32; } +Box :: struct { m: i32; } -WrapU :: union { b: Box; n: s32; } +WrapU :: union { b: Box; n: i32; } -main :: () -> s32 { +main :: () -> i32 { w : WrapU = ---; w.b.m = 5; print("own={} dep={}\n", w.b.m, dep_box()); diff --git a/examples/0816-route-all-new-surfaces-own-wins/dep.sx b/examples/0816-route-all-new-surfaces-own-wins/dep.sx index d8d3227..f132c66 100644 --- a/examples/0816-route-all-new-surfaces-own-wins/dep.sx +++ b/examples/0816-route-all-new-surfaces-own-wins/dep.sx @@ -2,9 +2,9 @@ // ALSO authors a `Box { m }` — its own author must win there (own-wins), while this // module's `Box` stays a DISTINCT nominal type used by `dep_box`. The field sets // are disjoint, so a cross-binding to the wrong `Box` is a hard compile error. -Box :: struct { a: s32; } +Box :: struct { a: i32; } -dep_box :: () -> s32 { +dep_box :: () -> i32 { b : Box = ---; b.a = 9; return b.a; diff --git a/examples/0817-modules-qualified-annotation-single-import-resolve.sx b/examples/0817-modules-qualified-annotation-single-import-resolve.sx index 9c328e6..5342151 100644 --- a/examples/0817-modules-qualified-annotation-single-import-resolve.sx +++ b/examples/0817-modules-qualified-annotation-single-import-resolve.sx @@ -12,7 +12,7 @@ #import "modules/std.sx"; a :: #import "0817-modules-qualified-annotation-single-import-resolve/dep.sx"; -main :: () -> s32 { +main :: () -> i32 { x : a.Box = ---; x.a = 4; print("x.a={}\n", x.a); diff --git a/examples/0817-modules-qualified-annotation-single-import-resolve/dep.sx b/examples/0817-modules-qualified-annotation-single-import-resolve/dep.sx index 796fe26..27b49df 100644 --- a/examples/0817-modules-qualified-annotation-single-import-resolve/dep.sx +++ b/examples/0817-modules-qualified-annotation-single-import-resolve/dep.sx @@ -1,3 +1,3 @@ // The namespace target module authors its OWN `Box { a }`. A qualified `a.Box` // type annotation in the importer must bind THIS type, not a stub named "a.Box". -Box :: struct { a: s32; } +Box :: struct { a: i32; } diff --git a/examples/0818-modules-qualified-annotation-own-wins.sx b/examples/0818-modules-qualified-annotation-own-wins.sx index fb9c332..37e4074 100644 --- a/examples/0818-modules-qualified-annotation-own-wins.sx +++ b/examples/0818-modules-qualified-annotation-own-wins.sx @@ -9,9 +9,9 @@ #import "modules/std.sx"; a :: #import "0818-modules-qualified-annotation-own-wins/dep.sx"; -Box :: struct { m: s32; } +Box :: struct { m: i32; } -main :: () -> s32 { +main :: () -> i32 { own : Box = ---; own.m = 5; q : a.Box = ---; diff --git a/examples/0818-modules-qualified-annotation-own-wins/dep.sx b/examples/0818-modules-qualified-annotation-own-wins/dep.sx index 15fb3a2..8a58345 100644 --- a/examples/0818-modules-qualified-annotation-own-wins/dep.sx +++ b/examples/0818-modules-qualified-annotation-own-wins/dep.sx @@ -1,3 +1,3 @@ // Namespace target authoring its OWN `Box { a }`. The importer (`main`) also // authors a same-name bare `Box { m }`; the qualified `a.Box` must bind THIS one. -Box :: struct { a: s32; } +Box :: struct { a: i32; } diff --git a/examples/0819-modules-qualified-annotation-error-set-own-wins.sx b/examples/0819-modules-qualified-annotation-error-set-own-wins.sx index a3e320a..27e3143 100644 --- a/examples/0819-modules-qualified-annotation-error-set-own-wins.sx +++ b/examples/0819-modules-qualified-annotation-error-set-own-wins.sx @@ -11,7 +11,7 @@ a :: #import "0819-modules-qualified-annotation-error-set-own-wins/dep.sx"; IoErr :: error { Disk } -main :: () -> s32 { +main :: () -> i32 { e : IoErr = error.Disk; q : a.IoErr = error.Net; print("own={} q={}\n", e, q); diff --git a/examples/0820-protocols-same-name-method-own-wins.sx b/examples/0820-protocols-same-name-method-own-wins.sx index 4d869e5..d2a8af2 100644 --- a/examples/0820-protocols-same-name-method-own-wins.sx +++ b/examples/0820-protocols-same-name-method-own-wins.sx @@ -12,13 +12,13 @@ #import "modules/std.sx"; #import "0820-protocols-same-name-method-own-wins/dep.sx"; -Box :: struct { m: s32; } +Box :: struct { m: i32; } Provider :: protocol { get :: () -> Box; } -Holder :: struct { val: s32 = 7; } +Holder :: struct { val: i32 = 7; } impl Provider for Holder { get :: (self: *Holder) -> Box { @@ -28,7 +28,7 @@ impl Provider for Holder { } } -main :: () -> s32 { +main :: () -> i32 { h : Holder = .{}; p : Provider = xx @h; b := p.get(); diff --git a/examples/0820-protocols-same-name-method-own-wins/dep.sx b/examples/0820-protocols-same-name-method-own-wins/dep.sx index 789dbfe..9998c84 100644 --- a/examples/0820-protocols-same-name-method-own-wins/dep.sx +++ b/examples/0820-protocols-same-name-method-own-wins/dep.sx @@ -1,9 +1,9 @@ // A flat-imported module authors its OWN `Box { a }`, a DISTINCT nominal from // main's same-name `Box { m }`. The protocol method-signature return must NOT bind // this one — the disjoint field sets make a wrong binding a hard compile error. -Box :: struct { a: s32; } +Box :: struct { a: i32; } -dep_box :: () -> s32 { +dep_box :: () -> i32 { b : Box = ---; b.a = 9; return b.a; diff --git a/examples/0821-protocols-same-name-method-ambiguous.sx b/examples/0821-protocols-same-name-method-ambiguous.sx index a336eb3..2b5b5a2 100644 --- a/examples/0821-protocols-same-name-method-ambiguous.sx +++ b/examples/0821-protocols-same-name-method-ambiguous.sx @@ -13,6 +13,6 @@ Provider :: protocol { get :: () -> Box; } -main :: () -> s32 { +main :: () -> i32 { 0 } diff --git a/examples/0821-protocols-same-name-method-ambiguous/a.sx b/examples/0821-protocols-same-name-method-ambiguous/a.sx index 1f94711..58219f5 100644 --- a/examples/0821-protocols-same-name-method-ambiguous/a.sx +++ b/examples/0821-protocols-same-name-method-ambiguous/a.sx @@ -1,3 +1,3 @@ // One of two flat-imported same-name `Box` authors — the bare `Box` in the // protocol return is a genuine collision the source cannot disambiguate. -Box :: struct { a: s32; } +Box :: struct { a: i32; } diff --git a/examples/0821-protocols-same-name-method-ambiguous/b.sx b/examples/0821-protocols-same-name-method-ambiguous/b.sx index 76d2e55..1e21ba2 100644 --- a/examples/0821-protocols-same-name-method-ambiguous/b.sx +++ b/examples/0821-protocols-same-name-method-ambiguous/b.sx @@ -1,3 +1,3 @@ // The second flat-imported same-name `Box` author. Two distinct flat authors and // no own author → the protocol return `Box` is ambiguous. -Box :: struct { b: s32; } +Box :: struct { b: i32; } diff --git a/examples/0822-route-all-own-wins-surfaces.sx b/examples/0822-route-all-own-wins-surfaces.sx index 136c8f2..9121e6f 100644 --- a/examples/0822-route-all-own-wins-surfaces.sx +++ b/examples/0822-route-all-own-wins-surfaces.sx @@ -4,18 +4,18 @@ // `.m` access (disjoint field sets → a wrong-author binding is a hard compile // error). Complements 0816 (which covered only the union body-builder child): // - pointer wrapper-alias element `BoxPtr :: *Box` -// - tuple element `(Box, s32)` +// - tuple element `(Box, i32)` // - enum body-builder child `WrapE :: enum { V: Box }` // - inline-anonymous union child `x : union { b: Box }` #import "modules/std.sx"; #import "0822-route-all-own-wins-surfaces/dep.sx"; -Box :: struct { m: s32; } +Box :: struct { m: i32; } BoxPtr :: *Box; WrapE :: enum { V: Box; } -main :: () -> s32 { +main :: () -> i32 { own : Box = ---; own.m = 10; @@ -23,7 +23,7 @@ main :: () -> s32 { bp : BoxPtr = @own; // tuple element own-wins - t : (Box, s32) = ---; + t : (Box, i32) = ---; t.0.m = 12; // enum body-builder child own-wins (payload must be main's `Box`) @@ -31,7 +31,7 @@ main :: () -> s32 { ev := we.V.m; // inline-anonymous union child own-wins - x : union { b: Box; n: s32 } = ---; + x : union { b: Box; n: i32 } = ---; x.b.m = 13; print("bp={} t={} ev={} x={} dep={}\n", bp.m, t.0.m, ev, x.b.m, dep_box()); diff --git a/examples/0822-route-all-own-wins-surfaces/dep.sx b/examples/0822-route-all-own-wins-surfaces/dep.sx index 9c72d84..11d0347 100644 --- a/examples/0822-route-all-own-wins-surfaces/dep.sx +++ b/examples/0822-route-all-own-wins-surfaces/dep.sx @@ -1,9 +1,9 @@ // A flat-imported module authoring its OWN `Box { a }`, a DISTINCT nominal from // main's `Box { m }`. The four route-all surfaces in `main` must each bind main's // own `Box`; the disjoint field sets make a wrong binding a hard compile error. -Box :: struct { a: s32; } +Box :: struct { a: i32; } -dep_box :: () -> s32 { +dep_box :: () -> i32 { b : Box = ---; b.a = 99; return b.a; diff --git a/examples/0823-route-all-own-wins-subform-wrappers.sx b/examples/0823-route-all-own-wins-subform-wrappers.sx index e96b992..c80649b 100644 --- a/examples/0823-route-all-own-wins-subform-wrappers.sx +++ b/examples/0823-route-all-own-wins-subform-wrappers.sx @@ -9,9 +9,9 @@ #import "modules/std.sx"; #import "0823-route-all-own-wins-subform-wrappers/dep.sx"; -Box :: struct { m: s32; } +Box :: struct { m: i32; } -main :: () -> s32 { +main :: () -> i32 { seed : Box = ---; seed.m = 1; diff --git a/examples/0823-route-all-own-wins-subform-wrappers/dep.sx b/examples/0823-route-all-own-wins-subform-wrappers/dep.sx index aa16e78..e380154 100644 --- a/examples/0823-route-all-own-wins-subform-wrappers/dep.sx +++ b/examples/0823-route-all-own-wins-subform-wrappers/dep.sx @@ -1,9 +1,9 @@ // A flat-imported module authoring its OWN `Box { a }`, a DISTINCT nominal from // main's `Box { m }`. The `?Box` / `[N]Box` / `[]Box` element wrappers in `main` // must each bind main's own `Box`; disjoint field sets make a wrong binding fail. -Box :: struct { a: s32; } +Box :: struct { a: i32; } -dep_box :: () -> s32 { +dep_box :: () -> i32 { b : Box = ---; b.a = 99; return b.a; diff --git a/examples/0824-protocols-same-name-method-wrapped-own-wins.sx b/examples/0824-protocols-same-name-method-wrapped-own-wins.sx index 8fca1c5..a93390d 100644 --- a/examples/0824-protocols-same-name-method-wrapped-own-wins.sx +++ b/examples/0824-protocols-same-name-method-wrapped-own-wins.sx @@ -16,7 +16,7 @@ #import "modules/std.sx"; #import "0824-protocols-same-name-method-wrapped-own-wins/dep.sx"; -Box :: struct { m: s32; } +Box :: struct { m: i32; } Holder :: struct { b: Box = ---; } Provider :: protocol { @@ -26,12 +26,12 @@ Provider :: protocol { gett :: () -> (Box, Box); geta :: () -> [2]Box; // routing-only wrapped/compound PARAMS - sump :: (p: *Box) -> s32; - sumo :: (o: ?Box) -> s32; - sums :: (s: []Box) -> s32; - suma :: (a: [2]Box) -> s32; - sumt :: (t: (Box, Box)) -> s32; - sumn :: (n: *?[]Box) -> s32; + sump :: (p: *Box) -> i32; + sumo :: (o: ?Box) -> i32; + sums :: (s: []Box) -> i32; + suma :: (a: [2]Box) -> i32; + sumt :: (t: (Box, Box)) -> i32; + sumn :: (n: *?[]Box) -> i32; } impl Provider for Holder { @@ -39,15 +39,15 @@ impl Provider for Holder { geto :: (self: *Holder) -> ?Box { self.b } gett :: (self: *Holder) -> (Box, Box) { (self.b, self.b) } geta :: (self: *Holder) -> [2]Box { r : [2]Box = ---; r[0] = self.b; r[1] = self.b; r } - sump :: (self: *Holder, p: *Box) -> s32 { p.m } - sumo :: (self: *Holder, o: ?Box) -> s32 { o!.m } - sums :: (self: *Holder, s: []Box) -> s32 { s[0].m } - suma :: (self: *Holder, a: [2]Box) -> s32 { a[0].m } - sumt :: (self: *Holder, t: (Box, Box)) -> s32 { t.0.m } - sumn :: (self: *Holder, n: *?[]Box) -> s32 { if n == null { 0 } else { 6 } } + sump :: (self: *Holder, p: *Box) -> i32 { p.m } + sumo :: (self: *Holder, o: ?Box) -> i32 { o!.m } + sums :: (self: *Holder, s: []Box) -> i32 { s[0].m } + suma :: (self: *Holder, a: [2]Box) -> i32 { a[0].m } + sumt :: (self: *Holder, t: (Box, Box)) -> i32 { t.0.m } + sumn :: (self: *Holder, n: *?[]Box) -> i32 { if n == null { 0 } else { 6 } } } -main :: () -> s32 { +main :: () -> i32 { h : Holder = ---; h.b.m = 7; p : Provider = xx @h; diff --git a/examples/0824-protocols-same-name-method-wrapped-own-wins/dep.sx b/examples/0824-protocols-same-name-method-wrapped-own-wins/dep.sx index 37fb81d..9ebda0a 100644 --- a/examples/0824-protocols-same-name-method-wrapped-own-wins/dep.sx +++ b/examples/0824-protocols-same-name-method-wrapped-own-wins/dep.sx @@ -2,9 +2,9 @@ // main's same-name `Box { m }`. The protocol method signatures below name `Box` // under every wrapper/compound form; a wrong (last-wins) author binds this `Box`, // whose disjoint field set makes a `.m` access a hard compile error. -Box :: struct { a: s32; } +Box :: struct { a: i32; } -dep_box :: () -> s32 { +dep_box :: () -> i32 { b : Box = ---; b.a = 9; return b.a; diff --git a/examples/0825-protocols-same-name-method-wrapped-ambiguous.sx b/examples/0825-protocols-same-name-method-wrapped-ambiguous.sx index b8ded8a..f35ab3e 100644 --- a/examples/0825-protocols-same-name-method-wrapped-ambiguous.sx +++ b/examples/0825-protocols-same-name-method-wrapped-ambiguous.sx @@ -18,6 +18,6 @@ Provider :: protocol { getp :: () -> *Box; } -main :: () -> s32 { +main :: () -> i32 { 0 } diff --git a/examples/0825-protocols-same-name-method-wrapped-ambiguous/a.sx b/examples/0825-protocols-same-name-method-wrapped-ambiguous/a.sx index 14907d2..9eb16f5 100644 --- a/examples/0825-protocols-same-name-method-wrapped-ambiguous/a.sx +++ b/examples/0825-protocols-same-name-method-wrapped-ambiguous/a.sx @@ -1,8 +1,8 @@ // One of two flat-imported `Box` authors. With no own author in main, the // protocol method-signature `() -> *Box` is a genuine collision. -Box :: struct { a: s32; } +Box :: struct { a: i32; } -a_box :: () -> s32 { +a_box :: () -> i32 { b : Box = ---; b.a = 1; return b.a; diff --git a/examples/0825-protocols-same-name-method-wrapped-ambiguous/b.sx b/examples/0825-protocols-same-name-method-wrapped-ambiguous/b.sx index 839c4ab..c7ae2f0 100644 --- a/examples/0825-protocols-same-name-method-wrapped-ambiguous/b.sx +++ b/examples/0825-protocols-same-name-method-wrapped-ambiguous/b.sx @@ -1,7 +1,7 @@ // The second flat-imported `Box` author — a DISTINCT nominal from a.sx's `Box`. -Box :: struct { b: s32; } +Box :: struct { b: i32; } -b_box :: () -> s32 { +b_box :: () -> i32 { x : Box = ---; x.b = 2; return x.b; diff --git a/examples/0826-protocols-param-impl-source-wrapped-own-wins.sx b/examples/0826-protocols-param-impl-source-wrapped-own-wins.sx index 7708623..bed9076 100644 --- a/examples/0826-protocols-param-impl-source-wrapped-own-wins.sx +++ b/examples/0826-protocols-param-impl-source-wrapped-own-wins.sx @@ -14,8 +14,8 @@ #import "modules/std.sx"; #import "0826-protocols-param-impl-source-wrapped-own-wins/dep.sx"; -Box :: struct { m: s32; } -Marker :: struct { v: s32; } +Box :: struct { m: i32; } +Marker :: struct { v: i32; } impl Into(Marker) for *Box { convert :: (self: *Box) -> Marker { @@ -23,7 +23,7 @@ impl Into(Marker) for *Box { } } -main :: () -> s32 { +main :: () -> i32 { b : Box = ---; b.m = 7; mk : Marker = xx @b; diff --git a/examples/0826-protocols-param-impl-source-wrapped-own-wins/dep.sx b/examples/0826-protocols-param-impl-source-wrapped-own-wins/dep.sx index 596bb0a..3ff842c 100644 --- a/examples/0826-protocols-param-impl-source-wrapped-own-wins/dep.sx +++ b/examples/0826-protocols-param-impl-source-wrapped-own-wins/dep.sx @@ -2,9 +2,9 @@ // main's same-name `Box { m }`. The param-impl SOURCE `*Box` must register against // main's `Box`, and the `xx` lookup at the use site must mangle to the SAME author, // so the conversion is found and `self.m` resolves. -Box :: struct { a: s32; } +Box :: struct { a: i32; } -dep_box :: () -> s32 { +dep_box :: () -> i32 { b : Box = ---; b.a = 9; return b.a; diff --git a/examples/0827-protocols-param-impl-source-wrapped-ambiguous.sx b/examples/0827-protocols-param-impl-source-wrapped-ambiguous.sx index 9816273..e5eb8c1 100644 --- a/examples/0827-protocols-param-impl-source-wrapped-ambiguous.sx +++ b/examples/0827-protocols-param-impl-source-wrapped-ambiguous.sx @@ -14,7 +14,7 @@ #import "0827-protocols-param-impl-source-wrapped-ambiguous/a.sx"; #import "0827-protocols-param-impl-source-wrapped-ambiguous/b.sx"; -Marker :: struct { v: s32; } +Marker :: struct { v: i32; } impl Into(Marker) for *Box { convert :: (self: *Box) -> Marker { @@ -22,6 +22,6 @@ impl Into(Marker) for *Box { } } -main :: () -> s32 { +main :: () -> i32 { 0 } diff --git a/examples/0827-protocols-param-impl-source-wrapped-ambiguous/a.sx b/examples/0827-protocols-param-impl-source-wrapped-ambiguous/a.sx index 7bf44bc..1683507 100644 --- a/examples/0827-protocols-param-impl-source-wrapped-ambiguous/a.sx +++ b/examples/0827-protocols-param-impl-source-wrapped-ambiguous/a.sx @@ -1,8 +1,8 @@ // One of two flat-imported `Box` authors; with no own author the param-impl // SOURCE `*Box` is a genuine collision. -Box :: struct { a: s32; } +Box :: struct { a: i32; } -a_box :: () -> s32 { +a_box :: () -> i32 { b : Box = ---; b.a = 1; return b.a; diff --git a/examples/0827-protocols-param-impl-source-wrapped-ambiguous/b.sx b/examples/0827-protocols-param-impl-source-wrapped-ambiguous/b.sx index 839c4ab..c7ae2f0 100644 --- a/examples/0827-protocols-param-impl-source-wrapped-ambiguous/b.sx +++ b/examples/0827-protocols-param-impl-source-wrapped-ambiguous/b.sx @@ -1,7 +1,7 @@ // The second flat-imported `Box` author — a DISTINCT nominal from a.sx's `Box`. -Box :: struct { b: s32; } +Box :: struct { b: i32; } -b_box :: () -> s32 { +b_box :: () -> i32 { x : Box = ---; x.b = 2; return x.b; diff --git a/examples/0828-protocols-param-impl-arg-wrapped-own-wins.sx b/examples/0828-protocols-param-impl-arg-wrapped-own-wins.sx index e3c064d..2bb9d08 100644 --- a/examples/0828-protocols-param-impl-arg-wrapped-own-wins.sx +++ b/examples/0828-protocols-param-impl-arg-wrapped-own-wins.sx @@ -11,20 +11,20 @@ #import "modules/std.sx"; #import "0828-protocols-param-impl-arg-wrapped-own-wins/dep.sx"; -Box :: struct { m: s32; } -Holder :: struct { n: s32; } +Box :: struct { m: i32; } +Holder :: struct { n: i32; } Tagged :: protocol(T: Type) { - tag :: () -> s32; + tag :: () -> i32; } impl Tagged(*Box) for Holder { - tag :: (self: *Holder) -> s32 { + tag :: (self: *Holder) -> i32 { self.n } } -main :: () -> s32 { +main :: () -> i32 { h : Holder = .{ n = 7 }; print("tag={} dep={}\n", h.tag(), dep_box()); 0 diff --git a/examples/0828-protocols-param-impl-arg-wrapped-own-wins/dep.sx b/examples/0828-protocols-param-impl-arg-wrapped-own-wins/dep.sx index bcdc78a..5f8d87a 100644 --- a/examples/0828-protocols-param-impl-arg-wrapped-own-wins/dep.sx +++ b/examples/0828-protocols-param-impl-arg-wrapped-own-wins/dep.sx @@ -2,9 +2,9 @@ // main's same-name `Box { m }`. The parameterised-impl protocol type-ARG `*Box` // registers SOURCE-AWARE against main's `Box` (own-wins), never the global // last-wins author. -Box :: struct { a: s32; } +Box :: struct { a: i32; } -dep_box :: () -> s32 { +dep_box :: () -> i32 { b : Box = ---; b.a = 9; return b.a; diff --git a/examples/0829-packs-param-impl-mixed-pack-source-ambiguous.sx b/examples/0829-packs-param-impl-mixed-pack-source-ambiguous.sx index 03743e1..0bfd090 100644 --- a/examples/0829-packs-param-impl-mixed-pack-source-ambiguous.sx +++ b/examples/0829-packs-param-impl-mixed-pack-source-ambiguous.sx @@ -19,7 +19,7 @@ #import "0829-packs-param-impl-mixed-pack-source-ambiguous/a.sx"; #import "0829-packs-param-impl-mixed-pack-source-ambiguous/b.sx"; -Block :: struct { tag: s32; } +Block :: struct { tag: i32; } Sink :: protocol(T: Type) { convert :: () -> T; @@ -31,6 +31,6 @@ impl Sink(Block) for Closure(*Box, ..$args) -> $R { } } -main :: () -> s32 { +main :: () -> i32 { 0 } diff --git a/examples/0829-packs-param-impl-mixed-pack-source-ambiguous/a.sx b/examples/0829-packs-param-impl-mixed-pack-source-ambiguous/a.sx index aac5930..cebcd62 100644 --- a/examples/0829-packs-param-impl-mixed-pack-source-ambiguous/a.sx +++ b/examples/0829-packs-param-impl-mixed-pack-source-ambiguous/a.sx @@ -1,8 +1,8 @@ // One of two flat-imported `Box` authors; with no own author the FIXED PREFIX // `*Box` of the pack-closure source is a genuine collision. -Box :: struct { a: s32; } +Box :: struct { a: i32; } -a_box :: () -> s32 { +a_box :: () -> i32 { b : Box = ---; b.a = 1; return b.a; diff --git a/examples/0829-packs-param-impl-mixed-pack-source-ambiguous/b.sx b/examples/0829-packs-param-impl-mixed-pack-source-ambiguous/b.sx index 839c4ab..c7ae2f0 100644 --- a/examples/0829-packs-param-impl-mixed-pack-source-ambiguous/b.sx +++ b/examples/0829-packs-param-impl-mixed-pack-source-ambiguous/b.sx @@ -1,7 +1,7 @@ // The second flat-imported `Box` author — a DISTINCT nominal from a.sx's `Box`. -Box :: struct { b: s32; } +Box :: struct { b: i32; } -b_box :: () -> s32 { +b_box :: () -> i32 { x : Box = ---; x.b = 2; return x.b; diff --git a/examples/0830-modules-flat-ns-same-name-forward-alias.sx b/examples/0830-modules-flat-ns-same-name-forward-alias.sx index fa794c3..847f68a 100644 --- a/examples/0830-modules-flat-ns-same-name-forward-alias.sx +++ b/examples/0830-modules-flat-ns-same-name-forward-alias.sx @@ -9,7 +9,7 @@ ns :: #import "0830-modules-flat-ns-same-name-forward-alias/ns.sx"; A :: B; B :: u64; -main :: () -> s32 { +main :: () -> i32 { x : A = 300; std.print("{}\n", x); 0 diff --git a/examples/0831-modules-namespace-alias-carry.sx b/examples/0831-modules-namespace-alias-carry.sx index 081db60..7632a61 100644 --- a/examples/0831-modules-namespace-alias-carry.sx +++ b/examples/0831-modules-namespace-alias-carry.sx @@ -15,6 +15,6 @@ main :: () { print("{} ", x.v); print("{} ", r.LIMIT); // module const print("{} ", r.Color.green); // enum variant - b := r.Box(s64).{ item = 3 }; // generic struct + b := r.Box(i64).{ item = 3 }; // generic struct print("{}\n", b.item); } diff --git a/examples/0831-modules-namespace-alias-carry/rich.sx b/examples/0831-modules-namespace-alias-carry/rich.sx index c40c028..8b03491 100644 --- a/examples/0831-modules-namespace-alias-carry/rich.sx +++ b/examples/0831-modules-namespace-alias-carry/rich.sx @@ -1,9 +1,9 @@ Thing :: struct { - v: s64; + v: i64; init :: () -> Thing { Thing.{ v = 5 } } - get :: (self: *Thing) -> s64 { self.v } + get :: (self: *Thing) -> i64 { self.v } } Color :: enum { red; green; } -LIMIT :s64: 99; +LIMIT :i64: 99; Box :: struct ($T: Type) { item: T; } -helper :: () -> s64 { 7 } +helper :: () -> i64 { 7 } diff --git a/examples/0832-modules-namespace-alias-two-hop-not-visible/target.sx b/examples/0832-modules-namespace-alias-two-hop-not-visible/target.sx index 72b7c09..7fc77df 100644 --- a/examples/0832-modules-namespace-alias-two-hop-not-visible/target.sx +++ b/examples/0832-modules-namespace-alias-two-hop-not-visible/target.sx @@ -1 +1 @@ -helper :: () -> s64 { 7 } +helper :: () -> i64 { 7 } diff --git a/examples/0833-modules-namespace-alias-carried-collision-ambiguous/a.sx b/examples/0833-modules-namespace-alias-carried-collision-ambiguous/a.sx index 681ff06..01db73c 100644 --- a/examples/0833-modules-namespace-alias-carried-collision-ambiguous/a.sx +++ b/examples/0833-modules-namespace-alias-carried-collision-ambiguous/a.sx @@ -1,2 +1,2 @@ t :: #import "x.sx"; -use_a :: () -> s64 { t.fx() } +use_a :: () -> i64 { t.fx() } diff --git a/examples/0833-modules-namespace-alias-carried-collision-ambiguous/b.sx b/examples/0833-modules-namespace-alias-carried-collision-ambiguous/b.sx index 280d1c7..939f6d8 100644 --- a/examples/0833-modules-namespace-alias-carried-collision-ambiguous/b.sx +++ b/examples/0833-modules-namespace-alias-carried-collision-ambiguous/b.sx @@ -1,2 +1,2 @@ t :: #import "y.sx"; -use_b :: () -> s64 { t.fy() } +use_b :: () -> i64 { t.fy() } diff --git a/examples/0833-modules-namespace-alias-carried-collision-ambiguous/x.sx b/examples/0833-modules-namespace-alias-carried-collision-ambiguous/x.sx index f1ddd1c..c601e28 100644 --- a/examples/0833-modules-namespace-alias-carried-collision-ambiguous/x.sx +++ b/examples/0833-modules-namespace-alias-carried-collision-ambiguous/x.sx @@ -1 +1 @@ -fx :: () -> s64 { 1 } +fx :: () -> i64 { 1 } diff --git a/examples/0833-modules-namespace-alias-carried-collision-ambiguous/y.sx b/examples/0833-modules-namespace-alias-carried-collision-ambiguous/y.sx index 87b0ad6..bccb4e1 100644 --- a/examples/0833-modules-namespace-alias-carried-collision-ambiguous/y.sx +++ b/examples/0833-modules-namespace-alias-carried-collision-ambiguous/y.sx @@ -1 +1 @@ -fy :: () -> s64 { 2 } +fy :: () -> i64 { 2 } diff --git a/examples/0834-modules-namespace-alias-own-target-pin/a.sx b/examples/0834-modules-namespace-alias-own-target-pin/a.sx index c212115..6c593c0 100644 --- a/examples/0834-modules-namespace-alias-own-target-pin/a.sx +++ b/examples/0834-modules-namespace-alias-own-target-pin/a.sx @@ -1,2 +1,2 @@ t :: #import "x.sx"; -use_a :: () -> s64 { t.f() } +use_a :: () -> i64 { t.f() } diff --git a/examples/0834-modules-namespace-alias-own-target-pin/b.sx b/examples/0834-modules-namespace-alias-own-target-pin/b.sx index a325fea..345999f 100644 --- a/examples/0834-modules-namespace-alias-own-target-pin/b.sx +++ b/examples/0834-modules-namespace-alias-own-target-pin/b.sx @@ -1,2 +1,2 @@ t :: #import "y.sx"; -use_b :: () -> s64 { t.f() } +use_b :: () -> i64 { t.f() } diff --git a/examples/0834-modules-namespace-alias-own-target-pin/x.sx b/examples/0834-modules-namespace-alias-own-target-pin/x.sx index bfe907b..91e4def 100644 --- a/examples/0834-modules-namespace-alias-own-target-pin/x.sx +++ b/examples/0834-modules-namespace-alias-own-target-pin/x.sx @@ -1 +1 @@ -f :: () -> s64 { 1 } +f :: () -> i64 { 1 } diff --git a/examples/0834-modules-namespace-alias-own-target-pin/y.sx b/examples/0834-modules-namespace-alias-own-target-pin/y.sx index 218aa36..03423df 100644 --- a/examples/0834-modules-namespace-alias-own-target-pin/y.sx +++ b/examples/0834-modules-namespace-alias-own-target-pin/y.sx @@ -1 +1 @@ -f :: () -> s64 { 2 } +f :: () -> i64 { 2 } diff --git a/examples/0835-modules-same-name-global-vs-const-own.sx b/examples/0835-modules-same-name-global-vs-const-own.sx index f27ab93..187631c 100644 --- a/examples/0835-modules-same-name-global-vs-const-own.sx +++ b/examples/0835-modules-same-name-global-vs-const-own.sx @@ -1,5 +1,5 @@ // A module's own scalar const `K` and another module's same-named ARRAY -// GLOBAL (`K : [4]s64 = .[...]`) coexist: each module's bare `K` binds its +// GLOBAL (`K : [4]i64 = .[...]`) coexist: each module's bare `K` binds its // OWN author. The global registry is last-wins across modules, so without // source-aware selection a.sx's `K` read the array global's address. // diff --git a/examples/0835-modules-same-name-global-vs-const-own/a.sx b/examples/0835-modules-same-name-global-vs-const-own/a.sx index 8dba014..b6f0652 100644 --- a/examples/0835-modules-same-name-global-vs-const-own/a.sx +++ b/examples/0835-modules-same-name-global-vs-const-own/a.sx @@ -1,2 +1,2 @@ K :: 1; -a_k :: () -> s64 { K } +a_k :: () -> i64 { K } diff --git a/examples/0835-modules-same-name-global-vs-const-own/h.sx b/examples/0835-modules-same-name-global-vs-const-own/h.sx index 17525a4..f75662d 100644 --- a/examples/0835-modules-same-name-global-vs-const-own/h.sx +++ b/examples/0835-modules-same-name-global-vs-const-own/h.sx @@ -1,2 +1,2 @@ -K : [4]s64 = .[11, 22, 33, 44]; -use_k :: () -> s64 { K[2] } +K : [4]i64 = .[11, 22, 33, 44]; +use_k :: () -> i64 { K[2] } diff --git a/examples/0836-modules-own-const-vs-ns-array-global.sx b/examples/0836-modules-own-const-vs-ns-array-global.sx index 6a852b6..af3a1bc 100644 --- a/examples/0836-modules-own-const-vs-ns-array-global.sx +++ b/examples/0836-modules-own-const-vs-ns-array-global.sx @@ -1,4 +1,4 @@ -// The MAIN file's own typed scalar const `K : s64 : 4` vs a namespaced +// The MAIN file's own typed scalar const `K : i64 : 4` vs a namespaced // module's same-named array global: the main file's bare `K` is its own // scalar — type inference must not borrow the array global's type either // (the print pack used to format the whole 4-element array). @@ -8,7 +8,7 @@ #import "modules/std.sx"; h :: #import "0836-modules-own-const-vs-ns-array-global/h.sx"; -K : s64 : 4; +K : i64 : 4; main :: () { print("K={} use_k={}\n", K, h.use_k()); diff --git a/examples/0836-modules-own-const-vs-ns-array-global/h.sx b/examples/0836-modules-own-const-vs-ns-array-global/h.sx index 17525a4..f75662d 100644 --- a/examples/0836-modules-own-const-vs-ns-array-global/h.sx +++ b/examples/0836-modules-own-const-vs-ns-array-global/h.sx @@ -1,2 +1,2 @@ -K : [4]s64 = .[11, 22, 33, 44]; -use_k :: () -> s64 { K[2] } +K : [4]i64 = .[11, 22, 33, 44]; +use_k :: () -> i64 { K[2] } diff --git a/examples/0837-modules-array-const-no-cross-borrow.sx b/examples/0837-modules-array-const-no-cross-borrow.sx index 2c033c6..92046cf 100644 --- a/examples/0837-modules-array-const-no-cross-borrow.sx +++ b/examples/0837-modules-array-const-no-cross-borrow.sx @@ -1,6 +1,6 @@ // An ARRAY-typed `::` const is an immutable global owned by its module. -// Cross-module: the main file's scalar `K : s64 : 4` and h.sx's array -// `K : [4]s64 : .[...]` coexist — each module's bare `K` binds its OWN +// Cross-module: the main file's scalar `K : i64 : 4` and h.sx's array +// `K : [4]i64 : .[...]` coexist — each module's bare `K` binds its OWN // author (h's use_k reads ITS array, main's K stays the scalar 4). // // Regression (issue 0115): h.sx's read used to borrow main's scalar K @@ -10,7 +10,7 @@ #import "modules/std.sx"; h :: #import "0837-modules-array-const-no-cross-borrow/h.sx"; -K : s64 : 4; +K : i64 : 4; main :: () { print("{} {}\n", K, h.use_k()); diff --git a/examples/0837-modules-array-const-no-cross-borrow/h.sx b/examples/0837-modules-array-const-no-cross-borrow/h.sx index f3dfc32..88089d6 100644 --- a/examples/0837-modules-array-const-no-cross-borrow/h.sx +++ b/examples/0837-modules-array-const-no-cross-borrow/h.sx @@ -1,2 +1,2 @@ -K : [4]s64 : .[11, 22, 33, 44]; -use_k :: () -> s64 { K[2] } +K : [4]i64 : .[11, 22, 33, 44]; +use_k :: () -> i64 { K[2] } diff --git a/examples/0838-memory-helpers.sx b/examples/0838-memory-helpers.sx index d5ef697..afc77a3 100644 --- a/examples/0838-memory-helpers.sx +++ b/examples/0838-memory-helpers.sx @@ -10,7 +10,7 @@ #import "modules/std.sx"; #import "modules/std/mem.sx"; -Session :: struct { id: s64; score: s64; } +Session :: struct { id: i64; score: i64; } main :: () { gpa := GPA.init(); @@ -36,7 +36,7 @@ main :: () { context.allocator.destroy(q); // alloc / free — typed slice - xs := a |> alloc(s64, 4); + xs := a |> alloc(i64, 4); xs[0] = 10; xs[1] = 20; xs[2] = 30; xs[3] = 40; print("alloc: {} {} len={}\n", xs[0], xs[3], xs.len); @@ -57,10 +57,10 @@ main :: () { // mem_realloc — bytes level raw := a.alloc_bytes(8); - q : *s64 = xx raw; + q : *i64 = xx raw; q.* = 1234; raw2 := mem_realloc(a, raw, 8, 16, 8); - q2 : *s64 = xx raw2; + q2 : *i64 = xx raw2; print("realloc: {}\n", q2.*); a.dealloc_bytes(raw2); diff --git a/examples/0840-modules-imported-fn-param-type-source-pin/m.sx b/examples/0840-modules-imported-fn-param-type-source-pin/m.sx index dfd3a20..883ea24 100644 --- a/examples/0840-modules-imported-fn-param-type-source-pin/m.sx +++ b/examples/0840-modules-imported-fn-param-type-source-pin/m.sx @@ -1,10 +1,10 @@ #import "modules/std.sx"; Failure :: struct { - code: s64 = 0; + code: i64 = 0; message: string = ""; } -describe :: (f: Failure) -> s64 { +describe :: (f: Failure) -> i64 { return f.code; } diff --git a/examples/0900-optionals-optionals.sx b/examples/0900-optionals-optionals.sx index 5b08cb1..9ce5649 100644 --- a/examples/0900-optionals-optionals.sx +++ b/examples/0900-optionals-optionals.sx @@ -1,22 +1,22 @@ #import "modules/std.sx"; // --- Type declarations --- -OptNode :: struct { value: s32; next: ?s32; } -OptInner :: struct { val: s32; } +OptNode :: struct { value: i32; next: ?i32; } +OptInner :: struct { val: i32; } OptOuter :: struct { inner: ?OptInner; } // --- Comptime optionals --- -ct_sum :: () -> s32 { - x: ?s32 = 42; - y: ?s32 = null; +ct_sum :: () -> i32 { + x: ?i32 = 42; + y: ?i32 = null; return (x ?? 0) + (y ?? 99); } CT_RESULT :: #run ct_sum(); -main :: () -> s32 { +main :: () -> i32 { // Basic optional creation - x: ?s32 = 42; - y: ?s32 = null; + x: ?i32 = 42; + y: ?i32 = null; print("x = {}\n", x); print("y = {}\n", y); @@ -38,7 +38,7 @@ main :: () -> s32 { } // Pattern matching - check :: (v: ?s32) -> s32 { + check :: (v: ?i32) -> i32 { return if v == { case .some: (val) { val } case .none: { 0 } @@ -60,14 +60,14 @@ main :: () -> s32 { print("o2.inner?.val = {}\n", o2.inner?.val ?? 0); // Flow-sensitive narrowing - a: ?s32 = 10; - b: ?s32 = 20; + a: ?i32 = 10; + b: ?i32 = 20; if a != null { print("narrowed a: {}\n", a); } // Guard narrowing - guard :: (v: ?s32) -> s32 { + guard :: (v: ?i32) -> i32 { if v == null { return 0; } return v; } @@ -80,7 +80,7 @@ main :: () -> s32 { } // Compound guard - guard2 :: (a: ?s32, b: ?s32) -> s32 { + guard2 :: (a: ?i32, b: ?i32) -> i32 { if a == null or b == null { return 0; } return a + b; } diff --git a/examples/0904-optionals-any-to-string-optional.sx b/examples/0904-optionals-any-to-string-optional.sx index d534b18..b81a79b 100644 --- a/examples/0904-optionals-any-to-string-optional.sx +++ b/examples/0904-optionals-any-to-string-optional.sx @@ -17,7 +17,7 @@ #import "modules/std.sx"; S :: struct { - a: ?s64; + a: ?i64; b: ?string; c: ?bool; } diff --git a/examples/0905-optionals-unwrap-field-chain.sx b/examples/0905-optionals-unwrap-field-chain.sx index 44e93fd..d80cb06 100644 --- a/examples/0905-optionals-unwrap-field-chain.sx +++ b/examples/0905-optionals-unwrap-field-chain.sx @@ -9,23 +9,23 @@ #import "modules/std.sx"; -Inner :: struct { tag: string; k: s64; } +Inner :: struct { tag: string; k: i64; } S :: struct { id: string; - n: s64; + n: i64; inner: Inner; greet :: (self: *S) -> string { return self.id; } // pointer receiver - bump :: (self: S, extra: s64) -> s64 { return self.n + extra; } // value receiver + bump :: (self: S, extra: i64) -> i64 { return self.n + extra; } // value receiver } mk :: () -> ?S { return S.{ id = "hello", n = 42, inner = Inner.{ tag = "deep", k = 7 } }; } -arr :: () -> ?[3]s64 { - v : [3]s64 = .[10, 20, 30]; +arr :: () -> ?[3]i64 { + v : [3]i64 = .[10, 20, 30]; return v; } diff --git a/examples/1000-errors-sets.sx b/examples/1000-errors-sets.sx index 12ba87a..d6481aa 100644 --- a/examples/1000-errors-sets.sx +++ b/examples/1000-errors-sets.sx @@ -9,10 +9,10 @@ ParseErr :: error { BadDigit, Overflow, Empty } -main :: () -> s32 { +main :: () -> i32 { c : ParseErr = error.BadDigit; d : ParseErr = error.Overflow; - r : s32 = 0; + r : i32 = 0; if c == error.BadDigit { r = r + 1; } // true -> +1 if c == error.Overflow { r = r + 2; } // false if c == d { r = r + 4; } // false (BadDigit != Overflow) diff --git a/examples/1001-errors-set-typing.sx b/examples/1001-errors-set-typing.sx index 442ae23..e78a440 100644 --- a/examples/1001-errors-set-typing.sx +++ b/examples/1001-errors-set-typing.sx @@ -9,7 +9,7 @@ ParseErr :: error { BadDigit, Overflow } -main :: () -> s32 { +main :: () -> i32 { c : ParseErr = error.NotInSet; // error: NotInSet not in ParseErr if c == 42 { return 1; } // error: error-set value vs raw integer return 0; diff --git a/examples/1002-errors-raise.sx b/examples/1002-errors-raise.sx index 227c29d..79e6bbc 100644 --- a/examples/1002-errors-raise.sx +++ b/examples/1002-errors-raise.sx @@ -9,15 +9,15 @@ ParseErr :: error { BadDigit, Overflow, Empty } // Pure failable: raises on bad input, otherwise succeeds (error slot 0). -check :: (n: s32) -> !ParseErr { +check :: (n: i32) -> !ParseErr { if n < 0 { raise error.BadDigit; } return; // success — no error } -main :: () -> s32 { +main :: () -> i32 { good := check(7); // success path -> no error bad := check(-1); // raise path -> BadDigit - r : s32 = 0; + r : i32 = 0; if bad == error.BadDigit { r = r + 8; } // true -> +8 if good == error.BadDigit { r = r + 1; } // false (success = no error) if bad == error.Overflow { r = r + 2; } // false (raised BadDigit) diff --git a/examples/1003-errors-raise-rejections.sx b/examples/1003-errors-raise-rejections.sx index 8342f70..91d4c97 100644 --- a/examples/1003-errors-raise-rejections.sx +++ b/examples/1003-errors-raise-rejections.sx @@ -24,9 +24,9 @@ relay :: () -> !ParseErr { raise e; // error: OtherErr not subset of ParseErr } -main :: () -> s32 { +main :: () -> i32 { x := bad_tag(); // force bad_tag to lower y := relay(); // force relay to lower - raise error.BadDigit; // error: main (-> s32) is not failable + raise error.BadDigit; // error: main (-> i32) is not failable return 0; } diff --git a/examples/1004-errors-try.sx b/examples/1004-errors-try.sx index 02f9ec8..6989020 100644 --- a/examples/1004-errors-try.sx +++ b/examples/1004-errors-try.sx @@ -9,21 +9,21 @@ E :: error { Bad, Worse } -inner :: (n: s32) -> !E { +inner :: (n: i32) -> !E { if n < 0 { raise error.Bad; } return; // success — no error } // Propagates inner's error (standalone `try`, target = function return). -outer :: (n: s32) -> !E { +outer :: (n: i32) -> !E { try inner(n); return; } -main :: () -> s32 { +main :: () -> i32 { bad := outer(-1); // inner raises Bad -> outer propagates good := outer(7); // inner succeeds -> outer succeeds - r : s32 = 0; + r : i32 = 0; if bad == error.Bad { r = r + 5; } // true -> +5 if good == error.Bad { r = r + 1; } // false (success = no error) if bad == error.Worse { r = r + 2; } // false (propagated Bad) diff --git a/examples/1005-errors-try-rejections.sx b/examples/1005-errors-try-rejections.sx index 15615d8..68007e0 100644 --- a/examples/1005-errors-try-rejections.sx +++ b/examples/1005-errors-try-rejections.sx @@ -13,17 +13,17 @@ B :: error { Yb } ga :: () -> !A { return; } gb :: () -> !B { return; } -plain :: () -> s32 { return 0; } +plain :: () -> i32 { return 0; } // `try` in a non-failable function. -bad_ctx :: () -> s32 { +bad_ctx :: () -> i32 { try ga(); // error: `try` outside a failable function return 0; } // `try` on a non-failable operand. bad_operand :: () -> !A { - try plain(); // error: operand has type s32 (not failable) + try plain(); // error: operand has type i32 (not failable) return; } @@ -33,7 +33,7 @@ widen :: () -> !A { return; } -main :: () -> s32 { +main :: () -> i32 { a := bad_ctx(); // force bad_ctx to lower b := bad_operand(); // force bad_operand to lower c := widen(); // force widen to lower diff --git a/examples/1006-errors-inferred-error-sets.sx b/examples/1006-errors-inferred-error-sets.sx index 32487b6..1c898d3 100644 --- a/examples/1006-errors-inferred-error-sets.sx +++ b/examples/1006-errors-inferred-error-sets.sx @@ -11,28 +11,28 @@ A :: error { Foo, Bar } -leaf :: (n: s32) -> ! { +leaf :: (n: i32) -> ! { if n < 0 { raise error.Foo; } return; } // Inferred set converges to {Foo, Bar}: {Foo} absorbed from `try leaf` plus // the directly-raised Bar. -mid :: (n: s32) -> ! { +mid :: (n: i32) -> ! { try leaf(n); if n == 100 { raise error.Bar; } return; } // Named caller: mid's converged {Foo, Bar} is a subset of A -> widening OK. -run :: (n: s32) -> !A { +run :: (n: i32) -> !A { try mid(n); return; } -main :: () -> s32 { +main :: () -> i32 { e := run(-1); // leaf raises Foo -> propagates out - r : s32 = 0; + r : i32 = 0; if e == error.Foo { r = r + 7; } // true -> +7 if e == error.Bar { r = r + 1; } // false (Foo escaped, not Bar) print("inferred result: {}\n", r); // -> 7 diff --git a/examples/1007-errors-inferred-widening-reject.sx b/examples/1007-errors-inferred-widening-reject.sx index 8ab3f46..4298230 100644 --- a/examples/1007-errors-inferred-widening-reject.sx +++ b/examples/1007-errors-inferred-widening-reject.sx @@ -24,7 +24,7 @@ caller :: () -> !A { return; } -main :: () -> s32 { +main :: () -> i32 { e := caller(); return 0; } diff --git a/examples/1008-errors-match-diverging-arms.sx b/examples/1008-errors-match-diverging-arms.sx index 48e2c32..133e508 100644 --- a/examples/1008-errors-match-diverging-arms.sx +++ b/examples/1008-errors-match-diverging-arms.sx @@ -9,7 +9,7 @@ #import "modules/std.sx"; // All arms diverge — the match is `noreturn`, no merge phi. -classify :: (n: s32) -> s32 { +classify :: (n: i32) -> i32 { if n == { case 0: return 10; case 1: return 20; @@ -19,7 +19,7 @@ classify :: (n: s32) -> s32 { } // Mixed: value arms + a diverging arm. -pick :: (n: s32) -> s32 { +pick :: (n: i32) -> i32 { v := if n == { case 0: 1; case 1: return 100; // diverging arm — no fallback const after its `ret` @@ -28,8 +28,8 @@ pick :: (n: s32) -> s32 { return v + 5; } -main :: () -> s32 { - r : s32 = 0; +main :: () -> i32 { + r : i32 = 0; r = r + classify(0); // 10 r = r + classify(1); // 20 r = r + classify(7); // 90 diff --git a/examples/1009-errors-catch.sx b/examples/1009-errors-catch.sx index 5792877..7e863a1 100644 --- a/examples/1009-errors-catch.sx +++ b/examples/1009-errors-catch.sx @@ -12,14 +12,14 @@ E :: error { Bad, Empty } -must :: (n: s32) -> !E { +must :: (n: i32) -> !E { if n < 0 { raise error.Bad; } if n == 0 { raise error.Empty; } return; } // Diverging body — returns from `classify` on error. -classify :: (n: s32) -> s32 { +classify :: (n: i32) -> i32 { must(n) catch (e) { if e == error.Bad { return 1; } if e == error.Empty { return 2; } @@ -29,7 +29,7 @@ classify :: (n: s32) -> s32 { } // Match-body form — sugar for `catch (e) { if e == { case ... } }`. -mclassify :: (n: s32) -> s32 { +mclassify :: (n: i32) -> i32 { must(n) catch (e) == { case .Bad: return 11; case .Empty: return 22; @@ -40,7 +40,7 @@ mclassify :: (n: s32) -> s32 { // Selective handle + re-raise (failable enclosing fn; `raise e` is the // variable form). Swallows Bad → success; re-raises everything else. -handle_some :: (n: s32) -> !E { +handle_some :: (n: i32) -> !E { must(n) catch (e) { if e == error.Bad { return; } // swallow → success raise e; // re-raise the rest @@ -48,8 +48,8 @@ handle_some :: (n: s32) -> !E { return; } -main :: () -> s32 { - r : s32 = 0; +main :: () -> i32 { + r : i32 = 0; must(-1) catch (e) { if e == error.Bad { r = r + 1; } }; // Bad → +1 must(5) catch { r = r + 100; }; // success → body skipped r = r + classify(0); // Empty → 2 diff --git a/examples/1010-errors-catch-rejections.sx b/examples/1010-errors-catch-rejections.sx index 76de09b..b7faa95 100644 --- a/examples/1010-errors-catch-rejections.sx +++ b/examples/1010-errors-catch-rejections.sx @@ -5,9 +5,9 @@ #import "modules/std.sx"; -plain :: () -> s32 { return 0; } +plain :: () -> i32 { return 0; } -main :: () -> s32 { - plain() catch (e) { return 1; }; // error: operand has type s32 (not failable) +main :: () -> i32 { + plain() catch (e) { return 1; }; // error: operand has type i32 (not failable) return 0; } diff --git a/examples/1011-errors-value-failable.sx b/examples/1011-errors-value-failable.sx index 621f946..e24f8d5 100644 --- a/examples/1011-errors-value-failable.sx +++ b/examples/1011-errors-value-failable.sx @@ -10,14 +10,14 @@ E :: error { Bad, Empty } -parse :: (n: s32) -> (s32, !E) { +parse :: (n: i32) -> (i32, !E) { if n < 0 { raise error.Bad; } if n == 0 { raise error.Empty; } return n * 10; // success → {n*10, 0} } -main :: () -> s32 { - r : s32 = 0; +main :: () -> i32 { + r : i32 = 0; // The value slot is live only where the error is proven absent (ERR E1.8): // read `v1` under an `if !e1` guard, not after a bare tag-compare. diff --git a/examples/1012-errors-value-failable-consume.sx b/examples/1012-errors-value-failable-consume.sx index 776457f..be81a50 100644 --- a/examples/1012-errors-value-failable-consume.sx +++ b/examples/1012-errors-value-failable-consume.sx @@ -10,32 +10,32 @@ E :: error { Bad, Empty } -parse :: (n: s32) -> (s32, !E) { +parse :: (n: i32) -> (i32, !E) { if n < 0 { raise error.Bad; } if n == 0 { raise error.Empty; } return n * 2; } // value-carrying `try` in a value-carrying caller — propagates {undef, tag}. -inc :: (n: s32) -> (s32, !E) { +inc :: (n: i32) -> (i32, !E) { v := try parse(n); return v + 1; } // value-carrying `try` in a pure-failable caller — propagates the tag. -relay :: (n: s32) -> !E { +relay :: (n: i32) -> !E { v := try parse(n); if v < 0 { raise error.Bad; } return; } // value-carrying `catch`, bare-expression fallback. -safe :: (n: s32) -> s32 { +safe :: (n: i32) -> i32 { return parse(n) catch (e) 0; } // value-carrying `catch`, match-body value. -classify :: (n: s32) -> s32 { +classify :: (n: i32) -> i32 { return parse(n) catch (e) == { case .Bad: 1; case .Empty: 2; @@ -43,8 +43,8 @@ classify :: (n: s32) -> s32 { }; } -main :: () -> s32 { - r : s32 = 0; +main :: () -> i32 { + r : i32 = 0; a, ea := inc(5); // parse(5)=10 → v=10 → 11 if !ea { r = r + a; } // success → +11 (value live only when proven ok) b, eb := inc(-1); // parse(-1)=Bad → propagate {undef, Bad} diff --git a/examples/1013-errors-value-failable-reject.sx b/examples/1013-errors-value-failable-reject.sx index 297d824..68145f7 100644 --- a/examples/1013-errors-value-failable-reject.sx +++ b/examples/1013-errors-value-failable-reject.sx @@ -8,12 +8,12 @@ E :: error { Bad } -parse :: (n: s32) -> (s32, !E) { +parse :: (n: i32) -> (i32, !E) { if n < 0 { raise error.Bad; } return n; } -main :: () -> s32 { +main :: () -> i32 { x := parse(-1) catch (e) { print("oops\n") }; // error: body yields no value return x; } diff --git a/examples/1014-errors-failable-or.sx b/examples/1014-errors-failable-or.sx index 1b25f96..6ca4162 100644 --- a/examples/1014-errors-failable-or.sx +++ b/examples/1014-errors-failable-or.sx @@ -9,13 +9,13 @@ E :: error { Bad, Empty } -parse :: (n: s32) -> (s32, !E) { +parse :: (n: i32) -> (i32, !E) { if n < 0 { raise error.Bad; } if n == 0 { raise error.Empty; } return n * 2; } -main :: () -> s32 { +main :: () -> i32 { a := parse(5) or 0; // success → 10 b := parse(-1) or 99; // Bad → 99 (terminator) c := parse(0) or 7; // Empty → 7 (terminator) diff --git a/examples/1015-errors-failable-or-reject.sx b/examples/1015-errors-failable-or-reject.sx index 3455eb3..862b07e 100644 --- a/examples/1015-errors-failable-or-reject.sx +++ b/examples/1015-errors-failable-or-reject.sx @@ -8,12 +8,12 @@ E :: error { Bad } -must :: (n: s32) -> !E { +must :: (n: i32) -> !E { if n < 0 { raise error.Bad; } return; } -main :: () -> s32 { +main :: () -> i32 { x := must(-1) or 0; // error: `-> !` has no success value to fall back to return 0; } diff --git a/examples/1016-errors-onfail.sx b/examples/1016-errors-onfail.sx index 1ba1d97..d07d085 100644 --- a/examples/1016-errors-onfail.sx +++ b/examples/1016-errors-onfail.sx @@ -9,13 +9,13 @@ E :: error { Bad } -inner :: (n: s32) -> !E { +inner :: (n: i32) -> !E { if n < 0 { raise error.Bad; } return; } // defer + onfail interleave on the error path; only defers on success. -run :: (n: s32) -> !E { +run :: (n: i32) -> !E { defer print("defer A\n"); onfail print("onfail B\n"); defer print("defer C\n"); @@ -24,13 +24,13 @@ run :: (n: s32) -> !E { } // `onfail e` binds the tag. -classify :: (n: s32) -> !E { +classify :: (n: i32) -> !E { onfail (e) { if e == error.Bad { print("cleanup: bad\n"); } } if n < 0 { raise error.Bad; } return; } -main :: () -> s32 { +main :: () -> i32 { print("[fail]\n"); a := run(-1); // error → defer C, onfail B, defer A print("[ok]\n"); diff --git a/examples/1017-errors-onfail-reject.sx b/examples/1017-errors-onfail-reject.sx index 4cb88ef..bf9c4d6 100644 --- a/examples/1017-errors-onfail-reject.sx +++ b/examples/1017-errors-onfail-reject.sx @@ -5,11 +5,11 @@ #import "modules/std.sx"; -non_failable :: () -> s32 { +non_failable :: () -> i32 { onfail print("never fires\n"); // error: onfail outside a failable function return 0; } -main :: () -> s32 { +main :: () -> i32 { return non_failable(); } diff --git a/examples/1018-errors-multi-value-failable.sx b/examples/1018-errors-multi-value-failable.sx index 88f5b0a..646e7fe 100644 --- a/examples/1018-errors-multi-value-failable.sx +++ b/examples/1018-errors-multi-value-failable.sx @@ -12,26 +12,26 @@ E :: error { Bad, Empty } -parse :: (n: s32) -> (s32, s32, !E) { +parse :: (n: i32) -> (i32, i32, !E) { if n < 0 { raise error.Bad; } if n == 0 { raise error.Empty; } return (n * 2, n + 1); // success → {n*2, n+1, 0} } // Multi-value `try` in a multi-value caller — propagates {undef, undef, tag}. -inc :: (n: s32) -> (s32, s32, !E) { +inc :: (n: i32) -> (i32, i32, !E) { v, b := try parse(n); return (v + 1, b + 1); } // Multi-value `catch`, bare-expression tuple fallback (absorbs the failure). -safe :: (n: s32) -> s32 { +safe :: (n: i32) -> i32 { v, b := parse(n) catch (e) (40, 50); return v + b; } // Multi-value `catch` match-body — per-tag dispatch, each arm a value-tuple. -classify :: (n: s32) -> s32 { +classify :: (n: i32) -> i32 { v, b := parse(n) catch (e) == { case .Bad: (1, 1); case .Empty: (2, 2); @@ -41,13 +41,13 @@ classify :: (n: s32) -> s32 { } // Multi-value `or (tuple)` value-terminator (absorbs the failure). -ortest :: (n: s32) -> s32 { +ortest :: (n: i32) -> i32 { v, b := parse(n) or (7, 8); return v + b; } -main :: () -> s32 { - r : s32 = 0; +main :: () -> i32 { + r : i32 = 0; // Destructure binds EVERY slot including the error tag (e1 / e2 / e3) — // the error is treated, never dropped. diff --git a/examples/1019-errors-failable-discard-reject.sx b/examples/1019-errors-failable-discard-reject.sx index c48fe9c..e1ba307 100644 --- a/examples/1019-errors-failable-discard-reject.sx +++ b/examples/1019-errors-failable-discard-reject.sx @@ -13,17 +13,17 @@ E :: error { Bad, Empty } -pair :: (n: s32) -> (s32, s32, !E) { +pair :: (n: i32) -> (i32, i32, !E) { if n < 0 { raise error.Bad; } return (n, n + 1); } -parse :: (n: s32) -> (s32, !E) { +parse :: (n: i32) -> (i32, !E) { if n < 0 { raise error.Bad; } return n * 2; } -main :: () -> s32 { +main :: () -> i32 { a, b := pair(5); // ERROR: error slot omitted (3 slots, 2 names) v, _ := parse(5); // ERROR: error slot discarded with `_` return a + b + v; diff --git a/examples/1020-errors-cleanup-body-restrictions.sx b/examples/1020-errors-cleanup-body-restrictions.sx index fb267c6..b7e8c2a 100644 --- a/examples/1020-errors-cleanup-body-restrictions.sx +++ b/examples/1020-errors-cleanup-body-restrictions.sx @@ -23,4 +23,4 @@ f :: () -> !E { return; } -main :: () -> s32 { return 0; } +main :: () -> i32 { return 0; } diff --git a/examples/1021-errors-main-exit-truncation.sx b/examples/1021-errors-main-exit-truncation.sx index ea00d47..5ff8096 100644 --- a/examples/1021-errors-main-exit-truncation.sx +++ b/examples/1021-errors-main-exit-truncation.sx @@ -8,7 +8,7 @@ #import "modules/std.sx"; -main :: () -> s32 { +main :: () -> i32 { print("returning 1105 -> exit {}\n", 1105 & 0xFF); // 81 return 1105; } diff --git a/examples/1023-errors-tag-interpolation.sx b/examples/1023-errors-tag-interpolation.sx index 426a529..908746d 100644 --- a/examples/1023-errors-tag-interpolation.sx +++ b/examples/1023-errors-tag-interpolation.sx @@ -8,13 +8,13 @@ E :: error { BadDigit, Empty, Overflow } -parse :: (n: s32) -> (s32, !E) { +parse :: (n: i32) -> (i32, !E) { if n < 0 { raise error.BadDigit; } if n == 0 { raise error.Empty; } return n * 2; } -main :: () -> s32 { +main :: () -> i32 { a : E = error.BadDigit; b : E = error.Overflow; print("a={} b={}\n", a, b); // a=BadDigit b=Overflow diff --git a/examples/1024-errors-trace-buffer.sx b/examples/1024-errors-trace-buffer.sx index 2fcef58..0898761 100644 --- a/examples/1024-errors-trace-buffer.sx +++ b/examples/1024-errors-trace-buffer.sx @@ -13,17 +13,17 @@ sx_trace_len :: () -> u32 #foreign; E :: error { Bad } -fail :: (n: s32) -> !E { +fail :: (n: i32) -> !E { if n < 0 { raise error.Bad; } // pushes a frame return; } -propagate :: (n: s32) -> !E { +propagate :: (n: i32) -> !E { try fail(n); // on failure: pushes a frame, propagates return; } -main :: () -> s32 { +main :: () -> i32 { // `catch` lets the handler INSPECT the trace, then absorbs: the buffer is // cleared when the handler completes (a non-diverging exit), not on entry. // So inside the handler the frames are still visible (here: the `raise` in diff --git a/examples/1025-errors-trace-format.sx b/examples/1025-errors-trace-format.sx index a13e514..b029752 100644 --- a/examples/1025-errors-trace-format.sx +++ b/examples/1025-errors-trace-format.sx @@ -16,17 +16,17 @@ sx_trace_len :: () -> u32 #foreign; E :: error { BadInput, Overflow } -leaf :: (n: s32) -> !E { +leaf :: (n: i32) -> !E { if n < 0 { raise error.BadInput; } // pushes frame 0 return; } -mid :: (n: s32) -> !E { +mid :: (n: i32) -> !E { try leaf(n); // propagation pushes frame 1 return; } -main :: () -> s32 { +main :: () -> i32 { mid(-1) catch (e) { print("[stdout] caught {}\n", e); // tag name via the always-linked table trace.print_current(); // [stderr] the 2-frame trace diff --git a/examples/1026-errors-failable-main.sx b/examples/1026-errors-failable-main.sx index 62442ae..79ec4d4 100644 --- a/examples/1026-errors-failable-main.sx +++ b/examples/1026-errors-failable-main.sx @@ -14,7 +14,7 @@ ParseErr :: error { Empty, BadDigit }; -inner :: (n: s32) -> (s32, !ParseErr) { +inner :: (n: i32) -> (i32, !ParseErr) { if n == 0 { raise error.Empty; } // pushes a frame if n < 0 { raise error.BadDigit; } return n * 2; diff --git a/examples/1027-errors-failable-main-value.sx b/examples/1027-errors-failable-main-value.sx index e450291..cdab14a 100644 --- a/examples/1027-errors-failable-main-value.sx +++ b/examples/1027-errors-failable-main-value.sx @@ -9,13 +9,13 @@ ParseErr :: error { Empty, BadDigit }; -inner :: (n: s32) -> (s32, !ParseErr) { +inner :: (n: i32) -> (i32, !ParseErr) { if n == 0 { raise error.Empty; } if n < 0 { raise error.BadDigit; } return n * 2; } -main :: () -> (s32, !ParseErr) { +main :: () -> (i32, !ParseErr) { v := try inner(32); // succeeds → v = 64 print("v = {}\n", v); return v; // success → exit code 64 diff --git a/examples/1028-errors-failable-or-chain.sx b/examples/1028-errors-failable-or-chain.sx index 188ade8..6a93052 100644 --- a/examples/1028-errors-failable-or-chain.sx +++ b/examples/1028-errors-failable-or-chain.sx @@ -12,21 +12,21 @@ E :: error { A, B }; -fa :: (n: s32) -> (s32, !E) { +fa :: (n: i32) -> (i32, !E) { if n == 0 { raise error.A; } if n < 0 { raise error.B; } return n; } -fv :: (n: s32) -> !E { // void (pure) failable +fv :: (n: i32) -> !E { // void (pure) failable if n == 0 { raise error.A; } return; } -main :: () -> (s32, !E) { +main :: () -> (i32, !E) { onfail print("onfail fired (BUG)\n"); // must NOT fire — every chain below absorbs - r : s32 = 0; + r : i32 = 0; r = r + (try fa(0) or try fa(7)); // a fails → b succeeds → 7 r = r + (try fa(0) or try fa(0) or try fa(3)); // first two fail → third → +3 = 10 r = r + (fa(0) or fa(0) or 96); // bare chain + value terminator → +96 = 106 diff --git a/examples/1029-errors-failable-or-chain-propagate.sx b/examples/1029-errors-failable-or-chain-propagate.sx index 137f7e3..5668b97 100644 --- a/examples/1029-errors-failable-or-chain-propagate.sx +++ b/examples/1029-errors-failable-or-chain-propagate.sx @@ -10,12 +10,12 @@ E :: error { A }; -fa :: (n: s32) -> (s32, !E) { +fa :: (n: i32) -> (i32, !E) { if n == 0 { raise error.A; } return n; } -main :: () -> (s32, !E) { +main :: () -> (i32, !E) { v := try fa(0) or try fa(0) or try fa(0); // all fail → propagate to main return v; } diff --git a/examples/1030-errors-log-and-comptime.sx b/examples/1030-errors-log-and-comptime.sx index 50c61ff..d72fa45 100644 --- a/examples/1030-errors-log-and-comptime.sx +++ b/examples/1030-errors-log-and-comptime.sx @@ -14,14 +14,14 @@ #import "modules/std.sx"; log :: #import "modules/std/log.sx"; -probe :: () -> s32 { +probe :: () -> i32 { if is_comptime() { return 1; } // comptime interpreter path return 2; // compiled-code path } CT :: #run probe(); // folds to 1 (run in the interpreter) -main :: () -> s32 { +main :: () -> i32 { log.warn("disk {}% full", 91); log.info("user {} connected", "alice"); log.err("bad fd {}", 7); diff --git a/examples/1031-errors-process-exit.sx b/examples/1031-errors-process-exit.sx index b48e82b..cafb770 100644 --- a/examples/1031-errors-process-exit.sx +++ b/examples/1031-errors-process-exit.sx @@ -7,7 +7,7 @@ #import "modules/std.sx"; proc :: #import "modules/std/process.sx"; -main :: () -> s32 { +main :: () -> i32 { print("starting\n"); proc.exit(42); print("unreachable\n"); diff --git a/examples/1032-errors-assert.sx b/examples/1032-errors-assert.sx index 8f7cc49..b30a6cf 100644 --- a/examples/1032-errors-assert.sx +++ b/examples/1032-errors-assert.sx @@ -6,7 +6,7 @@ #import "modules/std.sx"; proc :: #import "modules/std/process.sx"; -main :: () -> s32 { +main :: () -> i32 { proc.assert(2 + 2 == 4, "arithmetic"); // passes → no-op print("first assert passed\n"); proc.assert(2 + 2 == 5, "two plus two is not five"); // fails → abort diff --git a/examples/1033-errors-caller-location.sx b/examples/1033-errors-caller-location.sx index 20cb09f..1b13cd1 100644 --- a/examples/1033-errors-caller-location.sx +++ b/examples/1033-errors-caller-location.sx @@ -15,7 +15,7 @@ wrap :: (loc: Source_Location = #caller_location) { note(loc); } -main :: () -> s32 { +main :: () -> i32 { note(); // call site → func main wrap(); // forwarded → still reports this line in main return 0; diff --git a/examples/1034-errors-interp-frames.sx b/examples/1034-errors-interp-frames.sx index 1c26385..e21936a 100644 --- a/examples/1034-errors-interp-frames.sx +++ b/examples/1034-errors-interp-frames.sx @@ -18,6 +18,6 @@ inner :: () { #run inner(); // top-level #run drives the chain -main :: () -> s32 { +main :: () -> i32 { return 0; } diff --git a/examples/1035-errors-comptime-trace.sx b/examples/1035-errors-comptime-trace.sx index de51f55..aee40b3 100644 --- a/examples/1035-errors-comptime-trace.sx +++ b/examples/1035-errors-comptime-trace.sx @@ -28,6 +28,6 @@ probe :: () { #run probe(); -main :: () -> s32 { +main :: () -> i32 { return 0; } diff --git a/examples/1036-errors-failable-smoke.sx b/examples/1036-errors-failable-smoke.sx index d274bf7..f334886 100644 --- a/examples/1036-errors-failable-smoke.sx +++ b/examples/1036-errors-failable-smoke.sx @@ -9,7 +9,7 @@ SmokeErr :: error { Empty, BadDigit, Overflow } // value-carrying, named set -sm_parse :: (n: s32) -> (s32, !SmokeErr) { +sm_parse :: (n: i32) -> (i32, !SmokeErr) { if n < 0 { raise error.BadDigit; } if n == 0 { raise error.Empty; } if n > 99 { raise error.Overflow; } @@ -23,14 +23,14 @@ sm_check :: (ok: bool) -> ! { } // multi-value, inferred set: `try` propagates; SCC absorbs SmokeErr -sm_pair :: (a: s32, b: s32) -> (s32, s32, !) { +sm_pair :: (a: i32, b: i32) -> (i32, i32, !) { x := try sm_parse(a); y := try sm_parse(b); return (x, y); } // catch with a diverging block body -sm_or_default :: (n: s32) -> s32 { +sm_or_default :: (n: i32) -> i32 { return sm_parse(n) catch (e) { print(" logged {}\n", e); return -1; @@ -38,7 +38,7 @@ sm_or_default :: (n: s32) -> s32 { } // onfail + defer interleave: cleanup runs only on the error path -sm_acquire :: (fail: bool) -> (s32, !) { +sm_acquire :: (fail: bool) -> (i32, !) { defer print(" defer A\n"); onfail print(" onfail B\n"); if fail { raise error.Acquire; } @@ -46,7 +46,7 @@ sm_acquire :: (fail: bool) -> (s32, !) { } // or-chain: try a, fall to try b; propagate if both fail -sm_first :: (a: s32, b: s32) -> (s32, !) { +sm_first :: (a: i32, b: i32) -> (i32, !) { v := try sm_parse(a) or try sm_parse(b); return v; } @@ -54,13 +54,13 @@ sm_first :: (a: s32, b: s32) -> (s32, !) { // --- Composition (ERR E5.1): failable closures, widening, generics --- // Closure(...) param, try-propagated (the env is carried) -sm_run :: (cb: Closure(s32) -> (s32, !SmokeErr), n: s32) -> (s32, !SmokeErr) { +sm_run :: (cb: Closure(i32) -> (i32, !SmokeErr), n: i32) -> (i32, !SmokeErr) { return try cb(n); } // bare fn-type param: a NON-failable closure literal widens into the failable // slot (the ∅-widening adapter wraps `{value, 0}`) -sm_widen :: (cb: (s32) -> (s32, !SmokeErr), n: s32) -> s32 { +sm_widen :: (cb: (i32) -> (i32, !SmokeErr), n: i32) -> i32 { return cb(n) catch (e) -1; } @@ -120,15 +120,15 @@ main :: () { iv, ierr := sm_acquire(false); // composition: inline failable closure literal through a Closure(...) param - cl := sm_run(closure((x: s32) -> (s32, !SmokeErr) { if x < 0 { raise error.BadDigit; } return x * 2; }), 6) catch (e) -1; + cl := sm_run(closure((x: i32) -> (i32, !SmokeErr) { if x < 0 { raise error.BadDigit; } return x * 2; }), 6) catch (e) -1; print("closure-run: {}\n", cl); // 12 - print("closure-run-err: {}\n", sm_run(closure((x: s32) -> (s32, !SmokeErr) { raise error.Empty; }), 1) catch (e) -9); // -9 + print("closure-run-err: {}\n", sm_run(closure((x: i32) -> (i32, !SmokeErr) { raise error.Empty; }), 1) catch (e) -9); // -9 // non-failable closure literal widened into the failable bare slot - print("widen: {}\n", sm_widen(closure((x: s32) -> s32 => x + 1), 9)); // 10 + print("widen: {}\n", sm_widen(closure((x: i32) -> i32 => x + 1), 9)); // 10 - // generic failable composition (monomorphized at s32) - print("wrap: {}\n", sm_wrap(s32, closure(() -> (s32, !SmokeErr) { return 42; })) catch (e) 0); // 42 + // generic failable composition (monomorphized at i32) + print("wrap: {}\n", sm_wrap(i32, closure(() -> (i32, !SmokeErr) { return 42; })) catch (e) 0); // 42 print("errors ok\n"); } diff --git a/examples/1037-errors-comptime-run-escape.sx b/examples/1037-errors-comptime-run-escape.sx index 2e81624..c5e6fe8 100644 --- a/examples/1037-errors-comptime-run-escape.sx +++ b/examples/1037-errors-comptime-run-escape.sx @@ -7,7 +7,7 @@ E :: error { Bad, Empty } -parse :: (n: s32) -> (s32, !E) { +parse :: (n: i32) -> (i32, !E) { if n < 0 { raise error.Bad; } if n == 0 { raise error.Empty; } return n * 2; @@ -15,4 +15,4 @@ parse :: (n: s32) -> (s32, !E) { x :: #run parse(-1); // error.Bad escapes → comptime diagnostic + halt -main :: () -> s32 { return x; } +main :: () -> i32 { return x; } diff --git a/examples/1038-errors-comptime-run-handled.sx b/examples/1038-errors-comptime-run-handled.sx index 38cd763..76399b8 100644 --- a/examples/1038-errors-comptime-run-handled.sx +++ b/examples/1038-errors-comptime-run-handled.sx @@ -7,7 +7,7 @@ E :: error { Bad, Empty } -parse :: (n: s32) -> (s32, !E) { +parse :: (n: i32) -> (i32, !E) { if n < 0 { raise error.Bad; } if n == 0 { raise error.Empty; } return n * 2; @@ -25,7 +25,7 @@ ored :: #run parse(0) or 55; // Empty → 55 #run guard(false) catch (e) { }; // onfail fires during the comptime unwind -main :: () -> s32 { +main :: () -> i32 { print("ok={} caught={} ored={}\n", ok_v, caught, ored); return ok_v + caught + ored; // 10 + 99 + 55 = 164 } diff --git a/examples/1039-errors-failable-closure-literal.sx b/examples/1039-errors-failable-closure-literal.sx index 81a1f80..ac3b061 100644 --- a/examples/1039-errors-failable-closure-literal.sx +++ b/examples/1039-errors-failable-closure-literal.sx @@ -10,12 +10,12 @@ E :: error { Neg } -runwith :: (cb: Closure(s64) -> (s64, !E), n: s64) -> s64 { return cb(n) catch (e) -1; } +runwith :: (cb: Closure(i64) -> (i64, !E), n: i64) -> i64 { return cb(n) catch (e) -1; } -main :: () -> s32 { +main :: () -> i32 { // block-body and arrow-body failable closures, called directly - m := closure((x: s64) -> (s64, !E) { if x < 0 { raise error.Neg; } return x * 2; }); - n := closure((x: s64) -> (s64, !E) => x + 1); + m := closure((x: i64) -> (i64, !E) { if x < 0 { raise error.Neg; } return x * 2; }); + n := closure((x: i64) -> (i64, !E) => x + 1); print("{} {} {} {}\n", m(5) catch (e) 0, m(-1) catch (e) 99, m(-1) or 7, n(40) catch (e) 0); // 10 99 7 41 // failable closure passed as a Closure(...) parameter diff --git a/examples/1040-errors-failable-closure-composition.sx b/examples/1040-errors-failable-closure-composition.sx index 5405639..6bbbd69 100644 --- a/examples/1040-errors-failable-closure-composition.sx +++ b/examples/1040-errors-failable-closure-composition.sx @@ -12,23 +12,23 @@ E :: error { Neg } -bare :: (cb: (s64) -> (s64, !E), n: s64) -> s64 { return cb(n) catch (e) -1; } -chain :: (cb: Closure(s64) -> (s64, !E), n: s64) -> (s64, !E) { return try cb(n); } +bare :: (cb: (i64) -> (i64, !E), n: i64) -> i64 { return cb(n) catch (e) -1; } +chain :: (cb: Closure(i64) -> (i64, !E), n: i64) -> (i64, !E) { return try cb(n); } -dbl :: (x: s64) -> (s64, !E) { if x < 0 { raise error.Neg; } return x * 2; } +dbl :: (x: i64) -> (i64, !E) { if x < 0 { raise error.Neg; } return x * 2; } -main :: () -> s32 { +main :: () -> i32 { // failable closure literal through a bare fn-type param (matching ABI) print("bare ok={} err={}\n", - bare(closure((x: s64) -> (s64, !E) { if x < 0 { raise error.Neg; } return x * 2; }), 5), - bare(closure((x: s64) -> (s64, !E) => x * 2), -1)); // ok=10; err: arrow never raises → cb(-1) = -2 + bare(closure((x: i64) -> (i64, !E) { if x < 0 { raise error.Neg; } return x * 2; }), 5), + bare(closure((x: i64) -> (i64, !E) => x * 2), -1)); // ok=10; err: arrow never raises → cb(-1) = -2 // Closure(...) param, try-propagated, then caught at the call site print("chain ok={} err={}\n", - chain(closure((x: s64) -> (s64, !E) => x + 6), 4) catch (e) 0, // 10 - chain(closure((x: s64) -> (s64, !E) { raise error.Neg; }), 1) catch (e) 0); // 0 + chain(closure((x: i64) -> (i64, !E) => x + 6), 4) catch (e) 0, // 10 + chain(closure((x: i64) -> (i64, !E) { raise error.Neg; }), 1) catch (e) 0); // 0 // NON-failable closure literal widened into the failable bare slot - print("widen={}\n", bare(closure((x: s64) -> s64 => x + 1), 9)); // 10 + print("widen={}\n", bare(closure((x: i64) -> i64 => x + 1), 9)); // 10 return 0; } diff --git a/examples/1041-errors-failable-closure-shape-union.sx b/examples/1041-errors-failable-closure-shape-union.sx index 20d37e4..442fffb 100644 --- a/examples/1041-errors-failable-closure-shape-union.sx +++ b/examples/1041-errors-failable-closure-shape-union.sx @@ -1,5 +1,5 @@ // Program-wide inferred-`!` union per closure shape (ERR E5.1 sub-feature 2). -// All occurrences of `Closure(s32) -> (s32, !)` share ONE inferred error set; +// All occurrences of `Closure(i32) -> (i32, !)` share ONE inferred error set; // every bare-`!` closure literal of that shape unions its raised tags in. A // `try slot(x)` against any matching-shape slot widens against that union — so // a caller whose named set covers { Negative, Other } type-checks, and the @@ -10,18 +10,18 @@ All :: error { Negative, Other } // `h` is a bare-`!` Closure slot; the caller declares the union as `!All`. -dispatch :: (h: Closure(s32) -> (s32, !), x: s32) -> (s32, !All) { +dispatch :: (h: Closure(i32) -> (i32, !), x: i32) -> (i32, !All) { return try h(x); } -main :: () -> s32 { +main :: () -> i32 { gpa := GPA.init(); push Context.{ allocator = xx gpa } { // Two literals of the SAME shape raising DIFFERENT tags both feed the - // one shared `Closure(s32)->(s32,!)` union node. - handlers : List(Closure(s32) -> (s32, !)) = .{}; - handlers.append(closure((x: s32) -> (s32, !) { if x < 0 { raise error.Negative; } return x * 2; })); - handlers.append(closure((x: s32) -> (s32, !) { if x == 0 { raise error.Other; } return x + 100; })); + // one shared `Closure(i32)->(i32,!)` union node. + handlers : List(Closure(i32) -> (i32, !)) = .{}; + handlers.append(closure((x: i32) -> (i32, !) { if x < 0 { raise error.Negative; } return x * 2; })); + handlers.append(closure((x: i32) -> (i32, !) { if x == 0 { raise error.Other; } return x + 100; })); // success paths print("ok0={}\n", dispatch(handlers.items[0], 5) catch (e) 0); // 10 diff --git a/examples/1042-errors-failable-closure-shape-union-reject.sx b/examples/1042-errors-failable-closure-shape-union-reject.sx index 91ca31a..0ead4ab 100644 --- a/examples/1042-errors-failable-closure-shape-union-reject.sx +++ b/examples/1042-errors-failable-closure-shape-union-reject.sx @@ -1,5 +1,5 @@ // Program-wide closure-shape union — widening REJECTION (ERR E5.1 sub-feature 2). -// Two closure literals of shape `Closure(s32)->(s32,!)` raise `Negative` / +// Two closure literals of shape `Closure(i32)->(i32,!)` raise `Negative` / // `Other`; the shared inferred-`!` node for that shape is { Negative, Other }. // A caller that `try`s a slot of this shape but declares only `!Small` (which // omits both tags) is rejected — the union is checked against the caller's set @@ -9,16 +9,16 @@ Small :: error { Unrelated } -reject :: (h: Closure(s32) -> (s32, !), x: s32) -> (s32, !Small) { +reject :: (h: Closure(i32) -> (i32, !), x: i32) -> (i32, !Small) { return try h(x); // Negative, Other ∉ Small → two diagnostics } -main :: () -> s32 { +main :: () -> i32 { gpa := GPA.init(); push Context.{ allocator = xx gpa } { - handlers : List(Closure(s32) -> (s32, !)) = .{}; - handlers.append(closure((x: s32) -> (s32, !) { if x < 0 { raise error.Negative; } return x; })); - handlers.append(closure((x: s32) -> (s32, !) { if x == 0 { raise error.Other; } return x; })); + handlers : List(Closure(i32) -> (i32, !)) = .{}; + handlers.append(closure((x: i32) -> (i32, !) { if x < 0 { raise error.Negative; } return x; })); + handlers.append(closure((x: i32) -> (i32, !) { if x == 0 { raise error.Other; } return x; })); print("r={}\n", reject(handlers.items[0], 5) catch (e) 0); } return 0; diff --git a/examples/1043-errors-lambda-raise-annotation-hint.sx b/examples/1043-errors-lambda-raise-annotation-hint.sx index 00c66e6..20074ad 100644 --- a/examples/1043-errors-lambda-raise-annotation-hint.sx +++ b/examples/1043-errors-lambda-raise-annotation-hint.sx @@ -9,12 +9,12 @@ E :: error { Neg } -take :: (cb: Closure(s32) -> (s32, !E), x: s32) -> s32 { return cb(x) catch (e) -1; } +take :: (cb: Closure(i32) -> (i32, !E), x: i32) -> i32 { return cb(x) catch (e) -1; } -main :: () -> s32 { - // `-> s32` (non-failable) but the body raises → lambda-specific hint: +main :: () -> i32 { + // `-> i32` (non-failable) but the body raises → lambda-specific hint: // "lambda body raises; declare its return type explicitly with // `-> (T, !)` or `-> (T, !Named)`" - print("{}\n", take(closure((x: s32) -> s32 { if x < 0 { raise error.Neg; } return x; }), -1)); + print("{}\n", take(closure((x: i32) -> i32 { if x < 0 { raise error.Neg; } return x; }), -1)); return 0; } diff --git a/examples/1044-errors-generic-failable-composition.sx b/examples/1044-errors-generic-failable-composition.sx index a0445ff..635e527 100644 --- a/examples/1044-errors-generic-failable-composition.sx +++ b/examples/1044-errors-generic-failable-composition.sx @@ -11,17 +11,17 @@ E :: error { Bad } wrap :: ($T: Type, f: Closure() -> (T, !E)) -> (T, !E) { return try f(); } -main :: () -> s32 { +main :: () -> i32 { // success, consumed by catch - print("catch={}\n", wrap(s32, closure(() -> (s32, !E) { return 7; })) catch (e) -1); // 7 + print("catch={}\n", wrap(i32, closure(() -> (i32, !E) { return 7; })) catch (e) -1); // 7 // success, consumed by destructure (binds value + error slot); the value // slot is read only under an `if !err` guard (ERR E1.8 path-sensitivity) - r, err := wrap(s32, closure(() -> (s32, !E) { return 9; })); + r, err := wrap(i32, closure(() -> (i32, !E) { return 9; })); if !err { print("destr={} ok=true\n", r); } // destr=9 ok=true // failure path: the raised tag propagates through the generic `try` - print("fail={}\n", wrap(s32, closure(() -> (s32, !E) { raise error.Bad; }) ) catch (e) -1); // -1 + print("fail={}\n", wrap(i32, closure(() -> (i32, !E) { raise error.Bad; }) ) catch (e) -1); // -1 // a second monomorphization at a different T print("u8={}\n", wrap(u8, closure(() -> (u8, !E) { return 200; })) catch (e) 0); // 200 diff --git a/examples/1045-errors-closure-var-bare-slot-reject.sx b/examples/1045-errors-closure-var-bare-slot-reject.sx index 29b017c..c23927e 100644 --- a/examples/1045-errors-closure-var-bare-slot-reject.sx +++ b/examples/1045-errors-closure-var-bare-slot-reject.sx @@ -12,13 +12,13 @@ E :: error { Z } -bare :: (cb: (s64) -> s64, n: s64) -> s64 { return cb(n); } -baref :: (cb: (s64) -> (s64, !E), n: s64) -> s64 { return cb(n) catch (e) -1; } +bare :: (cb: (i64) -> i64, n: i64) -> i64 { return cb(n); } +baref :: (cb: (i64) -> (i64, !E), n: i64) -> i64 { return cb(n) catch (e) -1; } -main :: () -> s32 { - inc := closure((x: s64) -> s64 => x + 1); // capture-free closure var +main :: () -> i32 { + inc := closure((x: i64) -> i64 => x + 1); // capture-free closure var base := 100; - add := closure((x: s64) -> s64 => x + base); // CAPTURING closure var + add := closure((x: i64) -> i64 => x + base); // CAPTURING closure var _ := bare(inc, 9); // reject: closure value → bare slot _ := baref(inc, 9); // reject: also the ∅-widening crossing diff --git a/examples/1046-errors-value-slot-liveness.sx b/examples/1046-errors-value-slot-liveness.sx index 995920c..433c3b1 100644 --- a/examples/1046-errors-value-slot-liveness.sx +++ b/examples/1046-errors-value-slot-liveness.sx @@ -15,28 +15,28 @@ E :: error { Bad, Empty } -parse :: (n: s32) -> (s32, !E) { +parse :: (n: i32) -> (i32, !E) { if n < 0 { raise error.Bad; } if n == 0 { raise error.Empty; } return n * 10; } // Early-return guard: the fall-through proves `err` absent. -guarded :: (n: s32) -> s32 { +guarded :: (n: i32) -> i32 { v, err := parse(n); if err { return -1; } return v; // err proven absent here } // `if err { raise }` in a failable function: same fall-through proof. -relay :: (n: s32) -> (s32, !E) { +relay :: (n: i32) -> (i32, !E) { v, err := parse(n); if err { raise err; } return v + 1; // err proven absent here } -main :: () -> s32 { - total : s32 = 0; +main :: () -> i32 { + total : i32 = 0; // (1) proven inside `if !err` v1, e1 := parse(5); diff --git a/examples/1047-errors-value-slot-liveness-reject.sx b/examples/1047-errors-value-slot-liveness-reject.sx index bc1cfb9..2f91346 100644 --- a/examples/1047-errors-value-slot-liveness-reject.sx +++ b/examples/1047-errors-value-slot-liveness-reject.sx @@ -11,25 +11,25 @@ E :: error { Bad } -parse :: (n: s32) -> (s32, !E) { +parse :: (n: i32) -> (i32, !E) { if n < 0 { raise error.Bad; } return n * 10; } // (A) the read sits on the error path — `err` is present here, not absent. -bad_a :: () -> s32 { +bad_a :: () -> i32 { v, err := parse(5); if err { return v; } // REJECTED: err present on this path return 0; } // (B) a tag-compare narrows which error, but does not prove there is none. -bad_b :: () -> s32 { +bad_b :: () -> i32 { v, err := parse(5); if err == error.Bad { return 1; } return v; // REJECTED: err not proven absent } -main :: () -> s32 { +main :: () -> i32 { return bad_a() + bad_b(); } diff --git a/examples/1048-errors-cleanup-absorption.sx b/examples/1048-errors-cleanup-absorption.sx index f1b16b6..d49b6f6 100644 --- a/examples/1048-errors-cleanup-absorption.sx +++ b/examples/1048-errors-cleanup-absorption.sx @@ -9,9 +9,9 @@ E :: error { Bad } failing :: () -> !E { raise error.Bad; } -recover :: () -> (s32, !E) { raise error.Bad; } +recover :: () -> (i32, !E) { raise error.Bad; } -work :: (n: s32) -> !E { +work :: (n: i32) -> !E { defer print("defer: always\n"); // plain cleanup onfail { failing() catch (e) print("onfail: caught (catch)\n"); } // catch absorbs onfail { x := recover() or 7; print("onfail: x={} (or)\n", x); } // or-value absorbs @@ -19,7 +19,7 @@ work :: (n: s32) -> !E { return; } -main :: () -> s32 { +main :: () -> i32 { print("[error]\n"); a := work(-1); // raises → onfail bodies fire, then defer (reverse decl order) print("[ok]\n"); diff --git a/examples/1049-errors-cleanup-absorption-reject.sx b/examples/1049-errors-cleanup-absorption-reject.sx index 8ab0a0b..7778730 100644 --- a/examples/1049-errors-cleanup-absorption-reject.sx +++ b/examples/1049-errors-cleanup-absorption-reject.sx @@ -10,14 +10,14 @@ E :: error { Bad } failing :: () -> !E { raise error.Bad; } -work :: (n: s32) -> !E { +work :: (n: i32) -> !E { defer failing(); // REJECTED: bare failable in a defer body onfail { failing(); } // REJECTED: bare failable in an onfail body if n < 0 { raise error.Bad; } return; } -main :: () -> s32 { +main :: () -> i32 { a := work(-1); return 0; } diff --git a/examples/1050-errors-defer-block-body.sx b/examples/1050-errors-defer-block-body.sx index 17cd104..b451315 100644 --- a/examples/1050-errors-defer-block-body.sx +++ b/examples/1050-errors-defer-block-body.sx @@ -9,7 +9,7 @@ E :: error { Bad } -probe :: () -> (s32, !E) { return 21; } +probe :: () -> (i32, !E) { return 21; } failing :: () -> !E { raise error.Bad; } run :: () { @@ -21,7 +21,7 @@ run :: () { print("body\n"); } -main :: () -> s32 { +main :: () -> i32 { run(); return 0; } diff --git a/examples/1051-errors-cleanup-closure-boundary.sx b/examples/1051-errors-cleanup-closure-boundary.sx index aab9bfa..1dbc42d 100644 --- a/examples/1051-errors-cleanup-closure-boundary.sx +++ b/examples/1051-errors-cleanup-closure-boundary.sx @@ -24,7 +24,7 @@ E :: error { Bad } failing :: () -> !E { raise error.Bad; } -recover :: () -> (s32, !E) { return 21; } +recover :: () -> (i32, !E) { return 21; } work :: () { defer { @@ -42,7 +42,7 @@ work :: () { print("body\n"); } -main :: () -> s32 { +main :: () -> i32 { work(); return 0; } diff --git a/examples/1052-errors-cleanup-transitive-reject.sx b/examples/1052-errors-cleanup-transitive-reject.sx index 4a209e7..c83064e 100644 --- a/examples/1052-errors-cleanup-transitive-reject.sx +++ b/examples/1052-errors-cleanup-transitive-reject.sx @@ -13,7 +13,7 @@ E :: error { Bad } failing :: () -> !E { raise error.Bad; } -work :: (n: s32) -> !E { +work :: (n: i32) -> !E { defer { if n > 0 { failing(); // REJECTED: nested in the `if` then-branch @@ -30,7 +30,7 @@ work :: (n: s32) -> !E { return; } -main :: () -> s32 { +main :: () -> i32 { a := work(-1); return 0; } diff --git a/examples/1053-errors-nested-lambda-liveness-reject.sx b/examples/1053-errors-nested-lambda-liveness-reject.sx index 09b41f2..243eb3a 100644 --- a/examples/1053-errors-nested-lambda-liveness-reject.sx +++ b/examples/1053-errors-nested-lambda-liveness-reject.sx @@ -12,20 +12,20 @@ E :: error { Bad } -parse :: (n: s32) -> (s32, !E) { +parse :: (n: i32) -> (i32, !E) { if n < 0 { raise error.Bad; } return n * 10; } build :: () { - emit := () -> s32 { + emit := () -> i32 { v, err := parse(5); return v; // REJECTED: err not proven absent (inside lambda) }; print("unreached\n"); } -main :: () -> s32 { +main :: () -> i32 { build(); return 0; } diff --git a/examples/1054-errors-backtick-reserved-binding.sx b/examples/1054-errors-backtick-reserved-binding.sx index a5cff1d..8528e0e 100644 --- a/examples/1054-errors-backtick-reserved-binding.sx +++ b/examples/1054-errors-backtick-reserved-binding.sx @@ -1,5 +1,5 @@ // Backtick raw identifier as the error-tag binding of `catch` and `onfail`. A -// reserved type-name spelling (`s2`, `u8`) is a value name when backticked, so +// reserved type-name spelling (`i2`, `u8`) is a value name when backticked, so // it is accepted as the tag binding and a later reference resolves to it. A // *bare* reserved spelling in the same position is still rejected (see // examples/1123), so the backtick escape is the only way to spell these tags. @@ -8,15 +8,15 @@ E :: error { Bad, Empty } -parse :: (n: s32) -> (s32, !E) { +parse :: (n: i32) -> (i32, !E) { if n < 0 { raise error.Bad; } if n == 0 { raise error.Empty; } return n * 2; } -// `catch` tag binding spelled `s2`, referenced in the match body. -classify :: (n: s32) -> s32 { - return parse(n) catch (`s2) == { +// `catch` tag binding spelled `i2`, referenced in the match body. +classify :: (n: i32) -> i32 { + return parse(n) catch (`i2) == { case .Bad: 1; case .Empty: 2; else: 3 @@ -24,13 +24,13 @@ classify :: (n: s32) -> s32 { } // `onfail` tag binding spelled `u8`, referenced in the cleanup body. -cleanup :: (n: s32) -> !E { +cleanup :: (n: i32) -> !E { onfail (`u8) { if `u8 == error.Bad { print("cleanup: bad\n"); } } if n < 0 { raise error.Bad; } return; } -main :: () -> s32 { +main :: () -> i32 { print("classify(-1) = {}\n", classify(-1)); print("classify(0) = {}\n", classify(0)); print("classify(5) = {}\n", classify(5)); diff --git a/examples/1055-errors-enum-value-failable-error-slot.sx b/examples/1055-errors-enum-value-failable-error-slot.sx index f8536c2..6e74c1a 100644 --- a/examples/1055-errors-enum-value-failable-error-slot.sx +++ b/examples/1055-errors-enum-value-failable-error-slot.sx @@ -5,7 +5,7 @@ // with the tuple type, which the success-return lowering mistakes for a forwarded // full tuple and leaves the error slot UNDEFINED (read back as garbage nonzero). // -// This pins the slot at RUNTIME on the success path (cast(s64) e, bare `if e`, +// This pins the slot at RUNTIME on the success path (cast(i64) e, bare `if e`, // and `e == error.X`) — not only via the `if !e` proof that the compiler can // fold away. It also exercises a non-zero ordinal (`.blue` = 2) so a value slot // that collapses to 0 is caught, and asserts the error PATH still carries the @@ -22,21 +22,21 @@ pick :: (s: string) -> (Color, !E) { raise error.Nope; } -main :: () -> s32 { +main :: () -> i32 { // ── success path: error slot MUST read 0 at runtime ── c, e := pick("red"); - print("success err int = {}\n", cast(s64) e); // 0 + print("success err int = {}\n", cast(i64) e); // 0 if e { print("bare-if e: ERROR (WRONG)\n"); } else { print("bare-if e: ok\n"); } if e == error.Nope { print("e == Nope (WRONG)\n"); } else { print("e != Nope (ok)\n"); } - if !e { print("guard !e: c = {}\n", cast(s64) c); } // 0 (red) + if !e { print("guard !e: c = {}\n", cast(i64) c); } // 0 (red) // ── non-zero ordinal: value slot must carry the real ordinal ── c2, e2 := pick("blue"); - if !e2 { print("blue: err int = {}, c = {}\n", cast(s64) e2, cast(s64) c2); } // 0, 2 + if !e2 { print("blue: err int = {}, c = {}\n", cast(i64) e2, cast(i64) c2); } // 0, 2 // ── error path: the right tag flows through ── c3, e3 := pick("xxx"); - print("error err nonzero = {}\n", cast(s64) e3 != 0); // true (ordinal is program-global, not pinned) + print("error err nonzero = {}\n", cast(i64) e3 != 0); // true (ordinal is program-global, not pinned) if e3 == error.Nope { print("error: is Nope (ok)\n"); } else { print("error: not Nope (WRONG)\n"); } print("error tag name = {}\n", error_tag_name(e3)); // Nope diff --git a/examples/1056-errors-enum-value-failable-tuple-and-comptime.sx b/examples/1056-errors-enum-value-failable-tuple-and-comptime.sx index 9aa5ef2..7248a41 100644 --- a/examples/1056-errors-enum-value-failable-tuple-and-comptime.sx +++ b/examples/1056-errors-enum-value-failable-tuple-and-comptime.sx @@ -28,38 +28,38 @@ classify :: (s: string) -> (Color, !E) { } // F2: comptime parameter forces inline lowering of the body. -ct_pick :: ($n: s32, s: string) -> (Color, !E) { +ct_pick :: ($n: i32, s: string) -> (Color, !E) { if s == "red" { return .red; } // bare value, inline path → {0, 0} if s == "blue" { return .blue; } // bare value, inline path → {2, 0} raise error.Nope; // inline error path → {undef, 1} } -main :: () -> s32 { +main :: () -> i32 { // ── F1 success (bare value, explicit-tuple error fn): error slot 0 ── c, e := classify("ok"); - print("F1 ok: err int = {}\n", cast(s64) e); // 0 + print("F1 ok: err int = {}\n", cast(i64) e); // 0 if e { print("F1 ok bare-if: ERROR (WRONG)\n"); } else { print("F1 ok bare-if: ok\n"); } - if !e { print("F1 ok guard: c = {}\n", cast(s64) c); } // 2 (blue) + if !e { print("F1 ok guard: c = {}\n", cast(i64) c); } // 2 (blue) // ── F1 error (explicit tuple): right tag flows, no panic ── c2, e2 := classify("bad"); - print("F1 bad: err nonzero = {}\n", cast(s64) e2 != 0); // true (ordinal is program-global, not pinned) + print("F1 bad: err nonzero = {}\n", cast(i64) e2 != 0); // true (ordinal is program-global, not pinned) if e2 == error.Nope { print("F1 bad: is Nope (ok)\n"); } else { print("F1 bad: not Nope (WRONG)\n"); } print("F1 bad: tag name = {}\n", error_tag_name(e2)); // Nope // ── F2 success (comptime-param, inline path): error slot 0 at runtime ── c3, e3 := ct_pick(7, "red"); - print("F2 red: err int = {}\n", cast(s64) e3); // 0 + print("F2 red: err int = {}\n", cast(i64) e3); // 0 if e3 { print("F2 red bare-if: ERROR (WRONG)\n"); } else { print("F2 red bare-if: ok\n"); } if e3 == error.Nope { print("F2 red == Nope (WRONG)\n"); } else { print("F2 red != Nope (ok)\n"); } - if !e3 { print("F2 red guard: c = {}\n", cast(s64) c3); } // 0 + if !e3 { print("F2 red guard: c = {}\n", cast(i64) c3); } // 0 c4, e4 := ct_pick(7, "blue"); - if !e4 { print("F2 blue: err int = {}, c = {}\n", cast(s64) e4, cast(s64) c4); } // 0, 2 + if !e4 { print("F2 blue: err int = {}, c = {}\n", cast(i64) e4, cast(i64) c4); } // 0, 2 // ── F2 error (comptime-param, inline error path): right tag ── c5, e5 := ct_pick(7, "x"); - print("F2 err: err nonzero = {}\n", cast(s64) e5 != 0); // true (ordinal is program-global, not pinned) + print("F2 err: err nonzero = {}\n", cast(i64) e5 != 0); // true (ordinal is program-global, not pinned) if e5 == error.Nope { print("F2 err: is Nope (ok)\n"); } else { print("F2 err: not Nope (WRONG)\n"); } return 0; diff --git a/examples/1100-diagnostics-err-field-not-found.sx b/examples/1100-diagnostics-err-field-not-found.sx index 54d501f..78e71e6 100644 --- a/examples/1100-diagnostics-err-field-not-found.sx +++ b/examples/1100-diagnostics-err-field-not-found.sx @@ -3,7 +3,7 @@ Vec :: struct { x: f32; y: f32; } -main :: () -> s32 { +main :: () -> i32 { v := Vec.{ x = 1.0, y = 2.0 }; return xx v.bogus; } diff --git a/examples/1101-diagnostics-err-tuple-oob.sx b/examples/1101-diagnostics-err-tuple-oob.sx index 834d01f..db0d094 100644 --- a/examples/1101-diagnostics-err-tuple-oob.sx +++ b/examples/1101-diagnostics-err-tuple-oob.sx @@ -1,7 +1,7 @@ // Out-of-range tuple index produces a clear // `error: field 'N' not found on type 'tuple'` diagnostic and exit 1. -main :: () -> s32 { +main :: () -> i32 { t := (10, 20); return xx t.42; } diff --git a/examples/1102-diagnostics-err-dot-shorthand.sx b/examples/1102-diagnostics-err-dot-shorthand.sx index ca43f29..7657add 100644 --- a/examples/1102-diagnostics-err-dot-shorthand.sx +++ b/examples/1102-diagnostics-err-dot-shorthand.sx @@ -1,7 +1,7 @@ // Dot-shorthand `.Variant(args)` without a tagged-union target type produces // `error: cannot infer enum type for '.X'` instead of crashing. -main :: () -> s32 { +main :: () -> i32 { x := .Foo(1, 2); return 0; } diff --git a/examples/1104-diagnostics-callconv-mismatch-diagnostic.sx b/examples/1104-diagnostics-callconv-mismatch-diagnostic.sx index f17685e..9b2eaa4 100644 --- a/examples/1104-diagnostics-callconv-mismatch-diagnostic.sx +++ b/examples/1104-diagnostics-callconv-mismatch-diagnostic.sx @@ -8,7 +8,7 @@ sx_handler :: (arg: *void) -> *void { return arg; } -main :: () -> s32 { +main :: () -> i32 { fp : (*void) -> *void callconv(.c) = sx_handler; return 0; } diff --git a/examples/1106-diagnostics-binop-operand-type-check.sx b/examples/1106-diagnostics-binop-operand-type-check.sx index 44f280c..14d6165 100644 --- a/examples/1106-diagnostics-binop-operand-type-check.sx +++ b/examples/1106-diagnostics-binop-operand-type-check.sx @@ -1,6 +1,6 @@ // Scalar binary operators check operand-type compatibility. The result // type is otherwise taken from the left operand, so mixing a non-numeric -// type (here `string`) would lower as ` : s64` and either reinterpret +// type (here `string`) would lower as ` : i64` and either reinterpret // the string's bytes (arithmetic / bitwise → garbage) or feed mismatched // types to `icmp` (ordering → LLVM verifier failure). All such mismatches // are now rejected at compile time: @@ -13,13 +13,13 @@ #import "modules/std.sx"; -main :: () -> s32 { - n : s64 = 40; +main :: () -> i32 { + n : i64 = 40; s : string = "nope"; - a := n + s; // arithmetic: s64 + string - b := s * n; // arithmetic: non-numeric LHS (string * s64) - c := n < s; // ordering: s64 < string - d := n & s; // bitwise: s64 & string - e := n << s; // shift: s64 << string + a := n + s; // arithmetic: i64 + string + b := s * n; // arithmetic: non-numeric LHS (string * i64) + c := n < s; // ordering: i64 < string + d := n & s; // bitwise: i64 & string + e := n << s; // shift: i64 << string 0 } diff --git a/examples/1107-diagnostics-ref-capture-value-arg-diagnostic.sx b/examples/1107-diagnostics-ref-capture-value-arg-diagnostic.sx index 74b5ea1..61e6c91 100644 --- a/examples/1107-diagnostics-ref-capture-value-arg-diagnostic.sx +++ b/examples/1107-diagnostics-ref-capture-value-arg-diagnostic.sx @@ -5,11 +5,11 @@ #import "modules/std.sx"; -Move :: struct { flag: s64; } +Move :: struct { flag: i64; } -take :: (m: Move) -> s64 { return m.flag; } +take :: (m: Move) -> i64 { return m.flag; } -main :: () -> s32 { +main :: () -> i32 { moves : [2]Move = .[ Move.{ flag = 1 }, Move.{ flag = 2 } ]; for moves (*m) { take(m); diff --git a/examples/1108-diagnostics-pointer-param-value-arg-diagnostic.sx b/examples/1108-diagnostics-pointer-param-value-arg-diagnostic.sx index e3c0e42..ddc4040 100644 --- a/examples/1108-diagnostics-pointer-param-value-arg-diagnostic.sx +++ b/examples/1108-diagnostics-pointer-param-value-arg-diagnostic.sx @@ -6,13 +6,13 @@ #import "modules/std.sx"; -Move :: struct { flag: s64; } +Move :: struct { flag: i64; } -take :: (m: Move) -> s64 { return m.flag; } +take :: (m: Move) -> i64 { return m.flag; } -forward :: (m: *Move) -> s64 { return take(m); } +forward :: (m: *Move) -> i64 { return take(m); } -main :: () -> s32 { +main :: () -> i32 { mv : Move = .{ flag = 7 }; return xx forward(@mv); } diff --git a/examples/1109-diagnostics-deref-non-pointer-reject.sx b/examples/1109-diagnostics-deref-non-pointer-reject.sx index 0c3a008..cb04fb4 100644 --- a/examples/1109-diagnostics-deref-non-pointer-reject.sx +++ b/examples/1109-diagnostics-deref-non-pointer-reject.sx @@ -5,9 +5,9 @@ // emission" panic with no source location. `lowerDerefExpr` now diagnoses it. // Expected: a clean error pointing at the deref; exit 1. -Point :: struct { x: s32; y: s32; } +Point :: struct { x: i32; y: i32; } -main :: () -> s32 { +main :: () -> i32 { p : Point = .{ x = 3, y = 4 }; q := p.*; // ERROR: `p` is a Point value, not a pointer return q.x; diff --git a/examples/1110-diagnostics-autoref-compound-lvalue.sx b/examples/1110-diagnostics-autoref-compound-lvalue.sx index ee546a2..f691406 100644 --- a/examples/1110-diagnostics-autoref-compound-lvalue.sx +++ b/examples/1110-diagnostics-autoref-compound-lvalue.sx @@ -7,12 +7,12 @@ #import "modules/std.sx"; -S :: struct { v: s32; } +S :: struct { v: i32; } W :: struct { s: S; } bump :: (p: *S) { p.v = p.v + 41; } -main :: () -> s32 { +main :: () -> i32 { w : W = .{ s = .{ v = 1 } }; bump(w.s); // field access, no `@` — auto-refs &w.s print("w.s.v = {}\n", w.s.v); // 42, not 1 diff --git a/examples/1111-diagnostics-nondollar-type-param-rejected.sx b/examples/1111-diagnostics-nondollar-type-param-rejected.sx index bf35270..f68dd8d 100644 --- a/examples/1111-diagnostics-nondollar-type-param-rejected.sx +++ b/examples/1111-diagnostics-nondollar-type-param-rejected.sx @@ -5,6 +5,6 @@ // Regression (issue 0064). Expected: one error per `T` use site; exit 1. idwrap :: (T: Type, f: Closure() -> T) -> T { return f(); } -main :: () -> s32 { - return idwrap(s32, closure(() -> s32 { return 7; })); +main :: () -> i32 { + return idwrap(i32, closure(() -> i32 { return 7; })); } diff --git a/examples/1112-diagnostics-unknown-type-name-rejected.sx b/examples/1112-diagnostics-unknown-type-name-rejected.sx index 33f09cc..5e3511f 100644 --- a/examples/1112-diagnostics-unknown-type-name-rejected.sx +++ b/examples/1112-diagnostics-unknown-type-name-rejected.sx @@ -4,10 +4,10 @@ // so the program compiled and ran. Regression (issue 0064, broader fix). // Expected: a clean "unknown type" error at the field; exit 1. Point :: struct { - x: s32; + x: i32; y: Coordnate; // typo for a non-existent type } -main :: () -> s32 { +main :: () -> i32 { return 0; } diff --git a/examples/1113-diagnostics-unknown-type-local-var-rejected.sx b/examples/1113-diagnostics-unknown-type-local-var-rejected.sx index 3a79aaf..7901b58 100644 --- a/examples/1113-diagnostics-unknown-type-local-var-rejected.sx +++ b/examples/1113-diagnostics-unknown-type-local-var-rejected.sx @@ -4,7 +4,7 @@ // empty-struct stub silently gave the local a 0-field type, so `v: Coordnate // = 5` compiled and ran (the `5` dropped) with no diagnostic. Regression // (issue 0064, body-level positions). Expected: error at the annotation; exit 1. -main :: () -> s32 { +main :: () -> i32 { v: Coordnate = 5; return 0; } diff --git a/examples/1114-diagnostics-unknown-type-nested-closure-rejected.sx b/examples/1114-diagnostics-unknown-type-nested-closure-rejected.sx index 0e6ca43..b00e297 100644 --- a/examples/1114-diagnostics-unknown-type-nested-closure-rejected.sx +++ b/examples/1114-diagnostics-unknown-type-nested-closure-rejected.sx @@ -3,8 +3,8 @@ // body walk stopped at closure / nested-function boundaries, so a typo'd type // inside a closure slipped through and silently became a 0-field struct. // Regression (issue 0064, nested scopes). Expected: error at the annotation; exit 1. -main :: () -> s32 { - f := closure(() -> s32 { +main :: () -> i32 { + f := closure(() -> i32 { bad: Coordnate = ---; return 0; }); diff --git a/examples/1115-diagnostics-cast-value-param-rejected.sx b/examples/1115-diagnostics-cast-value-param-rejected.sx index 574b012..110e33b 100644 --- a/examples/1115-diagnostics-cast-value-param-rejected.sx +++ b/examples/1115-diagnostics-cast-value-param-rejected.sx @@ -3,10 +3,10 @@ // silently cast to a fabricated empty struct (an unknown *literal* cast target // already errored via value resolution, but the value-param case was silent). // Regression (issue 0064, cast position). Expected: tailored error; exit 1. -conv :: (T: Type, x: s32) -> s32 { +conv :: (T: Type, x: i32) -> i32 { return cast(T) x; } -main :: () -> s32 { - return conv(s32, 5); +main :: () -> i32 { + return conv(i32, 5); } diff --git a/examples/1116-diagnostics-tuple-type-nontype-element-rejected.sx b/examples/1116-diagnostics-tuple-type-nontype-element-rejected.sx index e77e686..125baec 100644 --- a/examples/1116-diagnostics-tuple-type-nontype-element-rejected.sx +++ b/examples/1116-diagnostics-tuple-type-nontype-element-rejected.sx @@ -1,13 +1,13 @@ -// A tuple literal used in a type position (`(s32, s32)` reinterpreted as a tuple +// A tuple literal used in a type position (`(i32, i32)` reinterpreted as a tuple // type at a type-demanding site like `size_of`) must list only types. A non-type -// element — here the `1` in `(s32, 1)` — is rejected with a user-facing -// diagnostic instead of silently fabricating an `s64` field for that slot. +// element — here the `1` in `(i32, 1)` — is rejected with a user-facing +// diagnostic instead of silently fabricating an `i64` field for that slot. // Regression (issue 0067). // Expected: a clean "tuple type element is not a type" error at the `1`; exit 1. #import "modules/std.sx"; -main :: () -> s32 { - print("bad tuple type size = {}\n", size_of((s32, 1))); +main :: () -> i32 { + print("bad tuple type size = {}\n", size_of((i32, 1))); 0 } diff --git a/examples/1117-diagnostics-value-const-as-type-rejected.sx b/examples/1117-diagnostics-value-const-as-type-rejected.sx index 43f97bb..08a895f 100644 --- a/examples/1117-diagnostics-value-const-as-type-rejected.sx +++ b/examples/1117-diagnostics-value-const-as-type-rejected.sx @@ -11,7 +11,7 @@ NotAType :: 123; -main :: () -> s32 { +main :: () -> i32 { v: NotAType = ---; print("value = {}\n", v); return 0; diff --git a/examples/1118-diagnostics-global-non-const-initializer-rejected.sx b/examples/1118-diagnostics-global-non-const-initializer-rejected.sx index a6a240c..3b1936d 100644 --- a/examples/1118-diagnostics-global-non-const-initializer-rejected.sx +++ b/examples/1118-diagnostics-global-non-const-initializer-rejected.sx @@ -9,11 +9,11 @@ #import "modules/std.sx"; -Point :: struct { x: s32; y: s32; } +Point :: struct { x: i32; y: i32; } K : Point : Point.{ x = 9, y = 4 }; -g : s32 = K.x; +g : i32 = K.x; -main :: () -> s32 { +main :: () -> i32 { print("g={}\n", g); return g; } diff --git a/examples/1119-diagnostics-reserved-type-name-as-identifier.sx b/examples/1119-diagnostics-reserved-type-name-as-identifier.sx index 0477ef6..a5bbfa5 100644 --- a/examples/1119-diagnostics-reserved-type-name-as-identifier.sx +++ b/examples/1119-diagnostics-reserved-type-name-as-identifier.sx @@ -1,15 +1,15 @@ // A value binding (parameter or local `var`) spelled as a reserved/builtin // type name is rejected at the declaration site, across every declaration -// form: a parameter name (`u8`), a typed local (`s64`, `bool`), and a `:=` +// form: a parameter name (`u8`), a typed local (`i64`, `bool`), and a `:=` // local (`string`). Such a spelling parses as a `.type_expr` rather than an // `.identifier`, so the address-of family in lowering mis-lowers it (issue // 0076). Expected: one error per offending name; exit 1. #import "modules/std.sx"; -takes_u8 :: (u8: s32) -> s32 { return u8; } +takes_u8 :: (u8: i32) -> i32 { return u8; } -main :: () -> s32 { - s64 : s32 = 3; +main :: () -> i32 { + i64 : i32 = 3; bool : bool = true; string := "x"; return 0; diff --git a/examples/1120-diagnostics-imported-reserved-type-name.sx b/examples/1120-diagnostics-imported-reserved-type-name.sx index e8b5fe9..1f67e0b 100644 --- a/examples/1120-diagnostics-imported-reserved-type-name.sx +++ b/examples/1120-diagnostics-imported-reserved-type-name.sx @@ -1,4 +1,4 @@ -// A value binding spelled as a reserved type name (`s2`, the `sN` arbitrary- +// A value binding spelled as a reserved type name (`i2`, the `sN` arbitrary- // width int syntax) is rejected at its declaration site even when it lives in // an IMPORTED module — the reserved-name binding diagnostic covers every // compiled module, not just the main file. Without universal coverage the @@ -6,11 +6,11 @@ // passed by value to a `*Box` param). // // Regression (issue 0077): the imported-module facet of issue 0076. Expected: -// one clean diagnostic pointing at the imported module's `s2 := ...`, exit 1 — +// one clean diagnostic pointing at the imported module's `i2 := ...`, exit 1 — // NOT an LLVM verifier abort. #import "modules/std.sx"; mod :: #import "1120-diagnostics-imported-reserved-type-name/mod.sx"; -main :: () -> s32 { +main :: () -> i32 { return mod.run_imported_reserved_name(); } diff --git a/examples/1120-diagnostics-imported-reserved-type-name/mod.sx b/examples/1120-diagnostics-imported-reserved-type-name/mod.sx index c255725..8f95235 100644 --- a/examples/1120-diagnostics-imported-reserved-type-name/mod.sx +++ b/examples/1120-diagnostics-imported-reserved-type-name/mod.sx @@ -1,16 +1,16 @@ #import "modules/std.sx"; -Box :: struct { total: s64 = 0; count: s64 = 0; } +Box :: struct { total: i64 = 0; count: i64 = 0; } -update :: ufcs (self: *Box, n: s64) { +update :: ufcs (self: *Box, n: i64) { self.total += n; self.count += 1; } -run_imported_reserved_name :: () -> s32 { - s2 := Box.{ total = 0, count = 0 }; - update(@s2, 5); - s2.update(7); - print("imported s2 total={} count={}\n", s2.total, s2.count); +run_imported_reserved_name :: () -> i32 { + i2 := Box.{ total = 0, count = 0 }; + update(@i2, 5); + i2.update(7); + print("imported i2 total={} count={}\n", i2.total, i2.count); return 0; } diff --git a/examples/1121-diagnostics-reserved-name-control-flow.sx b/examples/1121-diagnostics-reserved-name-control-flow.sx index 12e76a9..d716396 100644 --- a/examples/1121-diagnostics-reserved-name-control-flow.sx +++ b/examples/1121-diagnostics-reserved-name-control-flow.sx @@ -1,7 +1,7 @@ // Reserved/builtin type names are rejected as binding NAMES across every // control-flow and destructuring form, not just plain `var`/param decls: a -// destructure name (`s2`), an `if`/`while` optional binding (`u8`/`s16`), a -// `for` capture and index name (`bool`/`s32`), and a match-arm capture +// destructure name (`i2`), an `if`/`while` optional binding (`u8`/`i16`), a +// `for` capture and index name (`bool`/`i32`), and a match-arm capture // (`string`). Each spelling parses as a `.type_expr`, so the address-of family // in lowering mis-lowers it (a loaded aggregate passed by value to a `ptr` // param → LLVM verifier abort). The declaration-site diagnostic comes from one @@ -11,17 +11,17 @@ // offending name; exit 1 — NOT an LLVM verifier abort. #import "modules/std.sx"; -pair :: () -> (s64, s64) { (1, 2) } -maybe :: () -> ?s64 { return null; } +pair :: () -> (i64, i64) { (1, 2) } +maybe :: () -> ?i64 { return null; } -main :: () -> s32 { - s2, rest := pair(); // destructure name +main :: () -> i32 { + i2, rest := pair(); // destructure name if u8 := maybe() { } // if optional binding - while s16 := maybe() { break; } // while optional binding - xs := [3]s64.{ 10, 20, 30 }; + while i16 := maybe() { break; } // while optional binding + xs := [3]i64.{ 10, 20, 30 }; for xs (bool) { } // for capture name - for xs, 0.. (v, s32) { } // for index name - opt: ?s64 = 5; + for xs, 0.. (v, i32) { } // for index name + opt: ?i64 = 5; r := if opt == { // match-arm capture case .some: (string) { 0 } case .none: { 0 } diff --git a/examples/1122-diagnostics-reserved-name-impl-method.sx b/examples/1122-diagnostics-reserved-name-impl-method.sx index 289d8cd..d34d06f 100644 --- a/examples/1122-diagnostics-reserved-name-impl-method.sx +++ b/examples/1122-diagnostics-reserved-name-impl-method.sx @@ -1,29 +1,29 @@ // A reserved/builtin type name is rejected as a binding name inside an `impl` -// block's method too — both as a parameter (`u8`) and as a local (`s2`). The +// block's method too — both as a parameter (`u8`) and as a local (`i2`). The // impl method is reached through the exhaustive binding-name walk's // `impl_block` arm (→ each method's `fn_decl`), so an `impl` method is no more // exempt than a free function. Without the diagnostic the reserved local's -// `@s2` mis-lowers (a loaded aggregate passed by value to a `*Box` param → +// `@i2` mis-lowers (a loaded aggregate passed by value to a `*Box` param → // LLVM verifier abort). // // Regression (issue 0076, attempt-4 coverage). Expected: one error for the // param and one for the local; exit 1. #import "modules/std.sx"; -Box :: struct { total: s64 = 0; count: s64 = 0; } -update :: (self: *Box, n: s64) { self.total += n; self.count += 1; } +Box :: struct { total: i64 = 0; count: i64 = 0; } +update :: (self: *Box, n: i64) { self.total += n; self.count += 1; } -Doer :: protocol { go :: (self: *Self, n: s64); } +Doer :: protocol { go :: (self: *Self, n: i64); } impl Doer for Box { - go :: (self: *Box, u8: s64) { - s2 := Box.{ total = 1 }; - update(@s2, u8); - self.total += s2.total; + go :: (self: *Box, u8: i64) { + i2 := Box.{ total = 1 }; + update(@i2, u8); + self.total += i2.total; } } -main :: () -> s32 { +main :: () -> i32 { b := Box.{}; b.go(7); return 0; diff --git a/examples/1123-diagnostics-reserved-name-catch-onfail.sx b/examples/1123-diagnostics-reserved-name-catch-onfail.sx index 53e18f3..91184c1 100644 --- a/examples/1123-diagnostics-reserved-name-catch-onfail.sx +++ b/examples/1123-diagnostics-reserved-name-catch-onfail.sx @@ -1,5 +1,5 @@ // A reserved/builtin type name is rejected as the error-tag binding of a -// `catch` (`u8`) and of an `onfail` (`s64`). Both are reached through the +// `catch` (`u8`) and of an `onfail` (`i64`). Both are reached through the // exhaustive binding-name walk's `catch_expr` / `onfail_stmt` arms. The tag is // a scalar, so before the diagnostic these spellings were silently accepted // (they never reached the address-of mis-lowering) — the binding must still be @@ -11,18 +11,18 @@ E :: error { Bad } -must :: (n: s32) -> !E { +must :: (n: i32) -> !E { if n < 0 { raise error.Bad; } return; } -classify :: (n: s32) -> !E { - onfail (s64) { } // onfail tag binding +classify :: (n: i32) -> !E { + onfail (i64) { } // onfail tag binding must(n) catch (u8) { return; }; // catch tag binding return; } -main :: () -> s32 { +main :: () -> i32 { classify(-1) catch { }; return 0; } diff --git a/examples/1124-diagnostics-imported-reserved-destructure.sx b/examples/1124-diagnostics-imported-reserved-destructure.sx index 7b60588..93e315c 100644 --- a/examples/1124-diagnostics-imported-reserved-destructure.sx +++ b/examples/1124-diagnostics-imported-reserved-destructure.sx @@ -1,4 +1,4 @@ -// A reserved type name used as a DESTRUCTURE binding name (`s2`) is rejected +// A reserved type name used as a DESTRUCTURE binding name (`i2`) is rejected // even when it lives in an IMPORTED module — the exhaustive binding-name walk // descends the `namespace_decl` an `mod :: #import` wraps and renders the // diagnostic against that module's source (issue 0077's universal-coverage @@ -6,10 +6,10 @@ // lowering and aborts LLVM verification. // // Regression (issues 0076 + 0077, attempt-4 coverage). Expected: one clean -// diagnostic pointing at the imported module's `s2, rest := ...`, exit 1. +// diagnostic pointing at the imported module's `i2, rest := ...`, exit 1. #import "modules/std.sx"; mod :: #import "1124-diagnostics-imported-reserved-destructure/mod.sx"; -main :: () -> s32 { +main :: () -> i32 { return mod.run(); } diff --git a/examples/1124-diagnostics-imported-reserved-destructure/mod.sx b/examples/1124-diagnostics-imported-reserved-destructure/mod.sx index 4ae0979..5ea960c 100644 --- a/examples/1124-diagnostics-imported-reserved-destructure/mod.sx +++ b/examples/1124-diagnostics-imported-reserved-destructure/mod.sx @@ -1,8 +1,8 @@ #import "modules/std.sx"; -pair :: () -> (s64, s64) { (1, 2) } +pair :: () -> (i64, i64) { (1, 2) } -run :: () -> s32 { - s2, rest := pair(); // destructure name in an IMPORTED module +run :: () -> i32 { + i2, rest := pair(); // destructure name in an IMPORTED module return 0; } diff --git a/examples/1125-diagnostics-reserved-name-method-param.sx b/examples/1125-diagnostics-reserved-name-method-param.sx index 5578164..e4853d0 100644 --- a/examples/1125-diagnostics-reserved-name-method-param.sx +++ b/examples/1125-diagnostics-reserved-name-method-param.sx @@ -1,7 +1,7 @@ // A reserved/builtin type name used as a PARAMETER name is rejected inside the // two method-with-body forms that carry their params as bare name lists rather // than `Param` nodes: a protocol default-body method (`u8`) and a sx-defined -// foreign-class (`#objc_class`) method (`s16`). The declaration-site diagnostic +// foreign-class (`#objc_class`) method (`i16`). The declaration-site diagnostic // underlines the OFFENDING PARAMETER itself, not the enclosing `protocol` / // `#objc_class` block — each method's `param_name_spans` is threaded from the // parser so the caret lands on the parameter token. @@ -12,19 +12,19 @@ #import "modules/build.sx"; Greeter :: protocol { - greet :: (self: *Self, u8: s64) -> s64 { + greet :: (self: *Self, u8: i64) -> i64 { return u8; } } SxFoo :: #objc_class("SxFoo") { - counter: s32; + counter: i32; - bump :: (self: *Self, s16: s32) { - self.counter += s16; + bump :: (self: *Self, i16: i32) { + self.counter += i16; } } -main :: () -> s32 { +main :: () -> i32 { return 0; } diff --git a/examples/1126-diagnostics-global-aggregate-non-const-field-rejected.sx b/examples/1126-diagnostics-global-aggregate-non-const-field-rejected.sx index d2dd9e2..6852a24 100644 --- a/examples/1126-diagnostics-global-aggregate-non-const-field-rejected.sx +++ b/examples/1126-diagnostics-global-aggregate-non-const-field-rejected.sx @@ -10,12 +10,12 @@ #import "modules/std.sx"; -runtime_marker :: () -> s64 { return 7; } +runtime_marker :: () -> i64 { return 7; } -Box :: struct { p: *s64; marker: s64; } +Box :: struct { p: *i64; marker: i64; } boxes : [1]Box = .[ .{ p = null, marker = runtime_marker() } ]; -main :: () -> s32 { +main :: () -> i32 { print("marker={}\n", boxes[0].marker); return 0; } diff --git a/examples/1127-diagnostics-global-enum-literal-bad-variant.sx b/examples/1127-diagnostics-global-enum-literal-bad-variant.sx index 01891ef..3f99012 100644 --- a/examples/1127-diagnostics-global-enum-literal-bad-variant.sx +++ b/examples/1127-diagnostics-global-enum-literal-bad-variant.sx @@ -10,7 +10,7 @@ Color :: enum u8 { red; green; blue; } bad : Color = .purple; -main :: () -> s32 { +main :: () -> i32 { print("{}\n", bad); return 0; } diff --git a/examples/1128-diagnostics-comptime-global-funcref-rejected.sx b/examples/1128-diagnostics-comptime-global-funcref-rejected.sx index 38be1aa..352bb8a 100644 --- a/examples/1128-diagnostics-comptime-global-funcref-rejected.sx +++ b/examples/1128-diagnostics-comptime-global-funcref-rejected.sx @@ -14,13 +14,13 @@ #import "modules/std.sx"; -add :: (a: s32, b: s32) -> s32 { a + b } +add :: (a: i32, b: i32) -> i32 { a + b } -pick :: () -> (s32, s32) -> s32 { return add; } +pick :: () -> (i32, i32) -> i32 { return add; } fp :: #run pick(); -main :: () -> s32 { +main :: () -> i32 { print("{}\n", fp(3, 4)); return 0; } diff --git a/examples/1129-diagnostics-array-dim-not-const.sx b/examples/1129-diagnostics-array-dim-not-const.sx index 3e74efb..6e481df 100644 --- a/examples/1129-diagnostics-array-dim-not-const.sx +++ b/examples/1129-diagnostics-array-dim-not-const.sx @@ -14,8 +14,8 @@ // with a non-zero exit. #import "modules/std.sx"; -get :: () -> s64 { return 5; } -BadArr :: [get()]s64; +get :: () -> i64 { return 5; } +BadArr :: [get()]i64; main :: () { a : BadArr = ---; diff --git a/examples/1130-diagnostics-array-dim-oversized-u32.sx b/examples/1130-diagnostics-array-dim-oversized-u32.sx index 9ff8eae..f4c0cd7 100644 --- a/examples/1130-diagnostics-array-dim-oversized-u32.sx +++ b/examples/1130-diagnostics-array-dim-oversized-u32.sx @@ -1,5 +1,5 @@ // An array dimension that folds to a valid compile-time integer but exceeds a -// `u32` (`[5_000_000_000]s64`) is a hard error — a clean sx diagnostic with a +// `u32` (`[5_000_000_000]i64`) is a hard error — a clean sx diagnostic with a // non-zero exit, NOT a compiler panic. // // Regression (issue 0087 / F0.4 attempt 6): the dimension folded to a valid i64 @@ -10,6 +10,6 @@ #import "modules/std.sx"; main :: () { - a : [5000000000]s64 = ---; + a : [5000000000]i64 = ---; print("unreachable: {}\n", a.len); } diff --git a/examples/1131-diagnostics-array-dim-oversized-u32-alias.sx b/examples/1131-diagnostics-array-dim-oversized-u32-alias.sx index db32bc0..754b3fc 100644 --- a/examples/1131-diagnostics-array-dim-oversized-u32-alias.sx +++ b/examples/1131-diagnostics-array-dim-oversized-u32-alias.sx @@ -1,7 +1,7 @@ // An array dimension that folds to a valid compile-time integer but exceeds a // `u32` is a hard error — and it must report the SAME precise diagnostic whether -// the array is written directly (`a : [5_000_000_000]s64`, see example 1130) or -// behind a type ALIAS (`Big :: [5_000_000_000]s64`, here). Both forms now route +// the array is written directly (`a : [5_000_000_000]i64`, see example 1130) or +// behind a type ALIAS (`Big :: [5_000_000_000]i64`, here). Both forms now route // the dimension through one shared folder + one shared message map, so they // cannot diverge. // @@ -15,7 +15,7 @@ // see example 1129.) #import "modules/std.sx"; -Big :: [5000000000]s64; +Big :: [5000000000]i64; main :: () { a : Big = ---; diff --git a/examples/1132-diagnostics-array-dim-non-integral-float.sx b/examples/1132-diagnostics-array-dim-non-integral-float.sx index 79c70da..2400a96 100644 --- a/examples/1132-diagnostics-array-dim-non-integral-float.sx +++ b/examples/1132-diagnostics-array-dim-non-integral-float.sx @@ -14,6 +14,6 @@ N : f64 : 4.5; main :: () { - a : [N]s64 = ---; + a : [N]i64 = ---; print("unreachable: {}\n", a.len); } diff --git a/examples/1133-diagnostics-array-dim-negative-float.sx b/examples/1133-diagnostics-array-dim-negative-float.sx index d7a94b7..803ec79 100644 --- a/examples/1133-diagnostics-array-dim-negative-float.sx +++ b/examples/1133-diagnostics-array-dim-negative-float.sx @@ -7,6 +7,6 @@ #import "modules/std.sx"; main :: () { - a : [-2.0]s64 = ---; + a : [-2.0]i64 = ---; print("unreachable: {}\n", a.len); } diff --git a/examples/1134-diagnostics-value-param-u32-overflow.sx b/examples/1134-diagnostics-value-param-u32-overflow.sx index 1d5e950..1c2ad43 100644 --- a/examples/1134-diagnostics-value-param-u32-overflow.sx +++ b/examples/1134-diagnostics-value-param-u32-overflow.sx @@ -9,7 +9,7 @@ // so an oversized value is rejected before instantiation. #import "modules/std.sx"; -Box :: struct ($K: u32) { value: s64; } +Box :: struct ($K: u32) { value: i64; } main :: () { b : Box(5000000000) = ---; diff --git a/examples/1135-diagnostics-value-param-alias-constraint-overflow.sx b/examples/1135-diagnostics-value-param-alias-constraint-overflow.sx index 9812c67..9bdc97b 100644 --- a/examples/1135-diagnostics-value-param-alias-constraint-overflow.sx +++ b/examples/1135-diagnostics-value-param-alias-constraint-overflow.sx @@ -1,20 +1,20 @@ // A generic value-param arg that does not fit the param's declared integer type // is a hard error even when that type is reached through a type ALIAS -// (`$K: Count` where `Count :: u32`, `$K: Small` where `Small :: s8`) — a clean +// (`$K: Count` where `Count :: u32`, `$K: Small` where `Small :: i8`) — a clean // diagnostic + non-zero exit, NOT a silent truncating bind. // // Regression (issue 0083): the value-param range gate matched only BUILTIN // constraint names, so an aliased constraint slipped past `intTypeRange` and // `Box(5_000_000_000)` with `$K: Count` compiled and bound a truncated value. // The constraint now resolves to its underlying builtin (`Count` → u32, -// `Small` → s8) before range-checking, so an aliased integer constraint behaves +// `Small` → i8) before range-checking, so an aliased integer constraint behaves // exactly like the builtin it names — at both the struct and type-fn binders. #import "modules/std.sx"; Count :: u32; -Small :: s8; -Box :: struct ($K: Count) { value: s64; } -Tiny :: struct ($K: Small) { value: s64; } +Small :: i8; +Box :: struct ($K: Count) { value: i64; } +Tiny :: struct ($K: Small) { value: i64; } main :: () { b : Box(5000000000) = ---; diff --git a/examples/1136-diagnostics-array-dim-nonconst-direct-no-crash.sx b/examples/1136-diagnostics-array-dim-nonconst-direct-no-crash.sx index 8b277ba..e9a2421 100644 --- a/examples/1136-diagnostics-array-dim-nonconst-direct-no-crash.sx +++ b/examples/1136-diagnostics-array-dim-nonconst-direct-no-crash.sx @@ -13,10 +13,10 @@ // build with no fabrication and no panic. #import "modules/std.sx"; -get :: () -> s64 { return 5; } +get :: () -> i64 { return 5; } main :: () { - a : [get()]s64 = ---; + a : [get()]i64 = ---; a[0] = 7; print("unreachable: {} {}\n", a.len, a[0]); } diff --git a/examples/1137-diagnostics-value-param-type-fn-no-cascade.sx b/examples/1137-diagnostics-value-param-type-fn-no-cascade.sx index 4ae3cfb..2101a7a 100644 --- a/examples/1137-diagnostics-value-param-type-fn-no-cascade.sx +++ b/examples/1137-diagnostics-value-param-type-fn-no-cascade.sx @@ -20,8 +20,8 @@ MakeC :: ($K: Count, $T: Type) -> Type { return [K]T; } get :: () -> u32 { return 4; } main :: () { - a : MakeC(5000000000, s64) = ---; - b : MakeC(get(), s64) = ---; + a : MakeC(5000000000, i64) = ---; + b : MakeC(get(), i64) = ---; c : MakeC(3, NoSuchType) = ---; print("unreachable {} {} {}\n", a.len, b.len, c.len); } diff --git a/examples/1140-diagnostics-reserved-name-const-fn-decl.sx b/examples/1140-diagnostics-reserved-name-const-fn-decl.sx index 270a594..07381f4 100644 --- a/examples/1140-diagnostics-reserved-name-const-fn-decl.sx +++ b/examples/1140-diagnostics-reserved-name-const-fn-decl.sx @@ -1,19 +1,19 @@ // A reserved/builtin type-name spelling is rejected as the NAME of a `::` -// declaration too — both a constant (`s2 :: 5`) and a function +// declaration too — both a constant (`i2 :: 5`) and a function // (`u8 :: (…) {…}`). A function name and a const name are binding sites just -// like `s2 := …`; previously the `::` decl forms slipped past the +// like `i2 := …`; previously the `::` decl forms slipped past the // reserved-name check, so a bare reserved-name function compiled silently and // became callable — bypassing the backtick rule that handwritten sx must use. -// The backtick escape (`` `s2 :: … ``, examples/0153) is the only way to spell +// The backtick escape (`` `i2 :: … ``, examples/0153) is the only way to spell // these names; `#import c` foreign decls remain exempt (examples/1220). // // Regression (issue 0089). Expected: one error per declaration, each caret on // the declared name; exit 1. #import "modules/std.sx"; -s2 :: 5; -u8 :: (n: s64) -> s64 { return n + 7; } +i2 :: 5; +u8 :: (n: i64) -> i64 { return n + 7; } -main :: () -> s32 { +main :: () -> i32 { return 0; } diff --git a/examples/1141-diagnostics-reserved-name-type-decl.sx b/examples/1141-diagnostics-reserved-name-type-decl.sx index d7cc59c..8e834ba 100644 --- a/examples/1141-diagnostics-reserved-name-type-decl.sx +++ b/examples/1141-diagnostics-reserved-name-type-decl.sx @@ -2,8 +2,8 @@ // type-introducing `::` declaration too — struct, enum, union, error-set, and // a typed constant — not just `:=` / value-const / function names (those are // examples/1140). Each is a declaration-name binding site: a bare reserved -// spelling there mis-classifies and is rejected, exactly like `s2 := …`. The -// backtick escape (`` `s2 :: struct{…} ``, examples/0154) is the only way to +// spelling there mis-classifies and is rejected, exactly like `i2 := …`. The +// backtick escape (`` `i2 :: struct{…} ``, examples/0154) is the only way to // spell these names in handwritten sx; `#import c` foreign decls stay exempt // (examples/1220). // @@ -11,12 +11,12 @@ // Expected: one error per declaration, each caret ON the declared name; exit 1. #import "modules/std.sx"; -s8 :: struct { v: s64; } -s16 :: enum { A; B; } -u16 :: union { a: s32; b: f32; } +i8 :: struct { v: i64; } +i16 :: enum { A; B; } +u16 :: union { a: i32; b: f32; } u32 :: error { Bad, Empty } -s2 : s64 : 5; +i2 : i64 : 5; -main :: () -> s32 { +main :: () -> i32 { return 0; } diff --git a/examples/1142-diagnostics-reserved-name-struct-const.sx b/examples/1142-diagnostics-reserved-name-struct-const.sx index b07c455..fd54c44 100644 --- a/examples/1142-diagnostics-reserved-name-struct-const.sx +++ b/examples/1142-diagnostics-reserved-name-struct-const.sx @@ -1,6 +1,6 @@ // A bare reserved/builtin type-name spelling is rejected as the NAME of a -// STRUCT-BODY constant too — both the untyped (`s2 :: 5`) and the typed -// (`u8 : s64 : 9`) forms — exactly like a top-level const (examples/1140) or a +// STRUCT-BODY constant too — both the untyped (`i2 :: 5`) and the typed +// (`u8 : i64 : 9`) forms — exactly like a top-level const (examples/1140) or a // type decl (examples/1141). A struct member constant is a binding site, so a // bare reserved spelling mis-classifies and is rejected; the caret lands ON the // constant's name (not at 1:1). The backtick escape (examples/0156) is the only @@ -11,10 +11,10 @@ #import "modules/std.sx"; Holder :: struct { - s2 :: 5; - u8 : s64 : 9; + i2 :: 5; + u8 : i64 : 9; } -main :: () -> s32 { +main :: () -> i32 { return 0; } diff --git a/examples/1143-diagnostics-typed-module-const-mismatch.sx b/examples/1143-diagnostics-typed-module-const-mismatch.sx index f8b3b50..c3936e9 100644 --- a/examples/1143-diagnostics-typed-module-const-mismatch.sx +++ b/examples/1143-diagnostics-typed-module-const-mismatch.sx @@ -6,14 +6,14 @@ // // Regression (issue 0088): `N : string : 4` was accepted; `print(N)` then // segfaulted (an integer emitted as a `string` const → a bogus pointer) and -// `[N]s64` folded `N` to 4. The fix rejects the declaration at the root. The +// `[N]i64` folded `N` to 4. The fix rejects the declaration at the root. The // validation is type-based, so a const-EXPRESSION initializer (`E : string : // M + 2`, `V : string : -M`) is rejected just like a literal — not skipped // because its node kind isn't a literal (issue 0088, attempt 2). // -// The mixed-numeric pair (`s64 : M + 0.5`, `s64 : 0.5 + M`) is rejected in BOTH +// The mixed-numeric pair (`i64 : M + 0.5`, `i64 : 0.5 + M`) is rejected in BOTH // operand orders: arithmetic binary-op inference now promotes int+float to the -// float result (`Lowering.arithResultType`), so an s64 annotation no longer +// float result (`Lowering.arithResultType`), so an i64 annotation no longer // matches a float-producing initializer regardless of which operand is the // float (issue 0088, attempt 3 — the inferExprType promotion root fix). @@ -22,13 +22,13 @@ M :: 2; N : string : 4; // integer literal where a string is annotated -F : s64 : "x"; // string literal where an integer is annotated -B : s64 : true; // boolean literal where an integer is annotated -G : s64 : 1.5; // float literal where an integer is annotated +F : i64 : "x"; // string literal where an integer is annotated +B : i64 : true; // boolean literal where an integer is annotated +G : i64 : 1.5; // float literal where an integer is annotated E : string : M + 2; // integer EXPRESSION where a string is annotated V : string : -M; // integer (unary) expression where a string is annotated -BAD : s64 : M + 0.5; // mixed int+float (int LHS) → f64, rejected vs s64 -BAD2 : s64 : 0.5 + M; // mixed float+int (float LHS) → f64, rejected vs s64 — order-independent +BAD : i64 : M + 0.5; // mixed int+float (int LHS) → f64, rejected vs i64 +BAD2 : i64 : 0.5 + M; // mixed float+int (float LHS) → f64, rejected vs i64 — order-independent main :: () { print("unreachable\n"); diff --git a/examples/1145-diagnostics-missing-struct-field-assign.sx b/examples/1145-diagnostics-missing-struct-field-assign.sx index b8dffa8..fa6b870 100644 --- a/examples/1145-diagnostics-missing-struct-field-assign.sx +++ b/examples/1145-diagnostics-missing-struct-field-assign.sx @@ -4,25 +4,25 @@ // into a neighbouring field. // // Regression (issue 0094): the lvalue field lookup left `field_ty = .unresolved` -// (lowerAssignment's assignment-target path) or silently GEP'd field 0 as `.s64` +// (lowerAssignment's assignment-target path) or silently GEP'd field 0 as `.i64` // (lowerExprAsPtr's fallback / lowerMultiAssign's struct loop), so a missing-field // store either built a pointer-to-`.unresolved` that panicked at LLVM emission or // silently wrote field 0. All three lvalue sites now emit the field-not-found // diagnostic: the assignment-target path (`p.q`), the nested lvalue-pointer path // (`o.missing.a`), and the multi-target store path (`p.r, y`). -Point :: struct { x: s64; } -Inner :: struct { a: s64; } +Point :: struct { x: i64; } +Inner :: struct { a: i64; } Outer :: struct { inner: Inner; } -main :: () -> s32 { +main :: () -> i32 { p := Point.{ x = 1 }; p.q = 2; // site 1: lowerAssignment target path o := Outer.{ inner = Inner.{ a = 1 } }; o.missing.a = 5; // site 2: lowerExprAsPtr fallback - y : s64 = 0; + y : i64 = 0; p.r, y = 3, 4; // site 3: lowerMultiAssign field path return 0; diff --git a/examples/1146-diagnostics-nonintegral-float-to-int.sx b/examples/1146-diagnostics-nonintegral-float-to-int.sx index abd262d..d5870ed 100644 --- a/examples/1146-diagnostics-nonintegral-float-to-int.sx +++ b/examples/1146-diagnostics-nonintegral-float-to-int.sx @@ -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()); diff --git a/examples/1147-diagnostics-float-division-narrowing.sx b/examples/1147-diagnostics-float-division-narrowing.sx index fe20d88..3689bb0 100644 --- a/examples/1147-diagnostics-float-division-narrowing.sx +++ b/examples/1147-diagnostics-float-division-narrowing.sx @@ -20,7 +20,7 @@ // integer truncating division; each now rejects the non-integral float. #import "modules/std.sx"; -// An UNTYPED float-EXPRESSION const carries a placeholder `s64` type, yet its +// An UNTYPED float-EXPRESSION const carries a placeholder `i64` type, yet its // value is float — `ME / 2` is still float division and must reject (judged by // the const's VALUE, not its declared type), at BOTH the typed-binding path and // the count path. @@ -28,19 +28,19 @@ ME :: 4.0 + 1.0; // untyped float-EXPRESSION const (= 5.0) // Typed CONST: declared but not referenced, so the single narrowing error is not // followed by a downstream "unresolved const" cascade. -K : s64 : 5.0 / 2.0; // 2.5 non-integral float-DIVISION const → error +K : i64 : 5.0 / 2.0; // 2.5 non-integral float-DIVISION const → error BadField :: struct { - f : s64 = 5.0 / 2.0; // non-integral float-DIVISION field default → error + f : i64 = 5.0 / 2.0; // non-integral float-DIVISION field default → error } -badParam :: (x : s64 = 5.0 / 2.0) -> s64 { return x; } // float-DIVISION param default → error +badParam :: (x : i64 = 5.0 / 2.0) -> i64 { return x; } // float-DIVISION param default → error main :: () { - local : s64 = 5.0 / 2.0; // non-integral float-DIVISION local → error - dim : [5.0 / 2.0]s64 = ---; // non-integral float-DIVISION array dimension → error - cdiv : s64 = ME / 2; // untyped float-EXPR const division (5.0/2 = 2.5) → error - cdim : [ME / 2]s64 = ---; // same, at the count path → error + local : i64 = 5.0 / 2.0; // non-integral float-DIVISION local → error + dim : [5.0 / 2.0]i64 = ---; // non-integral float-DIVISION array dimension → error + cdiv : i64 = ME / 2; // untyped float-EXPR const division (5.0/2 = 2.5) → error + cdim : [ME / 2]i64 = ---; // same, at the count path → error b := BadField.{}; print("{} {} {} {} {} {}\n", local, b.f, badParam(), dim.len, cdiv, cdim.len); } diff --git a/examples/1148-diagnostics-value-shadow-field-dim-not-const.sx b/examples/1148-diagnostics-value-shadow-field-dim-not-const.sx index d6554c3..350a795 100644 --- a/examples/1148-diagnostics-value-shadow-field-dim-not-const.sx +++ b/examples/1148-diagnostics-value-shadow-field-dim-not-const.sx @@ -1,7 +1,7 @@ // A raw value binding whose spelling shadows a builtin INTEGER type name -// (`` `s8 ``) used as an array DIMENSION through one of its fields. Field -// access on a raw value is an ORDINARY runtime field read, so `` `s8.max `` is -// a runtime value — NOT the builtin `s8.max` (= 127) and NOT a compile-time +// (`` `i8 ``) used as an array DIMENSION through one of its fields. Field +// access on a raw value is an ORDINARY runtime field read, so `` `i8.max `` is +// a runtime value — NOT the builtin `i8.max` (= 127) and NOT a compile-time // constant. An array dimension demands a compile-time integer constant, so the // dimension is rejected with the same diagnostic a plainly-named runtime field // read (`b.max`) earns — the backtick spelling changes nothing. @@ -18,12 +18,12 @@ // Regression (issue 0095 / F0.11-7). #import "modules/std.sx"; -DimBox :: struct { max: s64; } +DimBox :: struct { max: i64; } main :: () { - `s8 := DimBox.{ max = 3 }; - // Raw value-shadow field read → a runtime value, not the builtin `s8.max` + `i8 := DimBox.{ max = 3 }; + // Raw value-shadow field read → a runtime value, not the builtin `i8.max` // (127) and not a compile-time constant → rejected as a non-const dim. - arr : [`s8.max]f32 = ---; + arr : [`i8.max]f32 = ---; print("len={}\n", arr.len); } diff --git a/examples/1149-diagnostics-for-colon-removed.sx b/examples/1149-diagnostics-for-colon-removed.sx index e6ced46..c151516 100644 --- a/examples/1149-diagnostics-for-colon-removed.sx +++ b/examples/1149-diagnostics-for-colon-removed.sx @@ -4,6 +4,6 @@ #import "modules/std.sx"; main :: () { - xs : [2]s64 = .[1, 2]; + xs : [2]i64 = .[1, 2]; for xs: (x) { } } diff --git a/examples/1150-diagnostics-for-capture-arity.sx b/examples/1150-diagnostics-for-capture-arity.sx index e2249dd..1a3df12 100644 --- a/examples/1150-diagnostics-for-capture-arity.sx +++ b/examples/1150-diagnostics-for-capture-arity.sx @@ -3,7 +3,7 @@ #import "modules/std.sx"; main :: () { - xs : [2]s64 = .[1, 2]; - ys : [2]s64 = .[3, 4]; + xs : [2]i64 = .[1, 2]; + ys : [2]i64 = .[3, 4]; for xs, ys (x) { } } diff --git a/examples/1154-diagnostics-for-call-needs-capture.sx b/examples/1154-diagnostics-for-call-needs-capture.sx index c654016..d76af60 100644 --- a/examples/1154-diagnostics-for-call-needs-capture.sx +++ b/examples/1154-diagnostics-for-call-needs-capture.sx @@ -4,7 +4,7 @@ #import "modules/std.sx"; -g :: () -> s64 { 1 } +g :: () -> i64 { 1 } main :: () { for g() { } diff --git a/examples/1155-diagnostics-for-not-iterable.sx b/examples/1155-diagnostics-for-not-iterable.sx index f6c89e0..badb2de 100644 --- a/examples/1155-diagnostics-for-not-iterable.sx +++ b/examples/1155-diagnostics-for-not-iterable.sx @@ -4,7 +4,7 @@ #import "modules/std.sx"; -f :: (n: s64) -> s64 { n } +f :: (n: i64) -> i64 { n } main :: () { n := 1; diff --git a/examples/1156-diagnostics-int-literal-out-of-range.sx b/examples/1156-diagnostics-int-literal-out-of-range.sx index cc56168..06ba6df 100644 --- a/examples/1156-diagnostics-int-literal-out-of-range.sx +++ b/examples/1156-diagnostics-int-literal-out-of-range.sx @@ -1,11 +1,11 @@ // An integer literal that does not fit its integer target type is a // compile error (no silent wrap): both faces diagnosed in one run. -// Regression (issue 0112): `x : s8 = 300` bound 44, `y : u8 = 256` bound 0. +// Regression (issue 0112): `x : i8 = 300` bound 44, `y : u8 = 256` bound 0. #import "modules/std.sx"; main :: () { - x : s8 = 300; + x : i8 = 300; print("x: {}\n", x); y : u8 = 256; print("y: {}\n", y); diff --git a/examples/1157-diagnostics-catch-binding-needs-parens.sx b/examples/1157-diagnostics-catch-binding-needs-parens.sx index 21c52f1..4eb3ee0 100644 --- a/examples/1157-diagnostics-catch-binding-needs-parens.sx +++ b/examples/1157-diagnostics-catch-binding-needs-parens.sx @@ -6,7 +6,7 @@ E :: error { Bad }; -f :: () -> (s64, !E) { raise error.Bad; } +f :: () -> (i64, !E) { raise error.Bad; } main :: () { v := f() catch e { 0 }; diff --git a/examples/1158-diagnostics-import-dir-file-ambiguous.sx b/examples/1158-diagnostics-import-dir-file-ambiguous.sx index 0fab5f5..54340db 100644 --- a/examples/1158-diagnostics-import-dir-file-ambiguous.sx +++ b/examples/1158-diagnostics-import-dir-file-ambiguous.sx @@ -6,6 +6,6 @@ #import "modules/std"; -main :: () -> s32 { +main :: () -> i32 { 0 } diff --git a/examples/1159-diagnostics-array-const-mixed-elements.sx b/examples/1159-diagnostics-array-const-mixed-elements.sx index af6917a..42a84c0 100644 --- a/examples/1159-diagnostics-array-const-mixed-elements.sx +++ b/examples/1159-diagnostics-array-const-mixed-elements.sx @@ -1,5 +1,5 @@ // An untyped array-literal constant infers its element type from the -// elements (ints -> s64; a numeric int/float mix promotes to f64). A +// elements (ints -> i64; a numeric int/float mix promotes to f64). A // NON-NUMERIC mix has no unified element type — diagnosed, with the // annotation as the fix. diff --git a/examples/1160-diagnostics-array-const-runtime-element.sx b/examples/1160-diagnostics-array-const-runtime-element.sx index f2d3268..356d140 100644 --- a/examples/1160-diagnostics-array-const-runtime-element.sx +++ b/examples/1160-diagnostics-array-const-runtime-element.sx @@ -4,8 +4,8 @@ #import "modules/std.sx"; -f :: () -> s64 { 7 } -BAD : [2]s64 : .[1, f()]; +f :: () -> i64 { 7 } +BAD : [2]i64 : .[1, f()]; main :: () { print("{}\n", BAD[0]); diff --git a/examples/1161-diagnostics-array-const-dim-mismatch.sx b/examples/1161-diagnostics-array-const-dim-mismatch.sx index a13f46c..9362cfc 100644 --- a/examples/1161-diagnostics-array-const-dim-mismatch.sx +++ b/examples/1161-diagnostics-array-const-dim-mismatch.sx @@ -3,7 +3,7 @@ #import "modules/std.sx"; -BAD : [3]s64 : .[1, 2]; +BAD : [3]i64 : .[1, 2]; main :: () { print("{}\n", BAD[0]); diff --git a/examples/1162-diagnostics-const-write-rejected.sx b/examples/1162-diagnostics-const-write-rejected.sx index 64ac9b8..71eebdd 100644 --- a/examples/1162-diagnostics-const-write-rejected.sx +++ b/examples/1162-diagnostics-const-write-rejected.sx @@ -6,10 +6,10 @@ #import "modules/std.sx"; -Color :: struct { r, g, b: s64; } +Color :: struct { r, g, b: i64; } WHITE :: Color.{ r = 255, g = 255, b = 255 }; -K : [4]s64 : .[11, 22, 33, 44]; -N : s64 : 4; +K : [4]i64 : .[11, 22, 33, 44]; +N : i64 : 4; main :: () { WHITE.r = 0; diff --git a/examples/1163-diagnostics-array-const-index-oob.sx b/examples/1163-diagnostics-array-const-index-oob.sx index d20ba8d..e582f34 100644 --- a/examples/1163-diagnostics-array-const-index-oob.sx +++ b/examples/1163-diagnostics-array-const-index-oob.sx @@ -4,7 +4,7 @@ #import "modules/std.sx"; -K : [4]s64 : .[11, 22, 33, 44]; +K : [4]i64 : .[11, 22, 33, 44]; main :: () { b : [K[9]]u8 = ---; diff --git a/examples/1164-diagnostics-inline-for-pack-rejections.sx b/examples/1164-diagnostics-inline-for-pack-rejections.sx index 9b14b53..ca4a452 100644 --- a/examples/1164-diagnostics-inline-for-pack-rejections.sx +++ b/examples/1164-diagnostics-inline-for-pack-rejections.sx @@ -7,7 +7,7 @@ #import "modules/std.sx"; Show :: protocol { show :: () -> string; } -IntBox :: struct { v: s64; } +IntBox :: struct { v: i64; } impl Show for IntBox { show :: (self: *IntBox) -> string { int_to_string(self.v) } } leak :: (..xs: Show) { diff --git a/examples/1165-diagnostics-generic-return-unbound.sx b/examples/1165-diagnostics-generic-return-unbound.sx index 0116313..d9aef7c 100644 --- a/examples/1165-diagnostics-generic-return-unbound.sx +++ b/examples/1165-diagnostics-generic-return-unbound.sx @@ -10,12 +10,12 @@ make :: () -> $T { 0 } Foo :: struct { - x: s64; + x: i64; weird :: (self: *Foo) -> $T { 0 } } Show2 :: protocol { show2 :: () -> string; } -IntBox :: struct { v: s64; } +IntBox :: struct { v: i64; } impl Show2 for IntBox { show2 :: (self: *IntBox) -> string { "x" } leak :: (self: *IntBox) -> $T { 0 } diff --git a/examples/1166-diagnostics-ufcs-not-opted-in.sx b/examples/1166-diagnostics-ufcs-not-opted-in.sx index a13c1bf..54811b2 100644 --- a/examples/1166-diagnostics-ufcs-not-opted-in.sx +++ b/examples/1166-diagnostics-ufcs-not-opted-in.sx @@ -3,9 +3,9 @@ #import "modules/std.sx"; -bump :: (x: s64) -> s64 { x + 1 } +bump :: (x: i64) -> i64 { x + 1 } main :: () { - f : s64 = 40; + f : i64 = 40; print("{}\n", f.bump()); } diff --git a/examples/1167-diagnostics-call-arity-mismatch.sx b/examples/1167-diagnostics-call-arity-mismatch.sx index 2904546..8c54847 100644 --- a/examples/1167-diagnostics-call-arity-mismatch.sx +++ b/examples/1167-diagnostics-call-arity-mismatch.sx @@ -6,16 +6,16 @@ #import "modules/std.sx"; -add2 :: (a: s64, b: s64) -> s64 { return a + b; } +add2 :: (a: i64, b: i64) -> i64 { return a + b; } Point :: struct { - x: s64; - scaled :: (self: Point, k: s64) -> s64 { return self.x * k; } + x: i64; + scaled :: (self: Point, k: i64) -> i64 { return self.x * k; } } -bump :: ufcs (p: Point, by: s64) -> s64 { return p.x + by; } +bump :: ufcs (p: Point, by: i64) -> i64 { return p.x + by; } -main :: () -> s32 { +main :: () -> i32 { _ = add2(1, 2, 3); // plain bare call, too many _ = add2(1); // plain bare call, too few _ = concat("a", "b", "c"); // flat-imported stdlib fn, too many diff --git a/examples/1168-diagnostics-generic-param-uninferrable.sx b/examples/1168-diagnostics-generic-param-uninferrable.sx index c7a1dd6..9bbb916 100644 --- a/examples/1168-diagnostics-generic-param-uninferrable.sx +++ b/examples/1168-diagnostics-generic-param-uninferrable.sx @@ -13,7 +13,7 @@ first :: (xs: []$T) -> T { return xs[0]; } -main :: () -> s32 { +main :: () -> i32 { print("{}\n", first("abc")); return 0; } diff --git a/examples/1200-ffi-callconv-c-callbacks.sx b/examples/1200-ffi-callconv-c-callbacks.sx index d869b06..4f89a07 100644 --- a/examples/1200-ffi-callconv-c-callbacks.sx +++ b/examples/1200-ffi-callconv-c-callbacks.sx @@ -5,7 +5,7 @@ #import "modules/std.sx"; // A function with C calling convention -add_c :: (a: s64, b: s64) -> s64 callconv(.c) { +add_c :: (a: i64, b: i64) -> i64 callconv(.c) { a + b } diff --git a/examples/1201-ffi-callconv-c-globals.sx b/examples/1201-ffi-callconv-c-globals.sx index 8670c43..f143e52 100644 --- a/examples/1201-ffi-callconv-c-globals.sx +++ b/examples/1201-ffi-callconv-c-globals.sx @@ -5,11 +5,11 @@ #import "modules/std.sx"; Pipe :: struct { - pw: s32; - ph: s32; - frame: s32; + pw: i32; + ph: i32; + frame: i32; - resize :: (self: *Pipe, nw: s32, nh: s32) { + resize :: (self: *Pipe, nw: i32, nh: i32) { self.pw = nw; self.ph = nh; } @@ -20,8 +20,8 @@ Pipe :: struct { } g_pipe : *Pipe = ---; -g_width : s32 = 800; -g_height : s32 = 600; +g_width : i32 = 800; +g_height : i32 = 600; do_render :: () { g_pipe.resize(g_width, g_height); @@ -29,7 +29,7 @@ do_render :: () { print("wrapper: pw={}, ph={}, frame={}\n", g_pipe.pw, g_pipe.ph, g_pipe.frame); } -callback_inline :: (userdata: *void, code: s64) -> bool callconv(.c) { +callback_inline :: (userdata: *void, code: i64) -> bool callconv(.c) { g_width = xx code; g_height = xx (code + 1); g_pipe.resize(xx g_width, xx g_height); @@ -38,7 +38,7 @@ callback_inline :: (userdata: *void, code: s64) -> bool callconv(.c) { true } -callback_wrapper :: (userdata: *void, code: s64) -> bool callconv(.c) { +callback_wrapper :: (userdata: *void, code: i64) -> bool callconv(.c) { g_width = xx code; g_height = xx (code + 1); do_render(); diff --git a/examples/1202-ffi-cc-c-large-aggregate.sx b/examples/1202-ffi-cc-c-large-aggregate.sx index 022304e..1198786 100644 --- a/examples/1202-ffi-cc-c-large-aggregate.sx +++ b/examples/1202-ffi-cc-c-large-aggregate.sx @@ -14,17 +14,17 @@ #import "modules/std.sx"; Wide :: struct { - a: s64; - b: s64; - c: s64; - d: s64; + a: i64; + b: i64; + c: i64; + d: i64; } -accept_c :: (w: Wide) -> s64 callconv(.c) { +accept_c :: (w: Wide) -> i64 callconv(.c) { w.a + w.b + w.c + w.d } -main :: () -> s32 { +main :: () -> i32 { w := Wide.{ a = 1, b = 10, c = 100, d = 1000 }; if accept_c(w) != 1111 { return 1; } 0 diff --git a/examples/1203-ffi-callconv-c-fnptr-large-aggregate.sx b/examples/1203-ffi-callconv-c-fnptr-large-aggregate.sx index 7cf0302..3c07cdd 100644 --- a/examples/1203-ffi-callconv-c-fnptr-large-aggregate.sx +++ b/examples/1203-ffi-callconv-c-fnptr-large-aggregate.sx @@ -16,21 +16,21 @@ #import "modules/std.sx"; Wide :: struct { - a: s64; - b: s64; - c: s64; - d: s64; + a: i64; + b: i64; + c: i64; + d: i64; } -accept_c :: (w: Wide) -> s64 callconv(.c) { +accept_c :: (w: Wide) -> i64 callconv(.c) { w.a + w.b + w.c + w.d } -main :: () -> s32 { +main :: () -> i32 { w := Wide.{ a = 1, b = 10, c = 100, d = 1000 }; if accept_c(w) != 1111 { return 1; } - fn_ptr : (Wide) -> s64 callconv(.c) = xx accept_c; + fn_ptr : (Wide) -> i64 callconv(.c) = xx accept_c; if fn_ptr(w) != 1111 { return 2; } 0 diff --git a/examples/1204-ffi-fnptr-cast-large-aggregate.sx b/examples/1204-ffi-fnptr-cast-large-aggregate.sx index a0502a9..65fd198 100644 --- a/examples/1204-ffi-fnptr-cast-large-aggregate.sx +++ b/examples/1204-ffi-fnptr-cast-large-aggregate.sx @@ -9,19 +9,19 @@ #import "modules/std.sx"; Wide :: struct { - a: s64; b: s64; c: s64; d: s64; + a: i64; b: i64; c: i64; d: i64; } -accept :: (w: Wide) -> s64 { +accept :: (w: Wide) -> i64 { w.a + w.b + w.c + w.d } -main :: () -> s32 { +main :: () -> i32 { w := Wide.{ a = 1, b = 10, c = 100, d = 1000 }; direct := accept(w); if direct != 1111 { return 1; } - fn_ptr : (Wide) -> s64 = xx accept; + fn_ptr : (Wide) -> i64 = xx accept; indirect := fn_ptr(w); if indirect != 1111 { return 2; } diff --git a/examples/1205-ffi-foreign-global-helper.sx b/examples/1205-ffi-foreign-global-helper.sx index 7020af9..7f5e701 100644 --- a/examples/1205-ffi-foreign-global-helper.sx +++ b/examples/1205-ffi-foreign-global-helper.sx @@ -8,6 +8,6 @@ __stdinp : *void #foreign; -stdinp_addr_present :: () -> s32 { +stdinp_addr_present :: () -> i32 { 1 } diff --git a/examples/1205-ffi-foreign-global.sx b/examples/1205-ffi-foreign-global.sx index 38f4c58..0eef143 100644 --- a/examples/1205-ffi-foreign-global.sx +++ b/examples/1205-ffi-foreign-global.sx @@ -19,7 +19,7 @@ __stdinp : *void #foreign; -main :: () -> s32 { +main :: () -> i32 { addr_bits : u64 = xx @__stdinp; print("stdin extern global non-null: {}\n", addr_bits != 0); // Force the helper symbol to participate in linking (otherwise the diff --git a/examples/1206-ffi-medium-struct.sx b/examples/1206-ffi-medium-struct.sx index 6ff80a9..4d5993b 100644 --- a/examples/1206-ffi-medium-struct.sx +++ b/examples/1206-ffi-medium-struct.sx @@ -20,11 +20,11 @@ #source "1206-ffi-medium-struct.c"; }; -Pair64 :: struct { a: s64; b: s64; } +Pair64 :: struct { a: i64; b: i64; } ffi_pair64_swap :: (p: Pair64) -> Pair64 #foreign; -main :: () -> s32 { +main :: () -> i32 { p : Pair64 = .{ a = 1, b = 2 }; q := ffi_pair64_swap(p); print("swap = ({}, {})\n", q.a, q.b); diff --git a/examples/1207-ffi-foreign-global-from-helper.sx b/examples/1207-ffi-foreign-global-from-helper.sx index eb3d3e7..11d09ee 100644 --- a/examples/1207-ffi-foreign-global-from-helper.sx +++ b/examples/1207-ffi-foreign-global-from-helper.sx @@ -18,7 +18,7 @@ stdinp_addr_via_helper :: () -> u64 { xx @__stdinp } -main :: () -> s32 { +main :: () -> i32 { direct : u64 = xx @__stdinp; via_helper := stdinp_addr_via_helper(); print("direct non-null = {}\n", direct != 0); diff --git a/examples/1208-ffi-closure-capture.sx b/examples/1208-ffi-closure-capture.sx index b7974eb..85006a4 100644 --- a/examples/1208-ffi-closure-capture.sx +++ b/examples/1208-ffi-closure-capture.sx @@ -10,16 +10,16 @@ #import "modules/build.sx"; #import "modules/ffi/objc.sx"; -passthrough_works :: (recv: *void) -> Closure(s32) -> *void { - closure((d: s32) -> *void => recv) // captures `recv` — fine +passthrough_works :: (recv: *void) -> Closure(i32) -> *void { + closure((d: i32) -> *void => recv) // captures `recv` — fine } -passthrough_via_objc_call :: (recv: *void) -> Closure(s32) -> s64 { +passthrough_via_objc_call :: (recv: *void) -> Closure(i32) -> i64 { // Same `recv` capture, but inside `#objc_call(...)`'s arg list. - closure((d: s32) -> s64 => #objc_call(s64)(recv, "hash")) + closure((d: i32) -> i64 => #objc_call(i64)(recv, "hash")) } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { f := passthrough_works(null); p := f(0); diff --git a/examples/1209-ffi-01-primitives.c b/examples/1209-ffi-01-primitives.c index 045569a..7400b3d 100644 --- a/examples/1209-ffi-01-primitives.c +++ b/examples/1209-ffi-01-primitives.c @@ -4,7 +4,7 @@ int ffi_id_int (int v) { return v; } unsigned int ffi_id_uint (unsigned int v) { return v; } short ffi_id_short (short v) { return v; } unsigned short ffi_id_ushort(unsigned short v) { return v; } -long long ffi_id_s64 (long long v) { return v; } +long long ffi_id_i64 (long long v) { return v; } unsigned long long ffi_id_u64 (unsigned long long v) { return v; } signed char ffi_id_schar (signed char v) { return v; } unsigned char ffi_id_uchar (unsigned char v) { return v; } diff --git a/examples/1209-ffi-01-primitives.h b/examples/1209-ffi-01-primitives.h index 44b111f..f17b2ce 100644 --- a/examples/1209-ffi-01-primitives.h +++ b/examples/1209-ffi-01-primitives.h @@ -8,7 +8,7 @@ int ffi_id_int (int v); unsigned int ffi_id_uint (unsigned int v); short ffi_id_short (short v); unsigned short ffi_id_ushort(unsigned short v); -long long ffi_id_s64 (long long v); +long long ffi_id_i64 (long long v); unsigned long long ffi_id_u64 (unsigned long long v); signed char ffi_id_schar (signed char v); unsigned char ffi_id_uchar (unsigned char v); diff --git a/examples/1209-ffi-01-primitives.sx b/examples/1209-ffi-01-primitives.sx index fb426a3..3f823f7 100644 --- a/examples/1209-ffi-01-primitives.sx +++ b/examples/1209-ffi-01-primitives.sx @@ -14,11 +14,11 @@ #source "1209-ffi-01-primitives.c"; }; -main :: () -> s32 { +main :: () -> i32 { // Signed roundtrips print("ffi_id_int(-42) = {}\n", ffi_id_int(0 - 42)); print("ffi_id_short(-1234) = {}\n", ffi_id_short(0 - 1234)); - print("ffi_id_s64(huge) = {}\n", ffi_id_s64(9000000000000000000)); + print("ffi_id_i64(huge) = {}\n", ffi_id_i64(9000000000000000000)); // Unsigned roundtrips print("ffi_id_uint(0xDEADBEEF) = {}\n", ffi_id_uint(0xDEADBEEF)); @@ -34,7 +34,7 @@ main :: () -> s32 { print("ffi_id_f64(1.5) = {}\n", ffi_id_f64(1.5)); // Pointer roundtrip — proves *void survives the boundary - sentinel : s32 = 42; + sentinel : i32 = 42; p_in : *void = xx @sentinel; p_out := ffi_id_ptr(p_in); addr_in : u64 = xx p_in; diff --git a/examples/1210-ffi-02-small-struct.h b/examples/1210-ffi-02-small-struct.h index 02e5f56..7724438 100644 --- a/examples/1210-ffi-02-small-struct.h +++ b/examples/1210-ffi-02-small-struct.h @@ -1,8 +1,8 @@ // FFI struct-marshalling baselines covering four aggregate ABI slots: // Vec2 — 8 B, two f32 — register-pair (float) path // Vec4f — 16 B, four f32 — HFA (homogeneous float aggregate) -// Pair64 — 16 B, two s64 — 9..16 B int ABI ([2 x i64] coercion) -// Quad32 — 16 B, four s32 — 9..16 B int ABI ([2 x i64] coercion) +// Pair64 — 16 B, two i64 — 9..16 B int ABI ([2 x i64] coercion) +// Quad32 — 16 B, four i32 — 9..16 B int ABI ([2 x i64] coercion) // Declared here so the .c has a header to include; sx side imports // via `#source` only and re-declares the structs natively (c_import // rewrites struct-typed params/returns to *void). diff --git a/examples/1210-ffi-02-small-struct.sx b/examples/1210-ffi-02-small-struct.sx index 4e4e4c9..3d28079 100644 --- a/examples/1210-ffi-02-small-struct.sx +++ b/examples/1210-ffi-02-small-struct.sx @@ -3,8 +3,8 @@ // shapes that exercise distinct aggregate ABI paths: // Vec2 — 8 B, two f32 (register pair, float) // Vec4f — 16 B, four f32 (HFA — homogeneous float aggregate) -// Pair64 — 16 B, two s64 (9..16 B int — [2 x i64] coercion slot) -// Quad32 — 16 B, four s32 (9..16 B int — same slot as Pair64) +// Pair64 — 16 B, two i64 (9..16 B int — [2 x i64] coercion slot) +// Quad32 — 16 B, four i32 (9..16 B int — same slot as Pair64) // // Pair64 / Quad32 were originally excluded (LLVM verifier rejected the // struct<->[2 x i64] type mismatch — see git history for issue-0036); @@ -23,8 +23,8 @@ Vec2 :: struct { x: f32; y: f32; } Vec4f :: struct { x: f32; y: f32; z: f32; w: f32; } -Pair64 :: struct { a: s64; b: s64; } -Quad32 :: struct { a: s32; b: s32; c: s32; d: s32; } +Pair64 :: struct { a: i64; b: i64; } +Quad32 :: struct { a: i32; b: i32; c: i32; d: i32; } ffi_vec2_make :: (x: f32, y: f32) -> Vec2 #foreign; ffi_vec2_swap :: (v: Vec2) -> Vec2 #foreign; @@ -34,15 +34,15 @@ ffi_vec4f_make :: (x: f32, y: f32, z: f32, w: f32) -> Vec4f #foreign; ffi_vec4f_reverse :: (v: Vec4f) -> Vec4f #foreign; ffi_vec4f_sum :: (v: Vec4f) -> f32 #foreign; -ffi_pair64_make :: (a: s64, b: s64) -> Pair64 #foreign; +ffi_pair64_make :: (a: i64, b: i64) -> Pair64 #foreign; ffi_pair64_swap :: (p: Pair64) -> Pair64 #foreign; -ffi_pair64_sum :: (p: Pair64) -> s64 #foreign; +ffi_pair64_sum :: (p: Pair64) -> i64 #foreign; -ffi_quad32_make :: (a: s32, b: s32, c: s32, d: s32) -> Quad32 #foreign; +ffi_quad32_make :: (a: i32, b: i32, c: i32, d: i32) -> Quad32 #foreign; ffi_quad32_reverse :: (q: Quad32) -> Quad32 #foreign; -ffi_quad32_sum :: (q: Quad32) -> s32 #foreign; +ffi_quad32_sum :: (q: Quad32) -> i32 #foreign; -main :: () -> s32 { +main :: () -> i32 { // ── Vec2 (8 bytes, float pair) ───────────────────────────────── v := ffi_vec2_make(1.5, 2.5); print("vec2 make = ({}, {})\n", v.x, v.y); @@ -57,14 +57,14 @@ main :: () -> s32 { print("vec4f rev = ({}, {}, {}, {})\n", g.x, g.y, g.z, g.w); print("vec4f sum = {}\n", ffi_vec4f_sum(f)); - // ── Pair64 (16 bytes, 2×s64 — [2 x i64] coercion path) ───────── + // ── Pair64 (16 bytes, 2×i64 — [2 x i64] coercion path) ───────── p := ffi_pair64_make(100, 200); print("pair64 make = ({}, {})\n", p.a, p.b); pp := ffi_pair64_swap(p); print("pair64 swap = ({}, {})\n", pp.a, pp.b); print("pair64 sum = {}\n", ffi_pair64_sum(p)); - // ── Quad32 (16 bytes, 4×s32 — same coercion path as Pair64) ──── + // ── Quad32 (16 bytes, 4×i32 — same coercion path as Pair64) ──── q := ffi_quad32_make(10, 20, 30, 40); print("quad32 make = ({}, {}, {}, {})\n", q.a, q.b, q.c, q.d); r := ffi_quad32_reverse(q); diff --git a/examples/1211-ffi-03-large-struct.h b/examples/1211-ffi-03-large-struct.h index 69f888b..a597d00 100644 --- a/examples/1211-ffi-03-large-struct.h +++ b/examples/1211-ffi-03-large-struct.h @@ -5,8 +5,8 @@ // register-pair / [2 x i64] / HFA paths the small-struct baseline // covers — locking those in here keeps the byval path honest. // -// Big24 — 24 B, three s64 -// Big48 — 48 B, six s64 +// Big24 — 24 B, three i64 +// Big48 — 48 B, six i64 typedef struct { long long a; long long b; long long c; } Big24; typedef struct { long long a; long long b; long long c; diff --git a/examples/1211-ffi-03-large-struct.sx b/examples/1211-ffi-03-large-struct.sx index 1dde1a1..be5a8f9 100644 --- a/examples/1211-ffi-03-large-struct.sx +++ b/examples/1211-ffi-03-large-struct.sx @@ -10,8 +10,8 @@ // helpers are `needsByval` (returns true when size > 16) and // `materializeByvalArg` (alloca + store + pass pointer). // -// Big24 — 24 B, three s64 -// Big48 — 48 B, six s64 +// Big24 — 24 B, three i64 +// Big48 — 48 B, six i64 #import "modules/std.sx"; @@ -19,22 +19,22 @@ #source "1211-ffi-03-large-struct.c"; }; -Big24 :: struct { a: s64; b: s64; c: s64; } +Big24 :: struct { a: i64; b: i64; c: i64; } Big48 :: struct { - a: s64; b: s64; c: s64; - d: s64; e: s64; f: s64; + a: i64; b: i64; c: i64; + d: i64; e: i64; f: i64; } -ffi_big24_make :: (a: s64, b: s64, c: s64) -> Big24 #foreign; +ffi_big24_make :: (a: i64, b: i64, c: i64) -> Big24 #foreign; ffi_big24_rotate :: (v: Big24) -> Big24 #foreign; -ffi_big24_sum :: (v: Big24) -> s64 #foreign; +ffi_big24_sum :: (v: Big24) -> i64 #foreign; -ffi_big48_make :: (a: s64, b: s64, c: s64, - d: s64, e: s64, f: s64) -> Big48 #foreign; +ffi_big48_make :: (a: i64, b: i64, c: i64, + d: i64, e: i64, f: i64) -> Big48 #foreign; ffi_big48_reverse :: (v: Big48) -> Big48 #foreign; -ffi_big48_sum :: (v: Big48) -> s64 #foreign; +ffi_big48_sum :: (v: Big48) -> i64 #foreign; -main :: () -> s32 { +main :: () -> i32 { // ── Big24 (24 bytes, byval pointer) ──────────────────────────── v := ffi_big24_make(1, 2, 3); print("big24 make = ({}, {}, {})\n", v.a, v.b, v.c); diff --git a/examples/1212-ffi-04-fp-struct.sx b/examples/1212-ffi-04-fp-struct.sx index 0aaa2d7..78d0a8b 100644 --- a/examples/1212-ffi-04-fp-struct.sx +++ b/examples/1212-ffi-04-fp-struct.sx @@ -30,7 +30,7 @@ ffi_dquad_make :: (a: f64, b: f64, c: f64, d: f64) -> DQuad #foreign; ffi_dquad_reverse :: (v: DQuad) -> DQuad #foreign; ffi_dquad_sum :: (v: DQuad) -> f64 #foreign; -main :: () -> s32 { +main :: () -> i32 { // ── FQuad (16 B, 4×f32 HFA) ──────────────────────────────────── f := ffi_fquad_make(1.0, 2.0, 3.0, 4.0); print("fquad make = ({}, {}, {}, {})\n", f.a, f.b, f.c, f.d); diff --git a/examples/1213-ffi-05-string-args.sx b/examples/1213-ffi-05-string-args.sx index ac8a1c5..5ca4378 100644 --- a/examples/1213-ffi-05-string-args.sx +++ b/examples/1213-ffi-05-string-args.sx @@ -14,13 +14,13 @@ #source "1213-ffi-05-string-args.c"; }; -ffi_strlen :: (s: [:0]u8) -> s32 #foreign; -ffi_first_byte :: (s: [:0]u8) -> s32 #foreign; -ffi_sum_bytes :: (buf: [*]u8, len: s32) -> s32 #foreign; -ffi_write_byte :: (buf: [*]u8, idx: s32, v: u8) -> void #foreign; +ffi_strlen :: (s: [:0]u8) -> i32 #foreign; +ffi_first_byte :: (s: [:0]u8) -> i32 #foreign; +ffi_sum_bytes :: (buf: [*]u8, len: i32) -> i32 #foreign; +ffi_write_byte :: (buf: [*]u8, idx: i32, v: u8) -> void #foreign; ffi_static_greeting :: () -> [*]u8 #foreign; -main :: () -> s32 { +main :: () -> i32 { // ── [:0]u8 null-terminated literal ───────────────────────────── msg : [:0]u8 = "hello"; print("strlen(\"hello\") = {}\n", ffi_strlen(msg)); diff --git a/examples/1214-ffi-06-callback.sx b/examples/1214-ffi-06-callback.sx index 5c7b113..d6a39e5 100644 --- a/examples/1214-ffi-06-callback.sx +++ b/examples/1214-ffi-06-callback.sx @@ -4,8 +4,8 @@ // library/modules/platform/android.sx. // // Two arities covered: -// 1. (s32) -> s32 — single-arg callback -// 2. (*void, s32) -> s32 — pointer + value (onInputEvent shape) +// 1. (i32) -> i32 — single-arg callback +// 2. (*void, i32) -> i32 — pointer + value (onInputEvent shape) // // Plus a side-effect via a global so we can confirm the callback // actually fired (return value + state mutation both observable). @@ -16,27 +16,27 @@ #source "1214-ffi-06-callback.c"; }; -ffi_apply_callback :: (cb: (s32) -> s32 callconv(.c), value: s32) -> s32 #foreign; -ffi_apply_callback2 :: (cb: (*void, s32) -> s32 callconv(.c), ctx: *void, v: s32) -> s32 #foreign; +ffi_apply_callback :: (cb: (i32) -> i32 callconv(.c), value: i32) -> i32 #foreign; +ffi_apply_callback2 :: (cb: (*void, i32) -> i32 callconv(.c), ctx: *void, v: i32) -> i32 #foreign; -g_callback_hits : s32 = 0; -g_callback_sum : s32 = 0; +g_callback_hits : i32 = 0; +g_callback_sum : i32 = 0; -double_it :: (x: s32) -> s32 callconv(.c) { +double_it :: (x: i32) -> i32 callconv(.c) { g_callback_hits += 1; g_callback_sum += x; x * 2 } -add_with_ctx :: (ctx: *void, v: s32) -> s32 callconv(.c) { +add_with_ctx :: (ctx: *void, v: i32) -> i32 callconv(.c) { g_callback_hits += 1; // Pass a sentinel via ctx to prove the pointer arg also survives the - // round-trip — read it back as an s32 through *s32. - p : *s32 = xx ctx; + // round-trip — read it back as an i32 through *i32. + p : *i32 = xx ctx; p.* + v } -main :: () -> s32 { +main :: () -> i32 { // ── Single-arg callback ──────────────────────────────────────── r1 := ffi_apply_callback(double_it, 21); print("callback returned = {}\n", r1); @@ -50,7 +50,7 @@ main :: () -> s32 { print("sum after three calls = {}\n", g_callback_sum); // ── Two-arg callback with opaque ctx pointer ─────────────────── - ctx_val : s32 = 100; + ctx_val : i32 = 100; r2 := ffi_apply_callback2(add_with_ctx, xx @ctx_val, 42); print("ctx + value = {}\n", r2); print("hits after ctx callback = {}\n", g_callback_hits); diff --git a/examples/1215-ffi-07-c-import-block.sx b/examples/1215-ffi-07-c-import-block.sx index 449708b..75287a7 100644 --- a/examples/1215-ffi-07-c-import-block.sx +++ b/examples/1215-ffi-07-c-import-block.sx @@ -18,7 +18,7 @@ #source "vendors/sx_ffi_resolve_test/sx_ffi_resolve_test.c"; }; -main :: () -> s32 { +main :: () -> i32 { print("add(3, 4) = {}\n", sx_ffi_resolve_test_add(3, 4)); print("mul(6, 7) = {}\n", sx_ffi_resolve_test_mul(6, 7)); 0 diff --git a/examples/1216-ffi-08-foreign-in-method.sx b/examples/1216-ffi-08-foreign-in-method.sx index 4741fb4..3c39ce6 100644 --- a/examples/1216-ffi-08-foreign-in-method.sx +++ b/examples/1216-ffi-08-foreign-in-method.sx @@ -18,8 +18,8 @@ // ── 1. Struct method calling a #foreign fn ─────────────────────────── Counter :: struct { - seed: s32 = 0; - next :: (self: *Counter) -> s32 { + seed: i32 = 0; + next :: (self: *Counter) -> i32 { v := ffi_method_helper(self.seed); self.seed += 1; v @@ -28,21 +28,21 @@ Counter :: struct { // ── 2. Protocol impl method calling a #foreign fn ──────────────────── Doubler :: protocol { - doubled :: (self: *Self) -> s32; + doubled :: (self: *Self) -> i32; } impl Doubler for Counter { - doubled :: (self: *Counter) -> s32 { + doubled :: (self: *Counter) -> i32 { ffi_method_helper(self.seed) * 2 } } // ── 3. Closure body calling a #foreign fn ──────────────────────────── -make_adder :: (bias: s32) -> Closure(s32) -> s32 { - closure((x: s32) -> s32 => ffi_method_helper(x) + bias) +make_adder :: (bias: i32) -> Closure(i32) -> i32 { + closure((x: i32) -> i32 => ffi_method_helper(x) + bias) } -main :: () -> s32 { +main :: () -> i32 { c : Counter = .{ seed = 1 }; // 1. struct method diff --git a/examples/1217-ffi-09-foreign-result-chain.sx b/examples/1217-ffi-09-foreign-result-chain.sx index e3151ac..fe4ff0f 100644 --- a/examples/1217-ffi-09-foreign-result-chain.sx +++ b/examples/1217-ffi-09-foreign-result-chain.sx @@ -22,7 +22,7 @@ Counter :: struct { label: string; } -main :: () -> s32 { +main :: () -> i32 { // ── 1. Chain: make → bump → peek ─────────────────────────────── a := ffi_chain_make(100); print("peek after make = {}\n", ffi_chain_peek(a)); @@ -39,14 +39,14 @@ main :: () -> s32 { // ── 3. Push handles into a List, iterate, feed back to C ────── handles : List(*void) = .{}; - i : s32 = 0; + i : i32 = 0; while i < 3 { h := ffi_chain_make(i * 10); handles.append(h); i += 1; } - j : s64 = 0; + j : i64 = 0; while j < handles.len { h := handles.items[j]; v := ffi_chain_peek(h); diff --git a/examples/1218-ffi-foreign-cvariadic.sx b/examples/1218-ffi-foreign-cvariadic.sx index 29a6f22..4db540b 100644 --- a/examples/1218-ffi-foreign-cvariadic.sx +++ b/examples/1218-ffi-foreign-cvariadic.sx @@ -1,7 +1,7 @@ // `#foreign` C-variadic tail: trailing `..args: []T` on a foreign fn maps // to the C calling convention's `...`. Extras at the call site are // passed via the variadic slot with the standard default argument -// promotion (s8/s16/bool → s32, f32 → f64) applied implicitly. +// promotion (i8/i16/bool → i32, f32 → f64) applied implicitly. #import "modules/std.sx"; @@ -9,11 +9,11 @@ #source "1218-ffi-foreign-cvariadic.c"; }; -sx_ffi_sum_ints :: (n: s32, ..args: []s32) -> s64 #foreign; -sx_ffi_avg_doubles :: (n: s32, ..args: []f64) -> f64 #foreign; -sx_ffi_count_args :: (tag: *u8, ..args: []*u8) -> s32 #foreign; +sx_ffi_sum_ints :: (n: i32, ..args: []i32) -> i64 #foreign; +sx_ffi_avg_doubles :: (n: i32, ..args: []f64) -> f64 #foreign; +sx_ffi_count_args :: (tag: *u8, ..args: []*u8) -> i32 #foreign; -main :: () -> s32 { +main :: () -> i32 { print("sum_ints(3, 10, 20, 30) = {}\n", sx_ffi_sum_ints(3, 10, 20, 30)); print("sum_ints(0) = {}\n", sx_ffi_sum_ints(0)); print("avg_doubles(2) = {}\n", sx_ffi_avg_doubles(2, 1.5, 2.5)); diff --git a/examples/1219-ffi-foreign.sx b/examples/1219-ffi-foreign.sx index 1242f01..cf1b4e2 100644 --- a/examples/1219-ffi-foreign.sx +++ b/examples/1219-ffi-foreign.sx @@ -7,7 +7,7 @@ pkg :: #import "tests/fixtures/testpkg"; // --- Foreign function binding --- libc :: #library "c"; -c_abs :: (n: s32) -> s32 #foreign libc "abs"; +c_abs :: (n: i32) -> i32 #foreign libc "abs"; // --- Protocol declarations (Phase 1: static dispatch only) --- diff --git a/examples/1220-ffi-c-import-reserved-name-params.c b/examples/1220-ffi-c-import-reserved-name-params.c index 120a0dd..7d09325 100644 --- a/examples/1220-ffi-c-import-reserved-name-params.c +++ b/examples/1220-ffi-c-import-reserved-name-params.c @@ -1,13 +1,13 @@ #include "1220-ffi-c-import-reserved-name-params.h" -int ffi_pick(int s1, int s2, int which) { - return which == 0 ? s1 : s2; +int ffi_pick(int i1, int i2, int which) { + return which == 0 ? i1 : i2; } -int ffi_sum(int s1, int s2) { - return s1 + s2; +int ffi_sum(int i1, int i2) { + return i1 + i2; } -int s2(int u8) { +int i2(int u8) { return u8 + 100; } diff --git a/examples/1220-ffi-c-import-reserved-name-params.h b/examples/1220-ffi-c-import-reserved-name-params.h index 7c1bdea..341b056 100644 --- a/examples/1220-ffi-c-import-reserved-name-params.h +++ b/examples/1220-ffi-c-import-reserved-name-params.h @@ -1,7 +1,7 @@ /* Foreign C declarations whose names collide with sx's reserved type spellings. The `#import c` exemption must accept these generated names unedited, both as - parameter names (`s1`, `s2`) and as a FUNCTION name (`s2`) — and a foreign + parameter names (`i1`, `i2`) and as a FUNCTION name (`i2`) — and a foreign reserved-name function must be bare-callable (issue 0089). */ -int ffi_pick(int s1, int s2, int which); -int ffi_sum(int s1, int s2); -int s2(int u8); +int ffi_pick(int i1, int i2, int which); +int ffi_sum(int i1, int i2); +int i2(int u8); diff --git a/examples/1220-ffi-c-import-reserved-name-params.sx b/examples/1220-ffi-c-import-reserved-name-params.sx index f9f3284..0553130 100644 --- a/examples/1220-ffi-c-import-reserved-name-params.sx +++ b/examples/1220-ffi-c-import-reserved-name-params.sx @@ -2,11 +2,11 @@ // type spellings import unedited. Foreign decls are treated as RAW — their names // are never type-classified nor reserved-checked — so the generated `#foreign` // bindings import and call without hand-edits (no backticks needed). This covers -// parameter names (`s1`/`s2`), a function whose own NAME is a reserved spelling -// (`s2`), and bare-calling that function (its callee spelling parses as a type +// parameter names (`i1`/`i2`), a function whose own NAME is a reserved spelling +// (`i2`), and bare-calling that function (its callee spelling parses as a type // but resolves to the foreign fn). Before issue 0089 the params errored with -// "'s1' is a reserved type name and cannot be used as an identifier", and the -// bare call errored with "unresolved 's2'". +// "'i1' is a reserved type name and cannot be used as an identifier", and the +// bare call errored with "unresolved 'i2'". // Regression (issue 0089). #import "modules/std.sx"; @@ -15,10 +15,10 @@ #source "1220-ffi-c-import-reserved-name-params.c"; }; -main :: () -> s32 { +main :: () -> i32 { print("pick(10,20,0) = {}\n", ffi_pick(10, 20, 0)); print("pick(10,20,1) = {}\n", ffi_pick(10, 20, 1)); print("sum(10,20) = {}\n", ffi_sum(10, 20)); - print("s2(4) bare = {}\n", s2(4)); + print("i2(4) bare = {}\n", i2(4)); 0 } diff --git a/examples/1300-ffi-objc-roundtrip.sx b/examples/1300-ffi-objc-roundtrip.sx index 465aaae..a9a9b63 100644 --- a/examples/1300-ffi-objc-roundtrip.sx +++ b/examples/1300-ffi-objc-roundtrip.sx @@ -13,7 +13,7 @@ #import "modules/std.sx"; #import "modules/ffi/objc.sx"; -main :: () -> s32 { +main :: () -> i32 { ns_class := objc_getClass("NSString".ptr); sel_with_utf8 := sel_registerName("stringWithUTF8String:".ptr); sel_utf8 := sel_registerName("UTF8String".ptr); diff --git a/examples/1301-ffi-objc-class.sx b/examples/1301-ffi-objc-class.sx index 9fb171e..b13ca97 100644 --- a/examples/1301-ffi-objc-class.sx +++ b/examples/1301-ffi-objc-class.sx @@ -13,7 +13,7 @@ #import "modules/std.sx"; #import "modules/ffi/objc.sx"; -g_marker : s32 = 0; +g_marker : i32 = 0; // IMP for `hello`. Must use C calling convention so `self` and `_cmd` land in // x0 and x1 the way the Obj-C runtime expects. @@ -21,7 +21,7 @@ hello_imp :: (self: *void, _cmd: *void) callconv(.c) { g_marker = 42; } -main :: () -> s32 { +main :: () -> i32 { NSObject := objc_getClass("NSObject".ptr); SxThing := objc_allocateClassPair(NSObject, "SxThing".ptr, 0); sel_hello := sel_registerName("hello".ptr); diff --git a/examples/1302-ffi-objc-block-noop.sx b/examples/1302-ffi-objc-block-noop.sx index 654a4a0..b428e5d 100644 --- a/examples/1302-ffi-objc-block-noop.sx +++ b/examples/1302-ffi-objc-block-noop.sx @@ -8,7 +8,7 @@ #import "modules/std.sx"; #import "modules/ffi/objc_block.sx"; -main :: () -> s32 { +main :: () -> i32 { cl := () => { print("noop block ran\n"); }; b : Block = xx cl; invoke_fn : (*Block) -> void callconv(.c) = xx b.invoke; diff --git a/examples/1303-ffi-objc-block-capture.sx b/examples/1303-ffi-objc-block-capture.sx index c41c734..5194cf3 100644 --- a/examples/1303-ffi-objc-block-capture.sx +++ b/examples/1303-ffi-objc-block-capture.sx @@ -6,9 +6,9 @@ #import "modules/std.sx"; #import "modules/ffi/objc_block.sx"; -main :: () -> s32 { - x : s64 = 42; - y : s64 = 100; +main :: () -> i32 { + x : i64 = 42; + y : i64 = 100; cl := () => { print("x + y = {}\n", x + y); }; b : Block = xx cl; invoke_fn : (*Block) -> void callconv(.c) = xx b.invoke; diff --git a/examples/1304-ffi-objc-block-multi-arg.sx b/examples/1304-ffi-objc-block-multi-arg.sx index 5d568de..0e555db 100644 --- a/examples/1304-ffi-objc-block-multi-arg.sx +++ b/examples/1304-ffi-objc-block-multi-arg.sx @@ -8,7 +8,7 @@ // app-specific). // // This test exercises the user-declared variant: signature -// `Closure(s32, *void) -> void` (a two-arg block — not in stdlib). +// `Closure(i32, *void) -> void` (a two-arg block — not in stdlib). // If the impl is missing, the compiler emits a focused diagnostic // pointing at modules/ffi/objc_block.sx as the template. @@ -18,18 +18,18 @@ // Trampoline matching `void (^)(int, void*)` — the C ABI Apple's // runtime calls. Forwards through to the sx closure with the // standard `(__sx_ctx, env, ...args)` shape. -__block_invoke_void_s32_p :: (block_self: *Block, arg0: s32, arg1: *void) callconv(.c) { - typed_fn : (*void, s32, *void) -> void = xx block_self.sx_fn; +__block_invoke_void_i32_p :: (block_self: *Block, arg0: i32, arg1: *void) callconv(.c) { + typed_fn : (*void, i32, *void) -> void = xx block_self.sx_fn; typed_fn(block_self.sx_env, arg0, arg1); } -impl Into(Block) for Closure(s32, *void) -> void { - convert :: (self: Closure(s32, *void) -> void) -> Block { +impl Into(Block) for Closure(i32, *void) -> void { + convert :: (self: Closure(i32, *void) -> void) -> Block { .{ isa = @_NSConcreteStackBlock, flags = 0, reserved = 0, - invoke = xx @__block_invoke_void_s32_p, + invoke = xx @__block_invoke_void_i32_p, descriptor = xx @__sx_block_descriptor, sx_env = self.env, sx_fn = self.fn_ptr, @@ -39,18 +39,18 @@ impl Into(Block) for Closure(s32, *void) -> void { // Side-effect capture so we can observe both args reached the // closure body. -g_sum: s32 = 0; +g_sum: i32 = 0; g_tag: *void = null; -main :: () -> s32 { - cl := (n: s32, tag: *void) => { +main :: () -> i32 { + cl := (n: i32, tag: *void) => { g_sum = n + 1; g_tag = tag; }; b : Block = xx cl; - invoke_fn : (*Block, s32, *void) -> void callconv(.c) = xx b.invoke; - sentinel: s32 = 42; + invoke_fn : (*Block, i32, *void) -> void callconv(.c) = xx b.invoke; + sentinel: i32 = 42; invoke_fn(@b, 41, xx @sentinel); if g_sum != 42 { print("FAIL: g_sum expected 42, got {}\n", g_sum); return 1; } diff --git a/examples/1305-ffi-objc-block-inline.sx b/examples/1305-ffi-objc-block-inline.sx index a673616..9626f09 100644 --- a/examples/1305-ffi-objc-block-inline.sx +++ b/examples/1305-ffi-objc-block-inline.sx @@ -10,8 +10,8 @@ invoke_once :: (b: *Block) { invoke_fn(b); } -main :: () -> s32 { - x : s64 = 7; +main :: () -> i32 { + x : i64 = 7; invoke_once(xx () => { print("inline block, x = {}\n", x); }); diff --git a/examples/1306-ffi-objc-foreign-class-chained-dispatch.sx b/examples/1306-ffi-objc-foreign-class-chained-dispatch.sx index 0bbcce1..82e1424 100644 --- a/examples/1306-ffi-objc-foreign-class-chained-dispatch.sx +++ b/examples/1306-ffi-objc-foreign-class-chained-dispatch.sx @@ -1,6 +1,6 @@ // Chained foreign-class method dispatch: `Cls.static().instance(...)` // resolves the inner call's return type so the outer dispatch's -// receiver type is known. Pre-fix this collapsed to s64 in +// receiver type is known. Pre-fix this collapsed to i64 in // `inferExprType`, the foreign_class_map lookup missed, and lowering // emitted `error: unresolved 'init'` (or 'initWithWindowScene' etc.) // — see issues/0043 for the chess uikit.sx C4 migration that hit it. @@ -22,7 +22,7 @@ NSObjectSelfReturn :: #foreign #objc_class("NSObject") { init :: (self: *Self) -> *Self; } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { a := NSObject.alloc().init(); if a != null { diff --git a/examples/1307-ffi-objc-expression-bodied-objc-method.sx b/examples/1307-ffi-objc-expression-bodied-objc-method.sx index 3c7322c..6fc262f 100644 --- a/examples/1307-ffi-objc-expression-bodied-objc-method.sx +++ b/examples/1307-ffi-objc-expression-bodied-objc-method.sx @@ -12,9 +12,9 @@ #import "modules/std.sx"; SxFoo :: #objc_class("SxFoo") { - greet :: (self: *Self) -> s32 => 42; + greet :: (self: *Self) -> i32 => 42; } -main :: () -> s32 { +main :: () -> i32 { 0 } diff --git a/examples/1308-ffi-objc-type-aliases.sx b/examples/1308-ffi-objc-type-aliases.sx index 41f3d2f..03f6536 100644 --- a/examples/1308-ffi-objc-type-aliases.sx +++ b/examples/1308-ffi-objc-type-aliases.sx @@ -2,7 +2,7 @@ // // `id`, `Class`, `SEL`, `BOOL` from `modules/ffi/objc.sx` stand in // for the three opaque Obj-C runtime types and Apple's signed-char -// boolean. They resolve to `*void` / `s8` at the LLVM layer — no +// boolean. They resolve to `*void` / `i8` at the LLVM layer — no // runtime cost — but make foreign-class and call-site declarations // read closer to Objective-C source. // @@ -22,7 +22,7 @@ NSObjectAlias :: #foreign #objc_class("NSObject") { isKindOfClass :: (self: *Self, cls: Class) -> BOOL; } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { // id - any Obj-C instance pointer. nsobj : id = NSObjectAlias.alloc().init(); diff --git a/examples/1309-ffi-objc-class-method-lowering.sx b/examples/1309-ffi-objc-class-method-lowering.sx index be1a05a..aea6641 100644 --- a/examples/1309-ffi-objc-class-method-lowering.sx +++ b/examples/1309-ffi-objc-class-method-lowering.sx @@ -29,14 +29,14 @@ #import "modules/build.sx"; SxFoo :: #objc_class("SxFoo") { - counter: s32; + counter: i32; bump :: (self: *Self) { self.counter += 1; } } -main :: () -> s32 { +main :: () -> i32 { print("compiled\n"); 0 } diff --git a/examples/1310-ffi-objc-class-registration.sx b/examples/1310-ffi-objc-class-registration.sx index 2c99bee..36beb76 100644 --- a/examples/1310-ffi-objc-class-registration.sx +++ b/examples/1310-ffi-objc-class-registration.sx @@ -20,14 +20,14 @@ #import "modules/ffi/objc.sx"; SxFoo :: #objc_class("SxFoo") { - counter: s32; + counter: i32; bump :: (self: *Self) { self.counter += 1; } } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { cls : Class = objc_getClass("SxFoo".ptr); if cls == null { diff --git a/examples/1311-ffi-objc-class-ivar-registration.sx b/examples/1311-ffi-objc-class-ivar-registration.sx index d4bf96c..eaa0334 100644 --- a/examples/1311-ffi-objc-class-ivar-registration.sx +++ b/examples/1311-ffi-objc-class-ivar-registration.sx @@ -23,14 +23,14 @@ class_getInstanceVariable :: (cls: *void, name: [*]u8) -> *void #foreign objc; SxFoo :: #objc_class("SxFoo") { - counter: s32; + counter: i32; bump :: (self: *Self) { self.counter += 1; } } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { cls : Class = objc_getClass("SxFoo".ptr); if cls == null { diff --git a/examples/1312-ffi-objc-class-method-dispatch.sx b/examples/1312-ffi-objc-class-method-dispatch.sx index 07b83fd..8f48e2c 100644 --- a/examples/1312-ffi-objc-class-method-dispatch.sx +++ b/examples/1312-ffi-objc-class-method-dispatch.sx @@ -18,18 +18,18 @@ class_getMethodImplementation :: (cls: *void, sel: *void) -> *void #foreign objc; SxFoo :: #objc_class("SxFoo") { - counter: s32; + counter: i32; bump :: (self: *Self) { self.counter += 1; } - add :: (self: *Self, n: s32) { + add :: (self: *Self, n: i32) { self.counter += n; } } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { cls : Class = objc_getClass("SxFoo".ptr); if cls == null { print("FAIL: SxFoo not registered\n"); return 1; } diff --git a/examples/1313-ffi-objc-class-alloc-roundtrip.sx b/examples/1313-ffi-objc-class-alloc-roundtrip.sx index 3200c44..ab7db81 100644 --- a/examples/1313-ffi-objc-class-alloc-roundtrip.sx +++ b/examples/1313-ffi-objc-class-alloc-roundtrip.sx @@ -21,14 +21,14 @@ class_getInstanceVariable :: (cls: *void, name: [*]u8) -> *void #foreign objc; SxFoo :: #objc_class("SxFoo") { - counter: s32; + counter: i32; bump :: (self: *Self) { self.counter += 1; } } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { cls : Class = objc_getClass("SxFoo".ptr); if cls == null { print("FAIL: SxFoo not registered\n"); return 1; } diff --git a/examples/1314-ffi-objc-class-dealloc-roundtrip.sx b/examples/1314-ffi-objc-class-dealloc-roundtrip.sx index e6e06ce..e607789 100644 --- a/examples/1314-ffi-objc-class-dealloc-roundtrip.sx +++ b/examples/1314-ffi-objc-class-dealloc-roundtrip.sx @@ -20,14 +20,14 @@ class_getInstanceVariable :: (cls: *void, name: [*]u8) -> *void #foreign objc; class_getMethodImplementation :: (cls: *void, sel: *void) -> *void #foreign objc; SxFoo :: #objc_class("SxFoo") { - counter: s32; + counter: i32; bump :: (self: *Self) { self.counter += 1; } } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { cls : Class = objc_getClass("SxFoo".ptr); if cls == null { print("FAIL: SxFoo not registered\n"); return 1; } diff --git a/examples/1315-ffi-objc-self-class-accessor.sx b/examples/1315-ffi-objc-self-class-accessor.sx index cdb3b99..1b1fad4 100644 --- a/examples/1315-ffi-objc-self-class-accessor.sx +++ b/examples/1315-ffi-objc-self-class-accessor.sx @@ -20,12 +20,12 @@ NSObjectFwd :: #foreign #objc_class("NSObject") { } SxFoo :: #objc_class("SxFoo") { - counter: s32; + counter: i32; alloc :: () -> *SxFoo; bump :: (self: *Self) { self.counter += 1; } } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { // sx-defined class round-trip. f := SxFoo.alloc(); diff --git a/examples/1316-ffi-objc-class-method-static-imp.sx b/examples/1316-ffi-objc-class-method-static-imp.sx index c9be38e..d816dd1 100644 --- a/examples/1316-ffi-objc-class-method-static-imp.sx +++ b/examples/1316-ffi-objc-class-method-static-imp.sx @@ -19,13 +19,13 @@ class_getClassMethod :: (cls: *void, sel: *void) -> *void #foreign objc; SxFoo :: #objc_class("SxFoo") { - counter: s32; + counter: i32; // Class method — no `self`. Returns 42. - answer :: () -> s32 { return 42; } + answer :: () -> i32 { return 42; } } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { cls : Class = objc_getClass("SxFoo".ptr); if cls == null { print("FAIL: SxFoo not registered\n"); return 1; } @@ -35,8 +35,8 @@ main :: () -> s32 { if method == null { print("FAIL: class method not on metaclass\n"); return 1; } // Invoke via objc_msgSend: [SxFoo answer] → 42. - msg_fn : (cls: *void, sel: *void) -> s32 callconv(.c) = xx objc_msgSend; - result : s32 = msg_fn(cls, sel_answer); + msg_fn : (cls: *void, sel: *void) -> i32 callconv(.c) = xx objc_msgSend; + result : i32 = msg_fn(cls, sel_answer); if result != 42 { print("FAIL: expected 42, got {}\n", result); return 1; } print("class method: {}\n", result); diff --git a/examples/1317-ffi-objc-class-level-constant.sx b/examples/1317-ffi-objc-class-level-constant.sx index dbb9023..99cef7c 100644 --- a/examples/1317-ffi-objc-class-level-constant.sx +++ b/examples/1317-ffi-objc-class-level-constant.sx @@ -21,24 +21,24 @@ NSObject :: #foreign #objc_class("NSObject") { // Reframed as a class method internally; user writes the constant form. SxThing :: #objc_class("SxThing") { - counter: s32; + counter: i32; // Class-level constant. - answer :: s32 = 42; + answer :: i32 = 42; // Canonical pattern: returning a *NSObject (stand-in for Apple's // '+layerClass' returning *CALayer). seedClass :: *NSObject = NSObject.alloc().init(); } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { cls : Class = objc_getClass("SxThing".ptr); if cls == null { print("FAIL: SxThing not registered\n"); return 1; } // [SxThing answer] → 42 sel_answer : SEL = sel_registerName("answer".ptr); - msg_int : (cls: *void, sel: *void) -> s32 callconv(.c) = xx objc_msgSend; + msg_int : (cls: *void, sel: *void) -> i32 callconv(.c) = xx objc_msgSend; r := msg_int(cls, sel_answer); if r != 42 { print("FAIL: answer expected 42, got {}\n", r); return 1; } diff --git a/examples/1318-ffi-objc-property-foreign.sx b/examples/1318-ffi-objc-property-foreign.sx index a5c00c2..dd58ee1 100644 --- a/examples/1318-ffi-objc-property-foreign.sx +++ b/examples/1318-ffi-objc-property-foreign.sx @@ -19,14 +19,14 @@ #import "modules/ffi/objc.sx"; // Build a probe class on the fly: registers two IMPs (`tag` and -// `setTag:`) that read/write an instance-bound s32 stored in a +// `setTag:`) that read/write an instance-bound i32 stored in a // runtime ivar. Property dispatch should round-trip through them. -g_probe_tag: s32 = 0; +g_probe_tag: i32 = 0; -probe_get_tag :: (self: *void, _cmd: *void) -> s32 callconv(.c) { +probe_get_tag :: (self: *void, _cmd: *void) -> i32 callconv(.c) { return g_probe_tag; } -probe_set_tag :: (self: *void, _cmd: *void, v: s32) callconv(.c) { +probe_set_tag :: (self: *void, _cmd: *void, v: i32) callconv(.c) { g_probe_tag = v; } @@ -34,10 +34,10 @@ probe_set_tag :: (self: *void, _cmd: *void, v: s32) callconv(.c) { SxPropProbe :: #foreign #objc_class("SxPropProbe") { alloc :: () -> *SxPropProbe; init :: (self: *SxPropProbe) -> *SxPropProbe; - tag: s32 #property; + tag: i32 #property; } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { // Register the class + the two IMPs. ns_object := objc_getClass("NSObject".ptr); diff --git a/examples/1319-ffi-objc-property-sx-defined.sx b/examples/1319-ffi-objc-property-sx-defined.sx index cb26034..81f10bc 100644 --- a/examples/1319-ffi-objc-property-sx-defined.sx +++ b/examples/1319-ffi-objc-property-sx-defined.sx @@ -24,15 +24,15 @@ class_getInstanceMethod :: (cls: *void, sel: *void) -> *void #foreign objc; SxBox :: #objc_class("SxBox") { - width: s32 #property; - height: s32 #property; - area: s32 #property(readonly); // setter omitted + width: i32 #property; + height: i32 #property; + area: i32 #property(readonly); // setter omitted alloc :: () -> *SxBox; init :: (self: *SxBox) -> *SxBox; } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { b := SxBox.alloc().init(); diff --git a/examples/1320-ffi-objc-extends-chain.sx b/examples/1320-ffi-objc-extends-chain.sx index 00539b1..141f1ee 100644 --- a/examples/1320-ffi-objc-extends-chain.sx +++ b/examples/1320-ffi-objc-extends-chain.sx @@ -23,7 +23,7 @@ NSObjectBase :: #foreign #objc_class("NSObject") { // walk through NSObjectBase, then dispatched by objc_msgSend. SxThing :: #objc_class("SxThing") { #extends NSObjectBase; - counter: s32; + counter: i32; alloc :: () -> *SxThing; init :: (self: *SxThing) -> *SxThing; @@ -41,7 +41,7 @@ SxLeaf :: #objc_class("SxLeaf") { init :: (self: *SxLeaf) -> *SxLeaf; } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { // 1-level chain: SxThing → NSObjectBase. t := SxThing.alloc().init(); diff --git a/examples/1321-ffi-objc-defined-class-method-self.sx b/examples/1321-ffi-objc-defined-class-method-self.sx index 3622dc0..1b52ca2 100644 --- a/examples/1321-ffi-objc-defined-class-method-self.sx +++ b/examples/1321-ffi-objc-defined-class-method-self.sx @@ -23,7 +23,7 @@ SxIssue44Bus :: #foreign #objc_class("NSNotificationCenter") { } SxIssue44Foo :: #objc_class("SxIssue44Foo") { - counter: s32; + counter: i32; sentinel: *void; alloc :: () -> *SxIssue44Foo; @@ -32,7 +32,7 @@ SxIssue44Foo :: #objc_class("SxIssue44Foo") { this.counter += 1; } - get :: (this: *Self) -> s32 { + get :: (this: *Self) -> i32 { return this.counter; } @@ -69,7 +69,7 @@ capture_observer :: (p: *void) { g_observer = p; } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { f := SxIssue44Foo.alloc(); if f == null { print("FAIL: alloc returned null\n"); return 1; } diff --git a/examples/1322-ffi-objc-arc-00-allocator-thread.sx b/examples/1322-ffi-objc-arc-00-allocator-thread.sx index b138778..22d58f7 100644 --- a/examples/1322-ffi-objc-arc-00-allocator-thread.sx +++ b/examples/1322-ffi-objc-arc-00-allocator-thread.sx @@ -27,11 +27,11 @@ SxAllocProbe :: #objc_class("SxAllocProbe") { #extends NSObject; - counter: s32; + counter: i32; alloc :: () -> *SxAllocProbe; } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { gpa := GPA.init(); tracker := TrackingAllocator.init(xx gpa); diff --git a/examples/1323-ffi-objc-arc-00b-multi-instance.sx b/examples/1323-ffi-objc-arc-00b-multi-instance.sx index 695c3ba..3ac7452 100644 --- a/examples/1323-ffi-objc-arc-00b-multi-instance.sx +++ b/examples/1323-ffi-objc-arc-00b-multi-instance.sx @@ -18,12 +18,12 @@ SxMultiProbe :: #objc_class("SxMultiProbe") { #extends NSObject; - a: s32; - b: s32; + a: i32; + b: i32; alloc :: () -> *SxMultiProbe; } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { gpa := GPA.init(); tracker := TrackingAllocator.init(xx gpa); diff --git a/examples/1324-ffi-objc-arc-01-autoreleasepool.sx b/examples/1324-ffi-objc-arc-01-autoreleasepool.sx index 5b15ed7..3d24aa5 100644 --- a/examples/1324-ffi-objc-arc-01-autoreleasepool.sx +++ b/examples/1324-ffi-objc-arc-01-autoreleasepool.sx @@ -15,7 +15,7 @@ #import "modules/ffi/objc.sx"; #import "modules/build.sx"; -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { // Manual retain/release on an NSObject instance — the // `defer obj.release();` pattern is the canonical sx idiom. diff --git a/examples/1325-ffi-objc-arc-02-strong-property.sx b/examples/1325-ffi-objc-arc-02-strong-property.sx index 9030500..eb7ae9d 100644 --- a/examples/1325-ffi-objc-arc-02-strong-property.sx +++ b/examples/1325-ffi-objc-arc-02-strong-property.sx @@ -21,7 +21,7 @@ SxStrongChild :: #objc_class("SxStrongChild") { #extends NSObject; - tag: s32; + tag: i32; alloc :: () -> *SxStrongChild; } @@ -31,7 +31,7 @@ SxStrongParent :: #objc_class("SxStrongParent") { alloc :: () -> *SxStrongParent; } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { gpa := GPA.init(); tracker := TrackingAllocator.init(xx gpa); diff --git a/examples/1326-ffi-objc-arc-03-weak-property.sx b/examples/1326-ffi-objc-arc-03-weak-property.sx index 34e5153..1219573 100644 --- a/examples/1326-ffi-objc-arc-03-weak-property.sx +++ b/examples/1326-ffi-objc-arc-03-weak-property.sx @@ -24,7 +24,7 @@ SxWeakTarget :: #objc_class("SxWeakTarget") { #extends NSObject; - tag: s32; + tag: i32; alloc :: () -> *SxWeakTarget; } @@ -34,7 +34,7 @@ SxWeakHolder :: #objc_class("SxWeakHolder") { alloc :: () -> *SxWeakHolder; } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { gpa := GPA.init(); tracker := TrackingAllocator.init(xx gpa); diff --git a/examples/1327-ffi-objc-call-01-parse.sx b/examples/1327-ffi-objc-call-01-parse.sx index 932145c..8f259f1 100644 --- a/examples/1327-ffi-objc-call-01-parse.sx +++ b/examples/1327-ffi-objc-call-01-parse.sx @@ -12,7 +12,7 @@ #import "modules/std.sx"; -main :: () -> s32 { +main :: () -> i32 { // `#objc_call(void)` with a null receiver — never executed (this // file's purpose is parser surface coverage). `inline if false` // would suppress sema/codegen too, but for the parse-only step diff --git a/examples/1328-ffi-objc-call-02-void-return.sx b/examples/1328-ffi-objc-call-02-void-return.sx index 5ede862..0676e64 100644 --- a/examples/1328-ffi-objc-call-02-void-return.sx +++ b/examples/1328-ffi-objc-call-02-void-return.sx @@ -13,7 +13,7 @@ #import "modules/std.sx"; #import "modules/build.sx"; -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { #objc_call(void)(null, "init"); print("ok\n"); diff --git a/examples/1329-ffi-objc-call-03-selector-sharing.sx b/examples/1329-ffi-objc-call-03-selector-sharing.sx index 3dce0a6..9dff2f3 100644 --- a/examples/1329-ffi-objc-call-03-selector-sharing.sx +++ b/examples/1329-ffi-objc-call-03-selector-sharing.sx @@ -20,7 +20,7 @@ #import "modules/std.sx"; #import "modules/build.sx"; -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { // Three calls, same selector, same nil receiver. Today these // emit three `sel_registerName("init")` calls. After 1.5 the diff --git a/examples/1330-ffi-objc-call-04-primitive-returns.sx b/examples/1330-ffi-objc-call-04-primitive-returns.sx index f30b5b1..26b92a6 100644 --- a/examples/1330-ffi-objc-call-04-primitive-returns.sx +++ b/examples/1330-ffi-objc-call-04-primitive-returns.sx @@ -11,13 +11,13 @@ #import "modules/build.sx"; #import "modules/ffi/objc.sx"; -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { // ── Nil-recv quick smoke ─────────────────────────────────── nil_cls := #objc_call(*void)(null, "class"); print("nil class = {}\n", nil_cls == null); - nil_n := #objc_call(s64)(null, "hash"); + nil_n := #objc_call(i64)(null, "hash"); print("nil hash = {}\n", nil_n); // ── Real-recv: NSObject ──────────────────────────────────── @@ -27,11 +27,11 @@ main :: () -> s32 { meta := #objc_call(*void)(ns_object, "class"); print("meta non-null = {}\n", meta != null); - // s64 return: [obj hash] returns NSUInteger. On the NSObject + // i64 return: [obj hash] returns NSUInteger. On the NSObject // class itself the value is implementation-defined but stable // within a process — pinning it as non-zero is enough for ABI // verification. - h := #objc_call(s64)(ns_object, "hash"); + h := #objc_call(i64)(ns_object, "hash"); print("hash non-zero = {}\n", h != 0); } inline if OS != .macos { diff --git a/examples/1331-ffi-objc-call-05-struct-returns.sx b/examples/1331-ffi-objc-call-05-struct-returns.sx index a68c978..1e56a21 100644 --- a/examples/1331-ffi-objc-call-05-struct-returns.sx +++ b/examples/1331-ffi-objc-call-05-struct-returns.sx @@ -28,7 +28,7 @@ NSRect :: struct { x: f64; y: f64; width: f64; height: f64; } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { // 16 B HFA — both fields zero. p := #objc_call(NSPoint)(null, "pointValue"); diff --git a/examples/1332-ffi-objc-call-06-sret-return.sx b/examples/1332-ffi-objc-call-06-sret-return.sx index 46aa436..6639cb1 100644 --- a/examples/1332-ffi-objc-call-06-sret-return.sx +++ b/examples/1332-ffi-objc-call-06-sret-return.sx @@ -16,7 +16,7 @@ #import "modules/build.sx"; #import "modules/ffi/objc.sx"; -Triple :: struct { a: s64; b: s64; c: s64; } +Triple :: struct { a: i64; b: i64; c: i64; } // IMP for the runtime-installed method. Obj-C convention: implicit // (self, _cmd) prefix, then declared args. Returns the value bytes. @@ -24,7 +24,7 @@ triple_imp :: (self: *void, _cmd: *void) -> Triple callconv(.c) { Triple.{ a = 11, b = 22, c = 33 } } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { // Build the class: // @interface SxTripleProbe : NSObject @@ -33,7 +33,7 @@ main :: () -> s32 { ns_object := objc_getClass("NSObject".ptr); my_cls := objc_allocateClassPair(ns_object, "SxTripleProbe".ptr, 0); sel := sel_registerName("tripleValue".ptr); - // Type encoding: {Triple=qqq}@: → returns 24 B struct of 3 s64, + // Type encoding: {Triple=qqq}@: → returns 24 B struct of 3 i64, // implicit (self: id, _cmd: SEL). ok := class_addMethod(my_cls, sel, xx triple_imp, "{Triple=qqq}@:".ptr); print("addMethod = {}\n", ok); diff --git a/examples/1333-ffi-objc-call-07-fp-hfa-return.sx b/examples/1333-ffi-objc-call-07-fp-hfa-return.sx index 1eab3a7..d659dfa 100644 --- a/examples/1333-ffi-objc-call-07-fp-hfa-return.sx +++ b/examples/1333-ffi-objc-call-07-fp-hfa-return.sx @@ -24,7 +24,7 @@ insets_imp :: (self: *void, _cmd: *void) -> UIEdgeInsets callconv(.c) { UIEdgeInsets.{ top = 1.5, left = 2.5, bottom = 3.5, right = 4.5 } } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { ns_object := objc_getClass("NSObject".ptr); my_cls := objc_allocateClassPair(ns_object, "SxInsetsProbe".ptr, 0); diff --git a/examples/1334-ffi-objc-call-08-multi-keyword.sx b/examples/1334-ffi-objc-call-08-multi-keyword.sx index 05f6574..3fb86e9 100644 --- a/examples/1334-ffi-objc-call-08-multi-keyword.sx +++ b/examples/1334-ffi-objc-call-08-multi-keyword.sx @@ -13,11 +13,11 @@ #import "modules/build.sx"; #import "modules/ffi/objc.sx"; -combine_imp :: (self: *void, _cmd: *void, a: s32, b: s32) -> s32 callconv(.c) { +combine_imp :: (self: *void, _cmd: *void, a: i32, b: i32) -> i32 callconv(.c) { a * 100 + b } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { ns_object := objc_getClass("NSObject".ptr); my_cls := objc_allocateClassPair(ns_object, "SxComboProbe".ptr, 0); @@ -31,7 +31,7 @@ main :: () -> s32 { objc_registerClassPair(my_cls); instance := class_createInstance(my_cls, 0); - r := #objc_call(s32)(instance, "combine:and:", 7, 42); + r := #objc_call(i32)(instance, "combine:and:", 7, 42); print("combine(7, 42) = {}\n", r); } inline if OS != .macos { diff --git a/examples/1335-ffi-objc-call-09-in-construct.sx b/examples/1335-ffi-objc-call-09-in-construct.sx index 379d195..cdd167c 100644 --- a/examples/1335-ffi-objc-call-09-in-construct.sx +++ b/examples/1335-ffi-objc-call-09-in-construct.sx @@ -17,19 +17,19 @@ // ── 1. Struct method calling #objc_call ───────────────────────────── Probe :: struct { receiver: *void = null; - fetch :: (self: *Probe) -> s64 { - #objc_call(s64)(self.receiver, "hash") + fetch :: (self: *Probe) -> i64 { + #objc_call(i64)(self.receiver, "hash") } } // ── 2. Protocol impl method ──────────────────────────────────────── Hashable :: protocol { - sx_hash :: (self: *Self) -> s64; + sx_hash :: (self: *Self) -> i64; } impl Hashable for Probe { - sx_hash :: (self: *Probe) -> s64 { - #objc_call(s64)(self.receiver, "hash") * 2 + sx_hash :: (self: *Probe) -> i64 { + #objc_call(i64)(self.receiver, "hash") * 2 } } @@ -37,17 +37,17 @@ impl Hashable for Probe { // The closure captures `recv` from its enclosing function and // references it inside the `#objc_call` arg list. Locked in by // `examples/103-ffi-closure-capture.sx`. -make_hasher :: (recv: *void) -> Closure(s32) -> s64 { - closure((dummy: s32) -> s64 => #objc_call(s64)(recv, "hash")) +make_hasher :: (recv: *void) -> Closure(i32) -> i64 { + closure((dummy: i32) -> i64 => #objc_call(i64)(recv, "hash")) } // ── 4. Generic function body — instantiated per call site ─────────── -hash_through :: (recv: $T) -> s64 { +hash_through :: (recv: $T) -> i64 { p : *void = xx recv; - #objc_call(s64)(p, "hash") + #objc_call(i64)(p, "hash") } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { ns_object := objc_getClass("NSObject".ptr); diff --git a/examples/1336-ffi-objc-call-10-os-gate.sx b/examples/1336-ffi-objc-call-10-os-gate.sx index 5c0c22a..541f6a1 100644 --- a/examples/1336-ffi-objc-call-10-os-gate.sx +++ b/examples/1336-ffi-objc-call-10-os-gate.sx @@ -18,7 +18,7 @@ // `inline if OS` gating around `#objc_call`, not Activity wiring. SxObjcOsGateStub :: #jni_main #jni_class("co/swipelab/sxobjcosgate/SxObjcOsGateStub") { } -main :: () -> s32 { +main :: () -> i32 { inline if OS == { case .ios: { // Stripped on macOS + Android. Compiled on iOS / ios-sim. diff --git a/examples/1337-ffi-objc-call-11-bool-return.sx b/examples/1337-ffi-objc-call-11-bool-return.sx index 49a3c33..201242e 100644 --- a/examples/1337-ffi-objc-call-11-bool-return.sx +++ b/examples/1337-ffi-objc-call-11-bool-return.sx @@ -16,7 +16,7 @@ yes_imp :: (self: *void, _cmd: *void) -> bool callconv(.c) { true } no_imp :: (self: *void, _cmd: *void) -> bool callconv(.c) { false } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { // Nil-recv: libobjc returns a zeroed slot, which decodes as false. nil_b := #objc_call(bool)(null, "isEqual:"); diff --git a/examples/1338-ffi-objc-call-12-rect-u64-returns.sx b/examples/1338-ffi-objc-call-12-rect-u64-returns.sx index 10fd1f9..0e3d8eb 100644 --- a/examples/1338-ffi-objc-call-12-rect-u64-returns.sx +++ b/examples/1338-ffi-objc-call-12-rect-u64-returns.sx @@ -3,7 +3,7 @@ // Both shapes were already exercised transitively in earlier work — // CGRect is structurally a 4×f64 HFA (same as UIEdgeInsets from // ffi-objc-call-07), and u64 is i64 at the LLVM level (same as the -// s64 return from ffi-objc-call-04's `hash`). The cluster-1.32 +// i64 return from ffi-objc-call-04's `hash`). The cluster-1.32 // migration of `uikit_keyboard_will_change_frame` was the first // place we used both shapes through `#objc_call` directly, but the // keyboard-change-frame callback isn't reached by the chess launch @@ -30,7 +30,7 @@ u64_imp :: (self: *void, _cmd: *void) -> u64 callconv(.c) { 0x7FEDCBA987654321 } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { ns_object := objc_getClass("NSObject".ptr); my_cls := objc_allocateClassPair(ns_object, "SxRectU64Probe".ptr, 0); diff --git a/examples/1339-ffi-objc-defined-class-01-instance.sx b/examples/1339-ffi-objc-defined-class-01-instance.sx index fcc7619..555e379 100644 --- a/examples/1339-ffi-objc-defined-class-01-instance.sx +++ b/examples/1339-ffi-objc-defined-class-01-instance.sx @@ -22,7 +22,7 @@ #import "modules/ffi/objc.sx"; SxFoo :: #objc_class("SxFoo") { - counter: s32; + counter: i32; // Declare the synthesized class methods so sx-side call sites // can resolve them. +alloc / -dealloc IMPs are emitted by the @@ -34,12 +34,12 @@ SxFoo :: #objc_class("SxFoo") { self.counter += 1; } - get :: (self: *Self) -> s32 { + get :: (self: *Self) -> i32 { return self.counter; } } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { f := SxFoo.alloc(); if f == null { print("FAIL: alloc returned null\n"); return 1; } diff --git a/examples/1340-ffi-objc-defined-class-02-struct-encoding.sx b/examples/1340-ffi-objc-defined-class-02-struct-encoding.sx index 38774ed..bde8dde 100644 --- a/examples/1340-ffi-objc-defined-class-02-struct-encoding.sx +++ b/examples/1340-ffi-objc-defined-class-02-struct-encoding.sx @@ -42,7 +42,7 @@ SxMover :: #objc_class("SxMover") { } } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { m := SxMover.alloc(); if m == null { print("FAIL: alloc returned null\n"); return 1; } diff --git a/examples/1341-ffi-objc-dsl-01-niladic.sx b/examples/1341-ffi-objc-dsl-01-niladic.sx index e8c24f3..130ea2b 100644 --- a/examples/1341-ffi-objc-dsl-01-niladic.sx +++ b/examples/1341-ffi-objc-dsl-01-niladic.sx @@ -17,14 +17,14 @@ #import "modules/ffi/objc.sx"; SxProbeNiladic :: #foreign #objc_class("SxProbeNiladic") { - length :: (self: *Self) -> s32; + length :: (self: *Self) -> i32; } -length_imp :: (self: *void, _cmd: *void) -> s32 callconv(.c) { +length_imp :: (self: *void, _cmd: *void) -> i32 callconv(.c) { 42 } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { ns_object := objc_getClass("NSObject".ptr); cls := objc_allocateClassPair(ns_object, "SxProbeNiladic".ptr, 0); diff --git a/examples/1342-ffi-objc-dsl-02-one-arg.sx b/examples/1342-ffi-objc-dsl-02-one-arg.sx index 01349d1..12d7a37 100644 --- a/examples/1342-ffi-objc-dsl-02-one-arg.sx +++ b/examples/1342-ffi-objc-dsl-02-one-arg.sx @@ -9,14 +9,14 @@ #import "modules/ffi/objc.sx"; SxProbeOneArg :: #foreign #objc_class("SxProbeOneArg") { - addObject :: (self: *Self, val: s32) -> s32; + addObject :: (self: *Self, val: i32) -> i32; } -addObject_imp :: (self: *void, _cmd: *void, val: s32) -> s32 callconv(.c) { +addObject_imp :: (self: *void, _cmd: *void, val: i32) -> i32 callconv(.c) { val * 2 } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { ns_object := objc_getClass("NSObject".ptr); cls := objc_allocateClassPair(ns_object, "SxProbeOneArg".ptr, 0); diff --git a/examples/1343-ffi-objc-dsl-03-multi-keyword.sx b/examples/1343-ffi-objc-dsl-03-multi-keyword.sx index 208a67a..b34cb97 100644 --- a/examples/1343-ffi-objc-dsl-03-multi-keyword.sx +++ b/examples/1343-ffi-objc-dsl-03-multi-keyword.sx @@ -8,14 +8,14 @@ #import "modules/ffi/objc.sx"; SxProbeMultiKeyword :: #foreign #objc_class("SxProbeMultiKeyword") { - combine_and :: (self: *Self, a: s32, b: s32) -> s32; + combine_and :: (self: *Self, a: i32, b: i32) -> i32; } -combine_imp :: (self: *void, _cmd: *void, a: s32, b: s32) -> s32 callconv(.c) { +combine_imp :: (self: *void, _cmd: *void, a: i32, b: i32) -> i32 callconv(.c) { a * 100 + b } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { ns_object := objc_getClass("NSObject".ptr); cls := objc_allocateClassPair(ns_object, "SxProbeMultiKeyword".ptr, 0); diff --git a/examples/1344-ffi-objc-dsl-04-mismatch.sx b/examples/1344-ffi-objc-dsl-04-mismatch.sx index 83195fc..2cd9dd5 100644 --- a/examples/1344-ffi-objc-dsl-04-mismatch.sx +++ b/examples/1344-ffi-objc-dsl-04-mismatch.sx @@ -9,10 +9,10 @@ #import "modules/build.sx"; SxProbeMismatch :: #foreign #objc_class("SxProbeMismatch") { - something_extra :: (self: *Self, x: s32) -> s32; + something_extra :: (self: *Self, x: i32) -> i32; } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { inst : *SxProbeMismatch = null; n := inst.something_extra(7); diff --git a/examples/1345-ffi-objc-dsl-05-static.sx b/examples/1345-ffi-objc-dsl-05-static.sx index fe9cecf..7c7b897 100644 --- a/examples/1345-ffi-objc-dsl-05-static.sx +++ b/examples/1345-ffi-objc-dsl-05-static.sx @@ -25,7 +25,7 @@ NSObject :: #foreign #objc_class("NSObject") { description :: () -> *void; } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { c := NSObject.class(); if c != null { diff --git a/examples/1346-ffi-objc-dsl-06-selector-override.sx b/examples/1346-ffi-objc-dsl-06-selector-override.sx index f650a2c..b6736b4 100644 --- a/examples/1346-ffi-objc-dsl-06-selector-override.sx +++ b/examples/1346-ffi-objc-dsl-06-selector-override.sx @@ -29,7 +29,7 @@ NSDictionary :: #foreign #objc_class("NSDictionary") { lookup :: (self: *Self, key: *void) -> *void #selector("objectForKey:"); } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { d := NSObject.gimme(); print("static override non-null: {}\n", d != null); diff --git a/examples/1347-ffi-objc-dsl-07-mangling-table.sx b/examples/1347-ffi-objc-dsl-07-mangling-table.sx index 653aa3a..43ba812 100644 --- a/examples/1347-ffi-objc-dsl-07-mangling-table.sx +++ b/examples/1347-ffi-objc-dsl-07-mangling-table.sx @@ -18,22 +18,22 @@ #import "modules/ffi/objc.sx"; SxManglingProbe :: #foreign #objc_class("SxManglingProbe") { - length :: (self: *Self) -> s32; - addObject :: (self: *Self, a: s32) -> s32; - combine_and :: (self: *Self, a: s32, b: s32) -> s32; - insert_after_index :: (self: *Self, a: s32, b: s32, c: s32) -> s32; - add_observer_for_event :: (self: *Self, a: s32, b: s32, c: s32, d: s32) -> s32; - initWithFrame_options :: (self: *Self, f: s32, o: s32) -> s32; - custom_name :: (self: *Self) -> s32 #selector("actualSelectorName"); + length :: (self: *Self) -> i32; + addObject :: (self: *Self, a: i32) -> i32; + combine_and :: (self: *Self, a: i32, b: i32) -> i32; + insert_after_index :: (self: *Self, a: i32, b: i32, c: i32) -> i32; + add_observer_for_event :: (self: *Self, a: i32, b: i32, c: i32, d: i32) -> i32; + initWithFrame_options :: (self: *Self, f: i32, o: i32) -> i32; + custom_name :: (self: *Self) -> i32 #selector("actualSelectorName"); } -universal_imp :: (self: *void, _cmd: *void, a: s32, b: s32, c: s32, d: s32) -> s32 callconv(.c) { +universal_imp :: (self: *void, _cmd: *void, a: i32, b: i32, c: i32, d: i32) -> i32 callconv(.c) { // Returns the arg count's witness; the test doesn't check return // values, only that dispatch succeeds for each selector shape. a + b + c + d } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { ns_object := objc_getClass("NSObject".ptr); cls := objc_allocateClassPair(ns_object, "SxManglingProbe".ptr, 0); diff --git a/examples/1400-ffi-jni-call-01-parse.sx b/examples/1400-ffi-jni-call-01-parse.sx index 3c5dfa6..1cef018 100644 --- a/examples/1400-ffi-jni-call-01-parse.sx +++ b/examples/1400-ffi-jni-call-01-parse.sx @@ -8,7 +8,7 @@ #import "modules/std.sx"; -main :: () -> s32 { +main :: () -> i32 { inline if false { env : *void = null; #jni_env(env) { @@ -16,7 +16,7 @@ main :: () -> s32 { #jni_call(*void)(null, "getWindow", "()Landroid/view/Window;"); // Static method: class, name, sig, args... - #jni_static_call(s32)(null, "max", "(II)I", 3, 7); + #jni_static_call(i32)(null, "max", "(II)I", 3, 7); // Returning a Java primitive (jboolean → sx bool). #jni_call(bool)(null, "isShown", "()Z"); diff --git a/examples/1401-ffi-jni-call-02-void.sx b/examples/1401-ffi-jni-call-02-void.sx index 125bedc..0cb1e1b 100644 --- a/examples/1401-ffi-jni-call-02-void.sx +++ b/examples/1401-ffi-jni-call-02-void.sx @@ -26,7 +26,7 @@ // file is testing `#jni_call` lowering, not Activity wiring. SxJniCallVoidStub :: #jni_main #jni_class("co/swipelab/sxjnicall/SxJniCallVoidStub") { } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .android { // Real Android entry passes env + target via the user's `onCreate` // / `#jni_attach`. For the cross-compile-only test we just need diff --git a/examples/1402-ffi-jni-call-03-methodid-sharing.sx b/examples/1402-ffi-jni-call-03-methodid-sharing.sx index e015cd5..18aeff0 100644 --- a/examples/1402-ffi-jni-call-03-methodid-sharing.sx +++ b/examples/1402-ffi-jni-call-03-methodid-sharing.sx @@ -23,7 +23,7 @@ unused_jni :: (env: *void, target: *void) { } } -main :: () -> s32 { +main :: () -> i32 { if g_should_call { unused_jni(null, null); } diff --git a/examples/1403-ffi-jni-call-04-jint-return.sx b/examples/1403-ffi-jni-call-04-jint-return.sx index 92d0e6d..c8f3744 100644 --- a/examples/1403-ffi-jni-call-04-jint-return.sx +++ b/examples/1403-ffi-jni-call-04-jint-return.sx @@ -1,7 +1,7 @@ -// Phase 1 step 1.18 (PLAN-FFI.md): `#jni_call(s32)` (jint return). +// Phase 1 step 1.18 (PLAN-FFI.md): `#jni_call(i32)` (jint return). // Today the lowering for any non-void return drops to `LLVMGetUndef` // — the IR snapshot captures that placeholder. Step 1.18-fix wires -// the `.s32 => 49` (`CallIntMethod`) arm and the snapshot updates to +// the `.i32 => 49` (`CallIntMethod`) arm and the snapshot updates to // show the full GetObjectClass + GetMethodID + CallIntMethod // sequence (using the cache machinery landed in 1.17). // @@ -13,13 +13,13 @@ g_should_call : bool = false; -read_int :: (env: *void, target: *void) -> s32 { +read_int :: (env: *void, target: *void) -> i32 { #jni_env(env) { - #jni_call(s32)(target, "getCount", "()I") + #jni_call(i32)(target, "getCount", "()I") } } -main :: () -> s32 { +main :: () -> i32 { if g_should_call { _ := read_int(null, null); } diff --git a/examples/1404-ffi-jni-call-05-jlong-return.sx b/examples/1404-ffi-jni-call-05-jlong-return.sx index edd2d25..dc2c89c 100644 --- a/examples/1404-ffi-jni-call-05-jlong-return.sx +++ b/examples/1404-ffi-jni-call-05-jlong-return.sx @@ -1,7 +1,7 @@ -// Phase 1 step 1.19 (PLAN-FFI.md): `#jni_call(s64)` (jlong return). +// Phase 1 step 1.19 (PLAN-FFI.md): `#jni_call(i64)` (jlong return). // Today the non-void switch falls through to `LLVMGetUndef`; the IR // snapshot captures the placeholder. The make-green commit adds the -// `.s64 => Jni.CallLongMethod` arm and the snapshot updates to show +// `.i64 => Jni.CallLongMethod` arm and the snapshot updates to show // the full dispatch through vtable slot 52, reusing the 1.17 slot // interning. @@ -9,13 +9,13 @@ g_should_call : bool = false; -read_long :: (env: *void, target: *void) -> s64 { +read_long :: (env: *void, target: *void) -> i64 { #jni_env(env) { - #jni_call(s64)(target, "currentTimeMillis", "()J") + #jni_call(i64)(target, "currentTimeMillis", "()J") } } -main :: () -> s32 { +main :: () -> i32 { if g_should_call { _ := read_long(null, null); } diff --git a/examples/1405-ffi-jni-call-06-jdouble-return.sx b/examples/1405-ffi-jni-call-06-jdouble-return.sx index 889405d..46fbbc0 100644 --- a/examples/1405-ffi-jni-call-06-jdouble-return.sx +++ b/examples/1405-ffi-jni-call-06-jdouble-return.sx @@ -12,7 +12,7 @@ read_double :: (env: *void, target: *void) -> f64 { } } -main :: () -> s32 { +main :: () -> i32 { if g_should_call { _ := read_double(null, null); } diff --git a/examples/1406-ffi-jni-call-07-jboolean-return.sx b/examples/1406-ffi-jni-call-07-jboolean-return.sx index 8ddbc5c..b6824bf 100644 --- a/examples/1406-ffi-jni-call-07-jboolean-return.sx +++ b/examples/1406-ffi-jni-call-07-jboolean-return.sx @@ -14,7 +14,7 @@ read_bool :: (env: *void, target: *void) -> bool { } } -main :: () -> s32 { +main :: () -> i32 { if g_should_call { _ := read_bool(null, null); } diff --git a/examples/1407-ffi-jni-call-08-jobject-return.sx b/examples/1407-ffi-jni-call-08-jobject-return.sx index 3894aab..2abd0ca 100644 --- a/examples/1407-ffi-jni-call-08-jobject-return.sx +++ b/examples/1407-ffi-jni-call-08-jobject-return.sx @@ -19,7 +19,7 @@ get_window :: (env: *void, activity: *void) -> *void { } } -main :: () -> s32 { +main :: () -> i32 { if g_should_call { _ := get_window(null, null); } diff --git a/examples/1408-ffi-jni-call-09-static.sx b/examples/1408-ffi-jni-call-09-static.sx index dc0759f..3e1cbc3 100644 --- a/examples/1408-ffi-jni-call-09-static.sx +++ b/examples/1408-ffi-jni-call-09-static.sx @@ -9,13 +9,13 @@ g_should_call : bool = false; -call_static_max :: (env: *void, cls: *void) -> s32 { +call_static_max :: (env: *void, cls: *void) -> i32 { #jni_env(env) { - #jni_static_call(s32)(cls, "max", "(II)I", 3, 7) + #jni_static_call(i32)(cls, "max", "(II)I", 3, 7) } } -main :: () -> s32 { +main :: () -> i32 { if g_should_call { _ := call_static_max(null, null); } diff --git a/examples/1409-ffi-jni-call-10-jfloat-return.sx b/examples/1409-ffi-jni-call-10-jfloat-return.sx index 490f949..f37e280 100644 --- a/examples/1409-ffi-jni-call-10-jfloat-return.sx +++ b/examples/1409-ffi-jni-call-10-jfloat-return.sx @@ -19,7 +19,7 @@ read_float :: (env: *void, target: *void) -> f32 { } } -main :: () -> s32 { +main :: () -> i32 { if g_should_call { _ := read_float(null, null); } diff --git a/examples/1410-ffi-jni-call-11-unsupported-return-diag.sx b/examples/1410-ffi-jni-call-11-unsupported-return-diag.sx index 8110c12..3f4384a 100644 --- a/examples/1410-ffi-jni-call-11-unsupported-return-diag.sx +++ b/examples/1410-ffi-jni-call-11-unsupported-return-diag.sx @@ -1,20 +1,20 @@ // Regression: when a `#jni_call` method returns a type the // `CallMethod` switch in `emit_llvm.zig` can't dispatch -// (anything outside void/bool/s32/s64/f32/f64/pointer), the +// (anything outside void/bool/i32/i64/f32/f64/pointer), the // compiler must emit a DIAGNOSTIC at lower time rather than // silently producing `LLVMGetUndef` at codegen time. Without // this guard, the chess Android touch bug shipped: an // unsupported return type silently became `undef` and showed // up as garbage arguments downstream. // -// Here we declare a JNI method returning `s8` (jbyte, not yet +// Here we declare a JNI method returning `i8` (jbyte, not yet // wired into the call-method switch). The compile must fail // with a clear message naming the method + return type. #import "modules/std.sx"; Buf :: #foreign #jni_class("java/nio/ByteBuffer") { - get :: (self: *Self) -> s8; + get :: (self: *Self) -> i8; } g_should_call : bool = false; @@ -25,7 +25,7 @@ unused :: (env: *void, b: *Buf) { } } -main :: () -> s32 { +main :: () -> i32 { if g_should_call { unused(null, null); } diff --git a/examples/1411-ffi-jni-class-01-empty.sx b/examples/1411-ffi-jni-class-01-empty.sx index 7e988fe..2ccbb54 100644 --- a/examples/1411-ffi-jni-class-01-empty.sx +++ b/examples/1411-ffi-jni-class-01-empty.sx @@ -12,7 +12,7 @@ Foo :: #foreign #jni_class("java/path/Foo") { } -main :: () -> s32 { +main :: () -> i32 { print("parse-only ok\n"); 0 } diff --git a/examples/1412-ffi-jni-class-02-method.sx b/examples/1412-ffi-jni-class-02-method.sx index 771bda9..5dc2275 100644 --- a/examples/1412-ffi-jni-class-02-method.sx +++ b/examples/1412-ffi-jni-class-02-method.sx @@ -11,10 +11,10 @@ // `Self` here refers to the enclosing `View` type — resolved at // 2.x sema, not at parse time. View :: #foreign #jni_class("android/view/View") { - getId :: (self: *Self) -> s32; + getId :: (self: *Self) -> i32; } -main :: () -> s32 { +main :: () -> i32 { print("parse-only ok\n"); 0 } diff --git a/examples/1413-ffi-jni-class-03-static.sx b/examples/1413-ffi-jni-class-03-static.sx index 969d4bd..94a0401 100644 --- a/examples/1413-ffi-jni-class-03-static.sx +++ b/examples/1413-ffi-jni-class-03-static.sx @@ -2,7 +2,7 @@ // method declarations inside a `#jni_class` body. // // Instance vs class method is determined by the first param's TYPE: -// `(self: *Self, ...)` ⇒ instance, anything else (here, `(n: s32)`) +// `(self: *Self, ...)` ⇒ instance, anything else (here, `(n: i32)`) // ⇒ class method, dispatched via `GetStaticMethodID` / // `CallStatic*` at lowering time (Phase 2.12). No explicit `static` // keyword; the param shape carries the signal. @@ -10,10 +10,10 @@ #import "modules/std.sx"; Math :: #foreign #jni_class("java/lang/Math") { - abs :: (n: s32) -> s32; // no `self: *Self` → class method + abs :: (n: i32) -> i32; // no `self: *Self` → class method } -main :: () -> s32 { +main :: () -> i32 { print("parse-only ok\n"); 0 } diff --git a/examples/1414-ffi-jni-class-04-extends.sx b/examples/1414-ffi-jni-class-04-extends.sx index d14c838..7617678 100644 --- a/examples/1414-ffi-jni-class-04-extends.sx +++ b/examples/1414-ffi-jni-class-04-extends.sx @@ -19,7 +19,7 @@ Window :: #foreign #jni_class("android/view/Window") { getDecorView :: (self: *Self) -> *View; } -main :: () -> s32 { +main :: () -> i32 { print("parse-only ok\n"); 0 } diff --git a/examples/1415-ffi-jni-class-05-field.sx b/examples/1415-ffi-jni-class-05-field.sx index cb86afb..952991b 100644 --- a/examples/1415-ffi-jni-class-05-field.sx +++ b/examples/1415-ffi-jni-class-05-field.sx @@ -9,11 +9,11 @@ #import "modules/std.sx"; Point :: #foreign #jni_class("android/graphics/Point") { - x: s32; - y: s32; + x: i32; + y: i32; } -main :: () -> s32 { +main :: () -> i32 { print("parse-only ok\n"); 0 } diff --git a/examples/1416-ffi-jni-class-06-desc.sx b/examples/1416-ffi-jni-class-06-desc.sx index d9e3461..ae6bd90 100644 --- a/examples/1416-ffi-jni-class-06-desc.sx +++ b/examples/1416-ffi-jni-class-06-desc.sx @@ -11,10 +11,10 @@ #import "modules/std.sx"; Foo :: #foreign #jni_class("com/example/Foo") { - weirdMethod :: (self: *Self) -> s32 #jni_method_descriptor("()I"); + weirdMethod :: (self: *Self) -> i32 #jni_method_descriptor("()I"); } -main :: () -> s32 { +main :: () -> i32 { print("parse-only ok\n"); 0 } diff --git a/examples/1417-ffi-jni-class-07-all-runtimes.sx b/examples/1417-ffi-jni-class-07-all-runtimes.sx index f839f41..6299caa 100644 --- a/examples/1417-ffi-jni-class-07-all-runtimes.sx +++ b/examples/1417-ffi-jni-class-07-all-runtimes.sx @@ -18,11 +18,11 @@ #import "modules/std.sx"; IFoo :: #foreign #jni_interface("com/example/IFoo") { - bar :: (self: *Self) -> s32; + bar :: (self: *Self) -> i32; } NSString :: #foreign #objc_class("NSString") { - length :: (self: *Self) -> s32; + length :: (self: *Self) -> i32; } NSCopying :: #foreign #objc_protocol("NSCopying") { @@ -38,10 +38,10 @@ Date :: #foreign #swift_struct("Foundation.Date") { } Hashable :: #foreign #swift_protocol("Swift.Hashable") { - hash :: (self: *Self) -> s32; + hash :: (self: *Self) -> i32; } -main :: () -> s32 { +main :: () -> i32 { print("parse-only ok\n"); 0 } diff --git a/examples/1418-ffi-jni-class-08-call.sx b/examples/1418-ffi-jni-class-08-call.sx index cd0b986..d022dc7 100644 --- a/examples/1418-ffi-jni-class-08-call.sx +++ b/examples/1418-ffi-jni-class-08-call.sx @@ -22,7 +22,7 @@ unused_jni :: (env: *void, act: *Activity) { } } -main :: () -> s32 { +main :: () -> i32 { if g_should_call { unused_jni(null, null); } diff --git a/examples/1419-ffi-jni-class-09-multi-float-args.sx b/examples/1419-ffi-jni-class-09-multi-float-args.sx index 6af4db9..c2a36d4 100644 --- a/examples/1419-ffi-jni-class-09-multi-float-args.sx +++ b/examples/1419-ffi-jni-class-09-multi-float-args.sx @@ -16,12 +16,12 @@ #import "modules/std.sx"; MotionEvent :: #foreign #jni_class("android/view/MotionEvent") { - getAction :: (self: *Self) -> s32; + getAction :: (self: *Self) -> i32; getX :: (self: *Self) -> f32; getY :: (self: *Self) -> f32; } -sx_consume_touch :: (action: s32, x: f32, y: f32) { +sx_consume_touch :: (action: i32, x: f32, y: f32) { // Black-hole call so the args aren't dead-stripped before LLVM // verification gets a chance to look at the call site. if action == 0 and x == 0.0 and y == 0.0 { @@ -40,7 +40,7 @@ drive_touch :: (env: *void, ev: *MotionEvent) { } } -main :: () -> s32 { +main :: () -> i32 { if g_should_call { drive_touch(null, null); } diff --git a/examples/1420-ffi-jni-env-01-block.sx b/examples/1420-ffi-jni-env-01-block.sx index e4f1e7c..b5853be 100644 --- a/examples/1420-ffi-jni-env-01-block.sx +++ b/examples/1420-ffi-jni-env-01-block.sx @@ -12,7 +12,7 @@ #import "modules/std.sx"; -main :: () -> s32 { +main :: () -> i32 { synth_env : *void = null; #jni_env(synth_env) { print("inside #jni_env scope\n"); diff --git a/examples/1421-ffi-jni-env-02-lexical-direct.sx b/examples/1421-ffi-jni-env-02-lexical-direct.sx index 4b8c0fc..0d97b50 100644 --- a/examples/1421-ffi-jni-env-02-lexical-direct.sx +++ b/examples/1421-ffi-jni-env-02-lexical-direct.sx @@ -21,7 +21,7 @@ unused_jni :: (env: *void, target: *void) { } } -main :: () -> s32 { +main :: () -> i32 { if g_should_call { unused_jni(null, null); } diff --git a/examples/1422-ffi-jni-env-03-tl-fallback.sx b/examples/1422-ffi-jni-env-03-tl-fallback.sx index 47a163d..49575d4 100644 --- a/examples/1422-ffi-jni-env-03-tl-fallback.sx +++ b/examples/1422-ffi-jni-env-03-tl-fallback.sx @@ -28,7 +28,7 @@ unused :: (env: *void, target: *void) { } } -main :: () -> s32 { +main :: () -> i32 { if g_should_call { unused(null, null); } diff --git a/examples/1423-ffi-jni-main-01-emit.sx b/examples/1423-ffi-jni-main-01-emit.sx index 69633a4..05e9aaf 100644 --- a/examples/1423-ffi-jni-main-01-emit.sx +++ b/examples/1423-ffi-jni-main-01-emit.sx @@ -28,4 +28,4 @@ SxApp :: #jni_main #jni_class("co/swipelab/sxjnimain/SxApp") { onCreate :: (self: *Self, b: *Bundle) { } } -main :: () -> s32 { 0 } +main :: () -> i32 { 0 } diff --git a/examples/1424-ffi-jni-main-02-super.sx b/examples/1424-ffi-jni-main-02-super.sx index cf2d47b..c056d01 100644 --- a/examples/1424-ffi-jni-main-02-super.sx +++ b/examples/1424-ffi-jni-main-02-super.sx @@ -21,4 +21,4 @@ SxApp :: #jni_main #jni_class("co/swipelab/sxjnimainsuper/SxApp") { } } -main :: () -> s32 { 0 } +main :: () -> i32 { 0 } diff --git a/examples/1425-ffi-jni-main-03-ctor.sx b/examples/1425-ffi-jni-main-03-ctor.sx index 2a62239..9a776ad 100644 --- a/examples/1425-ffi-jni-main-03-ctor.sx +++ b/examples/1425-ffi-jni-main-03-ctor.sx @@ -27,4 +27,4 @@ SxApp :: #jni_main #jni_class("co/swipelab/sxjnictor/SxApp") { } } -main :: () -> s32 { 0 } +main :: () -> i32 { 0 } diff --git a/examples/1601-platform-sdl-graphics.sx b/examples/1601-platform-sdl-graphics.sx index a32fec8..dbc0a82 100644 --- a/examples/1601-platform-sdl-graphics.sx +++ b/examples/1601-platform-sdl-graphics.sx @@ -96,9 +96,9 @@ main :: () { program := create_program(VERT_SHADER_SRC, FRAG_SHADER_SRC); glUseProgram(program); - mvp_loc : s32 = glGetUniformLocation(program, "uMVP"); - light_loc : s32 = glGetUniformLocation(program, "uLightDir"); - wire_loc : s32 = glGetUniformLocation(program, "uWire"); + mvp_loc : i32 = glGetUniformLocation(program, "uMVP"); + light_loc : i32 = glGetUniformLocation(program, "uLightDir"); + wire_loc : i32 = glGetUniformLocation(program, "uWire"); // Cube vertices: pos(vec4 w=1) + normal(vec4 w=0), 36 vertices × 2 vec4s = 72 vertices : []Vector(4, f32) = .[ diff --git a/examples/1602-platform-http-server.sx b/examples/1602-platform-http-server.sx index 1629ecc..4a83ed8 100644 --- a/examples/1602-platform-http-server.sx +++ b/examples/1602-platform-http-server.sx @@ -7,7 +7,7 @@ Logger :: struct { prefix: string; - count: s64; + count: i64; } log :: (logger: *Logger, msg: string) { @@ -17,7 +17,7 @@ log :: (logger: *Logger, msg: string) { -main :: () -> s32 { +main :: () -> i32 { PORT :: 8080; fd := socket(AF_INET, SOCK_STREAM, 0); @@ -26,7 +26,7 @@ main :: () -> s32 { return 1; } - opt : s32 = 1; + opt : i32 = 1; setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, @opt, 4); addr := SockAddr.{ sin_len = 16, sin_family = 2, sin_port = htons(PORT) }; @@ -63,7 +63,7 @@ main :: () -> s32 { 0 } -handle :: (client: s32) { +handle :: (client: i32) { // Read request buf : [4096]u8 = ---; read(client, buf, buf.len); diff --git a/examples/1603-platform-stb-image.sx b/examples/1603-platform-stb-image.sx index 62cd2c8..de91481 100644 --- a/examples/1603-platform-stb-image.sx +++ b/examples/1603-platform-stb-image.sx @@ -1,10 +1,10 @@ #import "modules/std.sx"; stb :: #import "modules/ffi/stb.sx"; -main :: () -> s32 { - w: s32 = 0; - h: s32 = 0; - ch: s32 = 0; +main :: () -> i32 { + w: i32 = 0; + h: i32 = 0; + ch: i32 = 0; img := stb.stbi_load("test.png", @w, @h, @ch, 4); if xx img != 0 { print("loaded {}x{} ({} channels)\n", w, h, ch); diff --git a/examples/1605-platform-frameworks.sx b/examples/1605-platform-frameworks.sx index c5d9a9b..0c8f7bc 100644 --- a/examples/1605-platform-frameworks.sx +++ b/examples/1605-platform-frameworks.sx @@ -6,7 +6,7 @@ CFAbsoluteTimeGetCurrent :: () -> f64 #foreign; -main :: () -> s32 { +main :: () -> i32 { t := CFAbsoluteTimeGetCurrent(); return if t > 0.0 then 0 else 1; } diff --git a/examples/1606-platform-metal-clear.sx b/examples/1606-platform-metal-clear.sx index 045a239..6f8cbc4 100644 --- a/examples/1606-platform-metal-clear.sx +++ b/examples/1606-platform-metal-clear.sx @@ -104,7 +104,7 @@ frame :: () { g_gpu.end_frame(0.0); } -main :: () -> s32 { +main :: () -> i32 { inline if OS != .ios { return 0; } plat : *UIKitPlatform = xx context.allocator.alloc_bytes(size_of(UIKitPlatform)); diff --git a/examples/1607-platform-uikit-app.sx b/examples/1607-platform-uikit-app.sx index 07eb132..63d96b5 100644 --- a/examples/1607-platform-uikit-app.sx +++ b/examples/1607-platform-uikit-app.sx @@ -16,7 +16,7 @@ #framework "UIKit"; -UIApplicationMain :: (argc: s32, argv: *void, principal_class: *NSString, delegate_class: *NSString) -> s32 #foreign; +UIApplicationMain :: (argc: i32, argv: *void, principal_class: *NSString, delegate_class: *NSString) -> i32 #foreign; // IMP for application:didFinishLaunchingWithOptions: // Obj-C: -(BOOL)application:(UIApplication *)app didFinishLaunchingWithOptions:(NSDictionary *)opts @@ -26,7 +26,7 @@ did_finish_launching :: (self: *void, _cmd: *void, app: *void, opts: *void) -> u return 1; // YES } -main :: () -> s32 { +main :: () -> i32 { // SxAppDelegate : UIResponder. We deliberately don't try // `class_addProtocol(UIApplicationDelegate)` — the linker dead-strips the // protocol metadata from UIKit when nothing references it at compile diff --git a/examples/1608-platform-uikit-window.sx b/examples/1608-platform-uikit-window.sx index cd7c8f1..a9188b3 100644 --- a/examples/1608-platform-uikit-window.sx +++ b/examples/1608-platform-uikit-window.sx @@ -18,7 +18,7 @@ #framework "UIKit"; -UIApplicationMain :: (argc: s32, argv: *void, principal_class: *NSString, delegate_class: *NSString) -> s32 #foreign; +UIApplicationMain :: (argc: i32, argv: *void, principal_class: *NSString, delegate_class: *NSString) -> i32 #foreign; g_window : *void = ---; @@ -79,7 +79,7 @@ did_finish_launching :: (self: *void, _cmd: *void, app: *void, opts: *void) -> u return 1; } -main :: () -> s32 { +main :: () -> i32 { UIResponder := objc_getClass("UIResponder".ptr); SxAppDelegate := objc_allocateClassPair(UIResponder, "SxAppDelegate".ptr, 0); diff --git a/examples/1609-platform-add-framework.sx b/examples/1609-platform-add-framework.sx index ec8cc63..425816f 100644 --- a/examples/1609-platform-add-framework.sx +++ b/examples/1609-platform-add-framework.sx @@ -14,7 +14,7 @@ configure_build :: () { CFAbsoluteTimeGetCurrent :: () -> f64 #foreign; -main :: () -> s32 { +main :: () -> i32 { t := CFAbsoluteTimeGetCurrent(); return if t > 0.0 then 0 else 1; } diff --git a/examples/1610-platform-uikit-platform.sx b/examples/1610-platform-uikit-platform.sx index 3b418a0..249349d 100644 --- a/examples/1610-platform-uikit-platform.sx +++ b/examples/1610-platform-uikit-platform.sx @@ -30,9 +30,9 @@ GL_SCISSOR_TEST :u32: 0x0C11; glEnable_ : (u32) -> void = ---; glDisable_ : (u32) -> void = ---; -glScissor_ : (s32, s32, s32, s32) -> void = ---; +glScissor_ : (i32, i32, i32, i32) -> void = ---; -g_color_index : s64 = 0; +g_color_index : i64 = 0; g_keyboard_up : bool = false; g_loaded : bool = false; @@ -48,7 +48,7 @@ tap_frame :: () { } events := g_uikit_plat.poll_events(); - i : s64 = 0; + i : i64 = 0; while i < events.len { ev := events.ptr[i]; if ev == { @@ -77,7 +77,7 @@ tap_frame :: () { // Bottom bar = the interpolated safe-area bottom inset. insets := g_uikit_plat.safe_insets(); - bar_h_px : s32 = xx (insets.bottom * fc.dpi_scale); + bar_h_px : i32 = xx (insets.bottom * fc.dpi_scale); if bar_h_px > 0 { glEnable_(GL_SCISSOR_TEST); glScissor_(0, 0, fc.pixel_w, bar_h_px); diff --git a/examples/1611-platform-post-link-callback.sx b/examples/1611-platform-post-link-callback.sx index 63b130f..2dc7678 100644 --- a/examples/1611-platform-post-link-callback.sx +++ b/examples/1611-platform-post-link-callback.sx @@ -8,7 +8,7 @@ // runner is `runtime main`. The post-link path is exercised via // `sx build` separately. -puts :: (s: [:0]u8) -> s32 #foreign libc; +puts :: (s: [:0]u8) -> i32 #foreign libc; post_link :: () -> bool { puts("[post-link] callback fired"); diff --git a/examples/1616-platform-ios-device-bundle.sx b/examples/1616-platform-ios-device-bundle.sx index dbe9b3b..99d0e24 100644 --- a/examples/1616-platform-ios-device-bundle.sx +++ b/examples/1616-platform-ios-device-bundle.sx @@ -22,7 +22,7 @@ #framework "UIKit"; -UIApplicationMain :: (argc: s32, argv: *void, principal_class: *NSString, delegate_class: *NSString) -> s32 #foreign; +UIApplicationMain :: (argc: i32, argv: *void, principal_class: *NSString, delegate_class: *NSString) -> i32 #foreign; #import "modules/build.sx"; #import "modules/platform/bundle.sx"; @@ -44,7 +44,7 @@ did_finish_launching :: (self: *void, _cmd: *void, app: *void, opts: *void) -> u return 1; // YES } -main :: () -> s32 { +main :: () -> i32 { UIResponder := objc_getClass("UIResponder".ptr); SxAppDelegate := objc_allocateClassPair(UIResponder, "SxAppDelegate".ptr, 0); diff --git a/examples/expected/0026-basic-operators.stdout b/examples/expected/0026-basic-operators.stdout index 6ddc648..6815d54 100644 --- a/examples/expected/0026-basic-operators.stdout +++ b/examples/expected/0026-basic-operators.stdout @@ -51,10 +51,10 @@ ca/=: 4 prec1: 14 prec2: 20 xx-cast: 200 -widen-u8-s64: 200 -widen-s32-f64: 42.000000 +widen-u8-i64: 200 +widen-i32-f64: 42.000000 widen-f32-f64: 1.500000 -widen-u8-s16: 100 -xx-s64-s32: 12345 +widen-u8-i16: 100 +xx-i64-i32: 12345 xx-f64-f32: 1.500000 -xx-f64-s32: 7 +xx-f64-i32: 7 diff --git a/examples/expected/0028-basic-functions.stdout b/examples/expected/0028-basic-functions.stdout index 6f2015f..522e106 100644 --- a/examples/expected/0028-basic-functions.stdout +++ b/examples/expected/0028-basic-functions.stdout @@ -6,7 +6,7 @@ implicit-ret: 42 early-ret: 5 early-ret2: 99 void-return: ok -generic-s32: 42 +generic-i32: 42 generic-f32: 1.500000 generic-bool: true generic-multi: 30 diff --git a/examples/expected/0030-basic-builtins.stdout b/examples/expected/0030-basic-builtins.stdout index d972526..8b55a5f 100644 --- a/examples/expected/0030-basic-builtins.stdout +++ b/examples/expected/0030-basic-builtins.stdout @@ -2,12 +2,12 @@ out-ok sqrt: 3.000000 sqrt-f64: 4.000000 -sizeof-s32: 4 +sizeof-i32: 4 sizeof-f64: 8 sizeof-struct: 8 alignof-u8: 1 -alignof-s32: 4 -alignof-s64: 8 +alignof-i32: 4 +alignof-i64: 8 alignof-struct: 4 typeof: int typeof-float: float diff --git a/examples/expected/0031-basic-local-fn-return.ir b/examples/expected/0031-basic-local-fn-return.ir index c1afc4a..e1e689f 100644 --- a/examples/expected/0031-basic-local-fn-return.ir +++ b/examples/expected/0031-basic-local-fn-return.ir @@ -25,10 +25,10 @@ @tag_names = private constant [14 x { ptr, i64 }] [{ ptr, i64 } { ptr @tag.str, i64 0 }, { ptr, i64 } { ptr @tag.str.438, i64 8 }, { ptr, i64 } { ptr @tag.str.439, i64 2 }, { ptr, i64 } { ptr @tag.str.440, i64 15 }, { ptr, i64 } { ptr @tag.str.441, i64 13 }, { ptr, i64 } { ptr @tag.str.442, i64 9 }, { ptr, i64 } { ptr @tag.str.443, i64 9 }, { ptr, i64 } { ptr @tag.str.444, i64 15 }, { ptr, i64 } { ptr @tag.str.445, i64 14 }, { ptr, i64 } { ptr @tag.str.446, i64 14 }, { ptr, i64 } { ptr @tag.str.447, i64 11 }, { ptr, i64 } { ptr @tag.str.448, i64 12 }, { ptr, i64 } { ptr @tag.str.449, i64 15 }, { ptr, i64 } { ptr @tag.str.450, i64 12 }] @tn.str = private constant [13 x i8] c"\00" @tn.str.451 = private constant [5 x i8] c"bool\00" -@tn.str.452 = private constant [3 x i8] c"s8\00" -@tn.str.453 = private constant [4 x i8] c"s16\00" -@tn.str.454 = private constant [4 x i8] c"s32\00" -@tn.str.455 = private constant [4 x i8] c"s64\00" +@tn.str.452 = private constant [3 x i8] c"i8\00" +@tn.str.453 = private constant [4 x i8] c"i16\00" +@tn.str.454 = private constant [4 x i8] c"i32\00" +@tn.str.455 = private constant [4 x i8] c"i64\00" @tn.str.456 = private constant [3 x i8] c"u8\00" @tn.str.457 = private constant [4 x i8] c"u16\00" @tn.str.458 = private constant [4 x i8] c"u32\00" @@ -45,7 +45,7 @@ @tn.str.469 = private constant [16 x i8] c"Source_Location\00" @tn.str.470 = private constant [10 x i8] c"Allocator\00" @tn.str.471 = private constant [8 x i8] c"Context\00" -@tn.str.472 = private constant [7 x i8] c"[4]s64\00" +@tn.str.472 = private constant [7 x i8] c"[4]i64\00" @tn.str.473 = private constant [9 x i8] c"[]string\00" @tn.str.474 = private constant [11 x i8] c"CAllocator\00" @tn.str.475 = private constant [12 x i8] c"*CAllocator\00" @@ -70,7 +70,7 @@ @tn.str.494 = private constant [4 x i8] c"*u8\00" @tn.str.495 = private constant [14 x i8] c"ProcessResult\00" @tn.str.496 = private constant [15 x i8] c"?ProcessResult\00" -@tn.str.497 = private constant [5 x i8] c"*s32\00" +@tn.str.497 = private constant [5 x i8] c"*i32\00" @tn.str.498 = private constant [9 x i8] c"SockAddr\00" @tn.str.499 = private constant [10 x i8] c"*SockAddr\00" @tn.str.500 = private constant [5 x i8] c"*u32\00" @@ -86,9 +86,9 @@ @tn.str.510 = private constant [5 x i8] c"[]u8\00" @tn.str.511 = private constant [5 x i8] c"Sink\00" @tn.str.512 = private constant [6 x i8] c"*Sink\00" -@tn.str.513 = private constant [17 x i8] c"(s64, JsonError)\00" +@tn.str.513 = private constant [17 x i8] c"(i64, JsonError)\00" @tn.str.514 = private constant [15 x i8] c"JsonParseError\00" -@tn.str.515 = private constant [22 x i8] c"(s64, JsonParseError)\00" +@tn.str.515 = private constant [22 x i8] c"(i64, JsonParseError)\00" @tn.str.516 = private constant [7 x i8] c"Parser\00" @tn.str.517 = private constant [8 x i8] c"*Parser\00" @tn.str.518 = private constant [25 x i8] c"(string, JsonParseError)\00" @@ -97,7 +97,7 @@ @tn.str.521 = private constant [13 x i8] c"Architecture\00" @tn.str.522 = private constant [13 x i8] c"BuildOptions\00" @tn.str.523 = private constant [11 x i8] c"() -> bool\00" -@tn.str.524 = private constant [5 x i8] c"*s64\00" +@tn.str.524 = private constant [5 x i8] c"*i64\00" @tn.str.525 = private constant [9 x i8] c"CliError\00" @tn.str.526 = private constant [9 x i8] c"FlagSpec\00" @tn.str.527 = private constant [11 x i8] c"[]FlagSpec\00" @@ -110,12 +110,12 @@ @tn.str.534 = private constant [19 x i8] c"(Parsed, CliError)\00" @tn.str.535 = private constant [10 x i8] c"[]Command\00" @tn.str.536 = private constant [6 x i8] c"*Diag\00" -@tn.str.537 = private constant [7 x i8] c"[8]s64\00" +@tn.str.537 = private constant [7 x i8] c"[8]i64\00" @tn.str.538 = private constant [7 x i8] c"[64]u8\00" @tn.str.539 = private constant [7 x i8] c"Sha256\00" @tn.str.540 = private constant [8 x i8] c"*Sha256\00" @tn.str.541 = private constant [8 x i8] c"?[64]u8\00" -@tn.str.542 = private constant [8 x i8] c"[64]s64\00" +@tn.str.542 = private constant [8 x i8] c"[64]i64\00" @tn.str.543 = private constant [8 x i8] c"[16]f32\00" @tn.str.544 = private constant [5 x i8] c"Mat4\00" @tn.str.545 = private constant [5 x i8] c"Vec2\00" @@ -135,7 +135,7 @@ @tn.str.559 = private constant [7 x i8] c"*Shape\00" @tn.str.560 = private constant [7 x i8] c"[1]Any\00" @tn.str.561 = private constant [8 x i8] c"*[1]Any\00" -@tn.str.562 = private constant [8 x i8] c"*[4]s64\00" +@tn.str.562 = private constant [8 x i8] c"*[4]i64\00" @tn.str.563 = private constant [5 x i8] c"*f64\00" @tn.str.564 = private constant [17 x i8] c"*Source_Location\00" @tn.str.565 = private constant [11 x i8] c"*Allocator\00" @@ -156,9 +156,9 @@ @tn.str.580 = private constant [17 x i8] c"*OperatingSystem\00" @tn.str.581 = private constant [14 x i8] c"*Architecture\00" @tn.str.582 = private constant [15 x i8] c"*[16]FlagValue\00" -@tn.str.583 = private constant [8 x i8] c"*[8]s64\00" +@tn.str.583 = private constant [8 x i8] c"*[8]i64\00" @tn.str.584 = private constant [8 x i8] c"*[64]u8\00" -@tn.str.585 = private constant [9 x i8] c"*[64]s64\00" +@tn.str.585 = private constant [9 x i8] c"*[64]i64\00" @tn.str.586 = private constant [9 x i8] c"*[16]f32\00" @tn.str.587 = private constant [10 x i8] c"*[]string\00" @tn.str.588 = private constant [6 x i8] c"*[]u8\00" @@ -172,7 +172,7 @@ @tn.str.596 = private constant [20 x i8] c"**TrackingAllocator\00" @tn.str.597 = private constant [7 x i8] c"**File\00" @tn.str.598 = private constant [5 x i8] c"**u8\00" -@tn.str.599 = private constant [6 x i8] c"**s32\00" +@tn.str.599 = private constant [6 x i8] c"**i32\00" @tn.str.600 = private constant [11 x i8] c"**SockAddr\00" @tn.str.601 = private constant [6 x i8] c"**u32\00" @tn.str.602 = private constant [10 x i8] c"*[*]Value\00" @@ -181,7 +181,7 @@ @tn.str.605 = private constant [9 x i8] c"**Object\00" @tn.str.606 = private constant [7 x i8] c"**Sink\00" @tn.str.607 = private constant [9 x i8] c"**Parser\00" -@tn.str.608 = private constant [6 x i8] c"**s64\00" +@tn.str.608 = private constant [6 x i8] c"**i64\00" @tn.str.609 = private constant [9 x i8] c"**Parsed\00" @tn.str.610 = private constant [7 x i8] c"**Diag\00" @tn.str.611 = private constant [9 x i8] c"**Sha256\00" @@ -603,7 +603,7 @@ @str.1024 = private unnamed_addr constant [4 x i8] c"*u8\00", align 1 @str.1025 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.1026 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.1027 = private unnamed_addr constant [5 x i8] c"*s32\00", align 1 +@str.1027 = private unnamed_addr constant [5 x i8] c"*i32\00", align 1 @str.1028 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.1029 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.1030 = private unnamed_addr constant [10 x i8] c"*SockAddr\00", align 1 @@ -630,7 +630,7 @@ @str.1051 = private unnamed_addr constant [8 x i8] c"*Parser\00", align 1 @str.1052 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.1053 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.1054 = private unnamed_addr constant [5 x i8] c"*s64\00", align 1 +@str.1054 = private unnamed_addr constant [5 x i8] c"*i64\00", align 1 @str.1055 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.1056 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.1057 = private unnamed_addr constant [8 x i8] c"*Parsed\00", align 1 @@ -2067,7 +2067,7 @@ dispatch.case.292: ; preds = %match.arm.47 %ua.raw194 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr195 = inttoptr i64 %ua.raw194 to ptr %ua.load196 = load [4 x i64], ptr %ua.ptr195, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %ua.load196) + %callN = call { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %ua.load196) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.290 @@ -2083,7 +2083,7 @@ dispatch.case.294: ; preds = %match.arm.47 %ua.raw202 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr203 = inttoptr i64 %ua.raw202 to ptr %ua.load204 = load [8 x i64], ptr %ua.ptr203, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %ua.load204) + %callN = call { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %ua.load204) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.290 @@ -2099,7 +2099,7 @@ dispatch.case.296: ; preds = %match.arm.47 %ua.raw210 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr211 = inttoptr i64 %ua.raw210 to ptr %ua.load212 = load [64 x i64], ptr %ua.ptr211, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %ua.load212) + %callN = call { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %ua.load212) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.290 @@ -2258,7 +2258,7 @@ dispatch.case.383: ; preds = %match.arm.49 dispatch.case.384: ; preds = %match.arm.49 %ua.raw277 = extractvalue { i64, i64 } %loadN, 1 %iNp278 = inttoptr i64 %ua.raw277 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %iNp278) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %iNp278) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.372 @@ -2321,7 +2321,7 @@ dispatch.case.392: ; preds = %match.arm.49 dispatch.case.393: ; preds = %match.arm.49 %ua.raw304 = extractvalue { i64, i64 } %loadN, 1 %iNp305 = inttoptr i64 %ua.raw304 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %iNp305) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %iNp305) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.372 @@ -4643,7 +4643,7 @@ entry: %sg = extractvalue { i32, i32 } %load, 0 %loadN = load { i32, i32 }, ptr %alloca, align 4 %sgN = extractvalue { i32, i32 } %loadN, 1 - call void @print__ct_s546acbc299164a0e__pack_s32_s32(ptr @__sx_default_context, i32 %sg, i32 %sgN) + call void @print__ct_s546acbc299164a0e__pack_i32_i32(ptr @__sx_default_context, i32 %sg, i32 %sgN) %callN = call { i64, [8 x i8] } @local_sh__1(ptr @__sx_default_context) %allocaN = alloca { i64, [8 x i8] }, align 8 store { i64, [8 x i8] } %callN, ptr %allocaN, align 8 @@ -4704,7 +4704,7 @@ entry: } ; Function Attrs: nounwind -define internal void @print__ct_s546acbc299164a0e__pack_s32_s32(ptr %0, i32 %1, i32 %2) #0 { +define internal void @print__ct_s546acbc299164a0e__pack_i32_i32(ptr %0, i32 %1, i32 %2) #0 { entry: %alloca = alloca { ptr, i64 }, align 8 store { ptr, i64 } { ptr @str.650, i64 20 }, ptr %alloca, align 8 @@ -4714,13 +4714,13 @@ entry: store i32 %2, ptr %allocaN, align 4 %allocaN = alloca [2 x { i64, i64 }], align 8 %load = load i32, ptr %allocaN, align 4 - %sN = sext i32 %load to i64 - %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %load to i64 + %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %igp.ptr = getelementptr { i64, i64 }, ptr %allocaN, i64 0 store { i64, i64 } %ba.val, ptr %igp.ptr, align 8 %loadN = load i32, ptr %allocaN, align 4 - %sN = sext i32 %loadN to i64 - %ba.val6 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %loadN to i64 + %ba.val6 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %igp.ptr7 = getelementptr { i64, i64 }, ptr %allocaN, i64 1 store { i64, i64 } %ba.val6, ptr %igp.ptr7, align 8 %allocaN = alloca { ptr, i64 }, align 8 @@ -4738,8 +4738,8 @@ entry: store { ptr, i64 } %callN, ptr %allocaN, align 8 %loadN = load { ptr, i64 }, ptr %allocaN, align 8 %loadN = load i32, ptr %allocaN, align 4 - %sN = sext i32 %loadN to i64 - %ba.val18 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %loadN to i64 + %ba.val18 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %callN = call { ptr, i64 } @any_to_string(ptr %0, { i64, i64 } %ba.val18) %callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN) store { ptr, i64 } %callN, ptr %allocaN, align 8 @@ -4750,8 +4750,8 @@ entry: store { ptr, i64 } %callN, ptr %allocaN, align 8 %loadN = load { ptr, i64 }, ptr %allocaN, align 8 %loadN = load i32, ptr %allocaN, align 4 - %sN = sext i32 %loadN to i64 - %ba.val28 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %loadN to i64 + %ba.val28 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %callN = call { ptr, i64 } @any_to_string(ptr %0, { i64, i64 } %ba.val28) %callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN) store { ptr, i64 } %callN, ptr %allocaN, align 8 @@ -4919,14 +4919,14 @@ fv.case: ; preds = %if.merge.129 fv.case17: ; preds = %if.merge.129 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.129 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.129 @@ -5622,8 +5622,8 @@ fv.default: ; preds = %if.merge.174 fv.case: ; preds = %if.merge.174 %fv.field = extractvalue { i32 } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge } @@ -5706,14 +5706,14 @@ fv.case: ; preds = %if.merge.179 fv.case17: ; preds = %if.merge.179 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.179 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.179 @@ -5798,8 +5798,8 @@ fv.default: ; preds = %if.merge.184 fv.case: ; preds = %if.merge.184 %fv.field = extractvalue { i32, { ptr, i64 } } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case17: ; preds = %if.merge.184 @@ -7143,14 +7143,14 @@ fv.default: ; preds = %if.merge.264 fv.case: ; preds = %if.merge.264 %fv.field = extractvalue { i32, i32 } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case17: ; preds = %if.merge.264 %fv.field18 = extractvalue { i32, i32 } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val20 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val20 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge } @@ -7584,7 +7584,7 @@ fv.case11: ; preds = %entry } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %1) #0 { entry: %alloca = alloca [4 x i64], align 8 %ig.tmp = alloca [4 x i64], align 8 @@ -7687,7 +7687,7 @@ if.merge.309: ; preds = %if.then.308, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %1) #0 { entry: %alloca = alloca [8 x i64], align 8 %ig.tmp = alloca [8 x i64], align 8 @@ -7788,7 +7788,7 @@ if.merge.319: ; preds = %if.then.318, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %1) #0 { entry: %alloca = alloca [64 x i64], align 8 %ig.tmp = alloca [64 x i64], align 8 @@ -8543,7 +8543,7 @@ if.merge.449: ; preds = %if.else.448, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 @@ -8793,7 +8793,7 @@ if.merge.476: ; preds = %if.else.475, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 diff --git a/examples/expected/0032-basic-ufcs-return-type.ir b/examples/expected/0032-basic-ufcs-return-type.ir index df2336b..4e5281d 100644 --- a/examples/expected/0032-basic-ufcs-return-type.ir +++ b/examples/expected/0032-basic-ufcs-return-type.ir @@ -25,10 +25,10 @@ @tag_names = private constant [14 x { ptr, i64 }] [{ ptr, i64 } { ptr @tag.str, i64 0 }, { ptr, i64 } { ptr @tag.str.438, i64 8 }, { ptr, i64 } { ptr @tag.str.439, i64 2 }, { ptr, i64 } { ptr @tag.str.440, i64 15 }, { ptr, i64 } { ptr @tag.str.441, i64 13 }, { ptr, i64 } { ptr @tag.str.442, i64 9 }, { ptr, i64 } { ptr @tag.str.443, i64 9 }, { ptr, i64 } { ptr @tag.str.444, i64 15 }, { ptr, i64 } { ptr @tag.str.445, i64 14 }, { ptr, i64 } { ptr @tag.str.446, i64 14 }, { ptr, i64 } { ptr @tag.str.447, i64 11 }, { ptr, i64 } { ptr @tag.str.448, i64 12 }, { ptr, i64 } { ptr @tag.str.449, i64 15 }, { ptr, i64 } { ptr @tag.str.450, i64 12 }] @tn.str = private constant [13 x i8] c"\00" @tn.str.451 = private constant [5 x i8] c"bool\00" -@tn.str.452 = private constant [3 x i8] c"s8\00" -@tn.str.453 = private constant [4 x i8] c"s16\00" -@tn.str.454 = private constant [4 x i8] c"s32\00" -@tn.str.455 = private constant [4 x i8] c"s64\00" +@tn.str.452 = private constant [3 x i8] c"i8\00" +@tn.str.453 = private constant [4 x i8] c"i16\00" +@tn.str.454 = private constant [4 x i8] c"i32\00" +@tn.str.455 = private constant [4 x i8] c"i64\00" @tn.str.456 = private constant [3 x i8] c"u8\00" @tn.str.457 = private constant [4 x i8] c"u16\00" @tn.str.458 = private constant [4 x i8] c"u32\00" @@ -45,7 +45,7 @@ @tn.str.469 = private constant [16 x i8] c"Source_Location\00" @tn.str.470 = private constant [10 x i8] c"Allocator\00" @tn.str.471 = private constant [8 x i8] c"Context\00" -@tn.str.472 = private constant [7 x i8] c"[4]s64\00" +@tn.str.472 = private constant [7 x i8] c"[4]i64\00" @tn.str.473 = private constant [9 x i8] c"[]string\00" @tn.str.474 = private constant [11 x i8] c"CAllocator\00" @tn.str.475 = private constant [12 x i8] c"*CAllocator\00" @@ -70,7 +70,7 @@ @tn.str.494 = private constant [4 x i8] c"*u8\00" @tn.str.495 = private constant [14 x i8] c"ProcessResult\00" @tn.str.496 = private constant [15 x i8] c"?ProcessResult\00" -@tn.str.497 = private constant [5 x i8] c"*s32\00" +@tn.str.497 = private constant [5 x i8] c"*i32\00" @tn.str.498 = private constant [9 x i8] c"SockAddr\00" @tn.str.499 = private constant [10 x i8] c"*SockAddr\00" @tn.str.500 = private constant [5 x i8] c"*u32\00" @@ -86,9 +86,9 @@ @tn.str.510 = private constant [5 x i8] c"[]u8\00" @tn.str.511 = private constant [5 x i8] c"Sink\00" @tn.str.512 = private constant [6 x i8] c"*Sink\00" -@tn.str.513 = private constant [17 x i8] c"(s64, JsonError)\00" +@tn.str.513 = private constant [17 x i8] c"(i64, JsonError)\00" @tn.str.514 = private constant [15 x i8] c"JsonParseError\00" -@tn.str.515 = private constant [22 x i8] c"(s64, JsonParseError)\00" +@tn.str.515 = private constant [22 x i8] c"(i64, JsonParseError)\00" @tn.str.516 = private constant [7 x i8] c"Parser\00" @tn.str.517 = private constant [8 x i8] c"*Parser\00" @tn.str.518 = private constant [25 x i8] c"(string, JsonParseError)\00" @@ -97,7 +97,7 @@ @tn.str.521 = private constant [13 x i8] c"Architecture\00" @tn.str.522 = private constant [13 x i8] c"BuildOptions\00" @tn.str.523 = private constant [11 x i8] c"() -> bool\00" -@tn.str.524 = private constant [5 x i8] c"*s64\00" +@tn.str.524 = private constant [5 x i8] c"*i64\00" @tn.str.525 = private constant [9 x i8] c"CliError\00" @tn.str.526 = private constant [9 x i8] c"FlagSpec\00" @tn.str.527 = private constant [11 x i8] c"[]FlagSpec\00" @@ -110,12 +110,12 @@ @tn.str.534 = private constant [19 x i8] c"(Parsed, CliError)\00" @tn.str.535 = private constant [10 x i8] c"[]Command\00" @tn.str.536 = private constant [6 x i8] c"*Diag\00" -@tn.str.537 = private constant [7 x i8] c"[8]s64\00" +@tn.str.537 = private constant [7 x i8] c"[8]i64\00" @tn.str.538 = private constant [7 x i8] c"[64]u8\00" @tn.str.539 = private constant [7 x i8] c"Sha256\00" @tn.str.540 = private constant [8 x i8] c"*Sha256\00" @tn.str.541 = private constant [8 x i8] c"?[64]u8\00" -@tn.str.542 = private constant [8 x i8] c"[64]s64\00" +@tn.str.542 = private constant [8 x i8] c"[64]i64\00" @tn.str.543 = private constant [8 x i8] c"[16]f32\00" @tn.str.544 = private constant [5 x i8] c"Mat4\00" @tn.str.545 = private constant [5 x i8] c"Vec2\00" @@ -130,7 +130,7 @@ @tn.str.554 = private constant [7 x i8] c"*Point\00" @tn.str.555 = private constant [7 x i8] c"[1]Any\00" @tn.str.556 = private constant [8 x i8] c"*[1]Any\00" -@tn.str.557 = private constant [8 x i8] c"*[4]s64\00" +@tn.str.557 = private constant [8 x i8] c"*[4]i64\00" @tn.str.558 = private constant [5 x i8] c"*f64\00" @tn.str.559 = private constant [17 x i8] c"*Source_Location\00" @tn.str.560 = private constant [11 x i8] c"*Allocator\00" @@ -150,9 +150,9 @@ @tn.str.574 = private constant [17 x i8] c"*OperatingSystem\00" @tn.str.575 = private constant [14 x i8] c"*Architecture\00" @tn.str.576 = private constant [15 x i8] c"*[16]FlagValue\00" -@tn.str.577 = private constant [8 x i8] c"*[8]s64\00" +@tn.str.577 = private constant [8 x i8] c"*[8]i64\00" @tn.str.578 = private constant [8 x i8] c"*[64]u8\00" -@tn.str.579 = private constant [9 x i8] c"*[64]s64\00" +@tn.str.579 = private constant [9 x i8] c"*[64]i64\00" @tn.str.580 = private constant [9 x i8] c"*[16]f32\00" @tn.str.581 = private constant [10 x i8] c"*[]string\00" @tn.str.582 = private constant [6 x i8] c"*[]u8\00" @@ -166,7 +166,7 @@ @tn.str.590 = private constant [20 x i8] c"**TrackingAllocator\00" @tn.str.591 = private constant [7 x i8] c"**File\00" @tn.str.592 = private constant [5 x i8] c"**u8\00" -@tn.str.593 = private constant [6 x i8] c"**s32\00" +@tn.str.593 = private constant [6 x i8] c"**i32\00" @tn.str.594 = private constant [11 x i8] c"**SockAddr\00" @tn.str.595 = private constant [6 x i8] c"**u32\00" @tn.str.596 = private constant [10 x i8] c"*[*]Value\00" @@ -175,7 +175,7 @@ @tn.str.599 = private constant [9 x i8] c"**Object\00" @tn.str.600 = private constant [7 x i8] c"**Sink\00" @tn.str.601 = private constant [9 x i8] c"**Parser\00" -@tn.str.602 = private constant [6 x i8] c"**s64\00" +@tn.str.602 = private constant [6 x i8] c"**i64\00" @tn.str.603 = private constant [9 x i8] c"**Parsed\00" @tn.str.604 = private constant [7 x i8] c"**Diag\00" @tn.str.605 = private constant [9 x i8] c"**Sha256\00" @@ -577,7 +577,7 @@ @str.998 = private unnamed_addr constant [4 x i8] c"*u8\00", align 1 @str.999 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.1000 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.1001 = private unnamed_addr constant [5 x i8] c"*s32\00", align 1 +@str.1001 = private unnamed_addr constant [5 x i8] c"*i32\00", align 1 @str.1002 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.1003 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.1004 = private unnamed_addr constant [10 x i8] c"*SockAddr\00", align 1 @@ -604,7 +604,7 @@ @str.1025 = private unnamed_addr constant [8 x i8] c"*Parser\00", align 1 @str.1026 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.1027 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.1028 = private unnamed_addr constant [5 x i8] c"*s64\00", align 1 +@str.1028 = private unnamed_addr constant [5 x i8] c"*i64\00", align 1 @str.1029 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.1030 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.1031 = private unnamed_addr constant [8 x i8] c"*Parsed\00", align 1 @@ -2009,7 +2009,7 @@ dispatch.case.283: ; preds = %match.arm.47 %ua.raw186 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr187 = inttoptr i64 %ua.raw186 to ptr %ua.load188 = load [4 x i64], ptr %ua.ptr187, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %ua.load188) + %callN = call { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %ua.load188) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.281 @@ -2025,7 +2025,7 @@ dispatch.case.285: ; preds = %match.arm.47 %ua.raw194 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr195 = inttoptr i64 %ua.raw194 to ptr %ua.load196 = load [8 x i64], ptr %ua.ptr195, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %ua.load196) + %callN = call { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %ua.load196) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.281 @@ -2041,7 +2041,7 @@ dispatch.case.287: ; preds = %match.arm.47 %ua.raw202 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr203 = inttoptr i64 %ua.raw202 to ptr %ua.load204 = load [64 x i64], ptr %ua.ptr203, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %ua.load204) + %callN = call { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %ua.load204) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.281 @@ -2192,7 +2192,7 @@ dispatch.case.368: ; preds = %match.arm.49 dispatch.case.369: ; preds = %match.arm.49 %ua.raw265 = extractvalue { i64, i64 } %loadN, 1 %iNp266 = inttoptr i64 %ua.raw265 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %iNp266) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %iNp266) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.357 @@ -2255,7 +2255,7 @@ dispatch.case.377: ; preds = %match.arm.49 dispatch.case.378: ; preds = %match.arm.49 %ua.raw292 = extractvalue { i64, i64 } %loadN, 1 %iNp293 = inttoptr i64 %ua.raw292 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %iNp293) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %iNp293) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.357 @@ -4573,10 +4573,10 @@ entry: store { i32, i32 } { i32 3, i32 4 }, ptr %alloca, align 4 %load = load { i32, i32 }, ptr %alloca, align 4 %call = call i32 @point_sum(ptr @__sx_default_context, { i32, i32 } %load) - call void @print__ct_sfd746eca0faee40b__pack_s32(ptr @__sx_default_context, i32 %call) + call void @print__ct_sfd746eca0faee40b__pack_i32(ptr @__sx_default_context, i32 %call) %loadN = load { i32, i32 }, ptr %alloca, align 4 %callN = call i32 @point_sum(ptr @__sx_default_context, { i32, i32 } %loadN) - call void @print__ct_s61f699add92dd2af__pack_s32(ptr @__sx_default_context, i32 %callN) + call void @print__ct_s61f699add92dd2af__pack_i32(ptr @__sx_default_context, i32 %callN) ret i32 0 } @@ -4626,7 +4626,7 @@ entry: } ; Function Attrs: nounwind -define internal void @print__ct_sfd746eca0faee40b__pack_s32(ptr %0, i32 %1) #0 { +define internal void @print__ct_sfd746eca0faee40b__pack_i32(ptr %0, i32 %1) #0 { entry: %alloca = alloca { ptr, i64 }, align 8 store { ptr, i64 } { ptr @str.642, i64 11 }, ptr %alloca, align 8 @@ -4634,8 +4634,8 @@ entry: store i32 %1, ptr %allocaN, align 4 %allocaN = alloca [1 x { i64, i64 }], align 8 %load = load i32, ptr %allocaN, align 4 - %sN = sext i32 %load to i64 - %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %load to i64 + %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %igp.ptr = getelementptr { i64, i64 }, ptr %allocaN, i64 0 store { i64, i64 } %ba.val, ptr %igp.ptr, align 8 %allocaN = alloca { ptr, i64 }, align 8 @@ -4653,8 +4653,8 @@ entry: store { ptr, i64 } %callN, ptr %allocaN, align 8 %loadN = load { ptr, i64 }, ptr %allocaN, align 8 %loadN = load i32, ptr %allocaN, align 4 - %sN = sext i32 %loadN to i64 - %ba.val13 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %loadN to i64 + %ba.val13 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %callN = call { ptr, i64 } @any_to_string(ptr %0, { i64, i64 } %ba.val13) %callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN) store { ptr, i64 } %callN, ptr %allocaN, align 8 @@ -4678,7 +4678,7 @@ entry: } ; Function Attrs: nounwind -define internal void @print__ct_s61f699add92dd2af__pack_s32(ptr %0, i32 %1) #0 { +define internal void @print__ct_s61f699add92dd2af__pack_i32(ptr %0, i32 %1) #0 { entry: %alloca = alloca { ptr, i64 }, align 8 store { ptr, i64 } { ptr @str.645, i64 9 }, ptr %alloca, align 8 @@ -4686,8 +4686,8 @@ entry: store i32 %1, ptr %allocaN, align 4 %allocaN = alloca [1 x { i64, i64 }], align 8 %load = load i32, ptr %allocaN, align 4 - %sN = sext i32 %load to i64 - %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %load to i64 + %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %igp.ptr = getelementptr { i64, i64 }, ptr %allocaN, i64 0 store { i64, i64 } %ba.val, ptr %igp.ptr, align 8 %allocaN = alloca { ptr, i64 }, align 8 @@ -4705,8 +4705,8 @@ entry: store { ptr, i64 } %callN, ptr %allocaN, align 8 %loadN = load { ptr, i64 }, ptr %allocaN, align 8 %loadN = load i32, ptr %allocaN, align 4 - %sN = sext i32 %loadN to i64 - %ba.val13 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %loadN to i64 + %ba.val13 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %callN = call { ptr, i64 } @any_to_string(ptr %0, { i64, i64 } %ba.val13) %callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN) store { ptr, i64 } %callN, ptr %allocaN, align 8 @@ -4806,14 +4806,14 @@ fv.case: ; preds = %if.merge.128 fv.case17: ; preds = %if.merge.128 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.128 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.128 @@ -5509,8 +5509,8 @@ fv.default: ; preds = %if.merge.173 fv.case: ; preds = %if.merge.173 %fv.field = extractvalue { i32 } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge } @@ -5593,14 +5593,14 @@ fv.case: ; preds = %if.merge.178 fv.case17: ; preds = %if.merge.178 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.178 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.178 @@ -5685,8 +5685,8 @@ fv.default: ; preds = %if.merge.183 fv.case: ; preds = %if.merge.183 %fv.field = extractvalue { i32, { ptr, i64 } } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case17: ; preds = %if.merge.183 @@ -7030,14 +7030,14 @@ fv.default: ; preds = %if.merge.263 fv.case: ; preds = %if.merge.263 %fv.field = extractvalue { i32, i32 } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case17: ; preds = %if.merge.263 %fv.field18 = extractvalue { i32, i32 } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val20 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val20 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge } @@ -7315,7 +7315,7 @@ if.merge.280: ; preds = %if.then.279, %entry } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %1) #0 { entry: %alloca = alloca [4 x i64], align 8 %ig.tmp = alloca [4 x i64], align 8 @@ -7418,7 +7418,7 @@ if.merge.299: ; preds = %if.then.298, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %1) #0 { entry: %alloca = alloca [8 x i64], align 8 %ig.tmp = alloca [8 x i64], align 8 @@ -7519,7 +7519,7 @@ if.merge.309: ; preds = %if.then.308, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %1) #0 { entry: %alloca = alloca [64 x i64], align 8 %ig.tmp = alloca [64 x i64], align 8 @@ -8221,7 +8221,7 @@ if.merge.432: ; preds = %if.else.431, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 @@ -8471,7 +8471,7 @@ if.merge.459: ; preds = %if.else.458, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 diff --git a/examples/expected/0041-basic-block-value-reject.stderr b/examples/expected/0041-basic-block-value-reject.stderr index d664441..84ec257 100644 --- a/examples/expected/0041-basic-block-value-reject.stderr +++ b/examples/expected/0041-basic-block-value-reject.stderr @@ -1,5 +1,5 @@ -error: function returns 's32' but the last expression's value is discarded by this `;` — drop the `;` to return it (or use an explicit `return`) - --> /Users/agra/projects/sx/examples/0041-basic-block-value-reject.sx:10:10 +error: function returns 'i32' but the last expression's value is discarded by this `;` — drop the `;` to return it (or use an explicit `return`) + --> examples/0041-basic-block-value-reject.sx:10:10 | 10 | n * 2; | ^ diff --git a/examples/expected/0044-basic-default-arg-expansion.ir b/examples/expected/0044-basic-default-arg-expansion.ir index 32037a8..e161f75 100644 --- a/examples/expected/0044-basic-default-arg-expansion.ir +++ b/examples/expected/0044-basic-default-arg-expansion.ir @@ -25,10 +25,10 @@ @tag_names = private constant [14 x { ptr, i64 }] [{ ptr, i64 } { ptr @tag.str, i64 0 }, { ptr, i64 } { ptr @tag.str.114, i64 8 }, { ptr, i64 } { ptr @tag.str.115, i64 2 }, { ptr, i64 } { ptr @tag.str.116, i64 15 }, { ptr, i64 } { ptr @tag.str.117, i64 13 }, { ptr, i64 } { ptr @tag.str.118, i64 9 }, { ptr, i64 } { ptr @tag.str.119, i64 9 }, { ptr, i64 } { ptr @tag.str.120, i64 15 }, { ptr, i64 } { ptr @tag.str.121, i64 14 }, { ptr, i64 } { ptr @tag.str.122, i64 14 }, { ptr, i64 } { ptr @tag.str.123, i64 11 }, { ptr, i64 } { ptr @tag.str.124, i64 12 }, { ptr, i64 } { ptr @tag.str.125, i64 15 }, { ptr, i64 } { ptr @tag.str.126, i64 12 }] @tn.str = private constant [13 x i8] c"\00" @tn.str.127 = private constant [5 x i8] c"bool\00" -@tn.str.128 = private constant [3 x i8] c"s8\00" -@tn.str.129 = private constant [4 x i8] c"s16\00" -@tn.str.130 = private constant [4 x i8] c"s32\00" -@tn.str.131 = private constant [4 x i8] c"s64\00" +@tn.str.128 = private constant [3 x i8] c"i8\00" +@tn.str.129 = private constant [4 x i8] c"i16\00" +@tn.str.130 = private constant [4 x i8] c"i32\00" +@tn.str.131 = private constant [4 x i8] c"i64\00" @tn.str.132 = private constant [3 x i8] c"u8\00" @tn.str.133 = private constant [4 x i8] c"u16\00" @tn.str.134 = private constant [4 x i8] c"u32\00" @@ -45,7 +45,7 @@ @tn.str.145 = private constant [16 x i8] c"Source_Location\00" @tn.str.146 = private constant [10 x i8] c"Allocator\00" @tn.str.147 = private constant [8 x i8] c"Context\00" -@tn.str.148 = private constant [7 x i8] c"[4]s64\00" +@tn.str.148 = private constant [7 x i8] c"[4]i64\00" @tn.str.149 = private constant [9 x i8] c"[]string\00" @tn.str.150 = private constant [11 x i8] c"CAllocator\00" @tn.str.151 = private constant [12 x i8] c"*CAllocator\00" @@ -70,7 +70,7 @@ @tn.str.170 = private constant [4 x i8] c"*u8\00" @tn.str.171 = private constant [14 x i8] c"ProcessResult\00" @tn.str.172 = private constant [15 x i8] c"?ProcessResult\00" -@tn.str.173 = private constant [5 x i8] c"*s32\00" +@tn.str.173 = private constant [5 x i8] c"*i32\00" @tn.str.174 = private constant [9 x i8] c"SockAddr\00" @tn.str.175 = private constant [10 x i8] c"*SockAddr\00" @tn.str.176 = private constant [5 x i8] c"*u32\00" @@ -86,9 +86,9 @@ @tn.str.186 = private constant [5 x i8] c"[]u8\00" @tn.str.187 = private constant [5 x i8] c"Sink\00" @tn.str.188 = private constant [6 x i8] c"*Sink\00" -@tn.str.189 = private constant [17 x i8] c"(s64, JsonError)\00" +@tn.str.189 = private constant [17 x i8] c"(i64, JsonError)\00" @tn.str.190 = private constant [15 x i8] c"JsonParseError\00" -@tn.str.191 = private constant [22 x i8] c"(s64, JsonParseError)\00" +@tn.str.191 = private constant [22 x i8] c"(i64, JsonParseError)\00" @tn.str.192 = private constant [7 x i8] c"Parser\00" @tn.str.193 = private constant [8 x i8] c"*Parser\00" @tn.str.194 = private constant [25 x i8] c"(string, JsonParseError)\00" @@ -97,7 +97,7 @@ @tn.str.197 = private constant [13 x i8] c"Architecture\00" @tn.str.198 = private constant [13 x i8] c"BuildOptions\00" @tn.str.199 = private constant [11 x i8] c"() -> bool\00" -@tn.str.200 = private constant [5 x i8] c"*s64\00" +@tn.str.200 = private constant [5 x i8] c"*i64\00" @tn.str.201 = private constant [9 x i8] c"CliError\00" @tn.str.202 = private constant [9 x i8] c"FlagSpec\00" @tn.str.203 = private constant [11 x i8] c"[]FlagSpec\00" @@ -110,12 +110,12 @@ @tn.str.210 = private constant [19 x i8] c"(Parsed, CliError)\00" @tn.str.211 = private constant [10 x i8] c"[]Command\00" @tn.str.212 = private constant [6 x i8] c"*Diag\00" -@tn.str.213 = private constant [7 x i8] c"[8]s64\00" +@tn.str.213 = private constant [7 x i8] c"[8]i64\00" @tn.str.214 = private constant [7 x i8] c"[64]u8\00" @tn.str.215 = private constant [7 x i8] c"Sha256\00" @tn.str.216 = private constant [8 x i8] c"*Sha256\00" @tn.str.217 = private constant [8 x i8] c"?[64]u8\00" -@tn.str.218 = private constant [8 x i8] c"[64]s64\00" +@tn.str.218 = private constant [8 x i8] c"[64]i64\00" @tn.str.219 = private constant [13 x i8] c"**CAllocator\00" @tn.str.220 = private constant [7 x i8] c"**void\00" @tn.str.221 = private constant [8 x i8] c"*string\00" @@ -127,7 +127,7 @@ @tn.str.227 = private constant [6 x i8] c"*bool\00" @tn.str.228 = private constant [7 x i8] c"[3]Any\00" @tn.str.229 = private constant [8 x i8] c"*[3]Any\00" -@tn.str.230 = private constant [8 x i8] c"*[4]s64\00" +@tn.str.230 = private constant [8 x i8] c"*[4]i64\00" @tn.str.231 = private constant [5 x i8] c"*f64\00" @tn.str.232 = private constant [17 x i8] c"*Source_Location\00" @tn.str.233 = private constant [11 x i8] c"*Allocator\00" @@ -145,9 +145,9 @@ @tn.str.245 = private constant [17 x i8] c"*OperatingSystem\00" @tn.str.246 = private constant [14 x i8] c"*Architecture\00" @tn.str.247 = private constant [15 x i8] c"*[16]FlagValue\00" -@tn.str.248 = private constant [8 x i8] c"*[8]s64\00" +@tn.str.248 = private constant [8 x i8] c"*[8]i64\00" @tn.str.249 = private constant [8 x i8] c"*[64]u8\00" -@tn.str.250 = private constant [9 x i8] c"*[64]s64\00" +@tn.str.250 = private constant [9 x i8] c"*[64]i64\00" @tn.str.251 = private constant [10 x i8] c"*[]string\00" @tn.str.252 = private constant [6 x i8] c"*[]u8\00" @tn.str.253 = private constant [12 x i8] c"*[]FlagSpec\00" @@ -160,7 +160,7 @@ @tn.str.260 = private constant [20 x i8] c"**TrackingAllocator\00" @tn.str.261 = private constant [7 x i8] c"**File\00" @tn.str.262 = private constant [5 x i8] c"**u8\00" -@tn.str.263 = private constant [6 x i8] c"**s32\00" +@tn.str.263 = private constant [6 x i8] c"**i32\00" @tn.str.264 = private constant [11 x i8] c"**SockAddr\00" @tn.str.265 = private constant [6 x i8] c"**u32\00" @tn.str.266 = private constant [10 x i8] c"*[*]Value\00" @@ -169,7 +169,7 @@ @tn.str.269 = private constant [9 x i8] c"**Object\00" @tn.str.270 = private constant [7 x i8] c"**Sink\00" @tn.str.271 = private constant [9 x i8] c"**Parser\00" -@tn.str.272 = private constant [6 x i8] c"**s64\00" +@tn.str.272 = private constant [6 x i8] c"**i64\00" @tn.str.273 = private constant [9 x i8] c"**Parsed\00" @tn.str.274 = private constant [7 x i8] c"**Diag\00" @tn.str.275 = private constant [9 x i8] c"**Sha256\00" @@ -554,7 +554,7 @@ @str.651 = private unnamed_addr constant [4 x i8] c"*u8\00", align 1 @str.652 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.653 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.654 = private unnamed_addr constant [5 x i8] c"*s32\00", align 1 +@str.654 = private unnamed_addr constant [5 x i8] c"*i32\00", align 1 @str.655 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.656 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.657 = private unnamed_addr constant [10 x i8] c"*SockAddr\00", align 1 @@ -581,7 +581,7 @@ @str.678 = private unnamed_addr constant [8 x i8] c"*Parser\00", align 1 @str.679 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.680 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.681 = private unnamed_addr constant [5 x i8] c"*s64\00", align 1 +@str.681 = private unnamed_addr constant [5 x i8] c"*i64\00", align 1 @str.682 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.683 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.684 = private unnamed_addr constant [8 x i8] c"*Parsed\00", align 1 @@ -1956,7 +1956,7 @@ dispatch.case.265: ; preds = %match.arm.47 %ua.raw174 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr175 = inttoptr i64 %ua.raw174 to ptr %ua.load176 = load [4 x i64], ptr %ua.ptr175, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %ua.load176) + %callN = call { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %ua.load176) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.263 @@ -1972,7 +1972,7 @@ dispatch.case.267: ; preds = %match.arm.47 %ua.raw182 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr183 = inttoptr i64 %ua.raw182 to ptr %ua.load184 = load [8 x i64], ptr %ua.ptr183, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %ua.load184) + %callN = call { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %ua.load184) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.263 @@ -1988,7 +1988,7 @@ dispatch.case.269: ; preds = %match.arm.47 %ua.raw190 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr191 = inttoptr i64 %ua.raw190 to ptr %ua.load192 = load [64 x i64], ptr %ua.ptr191, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %ua.load192) + %callN = call { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %ua.load192) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.263 @@ -2139,7 +2139,7 @@ dispatch.case.350: ; preds = %match.arm.49 dispatch.case.351: ; preds = %match.arm.49 %ua.raw253 = extractvalue { i64, i64 } %loadN, 1 %iNp254 = inttoptr i64 %ua.raw253 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %iNp254) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %iNp254) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.339 @@ -2202,7 +2202,7 @@ dispatch.case.359: ; preds = %match.arm.49 dispatch.case.360: ; preds = %match.arm.49 %ua.raw280 = extractvalue { i64, i64 } %loadN, 1 %iNp281 = inttoptr i64 %ua.raw280 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %iNp281) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %iNp281) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.339 @@ -3474,7 +3474,7 @@ entry: %load = load { ptr, i64 }, ptr %allocaN, align 8 %loadN = load i32, ptr %alloca, align 4 %loadN = load { ptr, i64 }, ptr %allocaN, align 8 - call void @print__ct_s7d5f90608c43cc01__pack_string_s32_string(ptr %0, { ptr, i64 } %load, i32 %loadN, { ptr, i64 } %loadN) + call void @print__ct_s7d5f90608c43cc01__pack_string_i32_string(ptr %0, { ptr, i64 } %load, i32 %loadN, { ptr, i64 } %loadN) %loadN = load i32, ptr %alloca, align 4 ret i32 %loadN } @@ -3483,9 +3483,9 @@ entry: define i32 @main() #0 { entry: %call = call i32 @scale(ptr @__sx_default_context, i32 5, i32 2) - call void @print__ct_sc20f1d9fe3bc82ac__pack_s32(ptr @__sx_default_context, i32 %call) + call void @print__ct_sc20f1d9fe3bc82ac__pack_i32(ptr @__sx_default_context, i32 %call) %callN = call i32 @scale(ptr @__sx_default_context, i32 5, i32 3) - call void @print__ct_sfb0b0da1195bd991__pack_s32(ptr @__sx_default_context, i32 %callN) + call void @print__ct_sfb0b0da1195bd991__pack_i32(ptr @__sx_default_context, i32 %callN) %callN = call i32 @label(ptr @__sx_default_context, i32 1, { ptr, i64 } { ptr @str.309, i64 1 }, { ptr, i64 } { ptr @str.310, i64 1 }) %callN = call i32 @label(ptr @__sx_default_context, i32 2, { ptr, i64 } { ptr @str.311, i64 1 }, { ptr, i64 } { ptr @str.312, i64 1 }) %callN = call i32 @label(ptr @__sx_default_context, i32 3, { ptr, i64 } { ptr @str.313, i64 1 }, { ptr, i64 } { ptr @str.314, i64 1 }) @@ -3507,7 +3507,7 @@ entry: } ; Function Attrs: nounwind -define internal void @print__ct_sc20f1d9fe3bc82ac__pack_s32(ptr %0, i32 %1) #0 { +define internal void @print__ct_sc20f1d9fe3bc82ac__pack_i32(ptr %0, i32 %1) #0 { entry: %alloca = alloca { ptr, i64 }, align 8 store { ptr, i64 } { ptr @str.315, i64 12 }, ptr %alloca, align 8 @@ -3515,8 +3515,8 @@ entry: store i32 %1, ptr %allocaN, align 4 %allocaN = alloca [1 x { i64, i64 }], align 8 %load = load i32, ptr %allocaN, align 4 - %sN = sext i32 %load to i64 - %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %load to i64 + %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %igp.ptr = getelementptr { i64, i64 }, ptr %allocaN, i64 0 store { i64, i64 } %ba.val, ptr %igp.ptr, align 8 %allocaN = alloca { ptr, i64 }, align 8 @@ -3534,8 +3534,8 @@ entry: store { ptr, i64 } %callN, ptr %allocaN, align 8 %loadN = load { ptr, i64 }, ptr %allocaN, align 8 %loadN = load i32, ptr %allocaN, align 4 - %sN = sext i32 %loadN to i64 - %ba.val13 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %loadN to i64 + %ba.val13 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %callN = call { ptr, i64 } @any_to_string(ptr %0, { i64, i64 } %ba.val13) %callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN) store { ptr, i64 } %callN, ptr %allocaN, align 8 @@ -3559,7 +3559,7 @@ entry: } ; Function Attrs: nounwind -define internal void @print__ct_sfb0b0da1195bd991__pack_s32(ptr %0, i32 %1) #0 { +define internal void @print__ct_sfb0b0da1195bd991__pack_i32(ptr %0, i32 %1) #0 { entry: %alloca = alloca { ptr, i64 }, align 8 store { ptr, i64 } { ptr @str.318, i64 13 }, ptr %alloca, align 8 @@ -3567,8 +3567,8 @@ entry: store i32 %1, ptr %allocaN, align 4 %allocaN = alloca [1 x { i64, i64 }], align 8 %load = load i32, ptr %allocaN, align 4 - %sN = sext i32 %load to i64 - %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %load to i64 + %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %igp.ptr = getelementptr { i64, i64 }, ptr %allocaN, i64 0 store { i64, i64 } %ba.val, ptr %igp.ptr, align 8 %allocaN = alloca { ptr, i64 }, align 8 @@ -3586,8 +3586,8 @@ entry: store { ptr, i64 } %callN, ptr %allocaN, align 8 %loadN = load { ptr, i64 }, ptr %allocaN, align 8 %loadN = load i32, ptr %allocaN, align 4 - %sN = sext i32 %loadN to i64 - %ba.val13 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %loadN to i64 + %ba.val13 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %callN = call { ptr, i64 } @any_to_string(ptr %0, { i64, i64 } %ba.val13) %callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN) store { ptr, i64 } %callN, ptr %allocaN, align 8 @@ -3611,7 +3611,7 @@ entry: } ; Function Attrs: nounwind -define internal void @print__ct_s7d5f90608c43cc01__pack_string_s32_string(ptr %0, { ptr, i64 } %1, i32 %2, { ptr, i64 } %3) #0 { +define internal void @print__ct_s7d5f90608c43cc01__pack_string_i32_string(ptr %0, { ptr, i64 } %1, i32 %2, { ptr, i64 } %3) #0 { entry: %alloca = alloca { ptr, i64 }, align 8 store { ptr, i64 } { ptr @str.321, i64 7 }, ptr %alloca, align 8 @@ -3630,8 +3630,8 @@ entry: %igp.ptr = getelementptr { i64, i64 }, ptr %allocaN, i64 0 store { i64, i64 } %ba.val, ptr %igp.ptr, align 8 %loadN = load i32, ptr %allocaN, align 4 - %sN = sext i32 %loadN to i64 - %ba.val6 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %loadN to i64 + %ba.val6 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %igp.ptr7 = getelementptr { i64, i64 }, ptr %allocaN, i64 1 store { i64, i64 } %ba.val6, ptr %igp.ptr7, align 8 %loadN = load { ptr, i64 }, ptr %allocaN, align 8 @@ -3660,8 +3660,8 @@ entry: store { ptr, i64 } %callN, ptr %allocaN, align 8 %loadN = load { ptr, i64 }, ptr %allocaN, align 8 %loadN = load i32, ptr %allocaN, align 4 - %sN = sext i32 %loadN to i64 - %ba.val26 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %loadN to i64 + %ba.val26 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %callN = call { ptr, i64 } @any_to_string(ptr %0, { i64, i64 } %ba.val26) %callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN) store { ptr, i64 } %callN, ptr %allocaN, align 8 @@ -3770,14 +3770,14 @@ fv.case: ; preds = %if.merge.125 fv.case17: ; preds = %if.merge.125 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.125 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.125 @@ -4473,8 +4473,8 @@ fv.default: ; preds = %if.merge.170 fv.case: ; preds = %if.merge.170 %fv.field = extractvalue { i32 } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge } @@ -4557,14 +4557,14 @@ fv.case: ; preds = %if.merge.175 fv.case17: ; preds = %if.merge.175 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.175 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.175 @@ -4649,8 +4649,8 @@ fv.default: ; preds = %if.merge.180 fv.case: ; preds = %if.merge.180 %fv.field = extractvalue { i32, { ptr, i64 } } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case17: ; preds = %if.merge.180 @@ -6051,7 +6051,7 @@ if.merge.262: ; preds = %if.then.261, %entry } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %1) #0 { entry: %alloca = alloca [4 x i64], align 8 %ig.tmp = alloca [4 x i64], align 8 @@ -6154,7 +6154,7 @@ if.merge.281: ; preds = %if.then.280, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %1) #0 { entry: %alloca = alloca [8 x i64], align 8 %ig.tmp = alloca [8 x i64], align 8 @@ -6255,7 +6255,7 @@ if.merge.291: ; preds = %if.then.290, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %1) #0 { entry: %alloca = alloca [64 x i64], align 8 %ig.tmp = alloca [64 x i64], align 8 @@ -6958,7 +6958,7 @@ if.merge.414: ; preds = %if.else.413, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 @@ -7208,7 +7208,7 @@ if.merge.441: ; preds = %if.else.440, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 diff --git a/examples/expected/0046-basic-int-formatter-extremes.stdout b/examples/expected/0046-basic-int-formatter-extremes.stdout index e5fa861..26f7c56 100644 --- a/examples/expected/0046-basic-int-formatter-extremes.stdout +++ b/examples/expected/0046-basic-int-formatter-extremes.stdout @@ -1,9 +1,9 @@ -s64.min=-9223372036854775808 -s64.max=9223372036854775807 +i64.min=-9223372036854775808 +i64.max=9223372036854775807 u64.max=18446744073709551615 -s8.min=-128 s8.max=127 -s16.min=-32768 s16.max=32767 -s32.min=-2147483648 s32.max=2147483647 +i8.min=-128 i8.max=127 +i16.min=-32768 i16.max=32767 +i32.min=-2147483648 i32.max=2147483647 u8.max=255 u16.max=65535 u32.max=4294967295 u8.min=0 u64.min=0 zero=0 diff --git a/examples/expected/0107-types-int-cmp-in-float-ternary.ir b/examples/expected/0107-types-int-cmp-in-float-ternary.ir index be5ae0f..640cf35 100644 --- a/examples/expected/0107-types-int-cmp-in-float-ternary.ir +++ b/examples/expected/0107-types-int-cmp-in-float-ternary.ir @@ -25,10 +25,10 @@ @tag_names = private constant [14 x { ptr, i64 }] [{ ptr, i64 } { ptr @tag.str, i64 0 }, { ptr, i64 } { ptr @tag.str.114, i64 8 }, { ptr, i64 } { ptr @tag.str.115, i64 2 }, { ptr, i64 } { ptr @tag.str.116, i64 15 }, { ptr, i64 } { ptr @tag.str.117, i64 13 }, { ptr, i64 } { ptr @tag.str.118, i64 9 }, { ptr, i64 } { ptr @tag.str.119, i64 9 }, { ptr, i64 } { ptr @tag.str.120, i64 15 }, { ptr, i64 } { ptr @tag.str.121, i64 14 }, { ptr, i64 } { ptr @tag.str.122, i64 14 }, { ptr, i64 } { ptr @tag.str.123, i64 11 }, { ptr, i64 } { ptr @tag.str.124, i64 12 }, { ptr, i64 } { ptr @tag.str.125, i64 15 }, { ptr, i64 } { ptr @tag.str.126, i64 12 }] @tn.str = private constant [13 x i8] c"\00" @tn.str.127 = private constant [5 x i8] c"bool\00" -@tn.str.128 = private constant [3 x i8] c"s8\00" -@tn.str.129 = private constant [4 x i8] c"s16\00" -@tn.str.130 = private constant [4 x i8] c"s32\00" -@tn.str.131 = private constant [4 x i8] c"s64\00" +@tn.str.128 = private constant [3 x i8] c"i8\00" +@tn.str.129 = private constant [4 x i8] c"i16\00" +@tn.str.130 = private constant [4 x i8] c"i32\00" +@tn.str.131 = private constant [4 x i8] c"i64\00" @tn.str.132 = private constant [3 x i8] c"u8\00" @tn.str.133 = private constant [4 x i8] c"u16\00" @tn.str.134 = private constant [4 x i8] c"u32\00" @@ -45,7 +45,7 @@ @tn.str.145 = private constant [16 x i8] c"Source_Location\00" @tn.str.146 = private constant [10 x i8] c"Allocator\00" @tn.str.147 = private constant [8 x i8] c"Context\00" -@tn.str.148 = private constant [7 x i8] c"[4]s64\00" +@tn.str.148 = private constant [7 x i8] c"[4]i64\00" @tn.str.149 = private constant [9 x i8] c"[]string\00" @tn.str.150 = private constant [11 x i8] c"CAllocator\00" @tn.str.151 = private constant [12 x i8] c"*CAllocator\00" @@ -70,7 +70,7 @@ @tn.str.170 = private constant [4 x i8] c"*u8\00" @tn.str.171 = private constant [14 x i8] c"ProcessResult\00" @tn.str.172 = private constant [15 x i8] c"?ProcessResult\00" -@tn.str.173 = private constant [5 x i8] c"*s32\00" +@tn.str.173 = private constant [5 x i8] c"*i32\00" @tn.str.174 = private constant [9 x i8] c"SockAddr\00" @tn.str.175 = private constant [10 x i8] c"*SockAddr\00" @tn.str.176 = private constant [5 x i8] c"*u32\00" @@ -86,9 +86,9 @@ @tn.str.186 = private constant [5 x i8] c"[]u8\00" @tn.str.187 = private constant [5 x i8] c"Sink\00" @tn.str.188 = private constant [6 x i8] c"*Sink\00" -@tn.str.189 = private constant [17 x i8] c"(s64, JsonError)\00" +@tn.str.189 = private constant [17 x i8] c"(i64, JsonError)\00" @tn.str.190 = private constant [15 x i8] c"JsonParseError\00" -@tn.str.191 = private constant [22 x i8] c"(s64, JsonParseError)\00" +@tn.str.191 = private constant [22 x i8] c"(i64, JsonParseError)\00" @tn.str.192 = private constant [7 x i8] c"Parser\00" @tn.str.193 = private constant [8 x i8] c"*Parser\00" @tn.str.194 = private constant [25 x i8] c"(string, JsonParseError)\00" @@ -97,7 +97,7 @@ @tn.str.197 = private constant [13 x i8] c"Architecture\00" @tn.str.198 = private constant [13 x i8] c"BuildOptions\00" @tn.str.199 = private constant [11 x i8] c"() -> bool\00" -@tn.str.200 = private constant [5 x i8] c"*s64\00" +@tn.str.200 = private constant [5 x i8] c"*i64\00" @tn.str.201 = private constant [9 x i8] c"CliError\00" @tn.str.202 = private constant [9 x i8] c"FlagSpec\00" @tn.str.203 = private constant [11 x i8] c"[]FlagSpec\00" @@ -110,12 +110,12 @@ @tn.str.210 = private constant [19 x i8] c"(Parsed, CliError)\00" @tn.str.211 = private constant [10 x i8] c"[]Command\00" @tn.str.212 = private constant [6 x i8] c"*Diag\00" -@tn.str.213 = private constant [7 x i8] c"[8]s64\00" +@tn.str.213 = private constant [7 x i8] c"[8]i64\00" @tn.str.214 = private constant [7 x i8] c"[64]u8\00" @tn.str.215 = private constant [7 x i8] c"Sha256\00" @tn.str.216 = private constant [8 x i8] c"*Sha256\00" @tn.str.217 = private constant [8 x i8] c"?[64]u8\00" -@tn.str.218 = private constant [8 x i8] c"[64]s64\00" +@tn.str.218 = private constant [8 x i8] c"[64]i64\00" @tn.str.219 = private constant [13 x i8] c"**CAllocator\00" @tn.str.220 = private constant [7 x i8] c"**void\00" @tn.str.221 = private constant [5 x i8] c"*f32\00" @@ -126,7 +126,7 @@ @tn.str.226 = private constant [8 x i8] c"*[1]Any\00" @tn.str.227 = private constant [7 x i8] c"*[]Any\00" @tn.str.228 = private constant [6 x i8] c"*bool\00" -@tn.str.229 = private constant [8 x i8] c"*[4]s64\00" +@tn.str.229 = private constant [8 x i8] c"*[4]i64\00" @tn.str.230 = private constant [5 x i8] c"*f64\00" @tn.str.231 = private constant [17 x i8] c"*Source_Location\00" @tn.str.232 = private constant [11 x i8] c"*Allocator\00" @@ -144,9 +144,9 @@ @tn.str.244 = private constant [17 x i8] c"*OperatingSystem\00" @tn.str.245 = private constant [14 x i8] c"*Architecture\00" @tn.str.246 = private constant [15 x i8] c"*[16]FlagValue\00" -@tn.str.247 = private constant [8 x i8] c"*[8]s64\00" +@tn.str.247 = private constant [8 x i8] c"*[8]i64\00" @tn.str.248 = private constant [8 x i8] c"*[64]u8\00" -@tn.str.249 = private constant [9 x i8] c"*[64]s64\00" +@tn.str.249 = private constant [9 x i8] c"*[64]i64\00" @tn.str.250 = private constant [10 x i8] c"*[]string\00" @tn.str.251 = private constant [6 x i8] c"*[]u8\00" @tn.str.252 = private constant [12 x i8] c"*[]FlagSpec\00" @@ -159,7 +159,7 @@ @tn.str.259 = private constant [20 x i8] c"**TrackingAllocator\00" @tn.str.260 = private constant [7 x i8] c"**File\00" @tn.str.261 = private constant [5 x i8] c"**u8\00" -@tn.str.262 = private constant [6 x i8] c"**s32\00" +@tn.str.262 = private constant [6 x i8] c"**i32\00" @tn.str.263 = private constant [11 x i8] c"**SockAddr\00" @tn.str.264 = private constant [6 x i8] c"**u32\00" @tn.str.265 = private constant [10 x i8] c"*[*]Value\00" @@ -168,7 +168,7 @@ @tn.str.268 = private constant [9 x i8] c"**Object\00" @tn.str.269 = private constant [7 x i8] c"**Sink\00" @tn.str.270 = private constant [9 x i8] c"**Parser\00" -@tn.str.271 = private constant [6 x i8] c"**s64\00" +@tn.str.271 = private constant [6 x i8] c"**i64\00" @tn.str.272 = private constant [9 x i8] c"**Parsed\00" @tn.str.273 = private constant [7 x i8] c"**Diag\00" @tn.str.274 = private constant [9 x i8] c"**Sha256\00" @@ -539,7 +539,7 @@ @str.636 = private unnamed_addr constant [4 x i8] c"*u8\00", align 1 @str.637 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.638 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.639 = private unnamed_addr constant [5 x i8] c"*s32\00", align 1 +@str.639 = private unnamed_addr constant [5 x i8] c"*i32\00", align 1 @str.640 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.641 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.642 = private unnamed_addr constant [10 x i8] c"*SockAddr\00", align 1 @@ -566,7 +566,7 @@ @str.663 = private unnamed_addr constant [8 x i8] c"*Parser\00", align 1 @str.664 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.665 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.666 = private unnamed_addr constant [5 x i8] c"*s64\00", align 1 +@str.666 = private unnamed_addr constant [5 x i8] c"*i64\00", align 1 @str.667 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.668 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.669 = private unnamed_addr constant [8 x i8] c"*Parsed\00", align 1 @@ -1939,7 +1939,7 @@ dispatch.case.270: ; preds = %match.arm.52 %ua.raw174 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr175 = inttoptr i64 %ua.raw174 to ptr %ua.load176 = load [4 x i64], ptr %ua.ptr175, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %ua.load176) + %callN = call { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %ua.load176) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.268 @@ -1955,7 +1955,7 @@ dispatch.case.272: ; preds = %match.arm.52 %ua.raw182 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr183 = inttoptr i64 %ua.raw182 to ptr %ua.load184 = load [8 x i64], ptr %ua.ptr183, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %ua.load184) + %callN = call { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %ua.load184) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.268 @@ -1971,7 +1971,7 @@ dispatch.case.274: ; preds = %match.arm.52 %ua.raw190 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr191 = inttoptr i64 %ua.raw190 to ptr %ua.load192 = load [64 x i64], ptr %ua.ptr191, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %ua.load192) + %callN = call { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %ua.load192) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.268 @@ -2114,7 +2114,7 @@ dispatch.case.349: ; preds = %match.arm.54 dispatch.case.350: ; preds = %match.arm.54 %ua.raw249 = extractvalue { i64, i64 } %loadN, 1 %iNp250 = inttoptr i64 %ua.raw249 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %iNp250) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %iNp250) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.338 @@ -2177,7 +2177,7 @@ dispatch.case.358: ; preds = %match.arm.54 dispatch.case.359: ; preds = %match.arm.54 %ua.raw276 = extractvalue { i64, i64 } %loadN, 1 %iNp277 = inttoptr i64 %ua.raw276 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %iNp277) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %iNp277) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.338 @@ -3603,14 +3603,14 @@ fv.case: ; preds = %if.merge.130 fv.case17: ; preds = %if.merge.130 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.130 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.130 @@ -4306,8 +4306,8 @@ fv.default: ; preds = %if.merge.175 fv.case: ; preds = %if.merge.175 %fv.field = extractvalue { i32 } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge } @@ -4390,14 +4390,14 @@ fv.case: ; preds = %if.merge.180 fv.case17: ; preds = %if.merge.180 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.180 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.180 @@ -4482,8 +4482,8 @@ fv.default: ; preds = %if.merge.185 fv.case: ; preds = %if.merge.185 %fv.field = extractvalue { i32, { ptr, i64 } } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case17: ; preds = %if.merge.185 @@ -5884,7 +5884,7 @@ if.merge.267: ; preds = %if.then.266, %entry } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %1) #0 { entry: %alloca = alloca [4 x i64], align 8 %ig.tmp = alloca [4 x i64], align 8 @@ -5987,7 +5987,7 @@ if.merge.285: ; preds = %if.then.284, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %1) #0 { entry: %alloca = alloca [8 x i64], align 8 %ig.tmp = alloca [8 x i64], align 8 @@ -6088,7 +6088,7 @@ if.merge.295: ; preds = %if.then.294, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %1) #0 { entry: %alloca = alloca [64 x i64], align 8 %ig.tmp = alloca [64 x i64], align 8 @@ -6738,7 +6738,7 @@ if.merge.413: ; preds = %if.else.412, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 @@ -6988,7 +6988,7 @@ if.merge.440: ; preds = %if.else.439, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 diff --git a/examples/expected/0114-types-build-block-convert.stdout b/examples/expected/0114-types-build-block-convert.stdout index e22ba0f..f4d9e1e 100644 --- a/examples/expected/0114-types-build-block-convert.stdout +++ b/examples/expected/0114-types-build-block-convert.stdout @@ -2,9 +2,9 @@ __invoke :: (block_self: *Block) -> void callconv(.c) { typed_fn : (*void) -> void = xx block_self.sx_fn; typed_fn(block_self.sx_env); } return .{ isa = @_NSConcreteStackBlock, flags = 0, reserved = 0, invoke = xx @__invoke, descriptor = xx @__sx_block_descriptor, sx_env = self.env, sx_fn = self.fn_ptr, }; --- void / bool --- __invoke :: (block_self: *Block, arg0: bool) -> void callconv(.c) { typed_fn : (*void, bool) -> void = xx block_self.sx_fn; typed_fn(block_self.sx_env, arg0); } return .{ isa = @_NSConcreteStackBlock, flags = 0, reserved = 0, invoke = xx @__invoke, descriptor = xx @__sx_block_descriptor, sx_env = self.env, sx_fn = self.fn_ptr, }; ---- void / s64, string --- -__invoke :: (block_self: *Block, arg0: s64, arg1: string) -> void callconv(.c) { typed_fn : (*void, s64, string) -> void = xx block_self.sx_fn; typed_fn(block_self.sx_env, arg0, arg1); } return .{ isa = @_NSConcreteStackBlock, flags = 0, reserved = 0, invoke = xx @__invoke, descriptor = xx @__sx_block_descriptor, sx_env = self.env, sx_fn = self.fn_ptr, }; ---- s32 / f64 --- -__invoke :: (block_self: *Block, arg0: f64) -> s32 callconv(.c) { typed_fn : (*void, f64) -> s32 = xx block_self.sx_fn; return typed_fn(block_self.sx_env, arg0); } return .{ isa = @_NSConcreteStackBlock, flags = 0, reserved = 0, invoke = xx @__invoke, descriptor = xx @__sx_block_descriptor, sx_env = self.env, sx_fn = self.fn_ptr, }; +--- void / i64, string --- +__invoke :: (block_self: *Block, arg0: i64, arg1: string) -> void callconv(.c) { typed_fn : (*void, i64, string) -> void = xx block_self.sx_fn; typed_fn(block_self.sx_env, arg0, arg1); } return .{ isa = @_NSConcreteStackBlock, flags = 0, reserved = 0, invoke = xx @__invoke, descriptor = xx @__sx_block_descriptor, sx_env = self.env, sx_fn = self.fn_ptr, }; +--- i32 / f64 --- +__invoke :: (block_self: *Block, arg0: f64) -> i32 callconv(.c) { typed_fn : (*void, f64) -> i32 = xx block_self.sx_fn; return typed_fn(block_self.sx_env, arg0); } return .{ isa = @_NSConcreteStackBlock, flags = 0, reserved = 0, invoke = xx @__invoke, descriptor = xx @__sx_block_descriptor, sx_env = self.env, sx_fn = self.fn_ptr, }; --- build done --- rt diff --git a/examples/expected/0115-types-compound-type-in-expression.stdout b/examples/expected/0115-types-compound-type-in-expression.stdout index 93b896c..46a1b05 100644 --- a/examples/expected/0115-types-compound-type-in-expression.stdout +++ b/examples/expected/0115-types-compound-type-in-expression.stdout @@ -2,8 +2,8 @@ size_of(*u8) = 8 align_of(*u8) = 8 size_of(?u8) = 2 size_of([3]u8) = 3 -size_of((s32)->s32) = 8 -size_of((s32, s32)) = 8 +size_of((i32)->i32) = 8 +size_of((i32, i32)) = 8 size_of(Ptr) = 8 size_of(Maybe) = 2 size_of(Arr) = 3 diff --git a/examples/expected/0116-types-type-alias-size-align.stdout b/examples/expected/0116-types-type-alias-size-align.stdout index ac6f984..4947b48 100644 --- a/examples/expected/0116-types-type-alias-size-align.stdout +++ b/examples/expected/0116-types-type-alias-size-align.stdout @@ -1,6 +1,6 @@ -direct s32: 4 -alias s32: 4 -chain s32: 4 +direct i32: 4 +alias i32: 4 +chain i32: 4 align alias: 4 align chain: 4 size struct-alias: 16 diff --git a/examples/expected/0118-types-type-all-interactions.stdout b/examples/expected/0118-types-type-all-interactions.stdout index 6f4d0e5..a57afa6 100644 --- a/examples/expected/0118-types-type-all-interactions.stdout +++ b/examples/expected/0118-types-type-all-interactions.stdout @@ -1,11 +1,11 @@ === 1. literal == === -s64 == s64: true -s64 == string: false +i64 == i64: true +i64 == string: false *u8 == *u8: true -?s64 == ?s64: true -?s64 == ?s32: false +?i64 == ?i64: true +?i64 == ?i32: false === 2. type_of(value) == T === -type_of(a) == s64: true +type_of(a) == i64: true type_of(b) == f64: true type_of(s) == string: true type_of(a) == f64: false @@ -15,45 +15,45 @@ t == string: false after reassign t == string: true t == bool: true === 4. type_name === -type_name(s64): s64 +type_name(i64): i64 type_name(*u8): *u8 type_name(Point): Point type_name(Color): Color type_name(t): f64 === 5. print Type values === -literal: s64 +literal: i64 var: string type_of(b): f64 === 6. generic dispatch === -describe(s64): int64 +describe(i64): int64 describe(string): text describe(bool): boolean describe(f64): other === 7. identity($T, val) === -identity(s64, 7): 7 +identity(i64, 7): 7 identity(string, hi): hi identity(bool, true): true === 8. Wrap($T) === -Wrap(s64).v: 42 +Wrap(i64).v: 42 Wrap(string).v: wrapped === 9. reflection on Type === -size_of(s64): 8 +size_of(i64): 8 size_of(*u8): 8 align_of(f64): 8 field_count(Point): 2 -type_eq(s64, s64): true -type_eq(s64, string): false +type_eq(i64, i64): true +type_eq(i64, string): false === 10. ..$args walking === type_list(): [] -type_list(1): [s64] -type_list(1, "x"): [s64, string] +type_list(1): [i64] +type_list(1, "x"): [i64, string] type_list(true, 3.14): [bool, f64] === 11. Type in struct field === -h.t == s64: true +h.t == i64: true h.t == string: false -type_name(h.t): s64 +type_name(h.t): i64 === 12. compound literals === type_name(*Point): *Point -type_name([4]s32): [4]s32 +type_name([4]i32): [4]i32 type_name([]bool): []bool type_name(?f64): ?f64 diff --git a/examples/expected/0121-types-types.stdout b/examples/expected/0121-types-types.stdout index a4c7a59..528d82f 100644 --- a/examples/expected/0121-types-types.stdout +++ b/examples/expected/0121-types-types.stdout @@ -1,7 +1,7 @@ === 3. Types === -s8: 127 -s16: 32000 -s32: 100000 +i8: 127 +i16: 32000 +i32: 100000 u8: 255 u16: 65000 u32: 4000000 diff --git a/examples/expected/0123-types-compound-assign.stdout b/examples/expected/0123-types-compound-assign.stdout index b9d4acc..859afaa 100644 --- a/examples/expected/0123-types-compound-assign.stdout +++ b/examples/expected/0123-types-compound-assign.stdout @@ -1,3 +1,3 @@ === 16. Compound Assign === f64+=f32: 13.000000 -s64-=s32: 93 +i64-=i32: 93 diff --git a/examples/expected/0125-types-type-named-var-rejected.stderr b/examples/expected/0125-types-type-named-var-rejected.stderr index 6b02235..4420b21 100644 --- a/examples/expected/0125-types-type-named-var-rejected.stderr +++ b/examples/expected/0125-types-type-named-var-rejected.stderr @@ -1,5 +1,5 @@ -error: 's2' is a reserved type name and cannot be used as an identifier - --> /Users/agra/projects/sx/examples/0125-types-type-named-var-rejected.sx:10:5 +error: 'i2' is a reserved type name and cannot be used as an identifier + --> examples/0125-types-type-named-var-rejected.sx:10:5 | -10 | s2 := 42; +10 | i2 := 42; | ^^ diff --git a/examples/expected/0131-types-init-blocks.stdout b/examples/expected/0131-types-init-blocks.stdout index 9c5b646..94d6528 100644 --- a/examples/expected/0131-types-init-blocks.stdout +++ b/examples/expected/0131-types-init-blocks.stdout @@ -17,5 +17,5 @@ opt-if5: 42.000000 usize: 42 isize: -7 usize+8: 50 -s32->usize: 10 -usize->s64: 42 +i32->usize: 10 +usize->i64: 42 diff --git a/examples/expected/0132-types-forward-type-alias.stdout b/examples/expected/0132-types-forward-type-alias.stdout index 63e1822..238613e 100644 --- a/examples/expected/0132-types-forward-type-alias.stdout +++ b/examples/expected/0132-types-forward-type-alias.stdout @@ -1,3 +1,3 @@ -chain s32: 4 +chain i32: 4 forward u8: 1 v + n: 10 diff --git a/examples/expected/0140-types-named-const-array-dim.stdout b/examples/expected/0140-types-named-const-array-dim.stdout index 579ec07..b50ac0d 100644 --- a/examples/expected/0140-types-named-const-array-dim.stdout +++ b/examples/expected/0140-types-named-const-array-dim.stdout @@ -1,7 +1,7 @@ scalar a0=7 a3=42 -string s0=hi s1=yo +string i0=hi i1=yo struct p0x=1 p0y=2 p2x=5 alias a0=11 a3=99 -alias s0=al s2=ok +alias i0=al i2=ok nested g00=1 g32=8 union u0=70 u3=7 diff --git a/examples/expected/0143-types-typed-const-array-dim.stdout b/examples/expected/0143-types-typed-const-array-dim.stdout index c92dfb8..97edf5f 100644 --- a/examples/expected/0143-types-typed-const-array-dim.stdout +++ b/examples/expected/0143-types-typed-const-array-dim.stdout @@ -1,6 +1,6 @@ direct d0=3 d7=21 len=8 alias a0=7 a7=99 len=8 -alias s0=hi s7=yo +alias i0=hi i7=yo alias p0x=1 p0y=2 p7x=5 nested g00=1 g77=10 fwd f0=4 f4=40 len=5 diff --git a/examples/expected/0144-types-const-expr-array-dim.stdout b/examples/expected/0144-types-const-expr-array-dim.stdout index 9b287b7..e1584a6 100644 --- a/examples/expected/0144-types-const-expr-array-dim.stdout +++ b/examples/expected/0144-types-const-expr-array-dim.stdout @@ -3,5 +3,5 @@ mul direct.len=24 alias.len=24 d23=230 a23=230 sub direct.len=2 alias.len=2 d1=9 a1=9 nest direct.len=9 alias.len=9 paren direct.len=10 alias.len=10 typed direct.len=6 alias.len=6 -str alias.len=5 s0=hi s4=yo +str alias.len=5 i0=hi i4=yo struct alias.len=5 p0x=1 p4y=6 diff --git a/examples/expected/0146-types-comptime-count-matrix.stdout b/examples/expected/0146-types-comptime-count-matrix.stdout index fc5b94b..273b34d 100644 --- a/examples/expected/0146-types-comptime-count-matrix.stdout +++ b/examples/expected/0146-types-comptime-count-matrix.stdout @@ -7,7 +7,7 @@ lane.expr3: 1.000000 2.000000 3.000000 lane.float4: 4.000000 vp.struct.expr: len=3 v=30 vp.struct.alias.u32: len=3 v=31 -vp.struct.alias.s8: len=4 v=32 +vp.struct.alias.i8: len=4 v=32 vp.typefn.expr: len=3 v=33 for.expr: 3 for.float: 6 diff --git a/examples/expected/0148-types-int-numeric-limits.stdout b/examples/expected/0148-types-int-numeric-limits.stdout index f6e3b70..d7a636d 100644 --- a/examples/expected/0148-types-int-numeric-limits.stdout +++ b/examples/expected/0148-types-int-numeric-limits.stdout @@ -1,18 +1,18 @@ -s1.min=-1 s1.max=0 -s2.min=-2 s2.max=1 -s3.max=3 +i1.min=-1 i1.max=0 +i2.min=-2 i2.max=1 +i3.max=3 u1.min=0 u1.max=1 u2.max=3 -s8.min=-128 s8.max=127 +i8.min=-128 i8.max=127 u8.max=255 -s32.min=-2147483648 s32.max=2147483647 -s64.max=9223372036854775807 -s64.min+1 == -(s64.max): true -s64.min + s64.max == -1: true -u64.max as s64 == -1: true -usize.max as s64 == -1: true +i32.min=-2147483648 i32.max=2147483647 +i64.max=9223372036854775807 +i64.min+1 == -(i64.max): true +i64.min + i64.max == -1: true +u64.max as i64 == -1: true +usize.max as i64 == -1: true usize.max == u64.max: true -isize.min == s64.min: true +isize.min == i64.min: true typed: m3=3 mu=255 ms=-128 [u8.max]u8 len=255 a[254]=7 -[s16.max]u8 len=32767 b[32766]=9 +[i16.max]u8 len=32767 b[32766]=9 diff --git a/examples/expected/0160-types-float-numeric-limits-errors.stderr b/examples/expected/0160-types-float-numeric-limits-errors.stderr index 7f9b2df..66f220b 100644 --- a/examples/expected/0160-types-float-numeric-limits-errors.stderr +++ b/examples/expected/0160-types-float-numeric-limits-errors.stderr @@ -1,7 +1,7 @@ -error: type 's32' has no '.epsilon' — '.epsilon' applies only to float types (f32/f64); integer types expose only '.min'/'.max' +error: type 'i32' has no '.epsilon' — '.epsilon' applies only to float types (f32/f64); integer types expose only '.min'/'.max' --> examples/0160-types-float-numeric-limits-errors.sx:20:10 | -20 | a := s32.epsilon; +20 | a := i32.epsilon; | ^^^^^^^^^^^ error: type 'u8' has no '.inf' — '.inf' applies only to float types (f32/f64); integer types expose only '.min'/'.max' @@ -10,10 +10,10 @@ error: type 'u8' has no '.inf' — '.inf' applies only to float types (f32/f64); 21 | b := u8.inf; | ^^^^^^ -error: type 's64' has no '.true_min' — '.true_min' applies only to float types (f32/f64); integer types expose only '.min'/'.max' +error: type 'i64' has no '.true_min' — '.true_min' applies only to float types (f32/f64); integer types expose only '.min'/'.max' --> examples/0160-types-float-numeric-limits-errors.sx:22:10 | -22 | c := s64.true_min; +22 | c := i64.true_min; | ^^^^^^^^^^^^ error: type 'bool' has no '.nan' — numeric limits apply only to integer and float types diff --git a/examples/expected/0161-types-numeric-limit-value-shadow.stdout b/examples/expected/0161-types-numeric-limit-value-shadow.stdout index 0703721..dd00cd0 100644 --- a/examples/expected/0161-types-numeric-limit-value-shadow.stdout +++ b/examples/expected/0161-types-numeric-limit-value-shadow.stdout @@ -1,12 +1,12 @@ local f64: epsilon=11 max=22 min_positive=33 -local s32: max=78 min=-78 +local i32: max=78 min=-78 local u8: max=7 global f32: epsilon=44 max=55 min_positive=66 -const s16: max=99 min=-99 +const i16: max=99 min=-99 typed val e=11 -lim s32.max=2147483647 s32.min=-2147483648 +lim i32.max=2147483647 i32.min=-2147483648 lim u8.max=255 -lim s16.max=32767 s16.min=-32768 +lim i16.max=32767 i16.min=-32768 lim (1.0+f64.epsilon)!=1.0: true lim f64.inf > f64.max: true lim f64.min == -f64.max: true diff --git a/examples/expected/0164-types-reflection-any-tag.stdout b/examples/expected/0164-types-reflection-any-tag.stdout index 4eafff9..0c6cf31 100644 --- a/examples/expected/0164-types-reflection-any-tag.stdout +++ b/examples/expected/0164-types-reflection-any-tag.stdout @@ -1,4 +1,4 @@ -type_name(av)=s64 +type_name(av)=i64 type_is_unsigned(av)=false print(av)=6 type_name(au)=u32 diff --git a/examples/expected/0173-types-int-literal-default-s64.exit b/examples/expected/0173-types-int-literal-default-i64.exit similarity index 100% rename from examples/expected/0173-types-int-literal-default-s64.exit rename to examples/expected/0173-types-int-literal-default-i64.exit diff --git a/examples/expected/0173-types-int-literal-default-s64.stderr b/examples/expected/0173-types-int-literal-default-i64.stderr similarity index 100% rename from examples/expected/0173-types-int-literal-default-s64.stderr rename to examples/expected/0173-types-int-literal-default-i64.stderr diff --git a/examples/expected/0173-types-int-literal-default-i64.stdout b/examples/expected/0173-types-int-literal-default-i64.stdout new file mode 100644 index 0000000..9517437 --- /dev/null +++ b/examples/expected/0173-types-int-literal-default-i64.stdout @@ -0,0 +1,5 @@ +f.x: i64 +g.x: i64 +big: i64 = 3000000000 +a: i64 b: i64 +main.x: i64 diff --git a/examples/expected/0173-types-int-literal-default-s64.stdout b/examples/expected/0173-types-int-literal-default-s64.stdout deleted file mode 100644 index 7475f92..0000000 --- a/examples/expected/0173-types-int-literal-default-s64.stdout +++ /dev/null @@ -1,5 +0,0 @@ -f.x: s64 -g.x: s64 -big: s64 = 3000000000 -a: s64 b: s64 -main.x: s64 diff --git a/examples/expected/0182-types-cast-compound-types.stdout b/examples/expected/0182-types-cast-compound-types.stdout index dc81b77..b2927a9 100644 --- a/examples/expected/0182-types-cast-compound-types.stdout +++ b/examples/expected/0182-types-cast-compound-types.stdout @@ -3,4 +3,4 @@ b: 42 c: 42 d: 7 e: 3 3 -f: *s64 +f: *i64 diff --git a/examples/expected/0200-generics-generic.ir b/examples/expected/0200-generics-generic.ir index e8414ad..5e6bfc6 100644 --- a/examples/expected/0200-generics-generic.ir +++ b/examples/expected/0200-generics-generic.ir @@ -25,10 +25,10 @@ @tag_names = private constant [14 x { ptr, i64 }] [{ ptr, i64 } { ptr @tag.str, i64 0 }, { ptr, i64 } { ptr @tag.str.114, i64 8 }, { ptr, i64 } { ptr @tag.str.115, i64 2 }, { ptr, i64 } { ptr @tag.str.116, i64 15 }, { ptr, i64 } { ptr @tag.str.117, i64 13 }, { ptr, i64 } { ptr @tag.str.118, i64 9 }, { ptr, i64 } { ptr @tag.str.119, i64 9 }, { ptr, i64 } { ptr @tag.str.120, i64 15 }, { ptr, i64 } { ptr @tag.str.121, i64 14 }, { ptr, i64 } { ptr @tag.str.122, i64 14 }, { ptr, i64 } { ptr @tag.str.123, i64 11 }, { ptr, i64 } { ptr @tag.str.124, i64 12 }, { ptr, i64 } { ptr @tag.str.125, i64 15 }, { ptr, i64 } { ptr @tag.str.126, i64 12 }] @tn.str = private constant [13 x i8] c"\00" @tn.str.127 = private constant [5 x i8] c"bool\00" -@tn.str.128 = private constant [3 x i8] c"s8\00" -@tn.str.129 = private constant [4 x i8] c"s16\00" -@tn.str.130 = private constant [4 x i8] c"s32\00" -@tn.str.131 = private constant [4 x i8] c"s64\00" +@tn.str.128 = private constant [3 x i8] c"i8\00" +@tn.str.129 = private constant [4 x i8] c"i16\00" +@tn.str.130 = private constant [4 x i8] c"i32\00" +@tn.str.131 = private constant [4 x i8] c"i64\00" @tn.str.132 = private constant [3 x i8] c"u8\00" @tn.str.133 = private constant [4 x i8] c"u16\00" @tn.str.134 = private constant [4 x i8] c"u32\00" @@ -45,7 +45,7 @@ @tn.str.145 = private constant [16 x i8] c"Source_Location\00" @tn.str.146 = private constant [10 x i8] c"Allocator\00" @tn.str.147 = private constant [8 x i8] c"Context\00" -@tn.str.148 = private constant [7 x i8] c"[4]s64\00" +@tn.str.148 = private constant [7 x i8] c"[4]i64\00" @tn.str.149 = private constant [9 x i8] c"[]string\00" @tn.str.150 = private constant [11 x i8] c"CAllocator\00" @tn.str.151 = private constant [12 x i8] c"*CAllocator\00" @@ -70,7 +70,7 @@ @tn.str.170 = private constant [4 x i8] c"*u8\00" @tn.str.171 = private constant [14 x i8] c"ProcessResult\00" @tn.str.172 = private constant [15 x i8] c"?ProcessResult\00" -@tn.str.173 = private constant [5 x i8] c"*s32\00" +@tn.str.173 = private constant [5 x i8] c"*i32\00" @tn.str.174 = private constant [9 x i8] c"SockAddr\00" @tn.str.175 = private constant [10 x i8] c"*SockAddr\00" @tn.str.176 = private constant [5 x i8] c"*u32\00" @@ -86,9 +86,9 @@ @tn.str.186 = private constant [5 x i8] c"[]u8\00" @tn.str.187 = private constant [5 x i8] c"Sink\00" @tn.str.188 = private constant [6 x i8] c"*Sink\00" -@tn.str.189 = private constant [17 x i8] c"(s64, JsonError)\00" +@tn.str.189 = private constant [17 x i8] c"(i64, JsonError)\00" @tn.str.190 = private constant [15 x i8] c"JsonParseError\00" -@tn.str.191 = private constant [22 x i8] c"(s64, JsonParseError)\00" +@tn.str.191 = private constant [22 x i8] c"(i64, JsonParseError)\00" @tn.str.192 = private constant [7 x i8] c"Parser\00" @tn.str.193 = private constant [8 x i8] c"*Parser\00" @tn.str.194 = private constant [25 x i8] c"(string, JsonParseError)\00" @@ -97,7 +97,7 @@ @tn.str.197 = private constant [13 x i8] c"Architecture\00" @tn.str.198 = private constant [13 x i8] c"BuildOptions\00" @tn.str.199 = private constant [11 x i8] c"() -> bool\00" -@tn.str.200 = private constant [5 x i8] c"*s64\00" +@tn.str.200 = private constant [5 x i8] c"*i64\00" @tn.str.201 = private constant [9 x i8] c"CliError\00" @tn.str.202 = private constant [9 x i8] c"FlagSpec\00" @tn.str.203 = private constant [11 x i8] c"[]FlagSpec\00" @@ -110,12 +110,12 @@ @tn.str.210 = private constant [19 x i8] c"(Parsed, CliError)\00" @tn.str.211 = private constant [10 x i8] c"[]Command\00" @tn.str.212 = private constant [6 x i8] c"*Diag\00" -@tn.str.213 = private constant [7 x i8] c"[8]s64\00" +@tn.str.213 = private constant [7 x i8] c"[8]i64\00" @tn.str.214 = private constant [7 x i8] c"[64]u8\00" @tn.str.215 = private constant [7 x i8] c"Sha256\00" @tn.str.216 = private constant [8 x i8] c"*Sha256\00" @tn.str.217 = private constant [8 x i8] c"?[64]u8\00" -@tn.str.218 = private constant [8 x i8] c"[64]s64\00" +@tn.str.218 = private constant [8 x i8] c"[64]i64\00" @tn.str.219 = private constant [13 x i8] c"**CAllocator\00" @tn.str.220 = private constant [7 x i8] c"**void\00" @tn.str.221 = private constant [8 x i8] c"*string\00" @@ -126,7 +126,7 @@ @tn.str.226 = private constant [7 x i8] c"*[]Any\00" @tn.str.227 = private constant [6 x i8] c"*bool\00" @tn.str.228 = private constant [5 x i8] c"*f64\00" -@tn.str.229 = private constant [8 x i8] c"*[4]s64\00" +@tn.str.229 = private constant [8 x i8] c"*[4]i64\00" @tn.str.230 = private constant [17 x i8] c"*Source_Location\00" @tn.str.231 = private constant [11 x i8] c"*Allocator\00" @tn.str.232 = private constant [9 x i8] c"*Context\00" @@ -143,9 +143,9 @@ @tn.str.243 = private constant [17 x i8] c"*OperatingSystem\00" @tn.str.244 = private constant [14 x i8] c"*Architecture\00" @tn.str.245 = private constant [15 x i8] c"*[16]FlagValue\00" -@tn.str.246 = private constant [8 x i8] c"*[8]s64\00" +@tn.str.246 = private constant [8 x i8] c"*[8]i64\00" @tn.str.247 = private constant [8 x i8] c"*[64]u8\00" -@tn.str.248 = private constant [9 x i8] c"*[64]s64\00" +@tn.str.248 = private constant [9 x i8] c"*[64]i64\00" @tn.str.249 = private constant [10 x i8] c"*[]string\00" @tn.str.250 = private constant [6 x i8] c"*[]u8\00" @tn.str.251 = private constant [12 x i8] c"*[]FlagSpec\00" @@ -158,7 +158,7 @@ @tn.str.258 = private constant [20 x i8] c"**TrackingAllocator\00" @tn.str.259 = private constant [7 x i8] c"**File\00" @tn.str.260 = private constant [5 x i8] c"**u8\00" -@tn.str.261 = private constant [6 x i8] c"**s32\00" +@tn.str.261 = private constant [6 x i8] c"**i32\00" @tn.str.262 = private constant [11 x i8] c"**SockAddr\00" @tn.str.263 = private constant [6 x i8] c"**u32\00" @tn.str.264 = private constant [10 x i8] c"*[*]Value\00" @@ -167,7 +167,7 @@ @tn.str.267 = private constant [9 x i8] c"**Object\00" @tn.str.268 = private constant [7 x i8] c"**Sink\00" @tn.str.269 = private constant [9 x i8] c"**Parser\00" -@tn.str.270 = private constant [6 x i8] c"**s64\00" +@tn.str.270 = private constant [6 x i8] c"**i64\00" @tn.str.271 = private constant [9 x i8] c"**Parsed\00" @tn.str.272 = private constant [7 x i8] c"**Diag\00" @tn.str.273 = private constant [9 x i8] c"**Sha256\00" @@ -540,7 +540,7 @@ @str.637 = private unnamed_addr constant [4 x i8] c"*u8\00", align 1 @str.638 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.639 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.640 = private unnamed_addr constant [5 x i8] c"*s32\00", align 1 +@str.640 = private unnamed_addr constant [5 x i8] c"*i32\00", align 1 @str.641 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.642 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.643 = private unnamed_addr constant [10 x i8] c"*SockAddr\00", align 1 @@ -567,7 +567,7 @@ @str.664 = private unnamed_addr constant [8 x i8] c"*Parser\00", align 1 @str.665 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.666 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.667 = private unnamed_addr constant [5 x i8] c"*s64\00", align 1 +@str.667 = private unnamed_addr constant [5 x i8] c"*i64\00", align 1 @str.668 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.669 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.670 = private unnamed_addr constant [8 x i8] c"*Parsed\00", align 1 @@ -1940,7 +1940,7 @@ dispatch.case.265: ; preds = %match.arm.47 %ua.raw174 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr175 = inttoptr i64 %ua.raw174 to ptr %ua.load176 = load [4 x i64], ptr %ua.ptr175, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %ua.load176) + %callN = call { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %ua.load176) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.263 @@ -1956,7 +1956,7 @@ dispatch.case.267: ; preds = %match.arm.47 %ua.raw182 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr183 = inttoptr i64 %ua.raw182 to ptr %ua.load184 = load [8 x i64], ptr %ua.ptr183, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %ua.load184) + %callN = call { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %ua.load184) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.263 @@ -1972,7 +1972,7 @@ dispatch.case.269: ; preds = %match.arm.47 %ua.raw190 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr191 = inttoptr i64 %ua.raw190 to ptr %ua.load192 = load [64 x i64], ptr %ua.ptr191, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %ua.load192) + %callN = call { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %ua.load192) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.263 @@ -2115,7 +2115,7 @@ dispatch.case.344: ; preds = %match.arm.49 dispatch.case.345: ; preds = %match.arm.49 %ua.raw249 = extractvalue { i64, i64 } %loadN, 1 %iNp250 = inttoptr i64 %ua.raw249 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %iNp250) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %iNp250) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.333 @@ -2178,7 +2178,7 @@ dispatch.case.353: ; preds = %match.arm.49 dispatch.case.354: ; preds = %match.arm.49 %ua.raw276 = extractvalue { i64, i64 } %loadN, 1 %iNp277 = inttoptr i64 %ua.raw276 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %iNp277) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %iNp277) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.333 @@ -3428,13 +3428,13 @@ declare void @assert.107(ptr, i1) #0 ; Function Attrs: nounwind define i32 @main() #0 { entry: - %call = call i64 @sum__s64(ptr @__sx_default_context, i64 2, i64 3) + %call = call i64 @sum__i64(ptr @__sx_default_context, i64 2, i64 3) %alloca = alloca i64, align 8 store i64 %call, ptr %alloca, align 8 %load = load i64, ptr %alloca, align 8 - call void @print__ct_s95dfd2a009f17129__pack_s64(ptr @__sx_default_context, i64 %load) - %callN = call i64 @sum__s64(ptr @__sx_default_context, i64 40, i64 2) - call void @print__ct_s95dfd2a009f17129__pack_s64(ptr @__sx_default_context, i64 %callN) + call void @print__ct_s95dfd2a009f17129__pack_i64(ptr @__sx_default_context, i64 %load) + %callN = call i64 @sum__i64(ptr @__sx_default_context, i64 40, i64 2) + call void @print__ct_s95dfd2a009f17129__pack_i64(ptr @__sx_default_context, i64 %callN) %callN = call double @sum__f64(ptr @__sx_default_context, double 4.000000e+01, double 2.500000e+00) call void @print__ct_s95dfd2a009f17129__pack_f64(ptr @__sx_default_context, double %callN) ret i32 0 @@ -3455,7 +3455,7 @@ entry: } ; Function Attrs: nounwind -define internal i64 @sum__s64(ptr %0, i64 %1, i64 %2) #0 { +define internal i64 @sum__i64(ptr %0, i64 %1, i64 %2) #0 { entry: %alloca = alloca i64, align 8 store i64 %1, ptr %alloca, align 8 @@ -3468,7 +3468,7 @@ entry: } ; Function Attrs: nounwind -define internal void @print__ct_s95dfd2a009f17129__pack_s64(ptr %0, i64 %1) #0 { +define internal void @print__ct_s95dfd2a009f17129__pack_i64(ptr %0, i64 %1) #0 { entry: %alloca = alloca { ptr, i64 }, align 8 store { ptr, i64 } { ptr @str.307, i64 8 }, ptr %alloca, align 8 @@ -3659,14 +3659,14 @@ fv.case: ; preds = %if.merge.125 fv.case17: ; preds = %if.merge.125 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.125 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.125 @@ -4362,8 +4362,8 @@ fv.default: ; preds = %if.merge.170 fv.case: ; preds = %if.merge.170 %fv.field = extractvalue { i32 } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge } @@ -4446,14 +4446,14 @@ fv.case: ; preds = %if.merge.175 fv.case17: ; preds = %if.merge.175 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.175 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.175 @@ -4538,8 +4538,8 @@ fv.default: ; preds = %if.merge.180 fv.case: ; preds = %if.merge.180 %fv.field = extractvalue { i32, { ptr, i64 } } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case17: ; preds = %if.merge.180 @@ -5940,7 +5940,7 @@ if.merge.262: ; preds = %if.then.261, %entry } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %1) #0 { entry: %alloca = alloca [4 x i64], align 8 %ig.tmp = alloca [4 x i64], align 8 @@ -6043,7 +6043,7 @@ if.merge.280: ; preds = %if.then.279, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %1) #0 { entry: %alloca = alloca [8 x i64], align 8 %ig.tmp = alloca [8 x i64], align 8 @@ -6144,7 +6144,7 @@ if.merge.290: ; preds = %if.then.289, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %1) #0 { entry: %alloca = alloca [64 x i64], align 8 %ig.tmp = alloca [64 x i64], align 8 @@ -6794,7 +6794,7 @@ if.merge.408: ; preds = %if.else.407, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 @@ -7044,7 +7044,7 @@ if.merge.435: ; preds = %if.else.434, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 diff --git a/examples/expected/0201-generics-generic-struct.ir b/examples/expected/0201-generics-generic-struct.ir index 923526c..85cab8b 100644 --- a/examples/expected/0201-generics-generic-struct.ir +++ b/examples/expected/0201-generics-generic-struct.ir @@ -25,10 +25,10 @@ @tag_names = private constant [14 x { ptr, i64 }] [{ ptr, i64 } { ptr @tag.str, i64 0 }, { ptr, i64 } { ptr @tag.str.114, i64 8 }, { ptr, i64 } { ptr @tag.str.115, i64 2 }, { ptr, i64 } { ptr @tag.str.116, i64 15 }, { ptr, i64 } { ptr @tag.str.117, i64 13 }, { ptr, i64 } { ptr @tag.str.118, i64 9 }, { ptr, i64 } { ptr @tag.str.119, i64 9 }, { ptr, i64 } { ptr @tag.str.120, i64 15 }, { ptr, i64 } { ptr @tag.str.121, i64 14 }, { ptr, i64 } { ptr @tag.str.122, i64 14 }, { ptr, i64 } { ptr @tag.str.123, i64 11 }, { ptr, i64 } { ptr @tag.str.124, i64 12 }, { ptr, i64 } { ptr @tag.str.125, i64 15 }, { ptr, i64 } { ptr @tag.str.126, i64 12 }] @tn.str = private constant [13 x i8] c"\00" @tn.str.127 = private constant [5 x i8] c"bool\00" -@tn.str.128 = private constant [3 x i8] c"s8\00" -@tn.str.129 = private constant [4 x i8] c"s16\00" -@tn.str.130 = private constant [4 x i8] c"s32\00" -@tn.str.131 = private constant [4 x i8] c"s64\00" +@tn.str.128 = private constant [3 x i8] c"i8\00" +@tn.str.129 = private constant [4 x i8] c"i16\00" +@tn.str.130 = private constant [4 x i8] c"i32\00" +@tn.str.131 = private constant [4 x i8] c"i64\00" @tn.str.132 = private constant [3 x i8] c"u8\00" @tn.str.133 = private constant [4 x i8] c"u16\00" @tn.str.134 = private constant [4 x i8] c"u32\00" @@ -45,7 +45,7 @@ @tn.str.145 = private constant [16 x i8] c"Source_Location\00" @tn.str.146 = private constant [10 x i8] c"Allocator\00" @tn.str.147 = private constant [8 x i8] c"Context\00" -@tn.str.148 = private constant [7 x i8] c"[4]s64\00" +@tn.str.148 = private constant [7 x i8] c"[4]i64\00" @tn.str.149 = private constant [9 x i8] c"[]string\00" @tn.str.150 = private constant [11 x i8] c"CAllocator\00" @tn.str.151 = private constant [12 x i8] c"*CAllocator\00" @@ -70,7 +70,7 @@ @tn.str.170 = private constant [4 x i8] c"*u8\00" @tn.str.171 = private constant [14 x i8] c"ProcessResult\00" @tn.str.172 = private constant [15 x i8] c"?ProcessResult\00" -@tn.str.173 = private constant [5 x i8] c"*s32\00" +@tn.str.173 = private constant [5 x i8] c"*i32\00" @tn.str.174 = private constant [9 x i8] c"SockAddr\00" @tn.str.175 = private constant [10 x i8] c"*SockAddr\00" @tn.str.176 = private constant [5 x i8] c"*u32\00" @@ -86,9 +86,9 @@ @tn.str.186 = private constant [5 x i8] c"[]u8\00" @tn.str.187 = private constant [5 x i8] c"Sink\00" @tn.str.188 = private constant [6 x i8] c"*Sink\00" -@tn.str.189 = private constant [17 x i8] c"(s64, JsonError)\00" +@tn.str.189 = private constant [17 x i8] c"(i64, JsonError)\00" @tn.str.190 = private constant [15 x i8] c"JsonParseError\00" -@tn.str.191 = private constant [22 x i8] c"(s64, JsonParseError)\00" +@tn.str.191 = private constant [22 x i8] c"(i64, JsonParseError)\00" @tn.str.192 = private constant [7 x i8] c"Parser\00" @tn.str.193 = private constant [8 x i8] c"*Parser\00" @tn.str.194 = private constant [25 x i8] c"(string, JsonParseError)\00" @@ -97,7 +97,7 @@ @tn.str.197 = private constant [13 x i8] c"Architecture\00" @tn.str.198 = private constant [13 x i8] c"BuildOptions\00" @tn.str.199 = private constant [11 x i8] c"() -> bool\00" -@tn.str.200 = private constant [5 x i8] c"*s64\00" +@tn.str.200 = private constant [5 x i8] c"*i64\00" @tn.str.201 = private constant [9 x i8] c"CliError\00" @tn.str.202 = private constant [9 x i8] c"FlagSpec\00" @tn.str.203 = private constant [11 x i8] c"[]FlagSpec\00" @@ -110,12 +110,12 @@ @tn.str.210 = private constant [19 x i8] c"(Parsed, CliError)\00" @tn.str.211 = private constant [10 x i8] c"[]Command\00" @tn.str.212 = private constant [6 x i8] c"*Diag\00" -@tn.str.213 = private constant [7 x i8] c"[8]s64\00" +@tn.str.213 = private constant [7 x i8] c"[8]i64\00" @tn.str.214 = private constant [7 x i8] c"[64]u8\00" @tn.str.215 = private constant [7 x i8] c"Sha256\00" @tn.str.216 = private constant [8 x i8] c"*Sha256\00" @tn.str.217 = private constant [8 x i8] c"?[64]u8\00" -@tn.str.218 = private constant [8 x i8] c"[64]s64\00" +@tn.str.218 = private constant [8 x i8] c"[64]i64\00" @tn.str.219 = private constant [8 x i8] c"[16]f32\00" @tn.str.220 = private constant [5 x i8] c"Mat4\00" @tn.str.221 = private constant [5 x i8] c"Vec2\00" @@ -142,7 +142,7 @@ @tn.str.242 = private constant [5 x i8] c"*f64\00" @tn.str.243 = private constant [8 x i8] c"Sx__f32\00" @tn.str.244 = private constant [9 x i8] c"*Sx__f32\00" -@tn.str.245 = private constant [8 x i8] c"*[4]s64\00" +@tn.str.245 = private constant [8 x i8] c"*[4]i64\00" @tn.str.246 = private constant [17 x i8] c"*Source_Location\00" @tn.str.247 = private constant [11 x i8] c"*Allocator\00" @tn.str.248 = private constant [9 x i8] c"*Context\00" @@ -163,9 +163,9 @@ @tn.str.263 = private constant [17 x i8] c"*OperatingSystem\00" @tn.str.264 = private constant [14 x i8] c"*Architecture\00" @tn.str.265 = private constant [15 x i8] c"*[16]FlagValue\00" -@tn.str.266 = private constant [8 x i8] c"*[8]s64\00" +@tn.str.266 = private constant [8 x i8] c"*[8]i64\00" @tn.str.267 = private constant [8 x i8] c"*[64]u8\00" -@tn.str.268 = private constant [9 x i8] c"*[64]s64\00" +@tn.str.268 = private constant [9 x i8] c"*[64]i64\00" @tn.str.269 = private constant [9 x i8] c"*[16]f32\00" @tn.str.270 = private constant [10 x i8] c"*[]string\00" @tn.str.271 = private constant [6 x i8] c"*[]u8\00" @@ -179,7 +179,7 @@ @tn.str.279 = private constant [20 x i8] c"**TrackingAllocator\00" @tn.str.280 = private constant [7 x i8] c"**File\00" @tn.str.281 = private constant [5 x i8] c"**u8\00" -@tn.str.282 = private constant [6 x i8] c"**s32\00" +@tn.str.282 = private constant [6 x i8] c"**i32\00" @tn.str.283 = private constant [11 x i8] c"**SockAddr\00" @tn.str.284 = private constant [6 x i8] c"**u32\00" @tn.str.285 = private constant [10 x i8] c"*[*]Value\00" @@ -188,7 +188,7 @@ @tn.str.288 = private constant [9 x i8] c"**Object\00" @tn.str.289 = private constant [7 x i8] c"**Sink\00" @tn.str.290 = private constant [9 x i8] c"**Parser\00" -@tn.str.291 = private constant [6 x i8] c"**s64\00" +@tn.str.291 = private constant [6 x i8] c"**i64\00" @tn.str.292 = private constant [9 x i8] c"**Parsed\00" @tn.str.293 = private constant [7 x i8] c"**Diag\00" @tn.str.294 = private constant [9 x i8] c"**Sha256\00" @@ -658,7 +658,7 @@ @str.755 = private unnamed_addr constant [4 x i8] c"*u8\00", align 1 @str.756 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.757 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.758 = private unnamed_addr constant [5 x i8] c"*s32\00", align 1 +@str.758 = private unnamed_addr constant [5 x i8] c"*i32\00", align 1 @str.759 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.760 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.761 = private unnamed_addr constant [10 x i8] c"*SockAddr\00", align 1 @@ -685,7 +685,7 @@ @str.782 = private unnamed_addr constant [8 x i8] c"*Parser\00", align 1 @str.783 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.784 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.785 = private unnamed_addr constant [5 x i8] c"*s64\00", align 1 +@str.785 = private unnamed_addr constant [5 x i8] c"*i64\00", align 1 @str.786 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.787 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.788 = private unnamed_addr constant [8 x i8] c"*Parsed\00", align 1 @@ -2186,7 +2186,7 @@ dispatch.case.312: ; preds = %match.arm.47 %ua.raw211 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr212 = inttoptr i64 %ua.raw211 to ptr %ua.load213 = load [4 x i64], ptr %ua.ptr212, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %ua.load213) + %callN = call { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %ua.load213) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.310 @@ -2202,7 +2202,7 @@ dispatch.case.314: ; preds = %match.arm.47 %ua.raw219 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr220 = inttoptr i64 %ua.raw219 to ptr %ua.load221 = load [8 x i64], ptr %ua.ptr220, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %ua.load221) + %callN = call { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %ua.load221) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.310 @@ -2218,7 +2218,7 @@ dispatch.case.316: ; preds = %match.arm.47 %ua.raw227 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr228 = inttoptr i64 %ua.raw227 to ptr %ua.load229 = load [64 x i64], ptr %ua.ptr228, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %ua.load229) + %callN = call { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %ua.load229) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.310 @@ -2377,7 +2377,7 @@ dispatch.case.403: ; preds = %match.arm.49 dispatch.case.404: ; preds = %match.arm.49 %ua.raw294 = extractvalue { i64, i64 } %loadN, 1 %iNp295 = inttoptr i64 %ua.raw294 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %iNp295) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %iNp295) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.392 @@ -2440,7 +2440,7 @@ dispatch.case.412: ; preds = %match.arm.49 dispatch.case.413: ; preds = %match.arm.49 %ua.raw321 = extractvalue { i64, i64 } %loadN, 1 %iNp322 = inttoptr i64 %ua.raw321 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %iNp322) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %iNp322) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.392 @@ -3882,9 +3882,9 @@ entry: store { i64, [4 x i8] } %ei.val, ptr %allocaN, align 8 %loadN = load { i64, [4 x i8] }, ptr %allocaN, align 8 call void @print__ct_sbc6305862a3a863d__pack_Sx__f32(ptr @__sx_default_context, { i64, [4 x i8] } %loadN) - call void @print__ct_sbc6305862a3a863d__pack_s64(ptr @__sx_default_context, i64 4) - call void @print__ct_sbc6305862a3a863d__pack_s64(ptr @__sx_default_context, i64 16) - call void @print__ct_sbc6305862a3a863d__pack_s64(ptr @__sx_default_context, i64 8) + call void @print__ct_sbc6305862a3a863d__pack_i64(ptr @__sx_default_context, i64 4) + call void @print__ct_sbc6305862a3a863d__pack_i64(ptr @__sx_default_context, i64 16) + call void @print__ct_sbc6305862a3a863d__pack_i64(ptr @__sx_default_context, i64 8) ret i32 0 } @@ -4515,7 +4515,7 @@ entry: } ; Function Attrs: nounwind -define internal void @print__ct_sbc6305862a3a863d__pack_s64(ptr %0, i64 %1) #0 { +define internal void @print__ct_sbc6305862a3a863d__pack_i64(ptr %0, i64 %1) #0 { entry: %alloca = alloca { ptr, i64 }, align 8 store { ptr, i64 } { ptr @str.368, i64 3 }, ptr %alloca, align 8 @@ -4636,14 +4636,14 @@ fv.case: ; preds = %if.merge.131 fv.case17: ; preds = %if.merge.131 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.131 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.131 @@ -5339,8 +5339,8 @@ fv.default: ; preds = %if.merge.176 fv.case: ; preds = %if.merge.176 %fv.field = extractvalue { i32 } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge } @@ -5423,14 +5423,14 @@ fv.case: ; preds = %if.merge.181 fv.case17: ; preds = %if.merge.181 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.181 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.181 @@ -5515,8 +5515,8 @@ fv.default: ; preds = %if.merge.186 fv.case: ; preds = %if.merge.186 %fv.field = extractvalue { i32, { ptr, i64 } } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case17: ; preds = %if.merge.186 @@ -7422,8 +7422,8 @@ fv.case: ; preds = %entry store { i64, [4 x i8] } %loadN, ptr %fv.utmp, align 8 %fv.pp = getelementptr inbounds { i64, [4 x i8] }, ptr %fv.utmp, i32 0, i32 1 %fv.field = load i32, ptr %fv.pp, align 4 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case6: ; preds = %entry @@ -7487,7 +7487,7 @@ if.merge.309: ; preds = %if.then.308, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %1) #0 { entry: %alloca = alloca [4 x i64], align 8 %ig.tmp = alloca [4 x i64], align 8 @@ -7590,7 +7590,7 @@ if.merge.329: ; preds = %if.then.328, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %1) #0 { entry: %alloca = alloca [8 x i64], align 8 %ig.tmp = alloca [8 x i64], align 8 @@ -7691,7 +7691,7 @@ if.merge.339: ; preds = %if.then.338, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %1) #0 { entry: %alloca = alloca [64 x i64], align 8 %ig.tmp = alloca [64 x i64], align 8 @@ -8445,7 +8445,7 @@ if.merge.473: ; preds = %if.else.472, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 @@ -8695,7 +8695,7 @@ if.merge.500: ; preds = %if.else.499, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 diff --git a/examples/expected/0205-generics-generic-method-dot-call.stdout b/examples/expected/0205-generics-generic-method-dot-call.stdout index c5c6c16..4d68d6b 100644 --- a/examples/expected/0205-generics-generic-method-dot-call.stdout +++ b/examples/expected/0205-generics-generic-method-dot-call.stdout @@ -1,5 +1,5 @@ plain: 7 -sized s32: 4 -sized s64: 8 +sized i32: 4 +sized i64: 8 taking explicit: 42 taking inferred: 99 diff --git a/examples/expected/0301-closures-fn-pointers.ir b/examples/expected/0301-closures-fn-pointers.ir index edf83eb..d36aee0 100644 --- a/examples/expected/0301-closures-fn-pointers.ir +++ b/examples/expected/0301-closures-fn-pointers.ir @@ -25,10 +25,10 @@ @tag_names = private constant [14 x { ptr, i64 }] [{ ptr, i64 } { ptr @tag.str, i64 0 }, { ptr, i64 } { ptr @tag.str.114, i64 8 }, { ptr, i64 } { ptr @tag.str.115, i64 2 }, { ptr, i64 } { ptr @tag.str.116, i64 15 }, { ptr, i64 } { ptr @tag.str.117, i64 13 }, { ptr, i64 } { ptr @tag.str.118, i64 9 }, { ptr, i64 } { ptr @tag.str.119, i64 9 }, { ptr, i64 } { ptr @tag.str.120, i64 15 }, { ptr, i64 } { ptr @tag.str.121, i64 14 }, { ptr, i64 } { ptr @tag.str.122, i64 14 }, { ptr, i64 } { ptr @tag.str.123, i64 11 }, { ptr, i64 } { ptr @tag.str.124, i64 12 }, { ptr, i64 } { ptr @tag.str.125, i64 15 }, { ptr, i64 } { ptr @tag.str.126, i64 12 }] @tn.str = private constant [13 x i8] c"\00" @tn.str.127 = private constant [5 x i8] c"bool\00" -@tn.str.128 = private constant [3 x i8] c"s8\00" -@tn.str.129 = private constant [4 x i8] c"s16\00" -@tn.str.130 = private constant [4 x i8] c"s32\00" -@tn.str.131 = private constant [4 x i8] c"s64\00" +@tn.str.128 = private constant [3 x i8] c"i8\00" +@tn.str.129 = private constant [4 x i8] c"i16\00" +@tn.str.130 = private constant [4 x i8] c"i32\00" +@tn.str.131 = private constant [4 x i8] c"i64\00" @tn.str.132 = private constant [3 x i8] c"u8\00" @tn.str.133 = private constant [4 x i8] c"u16\00" @tn.str.134 = private constant [4 x i8] c"u32\00" @@ -45,7 +45,7 @@ @tn.str.145 = private constant [16 x i8] c"Source_Location\00" @tn.str.146 = private constant [10 x i8] c"Allocator\00" @tn.str.147 = private constant [8 x i8] c"Context\00" -@tn.str.148 = private constant [7 x i8] c"[4]s64\00" +@tn.str.148 = private constant [7 x i8] c"[4]i64\00" @tn.str.149 = private constant [9 x i8] c"[]string\00" @tn.str.150 = private constant [11 x i8] c"CAllocator\00" @tn.str.151 = private constant [12 x i8] c"*CAllocator\00" @@ -70,7 +70,7 @@ @tn.str.170 = private constant [4 x i8] c"*u8\00" @tn.str.171 = private constant [14 x i8] c"ProcessResult\00" @tn.str.172 = private constant [15 x i8] c"?ProcessResult\00" -@tn.str.173 = private constant [5 x i8] c"*s32\00" +@tn.str.173 = private constant [5 x i8] c"*i32\00" @tn.str.174 = private constant [9 x i8] c"SockAddr\00" @tn.str.175 = private constant [10 x i8] c"*SockAddr\00" @tn.str.176 = private constant [5 x i8] c"*u32\00" @@ -86,9 +86,9 @@ @tn.str.186 = private constant [5 x i8] c"[]u8\00" @tn.str.187 = private constant [5 x i8] c"Sink\00" @tn.str.188 = private constant [6 x i8] c"*Sink\00" -@tn.str.189 = private constant [17 x i8] c"(s64, JsonError)\00" +@tn.str.189 = private constant [17 x i8] c"(i64, JsonError)\00" @tn.str.190 = private constant [15 x i8] c"JsonParseError\00" -@tn.str.191 = private constant [22 x i8] c"(s64, JsonParseError)\00" +@tn.str.191 = private constant [22 x i8] c"(i64, JsonParseError)\00" @tn.str.192 = private constant [7 x i8] c"Parser\00" @tn.str.193 = private constant [8 x i8] c"*Parser\00" @tn.str.194 = private constant [25 x i8] c"(string, JsonParseError)\00" @@ -97,7 +97,7 @@ @tn.str.197 = private constant [13 x i8] c"Architecture\00" @tn.str.198 = private constant [13 x i8] c"BuildOptions\00" @tn.str.199 = private constant [11 x i8] c"() -> bool\00" -@tn.str.200 = private constant [5 x i8] c"*s64\00" +@tn.str.200 = private constant [5 x i8] c"*i64\00" @tn.str.201 = private constant [9 x i8] c"CliError\00" @tn.str.202 = private constant [9 x i8] c"FlagSpec\00" @tn.str.203 = private constant [11 x i8] c"[]FlagSpec\00" @@ -110,16 +110,16 @@ @tn.str.210 = private constant [19 x i8] c"(Parsed, CliError)\00" @tn.str.211 = private constant [10 x i8] c"[]Command\00" @tn.str.212 = private constant [6 x i8] c"*Diag\00" -@tn.str.213 = private constant [7 x i8] c"[8]s64\00" +@tn.str.213 = private constant [7 x i8] c"[8]i64\00" @tn.str.214 = private constant [7 x i8] c"[64]u8\00" @tn.str.215 = private constant [7 x i8] c"Sha256\00" @tn.str.216 = private constant [8 x i8] c"*Sha256\00" @tn.str.217 = private constant [8 x i8] c"?[64]u8\00" -@tn.str.218 = private constant [8 x i8] c"[64]s64\00" -@tn.str.219 = private constant [18 x i8] c"(s32, s32) -> s32\00" +@tn.str.218 = private constant [8 x i8] c"[64]i64\00" +@tn.str.219 = private constant [18 x i8] c"(i32, i32) -> i32\00" @tn.str.220 = private constant [13 x i8] c"**CAllocator\00" @tn.str.221 = private constant [7 x i8] c"**void\00" -@tn.str.222 = private constant [19 x i8] c"*(s32, s32) -> s32\00" +@tn.str.222 = private constant [19 x i8] c"*(i32, i32) -> i32\00" @tn.str.223 = private constant [8 x i8] c"*string\00" @tn.str.224 = private constant [6 x i8] c"[]Any\00" @tn.str.225 = private constant [5 x i8] c"*Any\00" @@ -127,7 +127,7 @@ @tn.str.227 = private constant [8 x i8] c"*[1]Any\00" @tn.str.228 = private constant [7 x i8] c"*[]Any\00" @tn.str.229 = private constant [6 x i8] c"*bool\00" -@tn.str.230 = private constant [8 x i8] c"*[4]s64\00" +@tn.str.230 = private constant [8 x i8] c"*[4]i64\00" @tn.str.231 = private constant [5 x i8] c"*f64\00" @tn.str.232 = private constant [17 x i8] c"*Source_Location\00" @tn.str.233 = private constant [11 x i8] c"*Allocator\00" @@ -145,9 +145,9 @@ @tn.str.245 = private constant [17 x i8] c"*OperatingSystem\00" @tn.str.246 = private constant [14 x i8] c"*Architecture\00" @tn.str.247 = private constant [15 x i8] c"*[16]FlagValue\00" -@tn.str.248 = private constant [8 x i8] c"*[8]s64\00" +@tn.str.248 = private constant [8 x i8] c"*[8]i64\00" @tn.str.249 = private constant [8 x i8] c"*[64]u8\00" -@tn.str.250 = private constant [9 x i8] c"*[64]s64\00" +@tn.str.250 = private constant [9 x i8] c"*[64]i64\00" @tn.str.251 = private constant [10 x i8] c"*[]string\00" @tn.str.252 = private constant [6 x i8] c"*[]u8\00" @tn.str.253 = private constant [12 x i8] c"*[]FlagSpec\00" @@ -160,7 +160,7 @@ @tn.str.260 = private constant [20 x i8] c"**TrackingAllocator\00" @tn.str.261 = private constant [7 x i8] c"**File\00" @tn.str.262 = private constant [5 x i8] c"**u8\00" -@tn.str.263 = private constant [6 x i8] c"**s32\00" +@tn.str.263 = private constant [6 x i8] c"**i32\00" @tn.str.264 = private constant [11 x i8] c"**SockAddr\00" @tn.str.265 = private constant [6 x i8] c"**u32\00" @tn.str.266 = private constant [10 x i8] c"*[*]Value\00" @@ -169,13 +169,13 @@ @tn.str.269 = private constant [9 x i8] c"**Object\00" @tn.str.270 = private constant [7 x i8] c"**Sink\00" @tn.str.271 = private constant [9 x i8] c"**Parser\00" -@tn.str.272 = private constant [6 x i8] c"**s64\00" +@tn.str.272 = private constant [6 x i8] c"**i64\00" @tn.str.273 = private constant [9 x i8] c"**Parsed\00" @tn.str.274 = private constant [7 x i8] c"**Diag\00" @tn.str.275 = private constant [9 x i8] c"**Sha256\00" @tn.str.276 = private constant [14 x i8] c"***CAllocator\00" @tn.str.277 = private constant [8 x i8] c"***void\00" -@tn.str.278 = private constant [20 x i8] c"**(s32, s32) -> s32\00" +@tn.str.278 = private constant [20 x i8] c"**(i32, i32) -> i32\00" @tn.str.279 = private constant [9 x i8] c"**string\00" @tn.str.280 = private constant [6 x i8] c"**Any\00" @tn.str.281 = private constant [9 x i8] c"**[1]Any\00" @@ -545,7 +545,7 @@ @str.642 = private unnamed_addr constant [4 x i8] c"*u8\00", align 1 @str.643 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.644 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.645 = private unnamed_addr constant [5 x i8] c"*s32\00", align 1 +@str.645 = private unnamed_addr constant [5 x i8] c"*i32\00", align 1 @str.646 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.647 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.648 = private unnamed_addr constant [10 x i8] c"*SockAddr\00", align 1 @@ -572,7 +572,7 @@ @str.669 = private unnamed_addr constant [8 x i8] c"*Parser\00", align 1 @str.670 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.671 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.672 = private unnamed_addr constant [5 x i8] c"*s64\00", align 1 +@str.672 = private unnamed_addr constant [5 x i8] c"*i64\00", align 1 @str.673 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.674 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.675 = private unnamed_addr constant [8 x i8] c"*Parsed\00", align 1 @@ -1945,7 +1945,7 @@ dispatch.case.265: ; preds = %match.arm.47 %ua.raw174 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr175 = inttoptr i64 %ua.raw174 to ptr %ua.load176 = load [4 x i64], ptr %ua.ptr175, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %ua.load176) + %callN = call { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %ua.load176) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.263 @@ -1961,7 +1961,7 @@ dispatch.case.267: ; preds = %match.arm.47 %ua.raw182 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr183 = inttoptr i64 %ua.raw182 to ptr %ua.load184 = load [8 x i64], ptr %ua.ptr183, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %ua.load184) + %callN = call { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %ua.load184) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.263 @@ -1977,7 +1977,7 @@ dispatch.case.269: ; preds = %match.arm.47 %ua.raw190 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr191 = inttoptr i64 %ua.raw190 to ptr %ua.load192 = load [64 x i64], ptr %ua.ptr191, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %ua.load192) + %callN = call { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %ua.load192) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.263 @@ -2120,7 +2120,7 @@ dispatch.case.344: ; preds = %match.arm.49 dispatch.case.345: ; preds = %match.arm.49 %ua.raw249 = extractvalue { i64, i64 } %loadN, 1 %iNp250 = inttoptr i64 %ua.raw249 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %iNp250) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %iNp250) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.333 @@ -2183,7 +2183,7 @@ dispatch.case.353: ; preds = %match.arm.49 dispatch.case.354: ; preds = %match.arm.49 %ua.raw276 = extractvalue { i64, i64 } %loadN, 1 %iNp277 = inttoptr i64 %ua.raw276 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %iNp277) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %iNp277) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.333 @@ -2225,7 +2225,7 @@ dispatch.case.359: ; preds = %match.arm.49 dispatch.case.360: ; preds = %match.arm.49 %ua.raw294 = extractvalue { i64, i64 } %loadN, 1 %iNp295 = inttoptr i64 %ua.raw294 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_fn_s32_s32__s32(ptr %0, ptr %iNp295) + %callN = call { ptr, i64 } @pointer_to_string__ptr_fn_i32_i32__i32(ptr %0, ptr %iNp295) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.333 @@ -3479,15 +3479,15 @@ entry: store ptr @add, ptr %alloca, align 8 %load = load ptr, ptr %alloca, align 8 %icall = call i32 %load(ptr @__sx_default_context, i32 3, i32 4) - call void @print__ct_sab6a3b1f9bc359ad__pack_s32(ptr @__sx_default_context, i32 %icall) + call void @print__ct_sab6a3b1f9bc359ad__pack_i32(ptr @__sx_default_context, i32 %icall) store ptr @mul, ptr %alloca, align 8 %loadN = load ptr, ptr %alloca, align 8 %icallN = call i32 %loadN(ptr @__sx_default_context, i32 3, i32 4) - call void @print__ct_sab6a3b1f9bc359ad__pack_s32(ptr @__sx_default_context, i32 %icallN) + call void @print__ct_sab6a3b1f9bc359ad__pack_i32(ptr @__sx_default_context, i32 %icallN) %call = call i32 @apply(ptr @__sx_default_context, ptr @add, i32 5, i32 6) - call void @print__ct_s3417a75739024851__pack_s32(ptr @__sx_default_context, i32 %call) + call void @print__ct_s3417a75739024851__pack_i32(ptr @__sx_default_context, i32 %call) %callN = call i32 @apply(ptr @__sx_default_context, ptr @mul, i32 5, i32 6) - call void @print__ct_s2ed9f416bd1dfc65__pack_s32(ptr @__sx_default_context, i32 %callN) + call void @print__ct_s2ed9f416bd1dfc65__pack_i32(ptr @__sx_default_context, i32 %callN) ret i32 0 } @@ -3506,7 +3506,7 @@ entry: } ; Function Attrs: nounwind -define internal void @print__ct_sab6a3b1f9bc359ad__pack_s32(ptr %0, i32 %1) #0 { +define internal void @print__ct_sab6a3b1f9bc359ad__pack_i32(ptr %0, i32 %1) #0 { entry: %alloca = alloca { ptr, i64 }, align 8 store { ptr, i64 } { ptr @str.309, i64 13 }, ptr %alloca, align 8 @@ -3514,8 +3514,8 @@ entry: store i32 %1, ptr %allocaN, align 4 %allocaN = alloca [1 x { i64, i64 }], align 8 %load = load i32, ptr %allocaN, align 4 - %sN = sext i32 %load to i64 - %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %load to i64 + %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %igp.ptr = getelementptr { i64, i64 }, ptr %allocaN, i64 0 store { i64, i64 } %ba.val, ptr %igp.ptr, align 8 %allocaN = alloca { ptr, i64 }, align 8 @@ -3533,8 +3533,8 @@ entry: store { ptr, i64 } %callN, ptr %allocaN, align 8 %loadN = load { ptr, i64 }, ptr %allocaN, align 8 %loadN = load i32, ptr %allocaN, align 4 - %sN = sext i32 %loadN to i64 - %ba.val13 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %loadN to i64 + %ba.val13 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %callN = call { ptr, i64 } @any_to_string(ptr %0, { i64, i64 } %ba.val13) %callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN) store { ptr, i64 } %callN, ptr %allocaN, align 8 @@ -3558,7 +3558,7 @@ entry: } ; Function Attrs: nounwind -define internal void @print__ct_s3417a75739024851__pack_s32(ptr %0, i32 %1) #0 { +define internal void @print__ct_s3417a75739024851__pack_i32(ptr %0, i32 %1) #0 { entry: %alloca = alloca { ptr, i64 }, align 8 store { ptr, i64 } { ptr @str.312, i64 20 }, ptr %alloca, align 8 @@ -3566,8 +3566,8 @@ entry: store i32 %1, ptr %allocaN, align 4 %allocaN = alloca [1 x { i64, i64 }], align 8 %load = load i32, ptr %allocaN, align 4 - %sN = sext i32 %load to i64 - %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %load to i64 + %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %igp.ptr = getelementptr { i64, i64 }, ptr %allocaN, i64 0 store { i64, i64 } %ba.val, ptr %igp.ptr, align 8 %allocaN = alloca { ptr, i64 }, align 8 @@ -3585,8 +3585,8 @@ entry: store { ptr, i64 } %callN, ptr %allocaN, align 8 %loadN = load { ptr, i64 }, ptr %allocaN, align 8 %loadN = load i32, ptr %allocaN, align 4 - %sN = sext i32 %loadN to i64 - %ba.val13 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %loadN to i64 + %ba.val13 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %callN = call { ptr, i64 } @any_to_string(ptr %0, { i64, i64 } %ba.val13) %callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN) store { ptr, i64 } %callN, ptr %allocaN, align 8 @@ -3610,7 +3610,7 @@ entry: } ; Function Attrs: nounwind -define internal void @print__ct_s2ed9f416bd1dfc65__pack_s32(ptr %0, i32 %1) #0 { +define internal void @print__ct_s2ed9f416bd1dfc65__pack_i32(ptr %0, i32 %1) #0 { entry: %alloca = alloca { ptr, i64 }, align 8 store { ptr, i64 } { ptr @str.315, i64 20 }, ptr %alloca, align 8 @@ -3618,8 +3618,8 @@ entry: store i32 %1, ptr %allocaN, align 4 %allocaN = alloca [1 x { i64, i64 }], align 8 %load = load i32, ptr %allocaN, align 4 - %sN = sext i32 %load to i64 - %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %load to i64 + %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %igp.ptr = getelementptr { i64, i64 }, ptr %allocaN, i64 0 store { i64, i64 } %ba.val, ptr %igp.ptr, align 8 %allocaN = alloca { ptr, i64 }, align 8 @@ -3637,8 +3637,8 @@ entry: store { ptr, i64 } %callN, ptr %allocaN, align 8 %loadN = load { ptr, i64 }, ptr %allocaN, align 8 %loadN = load i32, ptr %allocaN, align 4 - %sN = sext i32 %loadN to i64 - %ba.val13 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %loadN to i64 + %ba.val13 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %callN = call { ptr, i64 } @any_to_string(ptr %0, { i64, i64 } %ba.val13) %callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN) store { ptr, i64 } %callN, ptr %allocaN, align 8 @@ -3738,14 +3738,14 @@ fv.case: ; preds = %if.merge.125 fv.case17: ; preds = %if.merge.125 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.125 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.125 @@ -4441,8 +4441,8 @@ fv.default: ; preds = %if.merge.170 fv.case: ; preds = %if.merge.170 %fv.field = extractvalue { i32 } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge } @@ -4525,14 +4525,14 @@ fv.case: ; preds = %if.merge.175 fv.case17: ; preds = %if.merge.175 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.175 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.175 @@ -4617,8 +4617,8 @@ fv.default: ; preds = %if.merge.180 fv.case: ; preds = %if.merge.180 %fv.field = extractvalue { i32, { ptr, i64 } } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case17: ; preds = %if.merge.180 @@ -6019,7 +6019,7 @@ if.merge.262: ; preds = %if.then.261, %entry } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %1) #0 { entry: %alloca = alloca [4 x i64], align 8 %ig.tmp = alloca [4 x i64], align 8 @@ -6122,7 +6122,7 @@ if.merge.280: ; preds = %if.then.279, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %1) #0 { entry: %alloca = alloca [8 x i64], align 8 %ig.tmp = alloca [8 x i64], align 8 @@ -6223,7 +6223,7 @@ if.merge.290: ; preds = %if.then.289, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %1) #0 { entry: %alloca = alloca [64 x i64], align 8 %ig.tmp = alloca [64 x i64], align 8 @@ -6873,7 +6873,7 @@ if.merge.408: ; preds = %if.else.407, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 @@ -7123,7 +7123,7 @@ if.merge.435: ; preds = %if.else.434, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 @@ -7291,7 +7291,7 @@ if.merge.453: ; preds = %if.else.452, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_fn_s32_s32__s32(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_fn_i32_i32__i32(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 diff --git a/examples/expected/0400-protocols-impl-for-builtin.ir b/examples/expected/0400-protocols-impl-for-builtin.ir index a1aac8a..1ba78a9 100644 --- a/examples/expected/0400-protocols-impl-for-builtin.ir +++ b/examples/expected/0400-protocols-impl-for-builtin.ir @@ -25,10 +25,10 @@ @tag_names = private constant [14 x { ptr, i64 }] [{ ptr, i64 } { ptr @tag.str, i64 0 }, { ptr, i64 } { ptr @tag.str.114, i64 8 }, { ptr, i64 } { ptr @tag.str.115, i64 2 }, { ptr, i64 } { ptr @tag.str.116, i64 15 }, { ptr, i64 } { ptr @tag.str.117, i64 13 }, { ptr, i64 } { ptr @tag.str.118, i64 9 }, { ptr, i64 } { ptr @tag.str.119, i64 9 }, { ptr, i64 } { ptr @tag.str.120, i64 15 }, { ptr, i64 } { ptr @tag.str.121, i64 14 }, { ptr, i64 } { ptr @tag.str.122, i64 14 }, { ptr, i64 } { ptr @tag.str.123, i64 11 }, { ptr, i64 } { ptr @tag.str.124, i64 12 }, { ptr, i64 } { ptr @tag.str.125, i64 15 }, { ptr, i64 } { ptr @tag.str.126, i64 12 }] @tn.str = private constant [13 x i8] c"\00" @tn.str.127 = private constant [5 x i8] c"bool\00" -@tn.str.128 = private constant [3 x i8] c"s8\00" -@tn.str.129 = private constant [4 x i8] c"s16\00" -@tn.str.130 = private constant [4 x i8] c"s32\00" -@tn.str.131 = private constant [4 x i8] c"s64\00" +@tn.str.128 = private constant [3 x i8] c"i8\00" +@tn.str.129 = private constant [4 x i8] c"i16\00" +@tn.str.130 = private constant [4 x i8] c"i32\00" +@tn.str.131 = private constant [4 x i8] c"i64\00" @tn.str.132 = private constant [3 x i8] c"u8\00" @tn.str.133 = private constant [4 x i8] c"u16\00" @tn.str.134 = private constant [4 x i8] c"u32\00" @@ -46,7 +46,7 @@ @tn.str.146 = private constant [16 x i8] c"Source_Location\00" @tn.str.147 = private constant [10 x i8] c"Allocator\00" @tn.str.148 = private constant [8 x i8] c"Context\00" -@tn.str.149 = private constant [7 x i8] c"[4]s64\00" +@tn.str.149 = private constant [7 x i8] c"[4]i64\00" @tn.str.150 = private constant [9 x i8] c"[]string\00" @tn.str.151 = private constant [11 x i8] c"CAllocator\00" @tn.str.152 = private constant [12 x i8] c"*CAllocator\00" @@ -71,7 +71,7 @@ @tn.str.171 = private constant [4 x i8] c"*u8\00" @tn.str.172 = private constant [14 x i8] c"ProcessResult\00" @tn.str.173 = private constant [15 x i8] c"?ProcessResult\00" -@tn.str.174 = private constant [5 x i8] c"*s32\00" +@tn.str.174 = private constant [5 x i8] c"*i32\00" @tn.str.175 = private constant [9 x i8] c"SockAddr\00" @tn.str.176 = private constant [10 x i8] c"*SockAddr\00" @tn.str.177 = private constant [5 x i8] c"*u32\00" @@ -87,9 +87,9 @@ @tn.str.187 = private constant [5 x i8] c"[]u8\00" @tn.str.188 = private constant [5 x i8] c"Sink\00" @tn.str.189 = private constant [6 x i8] c"*Sink\00" -@tn.str.190 = private constant [17 x i8] c"(s64, JsonError)\00" +@tn.str.190 = private constant [17 x i8] c"(i64, JsonError)\00" @tn.str.191 = private constant [15 x i8] c"JsonParseError\00" -@tn.str.192 = private constant [22 x i8] c"(s64, JsonParseError)\00" +@tn.str.192 = private constant [22 x i8] c"(i64, JsonParseError)\00" @tn.str.193 = private constant [7 x i8] c"Parser\00" @tn.str.194 = private constant [8 x i8] c"*Parser\00" @tn.str.195 = private constant [25 x i8] c"(string, JsonParseError)\00" @@ -98,7 +98,7 @@ @tn.str.198 = private constant [13 x i8] c"Architecture\00" @tn.str.199 = private constant [13 x i8] c"BuildOptions\00" @tn.str.200 = private constant [11 x i8] c"() -> bool\00" -@tn.str.201 = private constant [5 x i8] c"*s64\00" +@tn.str.201 = private constant [5 x i8] c"*i64\00" @tn.str.202 = private constant [9 x i8] c"CliError\00" @tn.str.203 = private constant [9 x i8] c"FlagSpec\00" @tn.str.204 = private constant [11 x i8] c"[]FlagSpec\00" @@ -111,12 +111,12 @@ @tn.str.211 = private constant [19 x i8] c"(Parsed, CliError)\00" @tn.str.212 = private constant [10 x i8] c"[]Command\00" @tn.str.213 = private constant [6 x i8] c"*Diag\00" -@tn.str.214 = private constant [7 x i8] c"[8]s64\00" +@tn.str.214 = private constant [7 x i8] c"[8]i64\00" @tn.str.215 = private constant [7 x i8] c"[64]u8\00" @tn.str.216 = private constant [7 x i8] c"Sha256\00" @tn.str.217 = private constant [8 x i8] c"*Sha256\00" @tn.str.218 = private constant [8 x i8] c"?[64]u8\00" -@tn.str.219 = private constant [8 x i8] c"[64]s64\00" +@tn.str.219 = private constant [8 x i8] c"[64]i64\00" @tn.str.220 = private constant [13 x i8] c"**CAllocator\00" @tn.str.221 = private constant [7 x i8] c"**void\00" @tn.str.222 = private constant [5 x i8] c"*f32\00" @@ -129,7 +129,7 @@ @tn.str.229 = private constant [6 x i8] c"*bool\00" @tn.str.230 = private constant [6 x i8] c"**f32\00" @tn.str.231 = private constant [10 x i8] c"*Lerpable\00" -@tn.str.232 = private constant [8 x i8] c"*[4]s64\00" +@tn.str.232 = private constant [8 x i8] c"*[4]i64\00" @tn.str.233 = private constant [5 x i8] c"*f64\00" @tn.str.234 = private constant [17 x i8] c"*Source_Location\00" @tn.str.235 = private constant [11 x i8] c"*Allocator\00" @@ -147,9 +147,9 @@ @tn.str.247 = private constant [17 x i8] c"*OperatingSystem\00" @tn.str.248 = private constant [14 x i8] c"*Architecture\00" @tn.str.249 = private constant [15 x i8] c"*[16]FlagValue\00" -@tn.str.250 = private constant [8 x i8] c"*[8]s64\00" +@tn.str.250 = private constant [8 x i8] c"*[8]i64\00" @tn.str.251 = private constant [8 x i8] c"*[64]u8\00" -@tn.str.252 = private constant [9 x i8] c"*[64]s64\00" +@tn.str.252 = private constant [9 x i8] c"*[64]i64\00" @tn.str.253 = private constant [10 x i8] c"*[]string\00" @tn.str.254 = private constant [6 x i8] c"*[]u8\00" @tn.str.255 = private constant [12 x i8] c"*[]FlagSpec\00" @@ -162,7 +162,7 @@ @tn.str.262 = private constant [20 x i8] c"**TrackingAllocator\00" @tn.str.263 = private constant [7 x i8] c"**File\00" @tn.str.264 = private constant [5 x i8] c"**u8\00" -@tn.str.265 = private constant [6 x i8] c"**s32\00" +@tn.str.265 = private constant [6 x i8] c"**i32\00" @tn.str.266 = private constant [11 x i8] c"**SockAddr\00" @tn.str.267 = private constant [6 x i8] c"**u32\00" @tn.str.268 = private constant [10 x i8] c"*[*]Value\00" @@ -171,7 +171,7 @@ @tn.str.271 = private constant [9 x i8] c"**Object\00" @tn.str.272 = private constant [7 x i8] c"**Sink\00" @tn.str.273 = private constant [9 x i8] c"**Parser\00" -@tn.str.274 = private constant [6 x i8] c"**s64\00" +@tn.str.274 = private constant [6 x i8] c"**i64\00" @tn.str.275 = private constant [9 x i8] c"**Parsed\00" @tn.str.276 = private constant [7 x i8] c"**Diag\00" @tn.str.277 = private constant [9 x i8] c"**Sha256\00" @@ -553,7 +553,7 @@ @str.650 = private unnamed_addr constant [4 x i8] c"*u8\00", align 1 @str.651 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.652 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.653 = private unnamed_addr constant [5 x i8] c"*s32\00", align 1 +@str.653 = private unnamed_addr constant [5 x i8] c"*i32\00", align 1 @str.654 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.655 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.656 = private unnamed_addr constant [10 x i8] c"*SockAddr\00", align 1 @@ -580,7 +580,7 @@ @str.677 = private unnamed_addr constant [8 x i8] c"*Parser\00", align 1 @str.678 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.679 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.680 = private unnamed_addr constant [5 x i8] c"*s64\00", align 1 +@str.680 = private unnamed_addr constant [5 x i8] c"*i64\00", align 1 @str.681 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.682 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.683 = private unnamed_addr constant [8 x i8] c"*Parsed\00", align 1 @@ -2039,7 +2039,7 @@ dispatch.case.271: ; preds = %match.arm.47 %ua.raw178 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr179 = inttoptr i64 %ua.raw178 to ptr %ua.load180 = load [4 x i64], ptr %ua.ptr179, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %ua.load180) + %callN = call { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %ua.load180) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.269 @@ -2055,7 +2055,7 @@ dispatch.case.273: ; preds = %match.arm.47 %ua.raw186 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr187 = inttoptr i64 %ua.raw186 to ptr %ua.load188 = load [8 x i64], ptr %ua.ptr187, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %ua.load188) + %callN = call { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %ua.load188) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.269 @@ -2071,7 +2071,7 @@ dispatch.case.275: ; preds = %match.arm.47 %ua.raw194 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr195 = inttoptr i64 %ua.raw194 to ptr %ua.load196 = load [64 x i64], ptr %ua.ptr195, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %ua.load196) + %callN = call { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %ua.load196) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.269 @@ -2214,7 +2214,7 @@ dispatch.case.350: ; preds = %match.arm.49 dispatch.case.351: ; preds = %match.arm.49 %ua.raw253 = extractvalue { i64, i64 } %loadN, 1 %iNp254 = inttoptr i64 %ua.raw253 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %iNp254) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %iNp254) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.339 @@ -2277,7 +2277,7 @@ dispatch.case.359: ; preds = %match.arm.49 dispatch.case.360: ; preds = %match.arm.49 %ua.raw280 = extractvalue { i64, i64 } %loadN, 1 %iNp281 = inttoptr i64 %ua.raw280 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %iNp281) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %iNp281) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.339 @@ -3825,14 +3825,14 @@ fv.case: ; preds = %if.merge.131 fv.case17: ; preds = %if.merge.131 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.131 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.131 @@ -4528,8 +4528,8 @@ fv.default: ; preds = %if.merge.176 fv.case: ; preds = %if.merge.176 %fv.field = extractvalue { i32 } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge } @@ -4612,14 +4612,14 @@ fv.case: ; preds = %if.merge.181 fv.case17: ; preds = %if.merge.181 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.181 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.181 @@ -4704,8 +4704,8 @@ fv.default: ; preds = %if.merge.186 fv.case: ; preds = %if.merge.186 %fv.field = extractvalue { i32, { ptr, i64 } } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case17: ; preds = %if.merge.186 @@ -6106,7 +6106,7 @@ if.merge.268: ; preds = %if.then.267, %entry } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %1) #0 { entry: %alloca = alloca [4 x i64], align 8 %ig.tmp = alloca [4 x i64], align 8 @@ -6209,7 +6209,7 @@ if.merge.286: ; preds = %if.then.285, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %1) #0 { entry: %alloca = alloca [8 x i64], align 8 %ig.tmp = alloca [8 x i64], align 8 @@ -6310,7 +6310,7 @@ if.merge.296: ; preds = %if.then.295, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %1) #0 { entry: %alloca = alloca [64 x i64], align 8 %ig.tmp = alloca [64 x i64], align 8 @@ -6960,7 +6960,7 @@ if.merge.416: ; preds = %if.else.415, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 @@ -7210,7 +7210,7 @@ if.merge.443: ; preds = %if.else.442, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 diff --git a/examples/expected/0410-protocols-impl-visibility.stderr b/examples/expected/0410-protocols-impl-visibility.stderr index dc81e6e..8725f7e 100644 --- a/examples/expected/0410-protocols-impl-visibility.stderr +++ b/examples/expected/0410-protocols-impl-visibility.stderr @@ -1,5 +1,5 @@ -error: no visible xx conversion from 's64' to 'Wrap' — impl exists in another module but is not imported - --> /Users/agra/projects/sx/examples/./0410-protocols-impl-visibility-user.sx:7:17 +error: no visible xx conversion from 'i64' to 'Wrap' — impl exists in another module but is not imported + --> examples/./0410-protocols-impl-visibility-user.sx:7:17 | 7 | w : Wrap = xx 7; | ^ diff --git a/examples/expected/0411-protocols-impl-duplicate.stderr b/examples/expected/0411-protocols-impl-duplicate.stderr index 3c92113..97ab393 100644 --- a/examples/expected/0411-protocols-impl-duplicate.stderr +++ b/examples/expected/0411-protocols-impl-duplicate.stderr @@ -1,5 +1,5 @@ -error: duplicate xx conversion from 's64' to 'Wrap': impls in /Users/agra/projects/sx/examples/./0411-protocols-impl-duplicate-impl-a.sx and /Users/agra/projects/sx/examples/./0411-protocols-impl-duplicate-impl-b.sx - --> /Users/agra/projects/sx/examples/0411-protocols-impl-duplicate.sx:23:17 +error: duplicate xx conversion from 'i64' to 'Wrap': impls in examples/./0411-protocols-impl-duplicate-impl-a.sx and examples/./0411-protocols-impl-duplicate-impl-b.sx + --> examples/0411-protocols-impl-duplicate.sx:23:17 | 23 | w : Wrap = xx 7; | ^ diff --git a/examples/expected/0412-protocols-impl-duplicate-same-file.stderr b/examples/expected/0412-protocols-impl-duplicate-same-file.stderr index 085e6b2..6b11505 100644 --- a/examples/expected/0412-protocols-impl-duplicate-same-file.stderr +++ b/examples/expected/0412-protocols-impl-duplicate-same-file.stderr @@ -1,9 +1,9 @@ -error: duplicate impl 'Into' for source 's64' in /Users/agra/projects/sx/examples/0412-protocols-impl-duplicate-same-file.sx - --> /Users/agra/projects/sx/examples/0412-protocols-impl-duplicate-same-file.sx:15:1 +error: duplicate impl 'Into' for source 'i64' in examples/0412-protocols-impl-duplicate-same-file.sx + --> examples/0412-protocols-impl-duplicate-same-file.sx:15:1 | -15 | impl Into(MyA) for s64 { +15 | impl Into(MyA) for i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^ -16 | convert :: (self: s64) -> MyA { .{ v = self * 2 } } +16 | convert :: (self: i64) -> MyA { .{ v = self * 2 } } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 17 | } | ^ diff --git a/examples/expected/0413-protocols-parameterized-protocol-value.ir b/examples/expected/0413-protocols-parameterized-protocol-value.ir index bc66bca..f9ca716 100644 --- a/examples/expected/0413-protocols-parameterized-protocol-value.ir +++ b/examples/expected/0413-protocols-parameterized-protocol-value.ir @@ -1,6 +1,6 @@ @__sx_default_context = internal constant { { ptr, ptr, ptr }, ptr } { { ptr, ptr, ptr } { ptr null, ptr @__thunk_CAllocator_Allocator_alloc_bytes, ptr @__thunk_CAllocator_Allocator_dealloc_bytes }, ptr null } -@__VL__s64__IntCell__vtable = internal constant { ptr } { ptr @__thunk_IntCell_VL__s64_get } +@__VL__i64__IntCell__vtable = internal constant { ptr } { ptr @__thunk_IntCell_VL__i64_get } @__VL__string__StrCell__vtable = internal constant { ptr } { ptr @__thunk_StrCell_VL__string_get } @str = private unnamed_addr constant [2 x i8] c"0\00", align 1 @str.108 = private unnamed_addr constant [2 x i8] c"0\00", align 1 @@ -27,10 +27,10 @@ @tag_names = private constant [14 x { ptr, i64 }] [{ ptr, i64 } { ptr @tag.str, i64 0 }, { ptr, i64 } { ptr @tag.str.114, i64 8 }, { ptr, i64 } { ptr @tag.str.115, i64 2 }, { ptr, i64 } { ptr @tag.str.116, i64 15 }, { ptr, i64 } { ptr @tag.str.117, i64 13 }, { ptr, i64 } { ptr @tag.str.118, i64 9 }, { ptr, i64 } { ptr @tag.str.119, i64 9 }, { ptr, i64 } { ptr @tag.str.120, i64 15 }, { ptr, i64 } { ptr @tag.str.121, i64 14 }, { ptr, i64 } { ptr @tag.str.122, i64 14 }, { ptr, i64 } { ptr @tag.str.123, i64 11 }, { ptr, i64 } { ptr @tag.str.124, i64 12 }, { ptr, i64 } { ptr @tag.str.125, i64 15 }, { ptr, i64 } { ptr @tag.str.126, i64 12 }] @tn.str = private constant [13 x i8] c"\00" @tn.str.127 = private constant [5 x i8] c"bool\00" -@tn.str.128 = private constant [3 x i8] c"s8\00" -@tn.str.129 = private constant [4 x i8] c"s16\00" -@tn.str.130 = private constant [4 x i8] c"s32\00" -@tn.str.131 = private constant [4 x i8] c"s64\00" +@tn.str.128 = private constant [3 x i8] c"i8\00" +@tn.str.129 = private constant [4 x i8] c"i16\00" +@tn.str.130 = private constant [4 x i8] c"i32\00" +@tn.str.131 = private constant [4 x i8] c"i64\00" @tn.str.132 = private constant [3 x i8] c"u8\00" @tn.str.133 = private constant [4 x i8] c"u16\00" @tn.str.134 = private constant [4 x i8] c"u32\00" @@ -47,7 +47,7 @@ @tn.str.145 = private constant [16 x i8] c"Source_Location\00" @tn.str.146 = private constant [10 x i8] c"Allocator\00" @tn.str.147 = private constant [8 x i8] c"Context\00" -@tn.str.148 = private constant [7 x i8] c"[4]s64\00" +@tn.str.148 = private constant [7 x i8] c"[4]i64\00" @tn.str.149 = private constant [9 x i8] c"[]string\00" @tn.str.150 = private constant [11 x i8] c"CAllocator\00" @tn.str.151 = private constant [12 x i8] c"*CAllocator\00" @@ -72,7 +72,7 @@ @tn.str.170 = private constant [4 x i8] c"*u8\00" @tn.str.171 = private constant [14 x i8] c"ProcessResult\00" @tn.str.172 = private constant [15 x i8] c"?ProcessResult\00" -@tn.str.173 = private constant [5 x i8] c"*s32\00" +@tn.str.173 = private constant [5 x i8] c"*i32\00" @tn.str.174 = private constant [9 x i8] c"SockAddr\00" @tn.str.175 = private constant [10 x i8] c"*SockAddr\00" @tn.str.176 = private constant [5 x i8] c"*u32\00" @@ -88,9 +88,9 @@ @tn.str.186 = private constant [5 x i8] c"[]u8\00" @tn.str.187 = private constant [5 x i8] c"Sink\00" @tn.str.188 = private constant [6 x i8] c"*Sink\00" -@tn.str.189 = private constant [17 x i8] c"(s64, JsonError)\00" +@tn.str.189 = private constant [17 x i8] c"(i64, JsonError)\00" @tn.str.190 = private constant [15 x i8] c"JsonParseError\00" -@tn.str.191 = private constant [22 x i8] c"(s64, JsonParseError)\00" +@tn.str.191 = private constant [22 x i8] c"(i64, JsonParseError)\00" @tn.str.192 = private constant [7 x i8] c"Parser\00" @tn.str.193 = private constant [8 x i8] c"*Parser\00" @tn.str.194 = private constant [25 x i8] c"(string, JsonParseError)\00" @@ -99,7 +99,7 @@ @tn.str.197 = private constant [13 x i8] c"Architecture\00" @tn.str.198 = private constant [13 x i8] c"BuildOptions\00" @tn.str.199 = private constant [11 x i8] c"() -> bool\00" -@tn.str.200 = private constant [5 x i8] c"*s64\00" +@tn.str.200 = private constant [5 x i8] c"*i64\00" @tn.str.201 = private constant [9 x i8] c"CliError\00" @tn.str.202 = private constant [9 x i8] c"FlagSpec\00" @tn.str.203 = private constant [11 x i8] c"[]FlagSpec\00" @@ -112,23 +112,23 @@ @tn.str.210 = private constant [19 x i8] c"(Parsed, CliError)\00" @tn.str.211 = private constant [10 x i8] c"[]Command\00" @tn.str.212 = private constant [6 x i8] c"*Diag\00" -@tn.str.213 = private constant [7 x i8] c"[8]s64\00" +@tn.str.213 = private constant [7 x i8] c"[8]i64\00" @tn.str.214 = private constant [7 x i8] c"[64]u8\00" @tn.str.215 = private constant [7 x i8] c"Sha256\00" @tn.str.216 = private constant [8 x i8] c"*Sha256\00" @tn.str.217 = private constant [8 x i8] c"?[64]u8\00" -@tn.str.218 = private constant [8 x i8] c"[64]s64\00" +@tn.str.218 = private constant [8 x i8] c"[64]i64\00" @tn.str.219 = private constant [8 x i8] c"IntCell\00" @tn.str.220 = private constant [8 x i8] c"StrCell\00" @tn.str.221 = private constant [9 x i8] c"*IntCell\00" @tn.str.222 = private constant [9 x i8] c"*StrCell\00" @tn.str.223 = private constant [13 x i8] c"**CAllocator\00" @tn.str.224 = private constant [7 x i8] c"**void\00" -@tn.str.225 = private constant [8 x i8] c"VL__s64\00" -@tn.str.226 = private constant [18 x i8] c"__VL__s64__Vtable\00" -@tn.str.227 = private constant [9 x i8] c"*VL__s64\00" +@tn.str.225 = private constant [8 x i8] c"VL__i64\00" +@tn.str.226 = private constant [18 x i8] c"__VL__i64__Vtable\00" +@tn.str.227 = private constant [9 x i8] c"*VL__i64\00" @tn.str.228 = private constant [10 x i8] c"**IntCell\00" -@tn.str.229 = private constant [19 x i8] c"*__VL__s64__Vtable\00" +@tn.str.229 = private constant [19 x i8] c"*__VL__i64__Vtable\00" @tn.str.230 = private constant [8 x i8] c"*string\00" @tn.str.231 = private constant [6 x i8] c"[]Any\00" @tn.str.232 = private constant [5 x i8] c"*Any\00" @@ -141,7 +141,7 @@ @tn.str.239 = private constant [12 x i8] c"*VL__string\00" @tn.str.240 = private constant [10 x i8] c"**StrCell\00" @tn.str.241 = private constant [22 x i8] c"*__VL__string__Vtable\00" -@tn.str.242 = private constant [8 x i8] c"*[4]s64\00" +@tn.str.242 = private constant [8 x i8] c"*[4]i64\00" @tn.str.243 = private constant [5 x i8] c"*f64\00" @tn.str.244 = private constant [17 x i8] c"*Source_Location\00" @tn.str.245 = private constant [11 x i8] c"*Allocator\00" @@ -159,9 +159,9 @@ @tn.str.257 = private constant [17 x i8] c"*OperatingSystem\00" @tn.str.258 = private constant [14 x i8] c"*Architecture\00" @tn.str.259 = private constant [15 x i8] c"*[16]FlagValue\00" -@tn.str.260 = private constant [8 x i8] c"*[8]s64\00" +@tn.str.260 = private constant [8 x i8] c"*[8]i64\00" @tn.str.261 = private constant [8 x i8] c"*[64]u8\00" -@tn.str.262 = private constant [9 x i8] c"*[64]s64\00" +@tn.str.262 = private constant [9 x i8] c"*[64]i64\00" @tn.str.263 = private constant [10 x i8] c"*[]string\00" @tn.str.264 = private constant [6 x i8] c"*[]u8\00" @tn.str.265 = private constant [12 x i8] c"*[]FlagSpec\00" @@ -174,7 +174,7 @@ @tn.str.272 = private constant [20 x i8] c"**TrackingAllocator\00" @tn.str.273 = private constant [7 x i8] c"**File\00" @tn.str.274 = private constant [5 x i8] c"**u8\00" -@tn.str.275 = private constant [6 x i8] c"**s32\00" +@tn.str.275 = private constant [6 x i8] c"**i32\00" @tn.str.276 = private constant [11 x i8] c"**SockAddr\00" @tn.str.277 = private constant [6 x i8] c"**u32\00" @tn.str.278 = private constant [10 x i8] c"*[*]Value\00" @@ -183,15 +183,15 @@ @tn.str.281 = private constant [9 x i8] c"**Object\00" @tn.str.282 = private constant [7 x i8] c"**Sink\00" @tn.str.283 = private constant [9 x i8] c"**Parser\00" -@tn.str.284 = private constant [6 x i8] c"**s64\00" +@tn.str.284 = private constant [6 x i8] c"**i64\00" @tn.str.285 = private constant [9 x i8] c"**Parsed\00" @tn.str.286 = private constant [7 x i8] c"**Diag\00" @tn.str.287 = private constant [9 x i8] c"**Sha256\00" @tn.str.288 = private constant [14 x i8] c"***CAllocator\00" @tn.str.289 = private constant [8 x i8] c"***void\00" -@tn.str.290 = private constant [10 x i8] c"**VL__s64\00" +@tn.str.290 = private constant [10 x i8] c"**VL__i64\00" @tn.str.291 = private constant [11 x i8] c"***IntCell\00" -@tn.str.292 = private constant [20 x i8] c"**__VL__s64__Vtable\00" +@tn.str.292 = private constant [20 x i8] c"**__VL__i64__Vtable\00" @tn.str.293 = private constant [9 x i8] c"**string\00" @tn.str.294 = private constant [6 x i8] c"**Any\00" @tn.str.295 = private constant [9 x i8] c"**[1]Any\00" @@ -467,7 +467,7 @@ @fld.str.562 = private constant [2 x i8] c"s\00" @field_names.563 = private constant [1 x { ptr, i64 }] [{ ptr, i64 } { ptr @fld.str.562, i64 1 }] @str.564 = private unnamed_addr constant [3 x i8] c": \00", align 1 -@str.565 = private unnamed_addr constant [8 x i8] c"VL__s64\00", align 1 +@str.565 = private unnamed_addr constant [8 x i8] c"VL__i64\00", align 1 @str.566 = private unnamed_addr constant [2 x i8] c"{\00", align 1 @str.567 = private unnamed_addr constant [2 x i8] c"}\00", align 1 @str.568 = private unnamed_addr constant [3 x i8] c", \00", align 1 @@ -475,7 +475,7 @@ @fld.str.570 = private constant [9 x i8] c"__vtable\00" @field_names.571 = private constant [2 x { ptr, i64 }] [{ ptr, i64 } { ptr @fld.str.569, i64 3 }, { ptr, i64 } { ptr @fld.str.570, i64 8 }] @str.572 = private unnamed_addr constant [3 x i8] c": \00", align 1 -@str.573 = private unnamed_addr constant [18 x i8] c"__VL__s64__Vtable\00", align 1 +@str.573 = private unnamed_addr constant [18 x i8] c"__VL__i64__Vtable\00", align 1 @str.574 = private unnamed_addr constant [2 x i8] c"{\00", align 1 @str.575 = private unnamed_addr constant [2 x i8] c"}\00", align 1 @str.576 = private unnamed_addr constant [3 x i8] c", \00", align 1 @@ -606,7 +606,7 @@ @str.701 = private unnamed_addr constant [4 x i8] c"*u8\00", align 1 @str.702 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.703 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.704 = private unnamed_addr constant [5 x i8] c"*s32\00", align 1 +@str.704 = private unnamed_addr constant [5 x i8] c"*i32\00", align 1 @str.705 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.706 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.707 = private unnamed_addr constant [10 x i8] c"*SockAddr\00", align 1 @@ -633,7 +633,7 @@ @str.728 = private unnamed_addr constant [8 x i8] c"*Parser\00", align 1 @str.729 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.730 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.731 = private unnamed_addr constant [5 x i8] c"*s64\00", align 1 +@str.731 = private unnamed_addr constant [5 x i8] c"*i64\00", align 1 @str.732 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.733 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.734 = private unnamed_addr constant [8 x i8] c"*Parsed\00", align 1 @@ -657,13 +657,13 @@ @str.752 = private unnamed_addr constant [7 x i8] c"**void\00", align 1 @str.753 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.754 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.755 = private unnamed_addr constant [9 x i8] c"*VL__s64\00", align 1 +@str.755 = private unnamed_addr constant [9 x i8] c"*VL__i64\00", align 1 @str.756 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.757 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.758 = private unnamed_addr constant [10 x i8] c"**IntCell\00", align 1 @str.759 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.760 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.761 = private unnamed_addr constant [19 x i8] c"*__VL__s64__Vtable\00", align 1 +@str.761 = private unnamed_addr constant [19 x i8] c"*__VL__i64__Vtable\00", align 1 @str.762 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.763 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.764 = private unnamed_addr constant [8 x i8] c"*string\00", align 1 @@ -2019,7 +2019,7 @@ dispatch.case.123: ; preds = %match.arm.43 %ua.raw168 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr169 = inttoptr i64 %ua.raw168 to ptr %ua.load170 = load { ptr, ptr }, ptr %ua.ptr169, align 8 - %callN = call { ptr, i64 } @struct_to_string__VL__s64(ptr %0, { ptr, ptr } %ua.load170) + %callN = call { ptr, i64 } @struct_to_string__VL__i64(ptr %0, { ptr, ptr } %ua.load170) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.94 @@ -2027,7 +2027,7 @@ dispatch.case.124: ; preds = %match.arm.43 %ua.raw172 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr173 = inttoptr i64 %ua.raw172 to ptr %ua.load174 = load { ptr }, ptr %ua.ptr173, align 8 - %callN = call { ptr, i64 } @struct_to_string____VL__s64__Vtable(ptr %0, { ptr } %ua.load174) + %callN = call { ptr, i64 } @struct_to_string____VL__i64__Vtable(ptr %0, { ptr } %ua.load174) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.94 @@ -2101,7 +2101,7 @@ dispatch.case.301: ; preds = %match.arm.47 %ua.raw198 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr199 = inttoptr i64 %ua.raw198 to ptr %ua.load200 = load [4 x i64], ptr %ua.ptr199, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %ua.load200) + %callN = call { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %ua.load200) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.299 @@ -2117,7 +2117,7 @@ dispatch.case.303: ; preds = %match.arm.47 %ua.raw206 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr207 = inttoptr i64 %ua.raw206 to ptr %ua.load208 = load [8 x i64], ptr %ua.ptr207, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %ua.load208) + %callN = call { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %ua.load208) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.299 @@ -2133,7 +2133,7 @@ dispatch.case.305: ; preds = %match.arm.47 %ua.raw214 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr215 = inttoptr i64 %ua.raw214 to ptr %ua.load216 = load [64 x i64], ptr %ua.ptr215, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %ua.load216) + %callN = call { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %ua.load216) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.299 @@ -2276,7 +2276,7 @@ dispatch.case.380: ; preds = %match.arm.49 dispatch.case.381: ; preds = %match.arm.49 %ua.raw273 = extractvalue { i64, i64 } %loadN, 1 %iNp274 = inttoptr i64 %ua.raw273 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %iNp274) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %iNp274) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.369 @@ -2339,7 +2339,7 @@ dispatch.case.389: ; preds = %match.arm.49 dispatch.case.390: ; preds = %match.arm.49 %ua.raw300 = extractvalue { i64, i64 } %loadN, 1 %iNp301 = inttoptr i64 %ua.raw300 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %iNp301) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %iNp301) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.369 @@ -2395,7 +2395,7 @@ dispatch.case.397: ; preds = %match.arm.49 dispatch.case.398: ; preds = %match.arm.49 %ua.raw324 = extractvalue { i64, i64 } %loadN, 1 %iNp325 = inttoptr i64 %ua.raw324 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_VL__s64(ptr %0, ptr %iNp325) + %callN = call { ptr, i64 } @pointer_to_string__ptr_VL__i64(ptr %0, ptr %iNp325) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.369 @@ -2409,7 +2409,7 @@ dispatch.case.399: ; preds = %match.arm.49 dispatch.case.400: ; preds = %match.arm.49 %ua.raw330 = extractvalue { i64, i64 } %loadN, 1 %iNp331 = inttoptr i64 %ua.raw330 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr___VL__s64__Vtable(ptr %0, ptr %iNp331) + %callN = call { ptr, i64 } @pointer_to_string__ptr___VL__i64__Vtable(ptr %0, ptr %iNp331) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.369 @@ -3670,7 +3670,7 @@ entry: %icall = call ptr %sgN(ptr @__sx_default_context, ptr %sgN, i64 8) %call = call ptr @memcpy(ptr %icall, ptr %allocaN, i64 8) %si = insertvalue { ptr, ptr } undef, ptr %icall, 0 - %siN = insertvalue { ptr, ptr } %si, ptr @__VL__s64__IntCell__vtable, 1 + %siN = insertvalue { ptr, ptr } %si, ptr @__VL__i64__IntCell__vtable, 1 store { ptr, ptr } %siN, ptr %alloca, align 8 %loadN = load { ptr, ptr }, ptr %alloca, align 8 %sgN = extractvalue { ptr, ptr } %loadN, 0 @@ -3678,7 +3678,7 @@ entry: %deref = load { ptr }, ptr %sgN, align 8 %sgN = extractvalue { ptr } %deref, 0 %icallN = call i64 %sgN(ptr @__sx_default_context, ptr %sgN) - call void @print__ct_seb9f5db11fd9fc4e__pack_s64(ptr @__sx_default_context, i64 %icallN) + call void @print__ct_seb9f5db11fd9fc4e__pack_i64(ptr @__sx_default_context, i64 %icallN) %allocaN = alloca { ptr, ptr }, align 8 %allocaN = alloca { { ptr, i64 } }, align 8 store { { ptr, i64 } } { { ptr, i64 } { ptr @str.326, i64 2 } }, ptr %allocaN, align 8 @@ -3716,14 +3716,14 @@ entry: } ; Function Attrs: nounwind -define internal i64 @__thunk_IntCell_VL__s64_get(ptr %0, ptr %1) #0 { +define internal i64 @__thunk_IntCell_VL__i64_get(ptr %0, ptr %1) #0 { entry: %call = call i64 @IntCell.get(ptr %0, ptr %1) ret i64 %call } ; Function Attrs: nounwind -define internal void @print__ct_seb9f5db11fd9fc4e__pack_s64(ptr %0, i64 %1) #0 { +define internal void @print__ct_seb9f5db11fd9fc4e__pack_i64(ptr %0, i64 %1) #0 { entry: %alloca = alloca { ptr, i64 }, align 8 store { ptr, i64 } { ptr @str.327, i64 9 }, ptr %alloca, align 8 @@ -3912,14 +3912,14 @@ fv.case: ; preds = %if.merge.131 fv.case17: ; preds = %if.merge.131 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.131 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.131 @@ -4615,8 +4615,8 @@ fv.default: ; preds = %if.merge.176 fv.case: ; preds = %if.merge.176 %fv.field = extractvalue { i32 } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge } @@ -4699,14 +4699,14 @@ fv.case: ; preds = %if.merge.181 fv.case17: ; preds = %if.merge.181 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.181 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.181 @@ -4791,8 +4791,8 @@ fv.default: ; preds = %if.merge.186 fv.case: ; preds = %if.merge.186 %fv.field = extractvalue { i32, { ptr, i64 } } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case17: ; preds = %if.merge.186 @@ -6061,7 +6061,7 @@ fv.case: ; preds = %if.merge.261 } ; Function Attrs: nounwind -define internal { ptr, i64 } @struct_to_string__VL__s64(ptr %0, { ptr, ptr } %1) #0 { +define internal { ptr, i64 } @struct_to_string__VL__i64(ptr %0, { ptr, ptr } %1) #0 { entry: %alloca = alloca { ptr, ptr }, align 8 store { ptr, ptr } %1, ptr %alloca, align 8 @@ -6138,7 +6138,7 @@ fv.case17: ; preds = %if.merge.266 } ; Function Attrs: nounwind -define internal { ptr, i64 } @struct_to_string____VL__s64__Vtable(ptr %0, { ptr } %1) #0 { +define internal { ptr, i64 } @struct_to_string____VL__i64__Vtable(ptr %0, { ptr } %1) #0 { entry: %alloca = alloca { ptr }, align 8 store { ptr } %1, ptr %alloca, align 8 @@ -6628,7 +6628,7 @@ if.merge.298: ; preds = %if.then.297, %entry } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %1) #0 { entry: %alloca = alloca [4 x i64], align 8 %ig.tmp = alloca [4 x i64], align 8 @@ -6731,7 +6731,7 @@ if.merge.316: ; preds = %if.then.315, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %1) #0 { entry: %alloca = alloca [8 x i64], align 8 %ig.tmp = alloca [8 x i64], align 8 @@ -6832,7 +6832,7 @@ if.merge.326: ; preds = %if.then.325, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %1) #0 { entry: %alloca = alloca [64 x i64], align 8 %ig.tmp = alloca [64 x i64], align 8 @@ -7482,7 +7482,7 @@ if.merge.451: ; preds = %if.else.450, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 @@ -7732,7 +7732,7 @@ if.merge.478: ; preds = %if.else.477, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 @@ -7956,7 +7956,7 @@ if.merge.502: ; preds = %if.else.501, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_VL__s64(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_VL__i64(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 @@ -8012,7 +8012,7 @@ if.merge.508: ; preds = %if.else.507, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr___VL__s64__Vtable(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr___VL__i64__Vtable(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 diff --git a/examples/expected/0414-protocols-generic-struct-protocol-erase.ir b/examples/expected/0414-protocols-generic-struct-protocol-erase.ir index 5f68c46..7792791 100644 --- a/examples/expected/0414-protocols-generic-struct-protocol-erase.ir +++ b/examples/expected/0414-protocols-generic-struct-protocol-erase.ir @@ -1,7 +1,7 @@ @__sx_default_context = internal constant { { ptr, ptr, ptr }, ptr } { { ptr, ptr, ptr } { ptr null, ptr @__thunk_CAllocator_Allocator_alloc_bytes, ptr @__thunk_CAllocator_Allocator_dealloc_bytes }, ptr null } -@__VL__s64__IntCell__vtable = internal constant { ptr } { ptr @__thunk_IntCell_VL__s64_get } -@__VL__s64__Combined__s64__s64__vtable = internal constant { ptr } { ptr @__thunk_Combined__s64__s64_VL__s64_get } +@__VL__i64__IntCell__vtable = internal constant { ptr } { ptr @__thunk_IntCell_VL__i64_get } +@__VL__i64__Combined__i64__i64__vtable = internal constant { ptr } { ptr @__thunk_Combined__i64__i64_VL__i64_get } @str = private unnamed_addr constant [2 x i8] c"0\00", align 1 @str.108 = private unnamed_addr constant [2 x i8] c"0\00", align 1 @str.109 = private unnamed_addr constant [5 x i8] c"true\00", align 1 @@ -27,10 +27,10 @@ @tag_names = private constant [14 x { ptr, i64 }] [{ ptr, i64 } { ptr @tag.str, i64 0 }, { ptr, i64 } { ptr @tag.str.114, i64 8 }, { ptr, i64 } { ptr @tag.str.115, i64 2 }, { ptr, i64 } { ptr @tag.str.116, i64 15 }, { ptr, i64 } { ptr @tag.str.117, i64 13 }, { ptr, i64 } { ptr @tag.str.118, i64 9 }, { ptr, i64 } { ptr @tag.str.119, i64 9 }, { ptr, i64 } { ptr @tag.str.120, i64 15 }, { ptr, i64 } { ptr @tag.str.121, i64 14 }, { ptr, i64 } { ptr @tag.str.122, i64 14 }, { ptr, i64 } { ptr @tag.str.123, i64 11 }, { ptr, i64 } { ptr @tag.str.124, i64 12 }, { ptr, i64 } { ptr @tag.str.125, i64 15 }, { ptr, i64 } { ptr @tag.str.126, i64 12 }] @tn.str = private constant [13 x i8] c"\00" @tn.str.127 = private constant [5 x i8] c"bool\00" -@tn.str.128 = private constant [3 x i8] c"s8\00" -@tn.str.129 = private constant [4 x i8] c"s16\00" -@tn.str.130 = private constant [4 x i8] c"s32\00" -@tn.str.131 = private constant [4 x i8] c"s64\00" +@tn.str.128 = private constant [3 x i8] c"i8\00" +@tn.str.129 = private constant [4 x i8] c"i16\00" +@tn.str.130 = private constant [4 x i8] c"i32\00" +@tn.str.131 = private constant [4 x i8] c"i64\00" @tn.str.132 = private constant [3 x i8] c"u8\00" @tn.str.133 = private constant [4 x i8] c"u16\00" @tn.str.134 = private constant [4 x i8] c"u32\00" @@ -47,7 +47,7 @@ @tn.str.145 = private constant [16 x i8] c"Source_Location\00" @tn.str.146 = private constant [10 x i8] c"Allocator\00" @tn.str.147 = private constant [8 x i8] c"Context\00" -@tn.str.148 = private constant [7 x i8] c"[4]s64\00" +@tn.str.148 = private constant [7 x i8] c"[4]i64\00" @tn.str.149 = private constant [9 x i8] c"[]string\00" @tn.str.150 = private constant [11 x i8] c"CAllocator\00" @tn.str.151 = private constant [12 x i8] c"*CAllocator\00" @@ -72,7 +72,7 @@ @tn.str.170 = private constant [4 x i8] c"*u8\00" @tn.str.171 = private constant [14 x i8] c"ProcessResult\00" @tn.str.172 = private constant [15 x i8] c"?ProcessResult\00" -@tn.str.173 = private constant [5 x i8] c"*s32\00" +@tn.str.173 = private constant [5 x i8] c"*i32\00" @tn.str.174 = private constant [9 x i8] c"SockAddr\00" @tn.str.175 = private constant [10 x i8] c"*SockAddr\00" @tn.str.176 = private constant [5 x i8] c"*u32\00" @@ -88,9 +88,9 @@ @tn.str.186 = private constant [5 x i8] c"[]u8\00" @tn.str.187 = private constant [5 x i8] c"Sink\00" @tn.str.188 = private constant [6 x i8] c"*Sink\00" -@tn.str.189 = private constant [17 x i8] c"(s64, JsonError)\00" +@tn.str.189 = private constant [17 x i8] c"(i64, JsonError)\00" @tn.str.190 = private constant [15 x i8] c"JsonParseError\00" -@tn.str.191 = private constant [22 x i8] c"(s64, JsonParseError)\00" +@tn.str.191 = private constant [22 x i8] c"(i64, JsonParseError)\00" @tn.str.192 = private constant [7 x i8] c"Parser\00" @tn.str.193 = private constant [8 x i8] c"*Parser\00" @tn.str.194 = private constant [25 x i8] c"(string, JsonParseError)\00" @@ -99,7 +99,7 @@ @tn.str.197 = private constant [13 x i8] c"Architecture\00" @tn.str.198 = private constant [13 x i8] c"BuildOptions\00" @tn.str.199 = private constant [11 x i8] c"() -> bool\00" -@tn.str.200 = private constant [5 x i8] c"*s64\00" +@tn.str.200 = private constant [5 x i8] c"*i64\00" @tn.str.201 = private constant [9 x i8] c"CliError\00" @tn.str.202 = private constant [9 x i8] c"FlagSpec\00" @tn.str.203 = private constant [11 x i8] c"[]FlagSpec\00" @@ -112,18 +112,18 @@ @tn.str.210 = private constant [19 x i8] c"(Parsed, CliError)\00" @tn.str.211 = private constant [10 x i8] c"[]Command\00" @tn.str.212 = private constant [6 x i8] c"*Diag\00" -@tn.str.213 = private constant [7 x i8] c"[8]s64\00" +@tn.str.213 = private constant [7 x i8] c"[8]i64\00" @tn.str.214 = private constant [7 x i8] c"[64]u8\00" @tn.str.215 = private constant [7 x i8] c"Sha256\00" @tn.str.216 = private constant [8 x i8] c"*Sha256\00" @tn.str.217 = private constant [8 x i8] c"?[64]u8\00" -@tn.str.218 = private constant [8 x i8] c"[64]s64\00" +@tn.str.218 = private constant [8 x i8] c"[64]i64\00" @tn.str.219 = private constant [8 x i8] c"IntCell\00" @tn.str.220 = private constant [9 x i8] c"*IntCell\00" @tn.str.221 = private constant [2 x i8] c"R\00" @tn.str.222 = private constant [9 x i8] c"Combined\00" -@tn.str.223 = private constant [8 x i8] c"VL__s64\00" -@tn.str.224 = private constant [18 x i8] c"__VL__s64__Vtable\00" +@tn.str.223 = private constant [8 x i8] c"VL__i64\00" +@tn.str.224 = private constant [18 x i8] c"__VL__i64__Vtable\00" @tn.str.225 = private constant [3 x i8] c"VL\00" @tn.str.226 = private constant [5 x i8] c"[]VL\00" @tn.str.227 = private constant [13 x i8] c"**CAllocator\00" @@ -133,17 +133,17 @@ @tn.str.231 = private constant [7 x i8] c"[1]Any\00" @tn.str.232 = private constant [8 x i8] c"*[1]Any\00" @tn.str.233 = private constant [7 x i8] c"*[]Any\00" -@tn.str.234 = private constant [10 x i8] c"(VL__s64)\00" -@tn.str.235 = private constant [19 x i8] c"Combined__s64__s64\00" -@tn.str.236 = private constant [20 x i8] c"*Combined__s64__s64\00" +@tn.str.234 = private constant [10 x i8] c"(VL__i64)\00" +@tn.str.235 = private constant [19 x i8] c"Combined__i64__i64\00" +@tn.str.236 = private constant [20 x i8] c"*Combined__i64__i64\00" @tn.str.237 = private constant [10 x i8] c"**IntCell\00" -@tn.str.238 = private constant [19 x i8] c"*__VL__s64__Vtable\00" -@tn.str.239 = private constant [11 x i8] c"*(VL__s64)\00" -@tn.str.240 = private constant [21 x i8] c"**Combined__s64__s64\00" -@tn.str.241 = private constant [9 x i8] c"*VL__s64\00" +@tn.str.238 = private constant [19 x i8] c"*__VL__i64__Vtable\00" +@tn.str.239 = private constant [11 x i8] c"*(VL__i64)\00" +@tn.str.240 = private constant [21 x i8] c"**Combined__i64__i64\00" +@tn.str.241 = private constant [9 x i8] c"*VL__i64\00" @tn.str.242 = private constant [8 x i8] c"*string\00" @tn.str.243 = private constant [6 x i8] c"*bool\00" -@tn.str.244 = private constant [8 x i8] c"*[4]s64\00" +@tn.str.244 = private constant [8 x i8] c"*[4]i64\00" @tn.str.245 = private constant [5 x i8] c"*f64\00" @tn.str.246 = private constant [17 x i8] c"*Source_Location\00" @tn.str.247 = private constant [11 x i8] c"*Allocator\00" @@ -164,9 +164,9 @@ @tn.str.262 = private constant [17 x i8] c"*OperatingSystem\00" @tn.str.263 = private constant [14 x i8] c"*Architecture\00" @tn.str.264 = private constant [15 x i8] c"*[16]FlagValue\00" -@tn.str.265 = private constant [8 x i8] c"*[8]s64\00" +@tn.str.265 = private constant [8 x i8] c"*[8]i64\00" @tn.str.266 = private constant [8 x i8] c"*[64]u8\00" -@tn.str.267 = private constant [9 x i8] c"*[64]s64\00" +@tn.str.267 = private constant [9 x i8] c"*[64]i64\00" @tn.str.268 = private constant [10 x i8] c"*[]string\00" @tn.str.269 = private constant [6 x i8] c"*[]u8\00" @tn.str.270 = private constant [12 x i8] c"*[]FlagSpec\00" @@ -180,7 +180,7 @@ @tn.str.278 = private constant [20 x i8] c"**TrackingAllocator\00" @tn.str.279 = private constant [7 x i8] c"**File\00" @tn.str.280 = private constant [5 x i8] c"**u8\00" -@tn.str.281 = private constant [6 x i8] c"**s32\00" +@tn.str.281 = private constant [6 x i8] c"**i32\00" @tn.str.282 = private constant [11 x i8] c"**SockAddr\00" @tn.str.283 = private constant [6 x i8] c"**u32\00" @tn.str.284 = private constant [10 x i8] c"*[*]Value\00" @@ -189,7 +189,7 @@ @tn.str.287 = private constant [9 x i8] c"**Object\00" @tn.str.288 = private constant [7 x i8] c"**Sink\00" @tn.str.289 = private constant [9 x i8] c"**Parser\00" -@tn.str.290 = private constant [6 x i8] c"**s64\00" +@tn.str.290 = private constant [6 x i8] c"**i64\00" @tn.str.291 = private constant [9 x i8] c"**Parsed\00" @tn.str.292 = private constant [7 x i8] c"**Diag\00" @tn.str.293 = private constant [9 x i8] c"**Sha256\00" @@ -199,10 +199,10 @@ @tn.str.297 = private constant [9 x i8] c"**[1]Any\00" @tn.str.298 = private constant [8 x i8] c"**[]Any\00" @tn.str.299 = private constant [11 x i8] c"***IntCell\00" -@tn.str.300 = private constant [20 x i8] c"**__VL__s64__Vtable\00" -@tn.str.301 = private constant [12 x i8] c"**(VL__s64)\00" -@tn.str.302 = private constant [22 x i8] c"***Combined__s64__s64\00" -@tn.str.303 = private constant [10 x i8] c"**VL__s64\00" +@tn.str.300 = private constant [20 x i8] c"**__VL__i64__Vtable\00" +@tn.str.301 = private constant [12 x i8] c"**(VL__i64)\00" +@tn.str.302 = private constant [22 x i8] c"***Combined__i64__i64\00" +@tn.str.303 = private constant [10 x i8] c"**VL__i64\00" @tn.str.304 = private constant [9 x i8] c"**string\00" @tn.str.305 = private constant [7 x i8] c"**bool\00" @tn.str.306 = private constant [7 x i8] c"*?File\00" @@ -473,7 +473,7 @@ @str.568 = private unnamed_addr constant [3 x i8] c", \00", align 1 @field_names.569 = private constant [0 x { ptr, i64 }] zeroinitializer @str.570 = private unnamed_addr constant [3 x i8] c": \00", align 1 -@str.571 = private unnamed_addr constant [8 x i8] c"VL__s64\00", align 1 +@str.571 = private unnamed_addr constant [8 x i8] c"VL__i64\00", align 1 @str.572 = private unnamed_addr constant [2 x i8] c"{\00", align 1 @str.573 = private unnamed_addr constant [2 x i8] c"}\00", align 1 @str.574 = private unnamed_addr constant [3 x i8] c", \00", align 1 @@ -481,7 +481,7 @@ @fld.str.576 = private constant [9 x i8] c"__vtable\00" @field_names.577 = private constant [2 x { ptr, i64 }] [{ ptr, i64 } { ptr @fld.str.575, i64 3 }, { ptr, i64 } { ptr @fld.str.576, i64 8 }] @str.578 = private unnamed_addr constant [3 x i8] c": \00", align 1 -@str.579 = private unnamed_addr constant [18 x i8] c"__VL__s64__Vtable\00", align 1 +@str.579 = private unnamed_addr constant [18 x i8] c"__VL__i64__Vtable\00", align 1 @str.580 = private unnamed_addr constant [2 x i8] c"{\00", align 1 @str.581 = private unnamed_addr constant [2 x i8] c"}\00", align 1 @str.582 = private unnamed_addr constant [3 x i8] c", \00", align 1 @@ -494,7 +494,7 @@ @str.589 = private unnamed_addr constant [3 x i8] c", \00", align 1 @field_names.590 = private constant [0 x { ptr, i64 }] zeroinitializer @str.591 = private unnamed_addr constant [3 x i8] c": \00", align 1 -@str.592 = private unnamed_addr constant [19 x i8] c"Combined__s64__s64\00", align 1 +@str.592 = private unnamed_addr constant [19 x i8] c"Combined__i64__i64\00", align 1 @str.593 = private unnamed_addr constant [2 x i8] c"{\00", align 1 @str.594 = private unnamed_addr constant [2 x i8] c"}\00", align 1 @str.595 = private unnamed_addr constant [3 x i8] c", \00", align 1 @@ -614,7 +614,7 @@ @str.709 = private unnamed_addr constant [4 x i8] c"*u8\00", align 1 @str.710 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.711 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.712 = private unnamed_addr constant [5 x i8] c"*s32\00", align 1 +@str.712 = private unnamed_addr constant [5 x i8] c"*i32\00", align 1 @str.713 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.714 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.715 = private unnamed_addr constant [10 x i8] c"*SockAddr\00", align 1 @@ -641,7 +641,7 @@ @str.736 = private unnamed_addr constant [8 x i8] c"*Parser\00", align 1 @str.737 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.738 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.739 = private unnamed_addr constant [5 x i8] c"*s64\00", align 1 +@str.739 = private unnamed_addr constant [5 x i8] c"*i64\00", align 1 @str.740 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.741 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.742 = private unnamed_addr constant [8 x i8] c"*Parsed\00", align 1 @@ -671,22 +671,22 @@ @str.766 = private unnamed_addr constant [7 x i8] c"*[]Any\00", align 1 @str.767 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.768 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.769 = private unnamed_addr constant [20 x i8] c"*Combined__s64__s64\00", align 1 +@str.769 = private unnamed_addr constant [20 x i8] c"*Combined__i64__i64\00", align 1 @str.770 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.771 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.772 = private unnamed_addr constant [10 x i8] c"**IntCell\00", align 1 @str.773 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.774 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.775 = private unnamed_addr constant [19 x i8] c"*__VL__s64__Vtable\00", align 1 +@str.775 = private unnamed_addr constant [19 x i8] c"*__VL__i64__Vtable\00", align 1 @str.776 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.777 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.778 = private unnamed_addr constant [7 x i8] c"*tuple\00", align 1 @str.779 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.780 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.781 = private unnamed_addr constant [21 x i8] c"**Combined__s64__s64\00", align 1 +@str.781 = private unnamed_addr constant [21 x i8] c"**Combined__i64__i64\00", align 1 @str.782 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.783 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.784 = private unnamed_addr constant [9 x i8] c"*VL__s64\00", align 1 +@str.784 = private unnamed_addr constant [9 x i8] c"*VL__i64\00", align 1 @str.785 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.786 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.787 = private unnamed_addr constant [8 x i8] c"*string\00", align 1 @@ -2034,7 +2034,7 @@ dispatch.case.124: ; preds = %match.arm.43 %ua.raw172 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr173 = inttoptr i64 %ua.raw172 to ptr %ua.load174 = load { ptr, ptr }, ptr %ua.ptr173, align 8 - %callN = call { ptr, i64 } @struct_to_string__VL__s64(ptr %0, { ptr, ptr } %ua.load174) + %callN = call { ptr, i64 } @struct_to_string__VL__i64(ptr %0, { ptr, ptr } %ua.load174) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.94 @@ -2042,7 +2042,7 @@ dispatch.case.125: ; preds = %match.arm.43 %ua.raw176 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr177 = inttoptr i64 %ua.raw176 to ptr %ua.load178 = load { ptr }, ptr %ua.ptr177, align 8 - %callN = call { ptr, i64 } @struct_to_string____VL__s64__Vtable(ptr %0, { ptr } %ua.load178) + %callN = call { ptr, i64 } @struct_to_string____VL__i64__Vtable(ptr %0, { ptr } %ua.load178) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.94 @@ -2058,7 +2058,7 @@ dispatch.case.127: ; preds = %match.arm.43 %ua.raw184 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr185 = inttoptr i64 %ua.raw184 to ptr %ua.load186 = load { { { ptr, ptr } }, i64 }, ptr %ua.ptr185, align 8 - %callN = call { ptr, i64 } @struct_to_string__Combined__s64__s64(ptr %0, { { { ptr, ptr } }, i64 } %ua.load186) + %callN = call { ptr, i64 } @struct_to_string__Combined__i64__i64(ptr %0, { { { ptr, ptr } }, i64 } %ua.load186) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.94 @@ -2116,7 +2116,7 @@ dispatch.case.307: ; preds = %match.arm.47 %ua.raw202 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr203 = inttoptr i64 %ua.raw202 to ptr %ua.load204 = load [4 x i64], ptr %ua.ptr203, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %ua.load204) + %callN = call { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %ua.load204) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.305 @@ -2132,7 +2132,7 @@ dispatch.case.309: ; preds = %match.arm.47 %ua.raw210 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr211 = inttoptr i64 %ua.raw210 to ptr %ua.load212 = load [8 x i64], ptr %ua.ptr211, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %ua.load212) + %callN = call { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %ua.load212) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.305 @@ -2148,7 +2148,7 @@ dispatch.case.311: ; preds = %match.arm.47 %ua.raw218 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr219 = inttoptr i64 %ua.raw218 to ptr %ua.load220 = load [64 x i64], ptr %ua.ptr219, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %ua.load220) + %callN = call { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %ua.load220) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.305 @@ -2299,7 +2299,7 @@ dispatch.case.392: ; preds = %match.arm.49 dispatch.case.393: ; preds = %match.arm.49 %ua.raw281 = extractvalue { i64, i64 } %loadN, 1 %iNp282 = inttoptr i64 %ua.raw281 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %iNp282) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %iNp282) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.381 @@ -2362,7 +2362,7 @@ dispatch.case.401: ; preds = %match.arm.49 dispatch.case.402: ; preds = %match.arm.49 %ua.raw308 = extractvalue { i64, i64 } %loadN, 1 %iNp309 = inttoptr i64 %ua.raw308 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %iNp309) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %iNp309) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.381 @@ -2432,7 +2432,7 @@ dispatch.case.411: ; preds = %match.arm.49 dispatch.case.412: ; preds = %match.arm.49 %ua.raw338 = extractvalue { i64, i64 } %loadN, 1 %iNp339 = inttoptr i64 %ua.raw338 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_Combined__s64__s64(ptr %0, ptr %iNp339) + %callN = call { ptr, i64 } @pointer_to_string__ptr_Combined__i64__i64(ptr %0, ptr %iNp339) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.381 @@ -2446,28 +2446,28 @@ dispatch.case.413: ; preds = %match.arm.49 dispatch.case.414: ; preds = %match.arm.49 %ua.raw344 = extractvalue { i64, i64 } %loadN, 1 %iNp345 = inttoptr i64 %ua.raw344 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr___VL__s64__Vtable(ptr %0, ptr %iNp345) + %callN = call { ptr, i64 } @pointer_to_string__ptr___VL__i64__Vtable(ptr %0, ptr %iNp345) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.381 dispatch.case.415: ; preds = %match.arm.49 %ua.raw347 = extractvalue { i64, i64 } %loadN, 1 %iNp348 = inttoptr i64 %ua.raw347 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_tu_VL__s64(ptr %0, ptr %iNp348) + %callN = call { ptr, i64 } @pointer_to_string__ptr_tu_VL__i64(ptr %0, ptr %iNp348) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.381 dispatch.case.416: ; preds = %match.arm.49 %ua.raw350 = extractvalue { i64, i64 } %loadN, 1 %iNp351 = inttoptr i64 %ua.raw350 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_ptr_Combined__s64__s64(ptr %0, ptr %iNp351) + %callN = call { ptr, i64 } @pointer_to_string__ptr_ptr_Combined__i64__i64(ptr %0, ptr %iNp351) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.381 dispatch.case.417: ; preds = %match.arm.49 %ua.raw353 = extractvalue { i64, i64 } %loadN, 1 %iNp354 = inttoptr i64 %ua.raw353 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_VL__s64(ptr %0, ptr %iNp354) + %callN = call { ptr, i64 } @pointer_to_string__ptr_VL__i64(ptr %0, ptr %iNp354) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.381 @@ -3677,7 +3677,7 @@ entry: %deref = load { ptr }, ptr %sgN, align 8 %sgN = extractvalue { ptr } %deref, 0 %icall = call i64 %sgN(ptr @__sx_default_context, ptr %sg) - call void @print__ct_sbc6305862a3a863d__pack_s64(ptr @__sx_default_context, i64 %icall) + call void @print__ct_sbc6305862a3a863d__pack_i64(ptr @__sx_default_context, i64 %icall) ret i32 0 } @@ -3720,32 +3720,32 @@ entry: store i64 99, ptr %gepN, align 8 %loadN = load { i64 }, ptr %alloca, align 8 %si = insertvalue { ptr, ptr } undef, ptr %alloca, 0 - %siN = insertvalue { ptr, ptr } %si, ptr @__VL__s64__IntCell__vtable, 1 + %siN = insertvalue { ptr, ptr } %si, ptr @__VL__i64__IntCell__vtable, 1 %ti = insertvalue { { ptr, ptr } } undef, { ptr, ptr } %siN, 0 %gepN = getelementptr inbounds { { { ptr, ptr } }, i64 }, ptr %allocaN, i32 0, i32 0 store { { ptr, ptr } } %ti, ptr %gepN, align 8 %loadN = load { { { ptr, ptr } }, i64 }, ptr %allocaN, align 8 %siN = insertvalue { ptr, ptr } undef, ptr %allocaN, 0 - %siN = insertvalue { ptr, ptr } %siN, ptr @__VL__s64__Combined__s64__s64__vtable, 1 + %siN = insertvalue { ptr, ptr } %siN, ptr @__VL__i64__Combined__i64__i64__vtable, 1 ret { ptr, ptr } %siN } ; Function Attrs: nounwind -define internal i64 @__thunk_IntCell_VL__s64_get(ptr %0, ptr %1) #0 { +define internal i64 @__thunk_IntCell_VL__i64_get(ptr %0, ptr %1) #0 { entry: %call = call i64 @IntCell.get(ptr %0, ptr %1) ret i64 %call } ; Function Attrs: nounwind -define internal i64 @__thunk_Combined__s64__s64_VL__s64_get(ptr %0, ptr %1) #0 { +define internal i64 @__thunk_Combined__i64__i64_VL__i64_get(ptr %0, ptr %1) #0 { entry: - %call = call i64 @Combined__s64__s64.get(ptr %0, ptr %1) + %call = call i64 @Combined__i64__i64.get(ptr %0, ptr %1) ret i64 %call } ; Function Attrs: nounwind -define internal i64 @Combined__s64__s64.get(ptr %0, ptr %1) #0 { +define internal i64 @Combined__i64__i64.get(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 @@ -3756,7 +3756,7 @@ entry: } ; Function Attrs: nounwind -define internal void @print__ct_sbc6305862a3a863d__pack_s64(ptr %0, i64 %1) #0 { +define internal void @print__ct_sbc6305862a3a863d__pack_i64(ptr %0, i64 %1) #0 { entry: %alloca = alloca { ptr, i64 }, align 8 store { ptr, i64 } { ptr @str.331, i64 3 }, ptr %alloca, align 8 @@ -3877,14 +3877,14 @@ fv.case: ; preds = %if.merge.132 fv.case17: ; preds = %if.merge.132 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.132 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.132 @@ -4580,8 +4580,8 @@ fv.default: ; preds = %if.merge.177 fv.case: ; preds = %if.merge.177 %fv.field = extractvalue { i32 } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge } @@ -4664,14 +4664,14 @@ fv.case: ; preds = %if.merge.182 fv.case17: ; preds = %if.merge.182 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.182 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.182 @@ -4756,8 +4756,8 @@ fv.default: ; preds = %if.merge.187 fv.case: ; preds = %if.merge.187 %fv.field = extractvalue { i32, { ptr, i64 } } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case17: ; preds = %if.merge.187 @@ -6064,7 +6064,7 @@ if.merge.267: ; preds = %if.then.266, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @struct_to_string__VL__s64(ptr %0, { ptr, ptr } %1) #0 { +define internal { ptr, i64 } @struct_to_string__VL__i64(ptr %0, { ptr, ptr } %1) #0 { entry: %alloca = alloca { ptr, ptr }, align 8 store { ptr, ptr } %1, ptr %alloca, align 8 @@ -6141,7 +6141,7 @@ fv.case17: ; preds = %if.merge.272 } ; Function Attrs: nounwind -define internal { ptr, i64 } @struct_to_string____VL__s64__Vtable(ptr %0, { ptr } %1) #0 { +define internal { ptr, i64 } @struct_to_string____VL__i64__Vtable(ptr %0, { ptr } %1) #0 { entry: %alloca = alloca { ptr }, align 8 store { ptr } %1, ptr %alloca, align 8 @@ -6266,7 +6266,7 @@ if.merge.282: ; preds = %if.then.281, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @struct_to_string__Combined__s64__s64(ptr %0, { { { ptr, ptr } }, i64 } %1) #0 { +define internal { ptr, i64 } @struct_to_string__Combined__i64__i64(ptr %0, { { { ptr, ptr } }, i64 } %1) #0 { entry: %alloca = alloca { { { ptr, ptr } }, i64 }, align 8 %ba.tmp = alloca { { ptr, ptr } }, align 8 @@ -6617,7 +6617,7 @@ if.merge.304: ; preds = %if.then.303, %entry } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %1) #0 { entry: %alloca = alloca [4 x i64], align 8 %ig.tmp = alloca [4 x i64], align 8 @@ -6720,7 +6720,7 @@ if.merge.322: ; preds = %if.then.321, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %1) #0 { entry: %alloca = alloca [8 x i64], align 8 %ig.tmp = alloca [8 x i64], align 8 @@ -6821,7 +6821,7 @@ if.merge.332: ; preds = %if.then.331, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %1) #0 { entry: %alloca = alloca [64 x i64], align 8 %ig.tmp = alloca [64 x i64], align 8 @@ -7525,7 +7525,7 @@ if.merge.462: ; preds = %if.else.461, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 @@ -7775,7 +7775,7 @@ if.merge.489: ; preds = %if.else.488, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 @@ -8055,7 +8055,7 @@ if.merge.519: ; preds = %if.else.518, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_Combined__s64__s64(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_Combined__i64__i64(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 @@ -8111,7 +8111,7 @@ if.merge.525: ; preds = %if.else.524, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr___VL__s64__Vtable(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr___VL__i64__Vtable(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 @@ -8139,7 +8139,7 @@ if.merge.528: ; preds = %if.else.527, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_tu_VL__s64(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_tu_VL__i64(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 @@ -8167,7 +8167,7 @@ if.merge.531: ; preds = %if.else.530, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_ptr_Combined__s64__s64(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_ptr_Combined__i64__i64(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 @@ -8195,7 +8195,7 @@ if.merge.534: ; preds = %if.else.533, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_VL__s64(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_VL__i64(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 diff --git a/examples/expected/0416-protocols-auto-type-erasure.ir b/examples/expected/0416-protocols-auto-type-erasure.ir index 7490b76..a1228e3 100644 --- a/examples/expected/0416-protocols-auto-type-erasure.ir +++ b/examples/expected/0416-protocols-auto-type-erasure.ir @@ -26,10 +26,10 @@ @tag_names = private constant [14 x { ptr, i64 }] [{ ptr, i64 } { ptr @tag.str, i64 0 }, { ptr, i64 } { ptr @tag.str.439, i64 8 }, { ptr, i64 } { ptr @tag.str.440, i64 2 }, { ptr, i64 } { ptr @tag.str.441, i64 15 }, { ptr, i64 } { ptr @tag.str.442, i64 13 }, { ptr, i64 } { ptr @tag.str.443, i64 9 }, { ptr, i64 } { ptr @tag.str.444, i64 9 }, { ptr, i64 } { ptr @tag.str.445, i64 15 }, { ptr, i64 } { ptr @tag.str.446, i64 14 }, { ptr, i64 } { ptr @tag.str.447, i64 14 }, { ptr, i64 } { ptr @tag.str.448, i64 11 }, { ptr, i64 } { ptr @tag.str.449, i64 12 }, { ptr, i64 } { ptr @tag.str.450, i64 15 }, { ptr, i64 } { ptr @tag.str.451, i64 12 }] @tn.str = private constant [13 x i8] c"\00" @tn.str.452 = private constant [5 x i8] c"bool\00" -@tn.str.453 = private constant [3 x i8] c"s8\00" -@tn.str.454 = private constant [4 x i8] c"s16\00" -@tn.str.455 = private constant [4 x i8] c"s32\00" -@tn.str.456 = private constant [4 x i8] c"s64\00" +@tn.str.453 = private constant [3 x i8] c"i8\00" +@tn.str.454 = private constant [4 x i8] c"i16\00" +@tn.str.455 = private constant [4 x i8] c"i32\00" +@tn.str.456 = private constant [4 x i8] c"i64\00" @tn.str.457 = private constant [3 x i8] c"u8\00" @tn.str.458 = private constant [4 x i8] c"u16\00" @tn.str.459 = private constant [4 x i8] c"u32\00" @@ -46,7 +46,7 @@ @tn.str.470 = private constant [16 x i8] c"Source_Location\00" @tn.str.471 = private constant [10 x i8] c"Allocator\00" @tn.str.472 = private constant [8 x i8] c"Context\00" -@tn.str.473 = private constant [7 x i8] c"[4]s64\00" +@tn.str.473 = private constant [7 x i8] c"[4]i64\00" @tn.str.474 = private constant [9 x i8] c"[]string\00" @tn.str.475 = private constant [11 x i8] c"CAllocator\00" @tn.str.476 = private constant [12 x i8] c"*CAllocator\00" @@ -71,7 +71,7 @@ @tn.str.495 = private constant [4 x i8] c"*u8\00" @tn.str.496 = private constant [14 x i8] c"ProcessResult\00" @tn.str.497 = private constant [15 x i8] c"?ProcessResult\00" -@tn.str.498 = private constant [5 x i8] c"*s32\00" +@tn.str.498 = private constant [5 x i8] c"*i32\00" @tn.str.499 = private constant [9 x i8] c"SockAddr\00" @tn.str.500 = private constant [10 x i8] c"*SockAddr\00" @tn.str.501 = private constant [5 x i8] c"*u32\00" @@ -87,9 +87,9 @@ @tn.str.511 = private constant [5 x i8] c"[]u8\00" @tn.str.512 = private constant [5 x i8] c"Sink\00" @tn.str.513 = private constant [6 x i8] c"*Sink\00" -@tn.str.514 = private constant [17 x i8] c"(s64, JsonError)\00" +@tn.str.514 = private constant [17 x i8] c"(i64, JsonError)\00" @tn.str.515 = private constant [15 x i8] c"JsonParseError\00" -@tn.str.516 = private constant [22 x i8] c"(s64, JsonParseError)\00" +@tn.str.516 = private constant [22 x i8] c"(i64, JsonParseError)\00" @tn.str.517 = private constant [7 x i8] c"Parser\00" @tn.str.518 = private constant [8 x i8] c"*Parser\00" @tn.str.519 = private constant [25 x i8] c"(string, JsonParseError)\00" @@ -98,7 +98,7 @@ @tn.str.522 = private constant [13 x i8] c"Architecture\00" @tn.str.523 = private constant [13 x i8] c"BuildOptions\00" @tn.str.524 = private constant [11 x i8] c"() -> bool\00" -@tn.str.525 = private constant [5 x i8] c"*s64\00" +@tn.str.525 = private constant [5 x i8] c"*i64\00" @tn.str.526 = private constant [9 x i8] c"CliError\00" @tn.str.527 = private constant [9 x i8] c"FlagSpec\00" @tn.str.528 = private constant [11 x i8] c"[]FlagSpec\00" @@ -111,12 +111,12 @@ @tn.str.535 = private constant [19 x i8] c"(Parsed, CliError)\00" @tn.str.536 = private constant [10 x i8] c"[]Command\00" @tn.str.537 = private constant [6 x i8] c"*Diag\00" -@tn.str.538 = private constant [7 x i8] c"[8]s64\00" +@tn.str.538 = private constant [7 x i8] c"[8]i64\00" @tn.str.539 = private constant [7 x i8] c"[64]u8\00" @tn.str.540 = private constant [7 x i8] c"Sha256\00" @tn.str.541 = private constant [8 x i8] c"*Sha256\00" @tn.str.542 = private constant [8 x i8] c"?[64]u8\00" -@tn.str.543 = private constant [8 x i8] c"[64]s64\00" +@tn.str.543 = private constant [8 x i8] c"[64]i64\00" @tn.str.544 = private constant [8 x i8] c"[16]f32\00" @tn.str.545 = private constant [5 x i8] c"Mat4\00" @tn.str.546 = private constant [5 x i8] c"Vec2\00" @@ -145,7 +145,7 @@ @tn.str.569 = private constant [8 x i8] c"*[1]Any\00" @tn.str.570 = private constant [7 x i8] c"*Adder\00" @tn.str.571 = private constant [14 x i8] c"**Accumulator\00" -@tn.str.572 = private constant [8 x i8] c"*[4]s64\00" +@tn.str.572 = private constant [8 x i8] c"*[4]i64\00" @tn.str.573 = private constant [5 x i8] c"*f64\00" @tn.str.574 = private constant [17 x i8] c"*Source_Location\00" @tn.str.575 = private constant [11 x i8] c"*Allocator\00" @@ -167,9 +167,9 @@ @tn.str.591 = private constant [17 x i8] c"*OperatingSystem\00" @tn.str.592 = private constant [14 x i8] c"*Architecture\00" @tn.str.593 = private constant [15 x i8] c"*[16]FlagValue\00" -@tn.str.594 = private constant [8 x i8] c"*[8]s64\00" +@tn.str.594 = private constant [8 x i8] c"*[8]i64\00" @tn.str.595 = private constant [8 x i8] c"*[64]u8\00" -@tn.str.596 = private constant [9 x i8] c"*[64]s64\00" +@tn.str.596 = private constant [9 x i8] c"*[64]i64\00" @tn.str.597 = private constant [9 x i8] c"*[16]f32\00" @tn.str.598 = private constant [10 x i8] c"*[]string\00" @tn.str.599 = private constant [6 x i8] c"*[]u8\00" @@ -183,7 +183,7 @@ @tn.str.607 = private constant [20 x i8] c"**TrackingAllocator\00" @tn.str.608 = private constant [7 x i8] c"**File\00" @tn.str.609 = private constant [5 x i8] c"**u8\00" -@tn.str.610 = private constant [6 x i8] c"**s32\00" +@tn.str.610 = private constant [6 x i8] c"**i32\00" @tn.str.611 = private constant [11 x i8] c"**SockAddr\00" @tn.str.612 = private constant [6 x i8] c"**u32\00" @tn.str.613 = private constant [10 x i8] c"*[*]Value\00" @@ -192,7 +192,7 @@ @tn.str.616 = private constant [9 x i8] c"**Object\00" @tn.str.617 = private constant [7 x i8] c"**Sink\00" @tn.str.618 = private constant [9 x i8] c"**Parser\00" -@tn.str.619 = private constant [6 x i8] c"**s64\00" +@tn.str.619 = private constant [6 x i8] c"**i64\00" @tn.str.620 = private constant [9 x i8] c"**Parsed\00" @tn.str.621 = private constant [7 x i8] c"**Diag\00" @tn.str.622 = private constant [9 x i8] c"**Sha256\00" @@ -662,7 +662,7 @@ @str.1083 = private unnamed_addr constant [4 x i8] c"*u8\00", align 1 @str.1084 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.1085 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.1086 = private unnamed_addr constant [5 x i8] c"*s32\00", align 1 +@str.1086 = private unnamed_addr constant [5 x i8] c"*i32\00", align 1 @str.1087 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.1088 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.1089 = private unnamed_addr constant [10 x i8] c"*SockAddr\00", align 1 @@ -689,7 +689,7 @@ @str.1110 = private unnamed_addr constant [8 x i8] c"*Parser\00", align 1 @str.1111 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.1112 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.1113 = private unnamed_addr constant [5 x i8] c"*s64\00", align 1 +@str.1113 = private unnamed_addr constant [5 x i8] c"*i64\00", align 1 @str.1114 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.1115 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.1116 = private unnamed_addr constant [8 x i8] c"*Parsed\00", align 1 @@ -2199,7 +2199,7 @@ dispatch.case.325: ; preds = %match.arm.47 %ua.raw214 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr215 = inttoptr i64 %ua.raw214 to ptr %ua.load216 = load [4 x i64], ptr %ua.ptr215, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %ua.load216) + %callN = call { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %ua.load216) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.323 @@ -2215,7 +2215,7 @@ dispatch.case.327: ; preds = %match.arm.47 %ua.raw222 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr223 = inttoptr i64 %ua.raw222 to ptr %ua.load224 = load [8 x i64], ptr %ua.ptr223, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %ua.load224) + %callN = call { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %ua.load224) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.323 @@ -2231,7 +2231,7 @@ dispatch.case.329: ; preds = %match.arm.47 %ua.raw230 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr231 = inttoptr i64 %ua.raw230 to ptr %ua.load232 = load [64 x i64], ptr %ua.ptr231, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %ua.load232) + %callN = call { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %ua.load232) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.323 @@ -2382,7 +2382,7 @@ dispatch.case.410: ; preds = %match.arm.49 dispatch.case.411: ; preds = %match.arm.49 %ua.raw293 = extractvalue { i64, i64 } %loadN, 1 %iNp294 = inttoptr i64 %ua.raw293 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %iNp294) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %iNp294) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.399 @@ -2445,7 +2445,7 @@ dispatch.case.419: ; preds = %match.arm.49 dispatch.case.420: ; preds = %match.arm.49 %ua.raw320 = extractvalue { i64, i64 } %loadN, 1 %iNp321 = inttoptr i64 %ua.raw320 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %iNp321) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %iNp321) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.399 @@ -4869,7 +4869,7 @@ entry: %allocaN = alloca i32, align 4 store i32 %callN, ptr %allocaN, align 4 %loadN = load i32, ptr %allocaN, align 4 - call void @print__ct_sbdf493528d053170__pack_s32(ptr @__sx_default_context, i32 %loadN) + call void @print__ct_sbdf493528d053170__pack_i32(ptr @__sx_default_context, i32 %loadN) %allocaN = alloca { i32 }, align 8 store { i32 } zeroinitializer, ptr %allocaN, align 4 %allocaN = alloca { ptr, ptr, ptr }, align 8 @@ -4890,7 +4890,7 @@ entry: %sgN = extractvalue { ptr, ptr, ptr } %loadN, 0 %sgN = extractvalue { ptr, ptr, ptr } %loadN, 2 %icallN = call i32 %sgN(ptr @__sx_default_context, ptr %sgN) - call void @print__ct_s35bfc3f99c7ed027__pack_s32(ptr @__sx_default_context, i32 %icallN) + call void @print__ct_s35bfc3f99c7ed027__pack_i32(ptr @__sx_default_context, i32 %icallN) %allocaN = alloca { i32 }, align 8 store { i32 } { i32 100 }, ptr %allocaN, align 4 %loadN = load { { ptr, ptr, ptr }, ptr }, ptr @__sx_default_context, align 8 @@ -4905,7 +4905,7 @@ entry: %allocaN = alloca i32, align 4 store i32 %callN, ptr %allocaN, align 4 %loadN = load i32, ptr %allocaN, align 4 - call void @print__ct_s9619ba29713d8564__pack_s32(ptr @__sx_default_context, i32 %loadN) + call void @print__ct_s9619ba29713d8564__pack_i32(ptr @__sx_default_context, i32 %loadN) %allocaN = alloca { i32 }, align 8 store { i32 } { i32 50 }, ptr %allocaN, align 4 %loadN = load { { ptr, ptr, ptr }, ptr }, ptr @__sx_default_context, align 8 @@ -4920,7 +4920,7 @@ entry: %allocaN = alloca i32, align 4 store i32 %callN, ptr %allocaN, align 4 %loadN = load i32, ptr %allocaN, align 4 - call void @print__ct_s299c24782c1d67ee__pack_s32(ptr @__sx_default_context, i32 %loadN) + call void @print__ct_s299c24782c1d67ee__pack_i32(ptr @__sx_default_context, i32 %loadN) %allocaN = alloca { i32 }, align 8 store { i32 } { i32 5 }, ptr %allocaN, align 4 %allocaN = alloca ptr, align 8 @@ -4932,7 +4932,7 @@ entry: call void @use_adder__3(ptr @__sx_default_context, { ptr, ptr, ptr } %siN) %loadN = load { i32 }, ptr %allocaN, align 4 %sgN = extractvalue { i32 } %loadN, 0 - call void @print__ct_sf40ed4735476a9ee__pack_s32(ptr @__sx_default_context, i32 %sgN) + call void @print__ct_sf40ed4735476a9ee__pack_i32(ptr @__sx_default_context, i32 %sgN) ret i32 0 } @@ -5022,7 +5022,7 @@ entry: } ; Function Attrs: nounwind -define internal void @print__ct_sbdf493528d053170__pack_s32(ptr %0, i32 %1) #0 { +define internal void @print__ct_sbdf493528d053170__pack_i32(ptr %0, i32 %1) #0 { entry: %alloca = alloca { ptr, i64 }, align 8 store { ptr, i64 } { ptr @str.664, i64 8 }, ptr %alloca, align 8 @@ -5030,8 +5030,8 @@ entry: store i32 %1, ptr %allocaN, align 4 %allocaN = alloca [1 x { i64, i64 }], align 8 %load = load i32, ptr %allocaN, align 4 - %sN = sext i32 %load to i64 - %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %load to i64 + %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %igp.ptr = getelementptr { i64, i64 }, ptr %allocaN, i64 0 store { i64, i64 } %ba.val, ptr %igp.ptr, align 8 %allocaN = alloca { ptr, i64 }, align 8 @@ -5049,8 +5049,8 @@ entry: store { ptr, i64 } %callN, ptr %allocaN, align 8 %loadN = load { ptr, i64 }, ptr %allocaN, align 8 %loadN = load i32, ptr %allocaN, align 4 - %sN = sext i32 %loadN to i64 - %ba.val13 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %loadN to i64 + %ba.val13 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %callN = call { ptr, i64 } @any_to_string(ptr %0, { i64, i64 } %ba.val13) %callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN) store { ptr, i64 } %callN, ptr %allocaN, align 8 @@ -5088,7 +5088,7 @@ entry: } ; Function Attrs: nounwind -define internal void @print__ct_s35bfc3f99c7ed027__pack_s32(ptr %0, i32 %1) #0 { +define internal void @print__ct_s35bfc3f99c7ed027__pack_i32(ptr %0, i32 %1) #0 { entry: %alloca = alloca { ptr, i64 }, align 8 store { ptr, i64 } { ptr @str.667, i64 8 }, ptr %alloca, align 8 @@ -5096,8 +5096,8 @@ entry: store i32 %1, ptr %allocaN, align 4 %allocaN = alloca [1 x { i64, i64 }], align 8 %load = load i32, ptr %allocaN, align 4 - %sN = sext i32 %load to i64 - %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %load to i64 + %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %igp.ptr = getelementptr { i64, i64 }, ptr %allocaN, i64 0 store { i64, i64 } %ba.val, ptr %igp.ptr, align 8 %allocaN = alloca { ptr, i64 }, align 8 @@ -5115,8 +5115,8 @@ entry: store { ptr, i64 } %callN, ptr %allocaN, align 8 %loadN = load { ptr, i64 }, ptr %allocaN, align 8 %loadN = load i32, ptr %allocaN, align 4 - %sN = sext i32 %loadN to i64 - %ba.val13 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %loadN to i64 + %ba.val13 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %callN = call { ptr, i64 } @any_to_string(ptr %0, { i64, i64 } %ba.val13) %callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN) store { ptr, i64 } %callN, ptr %allocaN, align 8 @@ -5166,7 +5166,7 @@ entry: } ; Function Attrs: nounwind -define internal void @print__ct_s9619ba29713d8564__pack_s32(ptr %0, i32 %1) #0 { +define internal void @print__ct_s9619ba29713d8564__pack_i32(ptr %0, i32 %1) #0 { entry: %alloca = alloca { ptr, i64 }, align 8 store { ptr, i64 } { ptr @str.670, i64 8 }, ptr %alloca, align 8 @@ -5174,8 +5174,8 @@ entry: store i32 %1, ptr %allocaN, align 4 %allocaN = alloca [1 x { i64, i64 }], align 8 %load = load i32, ptr %allocaN, align 4 - %sN = sext i32 %load to i64 - %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %load to i64 + %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %igp.ptr = getelementptr { i64, i64 }, ptr %allocaN, i64 0 store { i64, i64 } %ba.val, ptr %igp.ptr, align 8 %allocaN = alloca { ptr, i64 }, align 8 @@ -5193,8 +5193,8 @@ entry: store { ptr, i64 } %callN, ptr %allocaN, align 8 %loadN = load { ptr, i64 }, ptr %allocaN, align 8 %loadN = load i32, ptr %allocaN, align 4 - %sN = sext i32 %loadN to i64 - %ba.val13 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %loadN to i64 + %ba.val13 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %callN = call { ptr, i64 } @any_to_string(ptr %0, { i64, i64 } %ba.val13) %callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN) store { ptr, i64 } %callN, ptr %allocaN, align 8 @@ -5238,7 +5238,7 @@ entry: } ; Function Attrs: nounwind -define internal void @print__ct_s299c24782c1d67ee__pack_s32(ptr %0, i32 %1) #0 { +define internal void @print__ct_s299c24782c1d67ee__pack_i32(ptr %0, i32 %1) #0 { entry: %alloca = alloca { ptr, i64 }, align 8 store { ptr, i64 } { ptr @str.673, i64 8 }, ptr %alloca, align 8 @@ -5246,8 +5246,8 @@ entry: store i32 %1, ptr %allocaN, align 4 %allocaN = alloca [1 x { i64, i64 }], align 8 %load = load i32, ptr %allocaN, align 4 - %sN = sext i32 %load to i64 - %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %load to i64 + %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %igp.ptr = getelementptr { i64, i64 }, ptr %allocaN, i64 0 store { i64, i64 } %ba.val, ptr %igp.ptr, align 8 %allocaN = alloca { ptr, i64 }, align 8 @@ -5265,8 +5265,8 @@ entry: store { ptr, i64 } %callN, ptr %allocaN, align 8 %loadN = load { ptr, i64 }, ptr %allocaN, align 8 %loadN = load i32, ptr %allocaN, align 4 - %sN = sext i32 %loadN to i64 - %ba.val13 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %loadN to i64 + %ba.val13 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %callN = call { ptr, i64 } @any_to_string(ptr %0, { i64, i64 } %ba.val13) %callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN) store { ptr, i64 } %callN, ptr %allocaN, align 8 @@ -5302,7 +5302,7 @@ entry: } ; Function Attrs: nounwind -define internal void @print__ct_sf40ed4735476a9ee__pack_s32(ptr %0, i32 %1) #0 { +define internal void @print__ct_sf40ed4735476a9ee__pack_i32(ptr %0, i32 %1) #0 { entry: %alloca = alloca { ptr, i64 }, align 8 store { ptr, i64 } { ptr @str.676, i64 8 }, ptr %alloca, align 8 @@ -5310,8 +5310,8 @@ entry: store i32 %1, ptr %allocaN, align 4 %allocaN = alloca [1 x { i64, i64 }], align 8 %load = load i32, ptr %allocaN, align 4 - %sN = sext i32 %load to i64 - %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %load to i64 + %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %igp.ptr = getelementptr { i64, i64 }, ptr %allocaN, i64 0 store { i64, i64 } %ba.val, ptr %igp.ptr, align 8 %allocaN = alloca { ptr, i64 }, align 8 @@ -5329,8 +5329,8 @@ entry: store { ptr, i64 } %callN, ptr %allocaN, align 8 %loadN = load { ptr, i64 }, ptr %allocaN, align 8 %loadN = load i32, ptr %allocaN, align 4 - %sN = sext i32 %loadN to i64 - %ba.val13 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %loadN to i64 + %ba.val13 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %callN = call { ptr, i64 } @any_to_string(ptr %0, { i64, i64 } %ba.val13) %callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN) store { ptr, i64 } %callN, ptr %allocaN, align 8 @@ -5430,14 +5430,14 @@ fv.case: ; preds = %if.merge.135 fv.case17: ; preds = %if.merge.135 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.135 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.135 @@ -6133,8 +6133,8 @@ fv.default: ; preds = %if.merge.180 fv.case: ; preds = %if.merge.180 %fv.field = extractvalue { i32 } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge } @@ -6217,14 +6217,14 @@ fv.case: ; preds = %if.merge.185 fv.case17: ; preds = %if.merge.185 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.185 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.185 @@ -6309,8 +6309,8 @@ fv.default: ; preds = %if.merge.190 fv.case: ; preds = %if.merge.190 %fv.field = extractvalue { i32, { ptr, i64 } } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case17: ; preds = %if.merge.190 @@ -7654,14 +7654,14 @@ fv.default: ; preds = %if.merge.270 fv.case: ; preds = %if.merge.270 %fv.field = extractvalue { i32, i32 } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case17: ; preds = %if.merge.270 %fv.field18 = extractvalue { i32, i32 } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val20 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val20 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge } @@ -8031,8 +8031,8 @@ fv.default: ; preds = %if.merge.295 fv.case: ; preds = %if.merge.295 %fv.field = extractvalue { i32 } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge } @@ -8185,8 +8185,8 @@ fv.default: ; preds = %if.merge.305 fv.case: ; preds = %if.merge.305 %fv.field = extractvalue { i32 } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge } @@ -8464,7 +8464,7 @@ if.merge.322: ; preds = %if.then.321, %entry } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %1) #0 { entry: %alloca = alloca [4 x i64], align 8 %ig.tmp = alloca [4 x i64], align 8 @@ -8567,7 +8567,7 @@ if.merge.341: ; preds = %if.then.340, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %1) #0 { entry: %alloca = alloca [8 x i64], align 8 %ig.tmp = alloca [8 x i64], align 8 @@ -8668,7 +8668,7 @@ if.merge.351: ; preds = %if.then.350, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %1) #0 { entry: %alloca = alloca [64 x i64], align 8 %ig.tmp = alloca [64 x i64], align 8 @@ -9370,7 +9370,7 @@ if.merge.481: ; preds = %if.else.480, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 @@ -9620,7 +9620,7 @@ if.merge.508: ; preds = %if.else.507, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 diff --git a/examples/expected/0507-packs-pack-mono-dedup.ir b/examples/expected/0507-packs-pack-mono-dedup.ir index abb88a6..85cf7b3 100644 --- a/examples/expected/0507-packs-pack-mono-dedup.ir +++ b/examples/expected/0507-packs-pack-mono-dedup.ir @@ -25,10 +25,10 @@ @tag_names = private constant [14 x { ptr, i64 }] [{ ptr, i64 } { ptr @tag.str, i64 0 }, { ptr, i64 } { ptr @tag.str.114, i64 8 }, { ptr, i64 } { ptr @tag.str.115, i64 2 }, { ptr, i64 } { ptr @tag.str.116, i64 15 }, { ptr, i64 } { ptr @tag.str.117, i64 13 }, { ptr, i64 } { ptr @tag.str.118, i64 9 }, { ptr, i64 } { ptr @tag.str.119, i64 9 }, { ptr, i64 } { ptr @tag.str.120, i64 15 }, { ptr, i64 } { ptr @tag.str.121, i64 14 }, { ptr, i64 } { ptr @tag.str.122, i64 14 }, { ptr, i64 } { ptr @tag.str.123, i64 11 }, { ptr, i64 } { ptr @tag.str.124, i64 12 }, { ptr, i64 } { ptr @tag.str.125, i64 15 }, { ptr, i64 } { ptr @tag.str.126, i64 12 }] @tn.str = private constant [13 x i8] c"\00" @tn.str.127 = private constant [5 x i8] c"bool\00" -@tn.str.128 = private constant [3 x i8] c"s8\00" -@tn.str.129 = private constant [4 x i8] c"s16\00" -@tn.str.130 = private constant [4 x i8] c"s32\00" -@tn.str.131 = private constant [4 x i8] c"s64\00" +@tn.str.128 = private constant [3 x i8] c"i8\00" +@tn.str.129 = private constant [4 x i8] c"i16\00" +@tn.str.130 = private constant [4 x i8] c"i32\00" +@tn.str.131 = private constant [4 x i8] c"i64\00" @tn.str.132 = private constant [3 x i8] c"u8\00" @tn.str.133 = private constant [4 x i8] c"u16\00" @tn.str.134 = private constant [4 x i8] c"u32\00" @@ -45,7 +45,7 @@ @tn.str.145 = private constant [16 x i8] c"Source_Location\00" @tn.str.146 = private constant [10 x i8] c"Allocator\00" @tn.str.147 = private constant [8 x i8] c"Context\00" -@tn.str.148 = private constant [7 x i8] c"[4]s64\00" +@tn.str.148 = private constant [7 x i8] c"[4]i64\00" @tn.str.149 = private constant [9 x i8] c"[]string\00" @tn.str.150 = private constant [11 x i8] c"CAllocator\00" @tn.str.151 = private constant [12 x i8] c"*CAllocator\00" @@ -70,7 +70,7 @@ @tn.str.170 = private constant [4 x i8] c"*u8\00" @tn.str.171 = private constant [14 x i8] c"ProcessResult\00" @tn.str.172 = private constant [15 x i8] c"?ProcessResult\00" -@tn.str.173 = private constant [5 x i8] c"*s32\00" +@tn.str.173 = private constant [5 x i8] c"*i32\00" @tn.str.174 = private constant [9 x i8] c"SockAddr\00" @tn.str.175 = private constant [10 x i8] c"*SockAddr\00" @tn.str.176 = private constant [5 x i8] c"*u32\00" @@ -86,9 +86,9 @@ @tn.str.186 = private constant [5 x i8] c"[]u8\00" @tn.str.187 = private constant [5 x i8] c"Sink\00" @tn.str.188 = private constant [6 x i8] c"*Sink\00" -@tn.str.189 = private constant [17 x i8] c"(s64, JsonError)\00" +@tn.str.189 = private constant [17 x i8] c"(i64, JsonError)\00" @tn.str.190 = private constant [15 x i8] c"JsonParseError\00" -@tn.str.191 = private constant [22 x i8] c"(s64, JsonParseError)\00" +@tn.str.191 = private constant [22 x i8] c"(i64, JsonParseError)\00" @tn.str.192 = private constant [7 x i8] c"Parser\00" @tn.str.193 = private constant [8 x i8] c"*Parser\00" @tn.str.194 = private constant [25 x i8] c"(string, JsonParseError)\00" @@ -97,7 +97,7 @@ @tn.str.197 = private constant [13 x i8] c"Architecture\00" @tn.str.198 = private constant [13 x i8] c"BuildOptions\00" @tn.str.199 = private constant [11 x i8] c"() -> bool\00" -@tn.str.200 = private constant [5 x i8] c"*s64\00" +@tn.str.200 = private constant [5 x i8] c"*i64\00" @tn.str.201 = private constant [9 x i8] c"CliError\00" @tn.str.202 = private constant [9 x i8] c"FlagSpec\00" @tn.str.203 = private constant [11 x i8] c"[]FlagSpec\00" @@ -110,12 +110,12 @@ @tn.str.210 = private constant [19 x i8] c"(Parsed, CliError)\00" @tn.str.211 = private constant [10 x i8] c"[]Command\00" @tn.str.212 = private constant [6 x i8] c"*Diag\00" -@tn.str.213 = private constant [7 x i8] c"[8]s64\00" +@tn.str.213 = private constant [7 x i8] c"[8]i64\00" @tn.str.214 = private constant [7 x i8] c"[64]u8\00" @tn.str.215 = private constant [7 x i8] c"Sha256\00" @tn.str.216 = private constant [8 x i8] c"*Sha256\00" @tn.str.217 = private constant [8 x i8] c"?[64]u8\00" -@tn.str.218 = private constant [8 x i8] c"[64]s64\00" +@tn.str.218 = private constant [8 x i8] c"[64]i64\00" @tn.str.219 = private constant [13 x i8] c"**CAllocator\00" @tn.str.220 = private constant [7 x i8] c"**void\00" @tn.str.221 = private constant [6 x i8] c"[]Any\00" @@ -131,7 +131,7 @@ @tn.str.231 = private constant [8 x i8] c"*[2]Any\00" @tn.str.232 = private constant [7 x i8] c"[5]Any\00" @tn.str.233 = private constant [8 x i8] c"*[5]Any\00" -@tn.str.234 = private constant [8 x i8] c"*[4]s64\00" +@tn.str.234 = private constant [8 x i8] c"*[4]i64\00" @tn.str.235 = private constant [5 x i8] c"*f64\00" @tn.str.236 = private constant [17 x i8] c"*Source_Location\00" @tn.str.237 = private constant [11 x i8] c"*Allocator\00" @@ -149,9 +149,9 @@ @tn.str.249 = private constant [17 x i8] c"*OperatingSystem\00" @tn.str.250 = private constant [14 x i8] c"*Architecture\00" @tn.str.251 = private constant [15 x i8] c"*[16]FlagValue\00" -@tn.str.252 = private constant [8 x i8] c"*[8]s64\00" +@tn.str.252 = private constant [8 x i8] c"*[8]i64\00" @tn.str.253 = private constant [8 x i8] c"*[64]u8\00" -@tn.str.254 = private constant [9 x i8] c"*[64]s64\00" +@tn.str.254 = private constant [9 x i8] c"*[64]i64\00" @tn.str.255 = private constant [10 x i8] c"*[]string\00" @tn.str.256 = private constant [6 x i8] c"*[]u8\00" @tn.str.257 = private constant [12 x i8] c"*[]FlagSpec\00" @@ -164,7 +164,7 @@ @tn.str.264 = private constant [20 x i8] c"**TrackingAllocator\00" @tn.str.265 = private constant [7 x i8] c"**File\00" @tn.str.266 = private constant [5 x i8] c"**u8\00" -@tn.str.267 = private constant [6 x i8] c"**s32\00" +@tn.str.267 = private constant [6 x i8] c"**i32\00" @tn.str.268 = private constant [11 x i8] c"**SockAddr\00" @tn.str.269 = private constant [6 x i8] c"**u32\00" @tn.str.270 = private constant [10 x i8] c"*[*]Value\00" @@ -173,7 +173,7 @@ @tn.str.273 = private constant [9 x i8] c"**Object\00" @tn.str.274 = private constant [7 x i8] c"**Sink\00" @tn.str.275 = private constant [9 x i8] c"**Parser\00" -@tn.str.276 = private constant [6 x i8] c"**s64\00" +@tn.str.276 = private constant [6 x i8] c"**i64\00" @tn.str.277 = private constant [9 x i8] c"**Parsed\00" @tn.str.278 = private constant [7 x i8] c"**Diag\00" @tn.str.279 = private constant [9 x i8] c"**Sha256\00" @@ -555,7 +555,7 @@ @str.652 = private unnamed_addr constant [4 x i8] c"*u8\00", align 1 @str.653 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.654 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.655 = private unnamed_addr constant [5 x i8] c"*s32\00", align 1 +@str.655 = private unnamed_addr constant [5 x i8] c"*i32\00", align 1 @str.656 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.657 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.658 = private unnamed_addr constant [10 x i8] c"*SockAddr\00", align 1 @@ -582,7 +582,7 @@ @str.679 = private unnamed_addr constant [8 x i8] c"*Parser\00", align 1 @str.680 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.681 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.682 = private unnamed_addr constant [5 x i8] c"*s64\00", align 1 +@str.682 = private unnamed_addr constant [5 x i8] c"*i64\00", align 1 @str.683 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.684 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.685 = private unnamed_addr constant [8 x i8] c"*Parsed\00", align 1 @@ -1971,7 +1971,7 @@ dispatch.case.265: ; preds = %match.arm.47 %ua.raw174 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr175 = inttoptr i64 %ua.raw174 to ptr %ua.load176 = load [4 x i64], ptr %ua.ptr175, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %ua.load176) + %callN = call { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %ua.load176) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.263 @@ -1987,7 +1987,7 @@ dispatch.case.267: ; preds = %match.arm.47 %ua.raw182 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr183 = inttoptr i64 %ua.raw182 to ptr %ua.load184 = load [8 x i64], ptr %ua.ptr183, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %ua.load184) + %callN = call { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %ua.load184) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.263 @@ -2003,7 +2003,7 @@ dispatch.case.269: ; preds = %match.arm.47 %ua.raw190 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr191 = inttoptr i64 %ua.raw190 to ptr %ua.load192 = load [64 x i64], ptr %ua.ptr191, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %ua.load192) + %callN = call { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %ua.load192) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.263 @@ -2170,7 +2170,7 @@ dispatch.case.362: ; preds = %match.arm.49 dispatch.case.363: ; preds = %match.arm.49 %ua.raw261 = extractvalue { i64, i64 } %loadN, 1 %iNp262 = inttoptr i64 %ua.raw261 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %iNp262) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %iNp262) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.351 @@ -2233,7 +2233,7 @@ dispatch.case.371: ; preds = %match.arm.49 dispatch.case.372: ; preds = %match.arm.49 %ua.raw288 = extractvalue { i64, i64 } %loadN, 1 %iNp289 = inttoptr i64 %ua.raw288 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %iNp289) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %iNp289) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.351 @@ -3500,13 +3500,13 @@ entry: %call = call i64 @count__pack(ptr @__sx_default_context) %alloca = alloca i64, align 8 store i64 %call, ptr %alloca, align 8 - %callN = call i64 @count__pack_s64(ptr @__sx_default_context, i64 1) + %callN = call i64 @count__pack_i64(ptr @__sx_default_context, i64 1) %allocaN = alloca i64, align 8 store i64 %callN, ptr %allocaN, align 8 - %callN = call i64 @count__pack_s64(ptr @__sx_default_context, i64 2) + %callN = call i64 @count__pack_i64(ptr @__sx_default_context, i64 2) %allocaN = alloca i64, align 8 store i64 %callN, ptr %allocaN, align 8 - %callN = call i64 @count__pack_s64_s64_s64(ptr @__sx_default_context, i64 1, i64 2, i64 3) + %callN = call i64 @count__pack_i64_i64_i64(ptr @__sx_default_context, i64 1, i64 2, i64 3) %allocaN = alloca i64, align 8 store i64 %callN, ptr %allocaN, align 8 %callN = call i64 @count__pack_string_bool(ptr @__sx_default_context, { ptr, i64 } { ptr @str.315, i64 1 }, i1 true) @@ -3517,7 +3517,7 @@ entry: %loadN = load i64, ptr %allocaN, align 8 %loadN = load i64, ptr %allocaN, align 8 %loadN = load i64, ptr %allocaN, align 8 - call void @print__ct_s9aced10c9b3e5318__pack_s64_s64_s64_s64_s64(ptr @__sx_default_context, i64 %load, i64 %loadN, i64 %loadN, i64 %loadN, i64 %loadN) + call void @print__ct_s9aced10c9b3e5318__pack_i64_i64_i64_i64_i64(ptr @__sx_default_context, i64 %load, i64 %loadN, i64 %loadN, i64 %loadN, i64 %loadN) ret i32 0 } @@ -3547,7 +3547,7 @@ entry: } ; Function Attrs: nounwind -define internal i64 @count__pack_s64(ptr %0, i64 %1) #0 { +define internal i64 @count__pack_i64(ptr %0, i64 %1) #0 { entry: %alloca = alloca i64, align 8 store i64 %1, ptr %alloca, align 8 @@ -3566,7 +3566,7 @@ entry: } ; Function Attrs: nounwind -define internal i64 @count__pack_s64_s64_s64(ptr %0, i64 %1, i64 %2, i64 %3) #0 { +define internal i64 @count__pack_i64_i64_i64(ptr %0, i64 %1, i64 %2, i64 %3) #0 { entry: %alloca = alloca i64, align 8 store i64 %1, ptr %alloca, align 8 @@ -3626,7 +3626,7 @@ entry: } ; Function Attrs: nounwind -define internal void @print__ct_s9aced10c9b3e5318__pack_s64_s64_s64_s64_s64(ptr %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5) #0 { +define internal void @print__ct_s9aced10c9b3e5318__pack_i64_i64_i64_i64_i64(ptr %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5) #0 { entry: %alloca = alloca { ptr, i64 }, align 8 store { ptr, i64 } { ptr @str.316, i64 15 }, ptr %alloca, align 8 @@ -3815,14 +3815,14 @@ fv.case: ; preds = %if.merge.125 fv.case17: ; preds = %if.merge.125 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.125 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.125 @@ -4518,8 +4518,8 @@ fv.default: ; preds = %if.merge.170 fv.case: ; preds = %if.merge.170 %fv.field = extractvalue { i32 } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge } @@ -4602,14 +4602,14 @@ fv.case: ; preds = %if.merge.175 fv.case17: ; preds = %if.merge.175 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.175 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.175 @@ -4694,8 +4694,8 @@ fv.default: ; preds = %if.merge.180 fv.case: ; preds = %if.merge.180 %fv.field = extractvalue { i32, { ptr, i64 } } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case17: ; preds = %if.merge.180 @@ -6096,7 +6096,7 @@ if.merge.262: ; preds = %if.then.261, %entry } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %1) #0 { entry: %alloca = alloca [4 x i64], align 8 %ig.tmp = alloca [4 x i64], align 8 @@ -6199,7 +6199,7 @@ if.merge.283: ; preds = %if.then.282, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %1) #0 { entry: %alloca = alloca [8 x i64], align 8 %ig.tmp = alloca [8 x i64], align 8 @@ -6300,7 +6300,7 @@ if.merge.293: ; preds = %if.then.292, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %1) #0 { entry: %alloca = alloca [64 x i64], align 8 %ig.tmp = alloca [64 x i64], align 8 @@ -7109,7 +7109,7 @@ if.merge.428: ; preds = %if.else.427, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 @@ -7359,7 +7359,7 @@ if.merge.455: ; preds = %if.else.454, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 diff --git a/examples/expected/0510-packs-pack-index-oob.stderr b/examples/expected/0510-packs-pack-index-oob.stderr index 59d299d..cf9587b 100644 --- a/examples/expected/0510-packs-pack-index-oob.stderr +++ b/examples/expected/0510-packs-pack-index-oob.stderr @@ -1,5 +1,5 @@ error: pack index 2 out of bounds: 'args' has 1 element - --> /Users/agra/projects/sx/examples/0510-packs-pack-index-oob.sx:14:32 + --> examples/0510-packs-pack-index-oob.sx:14:32 | 14 | foo :: (..$args) -> $R => args[2]; | ^ diff --git a/examples/expected/0512-packs-pack-runtime-index.stderr b/examples/expected/0512-packs-pack-runtime-index.stderr index 4d49061..1f22c9e 100644 --- a/examples/expected/0512-packs-pack-runtime-index.stderr +++ b/examples/expected/0512-packs-pack-runtime-index.stderr @@ -1,5 +1,5 @@ error: pack 'args' must be indexed by a compile-time constant — a pack is comptime-only and has no runtime value - --> /Users/agra/projects/sx/examples/0512-packs-pack-runtime-index.sx:18:24 + --> examples/0512-packs-pack-runtime-index.sx:18:24 | 18 | x : Any = args[i]; // ERROR: runtime index into a comptime-only pack | ^ diff --git a/examples/expected/0513-packs-pack-mixed-comptime.ir b/examples/expected/0513-packs-pack-mixed-comptime.ir index e222f0a..8cf41bc 100644 --- a/examples/expected/0513-packs-pack-mixed-comptime.ir +++ b/examples/expected/0513-packs-pack-mixed-comptime.ir @@ -25,10 +25,10 @@ @tag_names = private constant [14 x { ptr, i64 }] [{ ptr, i64 } { ptr @tag.str, i64 0 }, { ptr, i64 } { ptr @tag.str.114, i64 8 }, { ptr, i64 } { ptr @tag.str.115, i64 2 }, { ptr, i64 } { ptr @tag.str.116, i64 15 }, { ptr, i64 } { ptr @tag.str.117, i64 13 }, { ptr, i64 } { ptr @tag.str.118, i64 9 }, { ptr, i64 } { ptr @tag.str.119, i64 9 }, { ptr, i64 } { ptr @tag.str.120, i64 15 }, { ptr, i64 } { ptr @tag.str.121, i64 14 }, { ptr, i64 } { ptr @tag.str.122, i64 14 }, { ptr, i64 } { ptr @tag.str.123, i64 11 }, { ptr, i64 } { ptr @tag.str.124, i64 12 }, { ptr, i64 } { ptr @tag.str.125, i64 15 }, { ptr, i64 } { ptr @tag.str.126, i64 12 }] @tn.str = private constant [13 x i8] c"\00" @tn.str.127 = private constant [5 x i8] c"bool\00" -@tn.str.128 = private constant [3 x i8] c"s8\00" -@tn.str.129 = private constant [4 x i8] c"s16\00" -@tn.str.130 = private constant [4 x i8] c"s32\00" -@tn.str.131 = private constant [4 x i8] c"s64\00" +@tn.str.128 = private constant [3 x i8] c"i8\00" +@tn.str.129 = private constant [4 x i8] c"i16\00" +@tn.str.130 = private constant [4 x i8] c"i32\00" +@tn.str.131 = private constant [4 x i8] c"i64\00" @tn.str.132 = private constant [3 x i8] c"u8\00" @tn.str.133 = private constant [4 x i8] c"u16\00" @tn.str.134 = private constant [4 x i8] c"u32\00" @@ -45,7 +45,7 @@ @tn.str.145 = private constant [16 x i8] c"Source_Location\00" @tn.str.146 = private constant [10 x i8] c"Allocator\00" @tn.str.147 = private constant [8 x i8] c"Context\00" -@tn.str.148 = private constant [7 x i8] c"[4]s64\00" +@tn.str.148 = private constant [7 x i8] c"[4]i64\00" @tn.str.149 = private constant [9 x i8] c"[]string\00" @tn.str.150 = private constant [11 x i8] c"CAllocator\00" @tn.str.151 = private constant [12 x i8] c"*CAllocator\00" @@ -70,7 +70,7 @@ @tn.str.170 = private constant [4 x i8] c"*u8\00" @tn.str.171 = private constant [14 x i8] c"ProcessResult\00" @tn.str.172 = private constant [15 x i8] c"?ProcessResult\00" -@tn.str.173 = private constant [5 x i8] c"*s32\00" +@tn.str.173 = private constant [5 x i8] c"*i32\00" @tn.str.174 = private constant [9 x i8] c"SockAddr\00" @tn.str.175 = private constant [10 x i8] c"*SockAddr\00" @tn.str.176 = private constant [5 x i8] c"*u32\00" @@ -86,9 +86,9 @@ @tn.str.186 = private constant [5 x i8] c"[]u8\00" @tn.str.187 = private constant [5 x i8] c"Sink\00" @tn.str.188 = private constant [6 x i8] c"*Sink\00" -@tn.str.189 = private constant [17 x i8] c"(s64, JsonError)\00" +@tn.str.189 = private constant [17 x i8] c"(i64, JsonError)\00" @tn.str.190 = private constant [15 x i8] c"JsonParseError\00" -@tn.str.191 = private constant [22 x i8] c"(s64, JsonParseError)\00" +@tn.str.191 = private constant [22 x i8] c"(i64, JsonParseError)\00" @tn.str.192 = private constant [7 x i8] c"Parser\00" @tn.str.193 = private constant [8 x i8] c"*Parser\00" @tn.str.194 = private constant [25 x i8] c"(string, JsonParseError)\00" @@ -97,7 +97,7 @@ @tn.str.197 = private constant [13 x i8] c"Architecture\00" @tn.str.198 = private constant [13 x i8] c"BuildOptions\00" @tn.str.199 = private constant [11 x i8] c"() -> bool\00" -@tn.str.200 = private constant [5 x i8] c"*s64\00" +@tn.str.200 = private constant [5 x i8] c"*i64\00" @tn.str.201 = private constant [9 x i8] c"CliError\00" @tn.str.202 = private constant [9 x i8] c"FlagSpec\00" @tn.str.203 = private constant [11 x i8] c"[]FlagSpec\00" @@ -110,12 +110,12 @@ @tn.str.210 = private constant [19 x i8] c"(Parsed, CliError)\00" @tn.str.211 = private constant [10 x i8] c"[]Command\00" @tn.str.212 = private constant [6 x i8] c"*Diag\00" -@tn.str.213 = private constant [7 x i8] c"[8]s64\00" +@tn.str.213 = private constant [7 x i8] c"[8]i64\00" @tn.str.214 = private constant [7 x i8] c"[64]u8\00" @tn.str.215 = private constant [7 x i8] c"Sha256\00" @tn.str.216 = private constant [8 x i8] c"*Sha256\00" @tn.str.217 = private constant [8 x i8] c"?[64]u8\00" -@tn.str.218 = private constant [8 x i8] c"[64]s64\00" +@tn.str.218 = private constant [8 x i8] c"[64]i64\00" @tn.str.219 = private constant [13 x i8] c"**CAllocator\00" @tn.str.220 = private constant [7 x i8] c"**void\00" @tn.str.221 = private constant [6 x i8] c"[]Any\00" @@ -127,7 +127,7 @@ @tn.str.227 = private constant [7 x i8] c"[1]Any\00" @tn.str.228 = private constant [8 x i8] c"*[1]Any\00" @tn.str.229 = private constant [6 x i8] c"*bool\00" -@tn.str.230 = private constant [8 x i8] c"*[4]s64\00" +@tn.str.230 = private constant [8 x i8] c"*[4]i64\00" @tn.str.231 = private constant [5 x i8] c"*f64\00" @tn.str.232 = private constant [17 x i8] c"*Source_Location\00" @tn.str.233 = private constant [11 x i8] c"*Allocator\00" @@ -145,9 +145,9 @@ @tn.str.245 = private constant [17 x i8] c"*OperatingSystem\00" @tn.str.246 = private constant [14 x i8] c"*Architecture\00" @tn.str.247 = private constant [15 x i8] c"*[16]FlagValue\00" -@tn.str.248 = private constant [8 x i8] c"*[8]s64\00" +@tn.str.248 = private constant [8 x i8] c"*[8]i64\00" @tn.str.249 = private constant [8 x i8] c"*[64]u8\00" -@tn.str.250 = private constant [9 x i8] c"*[64]s64\00" +@tn.str.250 = private constant [9 x i8] c"*[64]i64\00" @tn.str.251 = private constant [10 x i8] c"*[]string\00" @tn.str.252 = private constant [6 x i8] c"*[]u8\00" @tn.str.253 = private constant [12 x i8] c"*[]FlagSpec\00" @@ -160,7 +160,7 @@ @tn.str.260 = private constant [20 x i8] c"**TrackingAllocator\00" @tn.str.261 = private constant [7 x i8] c"**File\00" @tn.str.262 = private constant [5 x i8] c"**u8\00" -@tn.str.263 = private constant [6 x i8] c"**s32\00" +@tn.str.263 = private constant [6 x i8] c"**i32\00" @tn.str.264 = private constant [11 x i8] c"**SockAddr\00" @tn.str.265 = private constant [6 x i8] c"**u32\00" @tn.str.266 = private constant [10 x i8] c"*[*]Value\00" @@ -169,7 +169,7 @@ @tn.str.269 = private constant [9 x i8] c"**Object\00" @tn.str.270 = private constant [7 x i8] c"**Sink\00" @tn.str.271 = private constant [9 x i8] c"**Parser\00" -@tn.str.272 = private constant [6 x i8] c"**s64\00" +@tn.str.272 = private constant [6 x i8] c"**i64\00" @tn.str.273 = private constant [9 x i8] c"**Parsed\00" @tn.str.274 = private constant [7 x i8] c"**Diag\00" @tn.str.275 = private constant [9 x i8] c"**Sha256\00" @@ -542,7 +542,7 @@ @str.639 = private unnamed_addr constant [4 x i8] c"*u8\00", align 1 @str.640 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.641 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.642 = private unnamed_addr constant [5 x i8] c"*s32\00", align 1 +@str.642 = private unnamed_addr constant [5 x i8] c"*i32\00", align 1 @str.643 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.644 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.645 = private unnamed_addr constant [10 x i8] c"*SockAddr\00", align 1 @@ -569,7 +569,7 @@ @str.666 = private unnamed_addr constant [8 x i8] c"*Parser\00", align 1 @str.667 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.668 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.669 = private unnamed_addr constant [5 x i8] c"*s64\00", align 1 +@str.669 = private unnamed_addr constant [5 x i8] c"*i64\00", align 1 @str.670 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.671 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.672 = private unnamed_addr constant [8 x i8] c"*Parsed\00", align 1 @@ -1944,7 +1944,7 @@ dispatch.case.265: ; preds = %match.arm.47 %ua.raw174 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr175 = inttoptr i64 %ua.raw174 to ptr %ua.load176 = load [4 x i64], ptr %ua.ptr175, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %ua.load176) + %callN = call { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %ua.load176) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.263 @@ -1960,7 +1960,7 @@ dispatch.case.267: ; preds = %match.arm.47 %ua.raw182 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr183 = inttoptr i64 %ua.raw182 to ptr %ua.load184 = load [8 x i64], ptr %ua.ptr183, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %ua.load184) + %callN = call { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %ua.load184) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.263 @@ -1976,7 +1976,7 @@ dispatch.case.269: ; preds = %match.arm.47 %ua.raw190 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr191 = inttoptr i64 %ua.raw190 to ptr %ua.load192 = load [64 x i64], ptr %ua.ptr191, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %ua.load192) + %callN = call { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %ua.load192) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.263 @@ -2127,7 +2127,7 @@ dispatch.case.350: ; preds = %match.arm.49 dispatch.case.351: ; preds = %match.arm.49 %ua.raw253 = extractvalue { i64, i64 } %loadN, 1 %iNp254 = inttoptr i64 %ua.raw253 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %iNp254) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %iNp254) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.339 @@ -2190,7 +2190,7 @@ dispatch.case.359: ; preds = %match.arm.49 dispatch.case.360: ; preds = %match.arm.49 %ua.raw280 = extractvalue { i64, i64 } %loadN, 1 %iNp281 = inttoptr i64 %ua.raw280 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %iNp281) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %iNp281) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.339 @@ -3440,10 +3440,10 @@ declare void @assert.107(ptr, i1) #0 ; Function Attrs: nounwind define i32 @main() #0 { entry: - %call = call i64 @tagged__ct_7__pack_s64_s64_s64(ptr @__sx_default_context, i64 1, i64 2, i64 3) - call void @print__ct_sbc6305862a3a863d__pack_s64(ptr @__sx_default_context, i64 %call) + %call = call i64 @tagged__ct_7__pack_i64_i64_i64(ptr @__sx_default_context, i64 1, i64 2, i64 3) + call void @print__ct_sbc6305862a3a863d__pack_i64(ptr @__sx_default_context, i64 %call) %callN = call i64 @tagged__ct_9__pack(ptr @__sx_default_context) - call void @print__ct_sbc6305862a3a863d__pack_s64(ptr @__sx_default_context, i64 %callN) + call void @print__ct_sbc6305862a3a863d__pack_i64(ptr @__sx_default_context, i64 %callN) ret i32 0 } @@ -3462,7 +3462,7 @@ entry: } ; Function Attrs: nounwind -define internal i64 @tagged__ct_7__pack_s64_s64_s64(ptr %0, i64 %1, i64 %2, i64 %3) #0 { +define internal i64 @tagged__ct_7__pack_i64_i64_i64(ptr %0, i64 %1, i64 %2, i64 %3) #0 { entry: %alloca = alloca i64, align 8 store i64 7, ptr %alloca, align 8 @@ -3498,7 +3498,7 @@ entry: } ; Function Attrs: nounwind -define internal void @print__ct_sbc6305862a3a863d__pack_s64(ptr %0, i64 %1) #0 { +define internal void @print__ct_sbc6305862a3a863d__pack_i64(ptr %0, i64 %1) #0 { entry: %alloca = alloca { ptr, i64 }, align 8 store { ptr, i64 } { ptr @str.309, i64 3 }, ptr %alloca, align 8 @@ -3635,14 +3635,14 @@ fv.case: ; preds = %if.merge.125 fv.case17: ; preds = %if.merge.125 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.125 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.125 @@ -4338,8 +4338,8 @@ fv.default: ; preds = %if.merge.170 fv.case: ; preds = %if.merge.170 %fv.field = extractvalue { i32 } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge } @@ -4422,14 +4422,14 @@ fv.case: ; preds = %if.merge.175 fv.case17: ; preds = %if.merge.175 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.175 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.175 @@ -4514,8 +4514,8 @@ fv.default: ; preds = %if.merge.180 fv.case: ; preds = %if.merge.180 %fv.field = extractvalue { i32, { ptr, i64 } } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case17: ; preds = %if.merge.180 @@ -5916,7 +5916,7 @@ if.merge.262: ; preds = %if.then.261, %entry } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %1) #0 { entry: %alloca = alloca [4 x i64], align 8 %ig.tmp = alloca [4 x i64], align 8 @@ -6019,7 +6019,7 @@ if.merge.281: ; preds = %if.then.280, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %1) #0 { entry: %alloca = alloca [8 x i64], align 8 %ig.tmp = alloca [8 x i64], align 8 @@ -6120,7 +6120,7 @@ if.merge.291: ; preds = %if.then.290, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %1) #0 { entry: %alloca = alloca [64 x i64], align 8 %ig.tmp = alloca [64 x i64], align 8 @@ -6823,7 +6823,7 @@ if.merge.414: ; preds = %if.else.413, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 @@ -7073,7 +7073,7 @@ if.merge.441: ; preds = %if.else.440, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 diff --git a/examples/expected/0517-packs-pack-reflection-intrinsics.stdout b/examples/expected/0517-packs-pack-reflection-intrinsics.stdout index 1f552fa..1e02aa5 100644 --- a/examples/expected/0517-packs-pack-reflection-intrinsics.stdout +++ b/examples/expected/0517-packs-pack-reflection-intrinsics.stdout @@ -1,8 +1,8 @@ -s64 string bool +i64 string bool true false true false inline-if folded: same Allocator/CAllocator: true -Allocator/s64: false -Wrap(s64)/s32: true -Wrap(s64)/bool: false -Wrap(bool)/s32: false +Allocator/i64: false +Wrap(i64)/i32: true +Wrap(i64)/bool: false +Wrap(bool)/i32: false diff --git a/examples/expected/0518-packs-pack-value-dispatch.ir b/examples/expected/0518-packs-pack-value-dispatch.ir index 3aabe1e..c510e4d 100644 --- a/examples/expected/0518-packs-pack-value-dispatch.ir +++ b/examples/expected/0518-packs-pack-value-dispatch.ir @@ -25,10 +25,10 @@ @tag_names = private constant [14 x { ptr, i64 }] [{ ptr, i64 } { ptr @tag.str, i64 0 }, { ptr, i64 } { ptr @tag.str.114, i64 8 }, { ptr, i64 } { ptr @tag.str.115, i64 2 }, { ptr, i64 } { ptr @tag.str.116, i64 15 }, { ptr, i64 } { ptr @tag.str.117, i64 13 }, { ptr, i64 } { ptr @tag.str.118, i64 9 }, { ptr, i64 } { ptr @tag.str.119, i64 9 }, { ptr, i64 } { ptr @tag.str.120, i64 15 }, { ptr, i64 } { ptr @tag.str.121, i64 14 }, { ptr, i64 } { ptr @tag.str.122, i64 14 }, { ptr, i64 } { ptr @tag.str.123, i64 11 }, { ptr, i64 } { ptr @tag.str.124, i64 12 }, { ptr, i64 } { ptr @tag.str.125, i64 15 }, { ptr, i64 } { ptr @tag.str.126, i64 12 }] @tn.str = private constant [13 x i8] c"\00" @tn.str.127 = private constant [5 x i8] c"bool\00" -@tn.str.128 = private constant [3 x i8] c"s8\00" -@tn.str.129 = private constant [4 x i8] c"s16\00" -@tn.str.130 = private constant [4 x i8] c"s32\00" -@tn.str.131 = private constant [4 x i8] c"s64\00" +@tn.str.128 = private constant [3 x i8] c"i8\00" +@tn.str.129 = private constant [4 x i8] c"i16\00" +@tn.str.130 = private constant [4 x i8] c"i32\00" +@tn.str.131 = private constant [4 x i8] c"i64\00" @tn.str.132 = private constant [3 x i8] c"u8\00" @tn.str.133 = private constant [4 x i8] c"u16\00" @tn.str.134 = private constant [4 x i8] c"u32\00" @@ -45,7 +45,7 @@ @tn.str.145 = private constant [16 x i8] c"Source_Location\00" @tn.str.146 = private constant [10 x i8] c"Allocator\00" @tn.str.147 = private constant [8 x i8] c"Context\00" -@tn.str.148 = private constant [7 x i8] c"[4]s64\00" +@tn.str.148 = private constant [7 x i8] c"[4]i64\00" @tn.str.149 = private constant [9 x i8] c"[]string\00" @tn.str.150 = private constant [11 x i8] c"CAllocator\00" @tn.str.151 = private constant [12 x i8] c"*CAllocator\00" @@ -70,7 +70,7 @@ @tn.str.170 = private constant [4 x i8] c"*u8\00" @tn.str.171 = private constant [14 x i8] c"ProcessResult\00" @tn.str.172 = private constant [15 x i8] c"?ProcessResult\00" -@tn.str.173 = private constant [5 x i8] c"*s32\00" +@tn.str.173 = private constant [5 x i8] c"*i32\00" @tn.str.174 = private constant [9 x i8] c"SockAddr\00" @tn.str.175 = private constant [10 x i8] c"*SockAddr\00" @tn.str.176 = private constant [5 x i8] c"*u32\00" @@ -86,9 +86,9 @@ @tn.str.186 = private constant [5 x i8] c"[]u8\00" @tn.str.187 = private constant [5 x i8] c"Sink\00" @tn.str.188 = private constant [6 x i8] c"*Sink\00" -@tn.str.189 = private constant [17 x i8] c"(s64, JsonError)\00" +@tn.str.189 = private constant [17 x i8] c"(i64, JsonError)\00" @tn.str.190 = private constant [15 x i8] c"JsonParseError\00" -@tn.str.191 = private constant [22 x i8] c"(s64, JsonParseError)\00" +@tn.str.191 = private constant [22 x i8] c"(i64, JsonParseError)\00" @tn.str.192 = private constant [7 x i8] c"Parser\00" @tn.str.193 = private constant [8 x i8] c"*Parser\00" @tn.str.194 = private constant [25 x i8] c"(string, JsonParseError)\00" @@ -97,7 +97,7 @@ @tn.str.197 = private constant [13 x i8] c"Architecture\00" @tn.str.198 = private constant [13 x i8] c"BuildOptions\00" @tn.str.199 = private constant [11 x i8] c"() -> bool\00" -@tn.str.200 = private constant [5 x i8] c"*s64\00" +@tn.str.200 = private constant [5 x i8] c"*i64\00" @tn.str.201 = private constant [9 x i8] c"CliError\00" @tn.str.202 = private constant [9 x i8] c"FlagSpec\00" @tn.str.203 = private constant [11 x i8] c"[]FlagSpec\00" @@ -110,12 +110,12 @@ @tn.str.210 = private constant [19 x i8] c"(Parsed, CliError)\00" @tn.str.211 = private constant [10 x i8] c"[]Command\00" @tn.str.212 = private constant [6 x i8] c"*Diag\00" -@tn.str.213 = private constant [7 x i8] c"[8]s64\00" +@tn.str.213 = private constant [7 x i8] c"[8]i64\00" @tn.str.214 = private constant [7 x i8] c"[64]u8\00" @tn.str.215 = private constant [7 x i8] c"Sha256\00" @tn.str.216 = private constant [8 x i8] c"*Sha256\00" @tn.str.217 = private constant [8 x i8] c"?[64]u8\00" -@tn.str.218 = private constant [8 x i8] c"[64]s64\00" +@tn.str.218 = private constant [8 x i8] c"[64]i64\00" @tn.str.219 = private constant [13 x i8] c"**CAllocator\00" @tn.str.220 = private constant [7 x i8] c"**void\00" @tn.str.221 = private constant [6 x i8] c"[]Any\00" @@ -126,7 +126,7 @@ @tn.str.226 = private constant [8 x i8] c"*string\00" @tn.str.227 = private constant [6 x i8] c"*bool\00" @tn.str.228 = private constant [5 x i8] c"*f64\00" -@tn.str.229 = private constant [8 x i8] c"*[4]s64\00" +@tn.str.229 = private constant [8 x i8] c"*[4]i64\00" @tn.str.230 = private constant [17 x i8] c"*Source_Location\00" @tn.str.231 = private constant [11 x i8] c"*Allocator\00" @tn.str.232 = private constant [9 x i8] c"*Context\00" @@ -143,9 +143,9 @@ @tn.str.243 = private constant [17 x i8] c"*OperatingSystem\00" @tn.str.244 = private constant [14 x i8] c"*Architecture\00" @tn.str.245 = private constant [15 x i8] c"*[16]FlagValue\00" -@tn.str.246 = private constant [8 x i8] c"*[8]s64\00" +@tn.str.246 = private constant [8 x i8] c"*[8]i64\00" @tn.str.247 = private constant [8 x i8] c"*[64]u8\00" -@tn.str.248 = private constant [9 x i8] c"*[64]s64\00" +@tn.str.248 = private constant [9 x i8] c"*[64]i64\00" @tn.str.249 = private constant [10 x i8] c"*[]string\00" @tn.str.250 = private constant [6 x i8] c"*[]u8\00" @tn.str.251 = private constant [12 x i8] c"*[]FlagSpec\00" @@ -158,7 +158,7 @@ @tn.str.258 = private constant [20 x i8] c"**TrackingAllocator\00" @tn.str.259 = private constant [7 x i8] c"**File\00" @tn.str.260 = private constant [5 x i8] c"**u8\00" -@tn.str.261 = private constant [6 x i8] c"**s32\00" +@tn.str.261 = private constant [6 x i8] c"**i32\00" @tn.str.262 = private constant [11 x i8] c"**SockAddr\00" @tn.str.263 = private constant [6 x i8] c"**u32\00" @tn.str.264 = private constant [10 x i8] c"*[*]Value\00" @@ -167,7 +167,7 @@ @tn.str.267 = private constant [9 x i8] c"**Object\00" @tn.str.268 = private constant [7 x i8] c"**Sink\00" @tn.str.269 = private constant [9 x i8] c"**Parser\00" -@tn.str.270 = private constant [6 x i8] c"**s64\00" +@tn.str.270 = private constant [6 x i8] c"**i64\00" @tn.str.271 = private constant [9 x i8] c"**Parsed\00" @tn.str.272 = private constant [7 x i8] c"**Diag\00" @tn.str.273 = private constant [9 x i8] c"**Sha256\00" @@ -207,13 +207,13 @@ @str.306 = private unnamed_addr constant [5 x i8] c")); \00", align 1 @str.307 = private unnamed_addr constant [3 x i8] c"hi\00", align 1 @str.308 = private unnamed_addr constant [6 x i8] c"hello\00", align 1 -@str.309 = private unnamed_addr constant [4 x i8] c"s64\00", align 1 +@str.309 = private unnamed_addr constant [4 x i8] c"i64\00", align 1 @str.310 = private unnamed_addr constant [4 x i8] c"{}\0A\00", align 1 @str.311 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1 @str.312 = private unnamed_addr constant [4 x i8] c"{}\0A\00", align 1 @str.313 = private unnamed_addr constant [7 x i8] c"string\00", align 1 @str.314 = private unnamed_addr constant [4 x i8] c"f64\00", align 1 -@str.315 = private unnamed_addr constant [8 x i8] c"got s64\00", align 1 +@str.315 = private unnamed_addr constant [8 x i8] c"got i64\00", align 1 @str.316 = private unnamed_addr constant [11 x i8] c"got string\00", align 1 @str.317 = private unnamed_addr constant [9 x i8] c"got bool\00", align 1 @str.318 = private unnamed_addr constant [10 x i8] c"got other\00", align 1 @@ -546,7 +546,7 @@ @str.643 = private unnamed_addr constant [4 x i8] c"*u8\00", align 1 @str.644 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.645 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.646 = private unnamed_addr constant [5 x i8] c"*s32\00", align 1 +@str.646 = private unnamed_addr constant [5 x i8] c"*i32\00", align 1 @str.647 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.648 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.649 = private unnamed_addr constant [10 x i8] c"*SockAddr\00", align 1 @@ -573,7 +573,7 @@ @str.670 = private unnamed_addr constant [8 x i8] c"*Parser\00", align 1 @str.671 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.672 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.673 = private unnamed_addr constant [5 x i8] c"*s64\00", align 1 +@str.673 = private unnamed_addr constant [5 x i8] c"*i64\00", align 1 @str.674 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.675 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.676 = private unnamed_addr constant [8 x i8] c"*Parsed\00", align 1 @@ -1946,7 +1946,7 @@ dispatch.case.265: ; preds = %match.arm.47 %ua.raw174 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr175 = inttoptr i64 %ua.raw174 to ptr %ua.load176 = load [4 x i64], ptr %ua.ptr175, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %ua.load176) + %callN = call { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %ua.load176) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.263 @@ -1962,7 +1962,7 @@ dispatch.case.267: ; preds = %match.arm.47 %ua.raw182 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr183 = inttoptr i64 %ua.raw182 to ptr %ua.load184 = load [8 x i64], ptr %ua.ptr183, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %ua.load184) + %callN = call { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %ua.load184) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.263 @@ -1978,7 +1978,7 @@ dispatch.case.269: ; preds = %match.arm.47 %ua.raw190 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr191 = inttoptr i64 %ua.raw190 to ptr %ua.load192 = load [64 x i64], ptr %ua.ptr191, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %ua.load192) + %callN = call { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %ua.load192) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.263 @@ -2121,7 +2121,7 @@ dispatch.case.344: ; preds = %match.arm.49 dispatch.case.345: ; preds = %match.arm.49 %ua.raw249 = extractvalue { i64, i64 } %loadN, 1 %iNp250 = inttoptr i64 %ua.raw249 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %iNp250) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %iNp250) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.333 @@ -2184,7 +2184,7 @@ dispatch.case.353: ; preds = %match.arm.49 dispatch.case.354: ; preds = %match.arm.49 %ua.raw276 = extractvalue { i64, i64 } %loadN, 1 %iNp277 = inttoptr i64 %ua.raw276 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %iNp277) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %iNp277) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.333 @@ -3434,13 +3434,13 @@ declare void @assert.107(ptr, i1) #0 ; Function Attrs: nounwind define i32 @main() #0 { entry: - %call = call { ptr, i64 } @show__pack_s64(ptr @__sx_default_context, i64 42) + %call = call { ptr, i64 } @show__pack_i64(ptr @__sx_default_context, i64 42) call void @print__ct_sbc6305862a3a863d__pack_string(ptr @__sx_default_context, { ptr, i64 } %call) %callN = call { ptr, i64 } @show__pack_string(ptr @__sx_default_context, { ptr, i64 } { ptr @str.307, i64 2 }) call void @print__ct_sbc6305862a3a863d__pack_string(ptr @__sx_default_context, { ptr, i64 } %callN) %callN = call { ptr, i64 } @show__pack_f64(ptr @__sx_default_context, double 3.140000e+00) call void @print__ct_sbc6305862a3a863d__pack_string(ptr @__sx_default_context, { ptr, i64 } %callN) - %callN = call { ptr, i64 } @describe__pack_s64(ptr @__sx_default_context, i64 42) + %callN = call { ptr, i64 } @describe__pack_i64(ptr @__sx_default_context, i64 42) call void @print__ct_sbc6305862a3a863d__pack_string(ptr @__sx_default_context, { ptr, i64 } %callN) %callN = call { ptr, i64 } @describe__pack_string(ptr @__sx_default_context, { ptr, i64 } { ptr @str.308, i64 5 }) call void @print__ct_sbc6305862a3a863d__pack_string(ptr @__sx_default_context, { ptr, i64 } %callN) @@ -3466,7 +3466,7 @@ entry: } ; Function Attrs: nounwind -define internal { ptr, i64 } @show__pack_s64(ptr %0, i64 %1) #0 { +define internal { ptr, i64 } @show__pack_i64(ptr %0, i64 %1) #0 { entry: %alloca = alloca i64, align 8 store i64 %1, ptr %alloca, align 8 @@ -3578,7 +3578,7 @@ entry: } ; Function Attrs: nounwind -define internal { ptr, i64 } @describe__pack_s64(ptr %0, i64 %1) #0 { +define internal { ptr, i64 } @describe__pack_i64(ptr %0, i64 %1) #0 { entry: %alloca = alloca i64, align 8 store i64 %1, ptr %alloca, align 8 @@ -3735,14 +3735,14 @@ fv.case: ; preds = %if.merge.125 fv.case17: ; preds = %if.merge.125 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.125 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.125 @@ -4438,8 +4438,8 @@ fv.default: ; preds = %if.merge.170 fv.case: ; preds = %if.merge.170 %fv.field = extractvalue { i32 } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge } @@ -4522,14 +4522,14 @@ fv.case: ; preds = %if.merge.175 fv.case17: ; preds = %if.merge.175 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.175 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.175 @@ -4614,8 +4614,8 @@ fv.default: ; preds = %if.merge.180 fv.case: ; preds = %if.merge.180 %fv.field = extractvalue { i32, { ptr, i64 } } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case17: ; preds = %if.merge.180 @@ -6016,7 +6016,7 @@ if.merge.262: ; preds = %if.then.261, %entry } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %1) #0 { entry: %alloca = alloca [4 x i64], align 8 %ig.tmp = alloca [4 x i64], align 8 @@ -6119,7 +6119,7 @@ if.merge.280: ; preds = %if.then.279, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %1) #0 { entry: %alloca = alloca [8 x i64], align 8 %ig.tmp = alloca [8 x i64], align 8 @@ -6220,7 +6220,7 @@ if.merge.290: ; preds = %if.then.289, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %1) #0 { entry: %alloca = alloca [64 x i64], align 8 %ig.tmp = alloca [64 x i64], align 8 @@ -6870,7 +6870,7 @@ if.merge.408: ; preds = %if.else.407, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 @@ -7120,7 +7120,7 @@ if.merge.435: ; preds = %if.else.434, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 diff --git a/examples/expected/0518-packs-pack-value-dispatch.stdout b/examples/expected/0518-packs-pack-value-dispatch.stdout index e468731..6d2d241 100644 --- a/examples/expected/0518-packs-pack-value-dispatch.stdout +++ b/examples/expected/0518-packs-pack-value-dispatch.stdout @@ -1,7 +1,7 @@ -s64 +i64 string f64 -got s64 +got i64 got string got bool got other diff --git a/examples/expected/0520-packs-pack-dynamic-type-name.stdout b/examples/expected/0520-packs-pack-dynamic-type-name.stdout index 1a7ebe4..990cee7 100644 --- a/examples/expected/0520-packs-pack-dynamic-type-name.stdout +++ b/examples/expected/0520-packs-pack-dynamic-type-name.stdout @@ -1,3 +1,3 @@ -s64string +i64string --- build done --- rt diff --git a/examples/expected/0521-packs-pack-builder-smoke.stdout b/examples/expected/0521-packs-pack-builder-smoke.stdout index f8d3158..51dfdfd 100644 --- a/examples/expected/0521-packs-pack-builder-smoke.stdout +++ b/examples/expected/0521-packs-pack-builder-smoke.stdout @@ -1,6 +1,6 @@ [] -[s64] -[s64, string] -[bool, f64, string, s64] +[i64] +[i64, string] +[bool, f64, string, i64] --- build done --- rt diff --git a/examples/expected/0522-packs-pack-bare-args-cross-call.stdout b/examples/expected/0522-packs-pack-bare-args-cross-call.stdout index 2eac860..de015d4 100644 --- a/examples/expected/0522-packs-pack-bare-args-cross-call.stdout +++ b/examples/expected/0522-packs-pack-bare-args-cross-call.stdout @@ -1,6 +1,6 @@ 0: [] -1: [s64] -3: [s64, string, bool] -5: [s64, f64, string, bool, s64] +1: [i64] +3: [i64, string, bool] +5: [i64, f64, string, bool, i64] --- build done --- rt diff --git a/examples/expected/0527-packs-pack-non-conform.stderr b/examples/expected/0527-packs-pack-non-conform.stderr index 283225b..c4c66bd 100644 --- a/examples/expected/0527-packs-pack-non-conform.stderr +++ b/examples/expected/0527-packs-pack-non-conform.stderr @@ -1,5 +1,5 @@ error: pack argument of type 'Naked' does not conform to protocol 'Show' - --> /Users/agra/projects/sx/examples/0527-packs-pack-non-conform.sx:22:30 + --> examples/0527-packs-pack-non-conform.sx:22:30 | 22 | print("{}\n", howmany(a, n)); // `n` does not conform to Show | ^ diff --git a/examples/expected/0528-packs-protocol-pack-methods.ir b/examples/expected/0528-packs-protocol-pack-methods.ir index f4cfd96..920382f 100644 --- a/examples/expected/0528-packs-protocol-pack-methods.ir +++ b/examples/expected/0528-packs-protocol-pack-methods.ir @@ -25,10 +25,10 @@ @tag_names = private constant [14 x { ptr, i64 }] [{ ptr, i64 } { ptr @tag.str, i64 0 }, { ptr, i64 } { ptr @tag.str.114, i64 8 }, { ptr, i64 } { ptr @tag.str.115, i64 2 }, { ptr, i64 } { ptr @tag.str.116, i64 15 }, { ptr, i64 } { ptr @tag.str.117, i64 13 }, { ptr, i64 } { ptr @tag.str.118, i64 9 }, { ptr, i64 } { ptr @tag.str.119, i64 9 }, { ptr, i64 } { ptr @tag.str.120, i64 15 }, { ptr, i64 } { ptr @tag.str.121, i64 14 }, { ptr, i64 } { ptr @tag.str.122, i64 14 }, { ptr, i64 } { ptr @tag.str.123, i64 11 }, { ptr, i64 } { ptr @tag.str.124, i64 12 }, { ptr, i64 } { ptr @tag.str.125, i64 15 }, { ptr, i64 } { ptr @tag.str.126, i64 12 }] @tn.str = private constant [13 x i8] c"\00" @tn.str.127 = private constant [5 x i8] c"bool\00" -@tn.str.128 = private constant [3 x i8] c"s8\00" -@tn.str.129 = private constant [4 x i8] c"s16\00" -@tn.str.130 = private constant [4 x i8] c"s32\00" -@tn.str.131 = private constant [4 x i8] c"s64\00" +@tn.str.128 = private constant [3 x i8] c"i8\00" +@tn.str.129 = private constant [4 x i8] c"i16\00" +@tn.str.130 = private constant [4 x i8] c"i32\00" +@tn.str.131 = private constant [4 x i8] c"i64\00" @tn.str.132 = private constant [3 x i8] c"u8\00" @tn.str.133 = private constant [4 x i8] c"u16\00" @tn.str.134 = private constant [4 x i8] c"u32\00" @@ -45,7 +45,7 @@ @tn.str.145 = private constant [16 x i8] c"Source_Location\00" @tn.str.146 = private constant [10 x i8] c"Allocator\00" @tn.str.147 = private constant [8 x i8] c"Context\00" -@tn.str.148 = private constant [7 x i8] c"[4]s64\00" +@tn.str.148 = private constant [7 x i8] c"[4]i64\00" @tn.str.149 = private constant [9 x i8] c"[]string\00" @tn.str.150 = private constant [11 x i8] c"CAllocator\00" @tn.str.151 = private constant [12 x i8] c"*CAllocator\00" @@ -70,7 +70,7 @@ @tn.str.170 = private constant [4 x i8] c"*u8\00" @tn.str.171 = private constant [14 x i8] c"ProcessResult\00" @tn.str.172 = private constant [15 x i8] c"?ProcessResult\00" -@tn.str.173 = private constant [5 x i8] c"*s32\00" +@tn.str.173 = private constant [5 x i8] c"*i32\00" @tn.str.174 = private constant [9 x i8] c"SockAddr\00" @tn.str.175 = private constant [10 x i8] c"*SockAddr\00" @tn.str.176 = private constant [5 x i8] c"*u32\00" @@ -86,9 +86,9 @@ @tn.str.186 = private constant [5 x i8] c"[]u8\00" @tn.str.187 = private constant [5 x i8] c"Sink\00" @tn.str.188 = private constant [6 x i8] c"*Sink\00" -@tn.str.189 = private constant [17 x i8] c"(s64, JsonError)\00" +@tn.str.189 = private constant [17 x i8] c"(i64, JsonError)\00" @tn.str.190 = private constant [15 x i8] c"JsonParseError\00" -@tn.str.191 = private constant [22 x i8] c"(s64, JsonParseError)\00" +@tn.str.191 = private constant [22 x i8] c"(i64, JsonParseError)\00" @tn.str.192 = private constant [7 x i8] c"Parser\00" @tn.str.193 = private constant [8 x i8] c"*Parser\00" @tn.str.194 = private constant [25 x i8] c"(string, JsonParseError)\00" @@ -97,7 +97,7 @@ @tn.str.197 = private constant [13 x i8] c"Architecture\00" @tn.str.198 = private constant [13 x i8] c"BuildOptions\00" @tn.str.199 = private constant [11 x i8] c"() -> bool\00" -@tn.str.200 = private constant [5 x i8] c"*s64\00" +@tn.str.200 = private constant [5 x i8] c"*i64\00" @tn.str.201 = private constant [9 x i8] c"CliError\00" @tn.str.202 = private constant [9 x i8] c"FlagSpec\00" @tn.str.203 = private constant [11 x i8] c"[]FlagSpec\00" @@ -110,12 +110,12 @@ @tn.str.210 = private constant [19 x i8] c"(Parsed, CliError)\00" @tn.str.211 = private constant [10 x i8] c"[]Command\00" @tn.str.212 = private constant [6 x i8] c"*Diag\00" -@tn.str.213 = private constant [7 x i8] c"[8]s64\00" +@tn.str.213 = private constant [7 x i8] c"[8]i64\00" @tn.str.214 = private constant [7 x i8] c"[64]u8\00" @tn.str.215 = private constant [7 x i8] c"Sha256\00" @tn.str.216 = private constant [8 x i8] c"*Sha256\00" @tn.str.217 = private constant [8 x i8] c"?[64]u8\00" -@tn.str.218 = private constant [8 x i8] c"[64]s64\00" +@tn.str.218 = private constant [8 x i8] c"[64]i64\00" @tn.str.219 = private constant [8 x i8] c"Greeter\00" @tn.str.220 = private constant [18 x i8] c"__Greeter__Vtable\00" @tn.str.221 = private constant [4 x i8] c"Dog\00" @@ -136,7 +136,7 @@ @tn.str.236 = private constant [7 x i8] c"[1]Any\00" @tn.str.237 = private constant [8 x i8] c"*[1]Any\00" @tn.str.238 = private constant [6 x i8] c"*bool\00" -@tn.str.239 = private constant [8 x i8] c"*[4]s64\00" +@tn.str.239 = private constant [8 x i8] c"*[4]i64\00" @tn.str.240 = private constant [5 x i8] c"*f64\00" @tn.str.241 = private constant [17 x i8] c"*Source_Location\00" @tn.str.242 = private constant [11 x i8] c"*Allocator\00" @@ -156,9 +156,9 @@ @tn.str.256 = private constant [17 x i8] c"*OperatingSystem\00" @tn.str.257 = private constant [14 x i8] c"*Architecture\00" @tn.str.258 = private constant [15 x i8] c"*[16]FlagValue\00" -@tn.str.259 = private constant [8 x i8] c"*[8]s64\00" +@tn.str.259 = private constant [8 x i8] c"*[8]i64\00" @tn.str.260 = private constant [8 x i8] c"*[64]u8\00" -@tn.str.261 = private constant [9 x i8] c"*[64]s64\00" +@tn.str.261 = private constant [9 x i8] c"*[64]i64\00" @tn.str.262 = private constant [10 x i8] c"*[]string\00" @tn.str.263 = private constant [6 x i8] c"*[]u8\00" @tn.str.264 = private constant [12 x i8] c"*[]FlagSpec\00" @@ -172,7 +172,7 @@ @tn.str.272 = private constant [20 x i8] c"**TrackingAllocator\00" @tn.str.273 = private constant [7 x i8] c"**File\00" @tn.str.274 = private constant [5 x i8] c"**u8\00" -@tn.str.275 = private constant [6 x i8] c"**s32\00" +@tn.str.275 = private constant [6 x i8] c"**i32\00" @tn.str.276 = private constant [11 x i8] c"**SockAddr\00" @tn.str.277 = private constant [6 x i8] c"**u32\00" @tn.str.278 = private constant [10 x i8] c"*[*]Value\00" @@ -181,7 +181,7 @@ @tn.str.281 = private constant [9 x i8] c"**Object\00" @tn.str.282 = private constant [7 x i8] c"**Sink\00" @tn.str.283 = private constant [9 x i8] c"**Parser\00" -@tn.str.284 = private constant [6 x i8] c"**s64\00" +@tn.str.284 = private constant [6 x i8] c"**i64\00" @tn.str.285 = private constant [9 x i8] c"**Parsed\00" @tn.str.286 = private constant [7 x i8] c"**Diag\00" @tn.str.287 = private constant [9 x i8] c"**Sha256\00" @@ -594,7 +594,7 @@ @str.691 = private unnamed_addr constant [4 x i8] c"*u8\00", align 1 @str.692 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.693 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.694 = private unnamed_addr constant [5 x i8] c"*s32\00", align 1 +@str.694 = private unnamed_addr constant [5 x i8] c"*i32\00", align 1 @str.695 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.696 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.697 = private unnamed_addr constant [10 x i8] c"*SockAddr\00", align 1 @@ -621,7 +621,7 @@ @str.718 = private unnamed_addr constant [8 x i8] c"*Parser\00", align 1 @str.719 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.720 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.721 = private unnamed_addr constant [5 x i8] c"*s64\00", align 1 +@str.721 = private unnamed_addr constant [5 x i8] c"*i64\00", align 1 @str.722 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.723 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.724 = private unnamed_addr constant [8 x i8] c"*Parsed\00", align 1 @@ -2058,7 +2058,7 @@ dispatch.case.289: ; preds = %match.arm.47 %ua.raw190 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr191 = inttoptr i64 %ua.raw190 to ptr %ua.load192 = load [4 x i64], ptr %ua.ptr191, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %ua.load192) + %callN = call { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %ua.load192) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.287 @@ -2074,7 +2074,7 @@ dispatch.case.291: ; preds = %match.arm.47 %ua.raw198 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr199 = inttoptr i64 %ua.raw198 to ptr %ua.load200 = load [8 x i64], ptr %ua.ptr199, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %ua.load200) + %callN = call { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %ua.load200) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.287 @@ -2090,7 +2090,7 @@ dispatch.case.293: ; preds = %match.arm.47 %ua.raw206 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr207 = inttoptr i64 %ua.raw206 to ptr %ua.load208 = load [64 x i64], ptr %ua.ptr207, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %ua.load208) + %callN = call { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %ua.load208) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.287 @@ -2249,7 +2249,7 @@ dispatch.case.380: ; preds = %match.arm.49 dispatch.case.381: ; preds = %match.arm.49 %ua.raw273 = extractvalue { i64, i64 } %loadN, 1 %iNp274 = inttoptr i64 %ua.raw273 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %iNp274) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %iNp274) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.369 @@ -2312,7 +2312,7 @@ dispatch.case.389: ; preds = %match.arm.49 dispatch.case.390: ; preds = %match.arm.49 %ua.raw300 = extractvalue { i64, i64 } %loadN, 1 %iNp301 = inttoptr i64 %ua.raw300 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %iNp301) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %iNp301) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.369 @@ -3623,14 +3623,14 @@ entry: %load = load { i64 }, ptr %alloca, align 8 %loadN = load { i64 }, ptr %allocaN, align 8 %call = call i64 @pair_sum__pack_Dog_Cat(ptr @__sx_default_context, { i64 } %load, { i64 } %loadN) - call void @print__ct_sa93836785e55c522__pack_s64(ptr @__sx_default_context, i64 %call) + call void @print__ct_sa93836785e55c522__pack_i64(ptr @__sx_default_context, i64 %call) %loadN = load { i64 }, ptr %allocaN, align 8 %loadN = load { i64 }, ptr %alloca, align 8 %callN = call i64 @pair_sum__pack_Cat_Dog(ptr @__sx_default_context, { i64 } %loadN, { i64 } %loadN) - call void @print__ct_sdcda2f2aa37cf168__pack_s64(ptr @__sx_default_context, i64 %callN) + call void @print__ct_sdcda2f2aa37cf168__pack_i64(ptr @__sx_default_context, i64 %callN) %loadN = load { i64 }, ptr %alloca, align 8 %callN = call i64 @pair_sum__pack_Dog_Dog(ptr @__sx_default_context, { i64 } %loadN, { i64 } { i64 4 }) - call void @print__ct_s1a602d8c97d1af91__pack_s64(ptr @__sx_default_context, i64 %callN) + call void @print__ct_s1a602d8c97d1af91__pack_i64(ptr @__sx_default_context, i64 %callN) ret i32 0 } @@ -3689,7 +3689,7 @@ entry: } ; Function Attrs: nounwind -define internal void @print__ct_sa93836785e55c522__pack_s64(ptr %0, i64 %1) #0 { +define internal void @print__ct_sa93836785e55c522__pack_i64(ptr %0, i64 %1) #0 { entry: %alloca = alloca { ptr, i64 }, align 8 store { ptr, i64 } { ptr @str.323, i64 11 }, ptr %alloca, align 8 @@ -3779,7 +3779,7 @@ entry: } ; Function Attrs: nounwind -define internal void @print__ct_sdcda2f2aa37cf168__pack_s64(ptr %0, i64 %1) #0 { +define internal void @print__ct_sdcda2f2aa37cf168__pack_i64(ptr %0, i64 %1) #0 { entry: %alloca = alloca { ptr, i64 }, align 8 store { ptr, i64 } { ptr @str.326, i64 11 }, ptr %alloca, align 8 @@ -3869,7 +3869,7 @@ entry: } ; Function Attrs: nounwind -define internal void @print__ct_s1a602d8c97d1af91__pack_s64(ptr %0, i64 %1) #0 { +define internal void @print__ct_s1a602d8c97d1af91__pack_i64(ptr %0, i64 %1) #0 { entry: %alloca = alloca { ptr, i64 }, align 8 store { ptr, i64 } { ptr @str.329, i64 11 }, ptr %alloca, align 8 @@ -3995,14 +3995,14 @@ fv.case: ; preds = %if.merge.129 fv.case17: ; preds = %if.merge.129 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.129 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.129 @@ -4698,8 +4698,8 @@ fv.default: ; preds = %if.merge.174 fv.case: ; preds = %if.merge.174 %fv.field = extractvalue { i32 } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge } @@ -4782,14 +4782,14 @@ fv.case: ; preds = %if.merge.179 fv.case17: ; preds = %if.merge.179 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.179 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.179 @@ -4874,8 +4874,8 @@ fv.default: ; preds = %if.merge.184 fv.case: ; preds = %if.merge.184 %fv.field = extractvalue { i32, { ptr, i64 } } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case17: ; preds = %if.merge.184 @@ -6561,7 +6561,7 @@ if.merge.286: ; preds = %if.then.285, %entry } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %1) #0 { entry: %alloca = alloca [4 x i64], align 8 %ig.tmp = alloca [4 x i64], align 8 @@ -6664,7 +6664,7 @@ if.merge.305: ; preds = %if.then.304, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %1) #0 { entry: %alloca = alloca [8 x i64], align 8 %ig.tmp = alloca [8 x i64], align 8 @@ -6765,7 +6765,7 @@ if.merge.315: ; preds = %if.then.314, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %1) #0 { entry: %alloca = alloca [64 x i64], align 8 %ig.tmp = alloca [64 x i64], align 8 @@ -7522,7 +7522,7 @@ if.merge.448: ; preds = %if.else.447, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 @@ -7772,7 +7772,7 @@ if.merge.475: ; preds = %if.else.474, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 diff --git a/examples/expected/0530-packs-pack-interface-only.stderr b/examples/expected/0530-packs-pack-interface-only.stderr index 8f1e235..3f64422 100644 --- a/examples/expected/0530-packs-pack-interface-only.stderr +++ b/examples/expected/0530-packs-pack-interface-only.stderr @@ -1,5 +1,5 @@ error: 'v' is not part of protocol 'Box' — a pack element exposes only the protocol's interface - --> /Users/agra/projects/sx/examples/0530-packs-pack-interface-only.sx:16:12 + --> examples/0530-packs-pack-interface-only.sx:16:12 | 16 | return xs[0].v; // `v` is not part of Box — error | ^^^^^^^ diff --git a/examples/expected/0536-packs-pack-as-value.stderr b/examples/expected/0536-packs-pack-as-value.stderr index cbd24b9..19fb1dd 100644 --- a/examples/expected/0536-packs-pack-as-value.stderr +++ b/examples/expected/0536-packs-pack-as-value.stderr @@ -23,12 +23,12 @@ help: materialize a tuple `(..xs)` to store it, or `xx xs` to convert it to an e error: pack 'xs' has no runtime value — a pack is comptime-only and can't be used as a value here --> examples/0536-packs-pack-as-value.sx:16:42 | -16 | ret :: (..xs: Show) -> s64 { return xs; } // C: return +16 | ret :: (..xs: Show) -> i64 { return xs; } // C: return | ^^ help: to return it, return a tuple `(..xs)` and make the return type that tuple | -16 | ret :: (..xs: Show) -> s64 { return xs; } // C: return +16 | ret :: (..xs: Show) -> i64 { return xs; } // C: return | ^^ error: pack 'xs' has no runtime value — a pack is comptime-only and can't be used as a value here diff --git a/examples/expected/0601-comptime-meta.stdout b/examples/expected/0601-comptime-meta.stdout index aea7668..49863b0 100644 --- a/examples/expected/0601-comptime-meta.stdout +++ b/examples/expected/0601-comptime-meta.stdout @@ -1,4 +1,4 @@ f64 3.200000 Vector(4,f32) -() -> s32 +() -> i32 diff --git a/examples/expected/0706-modules-import-non-transitive.stderr b/examples/expected/0706-modules-import-non-transitive.stderr index 7f12a8f..73bc659 100644 --- a/examples/expected/0706-modules-import-non-transitive.stderr +++ b/examples/expected/0706-modules-import-non-transitive.stderr @@ -1,17 +1,17 @@ error: 'c_only_fn' is not visible; #import the module that declares it - --> /Users/agra/projects/sx/examples/0706-modules-import-non-transitive.sx:15:37 + --> examples/0706-modules-import-non-transitive.sx:15:37 | 15 | print("c_only_fn direct: {}\n", c_only_fn()); | ^^^^^^^^^ error: 'c_only_const' is not visible; #import the module that declares it - --> /Users/agra/projects/sx/examples/0706-modules-import-non-transitive.sx:16:40 + --> examples/0706-modules-import-non-transitive.sx:16:40 | 16 | print("c_only_const direct: {}\n", c_only_const); | ^^^^^^^^^^^^ -error: unresolved 'c_only_const' (in /Users/agra/projects/sx/examples/0706-modules-import-non-transitive.sx fn main) - --> /Users/agra/projects/sx/examples/0706-modules-import-non-transitive.sx:16:40 +error: unresolved 'c_only_const' (in examples/0706-modules-import-non-transitive.sx fn main) + --> examples/0706-modules-import-non-transitive.sx:16:40 | 16 | print("c_only_const direct: {}\n", c_only_const); | ^^^^^^^^^^^^ diff --git a/examples/expected/0714-modules-json-reader.stdout b/examples/expected/0714-modules-json-reader.stdout index b4848e2..f251417 100644 --- a/examples/expected/0714-modules-json-reader.stdout +++ b/examples/expected/0714-modules-json-reader.stdout @@ -21,10 +21,10 @@ uni-len: ok uni-A: ok uni-e1: ok uni-e2: ok -uni-s0: ok -uni-s1: ok -uni-s2: ok -uni-s3: ok +uni-i0: ok +uni-i1: ok +uni-i2: ok +uni-i3: ok err-truncated: ok err-bad-escape: ok err-trailing-junk: ok diff --git a/examples/expected/0742-modules-namespaced-only-bare-const-not-visible.stderr b/examples/expected/0742-modules-namespaced-only-bare-const-not-visible.stderr index 20db2ca..1ba805d 100644 --- a/examples/expected/0742-modules-namespaced-only-bare-const-not-visible.stderr +++ b/examples/expected/0742-modules-namespaced-only-bare-const-not-visible.stderr @@ -1,5 +1,5 @@ error: array dimension must be a compile-time integer constant --> examples/0742-modules-namespaced-only-bare-const-not-visible.sx:13:12 | -13 | arr : [DEP_LEN]s32 = ---; +13 | arr : [DEP_LEN]i32 = ---; | ^^^^^^^ diff --git a/examples/expected/0763-modules-import-type-non-transitive.stderr b/examples/expected/0763-modules-import-type-non-transitive.stderr index 4402aed..5cf62e0 100644 --- a/examples/expected/0763-modules-import-type-non-transitive.stderr +++ b/examples/expected/0763-modules-import-type-non-transitive.stderr @@ -1,5 +1,5 @@ error: type 'COnly' is not visible; #import the module that declares it - --> /Users/agra/projects/sx/examples/0763-modules-import-type-non-transitive.sx:17:9 + --> examples/0763-modules-import-type-non-transitive.sx:17:9 | 17 | x : COnly = .{ v = 5 }; | ^^^^^ diff --git a/examples/expected/0764-modules-import-generic-head-non-transitive.stderr b/examples/expected/0764-modules-import-generic-head-non-transitive.stderr index d345115..7547a8c 100644 --- a/examples/expected/0764-modules-import-generic-head-non-transitive.stderr +++ b/examples/expected/0764-modules-import-generic-head-non-transitive.stderr @@ -1,5 +1,5 @@ error: type 'Box' is not visible; #import the module that declares it - --> /Users/agra/projects/sx/examples/0764-modules-import-generic-head-non-transitive.sx:21:9 + --> examples/0764-modules-import-generic-head-non-transitive.sx:21:9 | -21 | x : Box(s64) = .{ v = 3 }; +21 | x : Box(i64) = .{ v = 3 }; | ^^^^^^^^ diff --git a/examples/expected/0765-modules-import-reflection-type-non-transitive.stderr b/examples/expected/0765-modules-import-reflection-type-non-transitive.stderr index 49c25c6..1eed066 100644 --- a/examples/expected/0765-modules-import-reflection-type-non-transitive.stderr +++ b/examples/expected/0765-modules-import-reflection-type-non-transitive.stderr @@ -1,17 +1,17 @@ error: type 'Nums' is not visible; #import the module that declares it - --> /Users/agra/projects/sx/examples/0765-modules-import-reflection-type-non-transitive.sx:22:27 + --> examples/0765-modules-import-reflection-type-non-transitive.sx:22:27 | 22 | print("{}\n", size_of(Nums)); | ^^^^ error: type 'COnly' is not visible; #import the module that declares it - --> /Users/agra/projects/sx/examples/0765-modules-import-reflection-type-non-transitive.sx:23:28 + --> examples/0765-modules-import-reflection-type-non-transitive.sx:23:28 | 23 | print("{}\n", size_of(*COnly)); | ^^^^^ error: type 'Nums' is not visible; #import the module that declares it - --> /Users/agra/projects/sx/examples/0765-modules-import-reflection-type-non-transitive.sx:24:11 + --> examples/0765-modules-import-reflection-type-non-transitive.sx:24:11 | 24 | xs := Nums.[1, 2]; | ^^^^ diff --git a/examples/expected/0767-modules-ambiguous-bare-type-forms.stderr b/examples/expected/0767-modules-ambiguous-bare-type-forms.stderr index 42a400b..f8cc41a 100644 --- a/examples/expected/0767-modules-ambiguous-bare-type-forms.stderr +++ b/examples/expected/0767-modules-ambiguous-bare-type-forms.stderr @@ -13,7 +13,7 @@ error: type 'Nums' is ambiguous: it is declared in multiple flat-imported module error: type 'Box' is ambiguous: it is declared in multiple flat-imported modules; qualify the reference or remove the duplicate import --> examples/0767-modules-ambiguous-bare-type-forms.sx:35:9 | -35 | x : Box(s64) = .{ v = 3 }; +35 | x : Box(i64) = .{ v = 3 }; | ^^^^^^^^ error: type 'Thing' is ambiguous: it is declared in multiple flat-imported modules; qualify the reference or remove the duplicate import diff --git a/examples/expected/0769-modules-ambiguous-type-fn-head.stderr b/examples/expected/0769-modules-ambiguous-type-fn-head.stderr index 70c2974..304f856 100644 --- a/examples/expected/0769-modules-ambiguous-type-fn-head.stderr +++ b/examples/expected/0769-modules-ambiguous-type-fn-head.stderr @@ -1,5 +1,5 @@ error: type 'Make' is ambiguous: it is declared in multiple flat-imported modules; qualify the reference or remove the duplicate import --> examples/0769-modules-ambiguous-type-fn-head.sx:19:32 | -19 | print("size={}\n", size_of(Make(s64))); +19 | print("size={}\n", size_of(Make(i64))); | ^^^^ diff --git a/examples/expected/0770-modules-type-fn-head-non-transitive.stderr b/examples/expected/0770-modules-type-fn-head-non-transitive.stderr index 9cd0418..baf5d0b 100644 --- a/examples/expected/0770-modules-type-fn-head-non-transitive.stderr +++ b/examples/expected/0770-modules-type-fn-head-non-transitive.stderr @@ -1,5 +1,5 @@ error: type 'Make' is not visible; #import the module that declares it --> examples/0770-modules-type-fn-head-non-transitive.sx:21:32 | -21 | print("size={}\n", size_of(Make(s64))); +21 | print("size={}\n", size_of(Make(i64))); | ^^^^ diff --git a/examples/expected/0771-modules-type-fn-head-ordinary-fn-no-vouch.stderr b/examples/expected/0771-modules-type-fn-head-ordinary-fn-no-vouch.stderr index 7cfbbda..47920da 100644 --- a/examples/expected/0771-modules-type-fn-head-ordinary-fn-no-vouch.stderr +++ b/examples/expected/0771-modules-type-fn-head-ordinary-fn-no-vouch.stderr @@ -1,5 +1,5 @@ error: type 'Make' is not visible; #import the module that declares it --> examples/0771-modules-type-fn-head-ordinary-fn-no-vouch.sx:23:32 | -23 | print("size={}\n", size_of(Make(s64))); +23 | print("size={}\n", size_of(Make(i64))); | ^^^^ diff --git a/examples/expected/0775-modules-qualified-generic-missing-member.stderr b/examples/expected/0775-modules-qualified-generic-missing-member.stderr index 5789cc4..8959e0e 100644 --- a/examples/expected/0775-modules-qualified-generic-missing-member.stderr +++ b/examples/expected/0775-modules-qualified-generic-missing-member.stderr @@ -1,5 +1,5 @@ error: namespace 'a' has no member 'Box' --> examples/0775-modules-qualified-generic-missing-member.sx:20:9 | -20 | x : a.Box(s64) = .{ x = 1, y = 2 }; +20 | x : a.Box(i64) = .{ x = 1, y = 2 }; | ^^^^^^^^^^ diff --git a/examples/expected/0782-modules-bare-generic-instance-ambiguous-authors.stderr b/examples/expected/0782-modules-bare-generic-instance-ambiguous-authors.stderr index 0060e90..7658e8c 100644 --- a/examples/expected/0782-modules-bare-generic-instance-ambiguous-authors.stderr +++ b/examples/expected/0782-modules-bare-generic-instance-ambiguous-authors.stderr @@ -1,5 +1,5 @@ error: type 'Box' is ambiguous: it is declared in multiple flat-imported modules; qualify the reference or remove the duplicate import --> examples/0782-modules-bare-generic-instance-ambiguous-authors.sx:15:10 | -15 | x := Box(s64).make(7); +15 | x := Box(i64).make(7); | ^^^ diff --git a/examples/expected/0785-modules-qualified-generic-static-missing-member.stderr b/examples/expected/0785-modules-qualified-generic-static-missing-member.stderr index e3eddf6..41ebe86 100644 --- a/examples/expected/0785-modules-qualified-generic-static-missing-member.stderr +++ b/examples/expected/0785-modules-qualified-generic-static-missing-member.stderr @@ -1,5 +1,5 @@ error: namespace 'a' has no member 'Box' --> examples/0785-modules-qualified-generic-static-missing-member.sx:16:10 | -16 | x := a.Box(s64).make(7); +16 | x := a.Box(i64).make(7); | ^^^^^ diff --git a/examples/expected/0800-memory-list.stdout b/examples/expected/0800-memory-list.stdout index 98c2e6e..95edf09 100644 --- a/examples/expected/0800-memory-list.stdout +++ b/examples/expected/0800-memory-list.stdout @@ -1 +1 @@ -List__s32{items: [*]s32@0xADDR, len: 5, cap: 8} +List__i32{items: [*]i32@0xADDR, len: 5, cap: 8} diff --git a/examples/expected/0903-optionals-optional-roundtrip.ir b/examples/expected/0903-optionals-optional-roundtrip.ir index d8df3bb..a35dd66 100644 --- a/examples/expected/0903-optionals-optional-roundtrip.ir +++ b/examples/expected/0903-optionals-optional-roundtrip.ir @@ -26,10 +26,10 @@ @tag_names = private constant [14 x { ptr, i64 }] [{ ptr, i64 } { ptr @tag.str, i64 0 }, { ptr, i64 } { ptr @tag.str.114, i64 8 }, { ptr, i64 } { ptr @tag.str.115, i64 2 }, { ptr, i64 } { ptr @tag.str.116, i64 15 }, { ptr, i64 } { ptr @tag.str.117, i64 13 }, { ptr, i64 } { ptr @tag.str.118, i64 9 }, { ptr, i64 } { ptr @tag.str.119, i64 9 }, { ptr, i64 } { ptr @tag.str.120, i64 15 }, { ptr, i64 } { ptr @tag.str.121, i64 14 }, { ptr, i64 } { ptr @tag.str.122, i64 14 }, { ptr, i64 } { ptr @tag.str.123, i64 11 }, { ptr, i64 } { ptr @tag.str.124, i64 12 }, { ptr, i64 } { ptr @tag.str.125, i64 15 }, { ptr, i64 } { ptr @tag.str.126, i64 12 }] @tn.str = private constant [13 x i8] c"\00" @tn.str.127 = private constant [5 x i8] c"bool\00" -@tn.str.128 = private constant [3 x i8] c"s8\00" -@tn.str.129 = private constant [4 x i8] c"s16\00" -@tn.str.130 = private constant [4 x i8] c"s32\00" -@tn.str.131 = private constant [4 x i8] c"s64\00" +@tn.str.128 = private constant [3 x i8] c"i8\00" +@tn.str.129 = private constant [4 x i8] c"i16\00" +@tn.str.130 = private constant [4 x i8] c"i32\00" +@tn.str.131 = private constant [4 x i8] c"i64\00" @tn.str.132 = private constant [3 x i8] c"u8\00" @tn.str.133 = private constant [4 x i8] c"u16\00" @tn.str.134 = private constant [4 x i8] c"u32\00" @@ -46,7 +46,7 @@ @tn.str.145 = private constant [16 x i8] c"Source_Location\00" @tn.str.146 = private constant [10 x i8] c"Allocator\00" @tn.str.147 = private constant [8 x i8] c"Context\00" -@tn.str.148 = private constant [7 x i8] c"[4]s64\00" +@tn.str.148 = private constant [7 x i8] c"[4]i64\00" @tn.str.149 = private constant [9 x i8] c"[]string\00" @tn.str.150 = private constant [11 x i8] c"CAllocator\00" @tn.str.151 = private constant [12 x i8] c"*CAllocator\00" @@ -71,7 +71,7 @@ @tn.str.170 = private constant [4 x i8] c"*u8\00" @tn.str.171 = private constant [14 x i8] c"ProcessResult\00" @tn.str.172 = private constant [15 x i8] c"?ProcessResult\00" -@tn.str.173 = private constant [5 x i8] c"*s32\00" +@tn.str.173 = private constant [5 x i8] c"*i32\00" @tn.str.174 = private constant [9 x i8] c"SockAddr\00" @tn.str.175 = private constant [10 x i8] c"*SockAddr\00" @tn.str.176 = private constant [5 x i8] c"*u32\00" @@ -87,9 +87,9 @@ @tn.str.186 = private constant [5 x i8] c"[]u8\00" @tn.str.187 = private constant [5 x i8] c"Sink\00" @tn.str.188 = private constant [6 x i8] c"*Sink\00" -@tn.str.189 = private constant [17 x i8] c"(s64, JsonError)\00" +@tn.str.189 = private constant [17 x i8] c"(i64, JsonError)\00" @tn.str.190 = private constant [15 x i8] c"JsonParseError\00" -@tn.str.191 = private constant [22 x i8] c"(s64, JsonParseError)\00" +@tn.str.191 = private constant [22 x i8] c"(i64, JsonParseError)\00" @tn.str.192 = private constant [7 x i8] c"Parser\00" @tn.str.193 = private constant [8 x i8] c"*Parser\00" @tn.str.194 = private constant [25 x i8] c"(string, JsonParseError)\00" @@ -98,7 +98,7 @@ @tn.str.197 = private constant [13 x i8] c"Architecture\00" @tn.str.198 = private constant [13 x i8] c"BuildOptions\00" @tn.str.199 = private constant [11 x i8] c"() -> bool\00" -@tn.str.200 = private constant [5 x i8] c"*s64\00" +@tn.str.200 = private constant [5 x i8] c"*i64\00" @tn.str.201 = private constant [9 x i8] c"CliError\00" @tn.str.202 = private constant [9 x i8] c"FlagSpec\00" @tn.str.203 = private constant [11 x i8] c"[]FlagSpec\00" @@ -111,12 +111,12 @@ @tn.str.210 = private constant [19 x i8] c"(Parsed, CliError)\00" @tn.str.211 = private constant [10 x i8] c"[]Command\00" @tn.str.212 = private constant [6 x i8] c"*Diag\00" -@tn.str.213 = private constant [7 x i8] c"[8]s64\00" +@tn.str.213 = private constant [7 x i8] c"[8]i64\00" @tn.str.214 = private constant [7 x i8] c"[64]u8\00" @tn.str.215 = private constant [7 x i8] c"Sha256\00" @tn.str.216 = private constant [8 x i8] c"*Sha256\00" @tn.str.217 = private constant [8 x i8] c"?[64]u8\00" -@tn.str.218 = private constant [8 x i8] c"[64]s64\00" +@tn.str.218 = private constant [8 x i8] c"[64]i64\00" @tn.str.219 = private constant [5 x i8] c"?f32\00" @tn.str.220 = private constant [13 x i8] c"ProposedSize\00" @tn.str.221 = private constant [8 x i8] c"Sizable\00" @@ -138,7 +138,7 @@ @tn.str.237 = private constant [9 x i8] c"*Sizable\00" @tn.str.238 = private constant [9 x i8] c"**Widget\00" @tn.str.239 = private constant [19 x i8] c"*__Sizable__Vtable\00" -@tn.str.240 = private constant [8 x i8] c"*[4]s64\00" +@tn.str.240 = private constant [8 x i8] c"*[4]i64\00" @tn.str.241 = private constant [17 x i8] c"*Source_Location\00" @tn.str.242 = private constant [11 x i8] c"*Allocator\00" @tn.str.243 = private constant [9 x i8] c"*Context\00" @@ -155,9 +155,9 @@ @tn.str.254 = private constant [17 x i8] c"*OperatingSystem\00" @tn.str.255 = private constant [14 x i8] c"*Architecture\00" @tn.str.256 = private constant [15 x i8] c"*[16]FlagValue\00" -@tn.str.257 = private constant [8 x i8] c"*[8]s64\00" +@tn.str.257 = private constant [8 x i8] c"*[8]i64\00" @tn.str.258 = private constant [8 x i8] c"*[64]u8\00" -@tn.str.259 = private constant [9 x i8] c"*[64]s64\00" +@tn.str.259 = private constant [9 x i8] c"*[64]i64\00" @tn.str.260 = private constant [10 x i8] c"*[]string\00" @tn.str.261 = private constant [6 x i8] c"*[]u8\00" @tn.str.262 = private constant [12 x i8] c"*[]FlagSpec\00" @@ -170,7 +170,7 @@ @tn.str.269 = private constant [20 x i8] c"**TrackingAllocator\00" @tn.str.270 = private constant [7 x i8] c"**File\00" @tn.str.271 = private constant [5 x i8] c"**u8\00" -@tn.str.272 = private constant [6 x i8] c"**s32\00" +@tn.str.272 = private constant [6 x i8] c"**i32\00" @tn.str.273 = private constant [11 x i8] c"**SockAddr\00" @tn.str.274 = private constant [6 x i8] c"**u32\00" @tn.str.275 = private constant [10 x i8] c"*[*]Value\00" @@ -179,7 +179,7 @@ @tn.str.278 = private constant [9 x i8] c"**Object\00" @tn.str.279 = private constant [7 x i8] c"**Sink\00" @tn.str.280 = private constant [9 x i8] c"**Parser\00" -@tn.str.281 = private constant [6 x i8] c"**s64\00" +@tn.str.281 = private constant [6 x i8] c"**i64\00" @tn.str.282 = private constant [9 x i8] c"**Parsed\00" @tn.str.283 = private constant [7 x i8] c"**Diag\00" @tn.str.284 = private constant [9 x i8] c"**Sha256\00" @@ -611,7 +611,7 @@ @str.707 = private unnamed_addr constant [4 x i8] c"*u8\00", align 1 @str.708 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.709 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.710 = private unnamed_addr constant [5 x i8] c"*s32\00", align 1 +@str.710 = private unnamed_addr constant [5 x i8] c"*i32\00", align 1 @str.711 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.712 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.713 = private unnamed_addr constant [10 x i8] c"*SockAddr\00", align 1 @@ -638,7 +638,7 @@ @str.734 = private unnamed_addr constant [8 x i8] c"*Parser\00", align 1 @str.735 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.736 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.737 = private unnamed_addr constant [5 x i8] c"*s64\00", align 1 +@str.737 = private unnamed_addr constant [5 x i8] c"*i64\00", align 1 @str.738 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.739 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.740 = private unnamed_addr constant [8 x i8] c"*Parsed\00", align 1 @@ -2084,7 +2084,7 @@ dispatch.case.301: ; preds = %match.arm.59 %ua.raw190 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr191 = inttoptr i64 %ua.raw190 to ptr %ua.load192 = load [4 x i64], ptr %ua.ptr191, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %ua.load192) + %callN = call { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %ua.load192) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.299 @@ -2100,7 +2100,7 @@ dispatch.case.303: ; preds = %match.arm.59 %ua.raw198 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr199 = inttoptr i64 %ua.raw198 to ptr %ua.load200 = load [8 x i64], ptr %ua.ptr199, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %ua.load200) + %callN = call { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %ua.load200) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.299 @@ -2116,7 +2116,7 @@ dispatch.case.305: ; preds = %match.arm.59 %ua.raw206 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr207 = inttoptr i64 %ua.raw206 to ptr %ua.load208 = load [64 x i64], ptr %ua.ptr207, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %ua.load208) + %callN = call { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %ua.load208) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.299 @@ -2259,7 +2259,7 @@ dispatch.case.380: ; preds = %match.arm.61 dispatch.case.381: ; preds = %match.arm.61 %ua.raw265 = extractvalue { i64, i64 } %loadN, 1 %iNp266 = inttoptr i64 %ua.raw265 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %iNp266) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %iNp266) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.369 @@ -2322,7 +2322,7 @@ dispatch.case.389: ; preds = %match.arm.61 dispatch.case.390: ; preds = %match.arm.61 %ua.raw292 = extractvalue { i64, i64 } %loadN, 1 %iNp293 = inttoptr i64 %ua.raw292 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %iNp293) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %iNp293) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.369 @@ -4392,14 +4392,14 @@ fv.case: ; preds = %if.merge.141 fv.case17: ; preds = %if.merge.141 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.141 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.141 @@ -5095,8 +5095,8 @@ fv.default: ; preds = %if.merge.186 fv.case: ; preds = %if.merge.186 %fv.field = extractvalue { i32 } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge } @@ -5179,14 +5179,14 @@ fv.case: ; preds = %if.merge.191 fv.case17: ; preds = %if.merge.191 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.191 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.191 @@ -5271,8 +5271,8 @@ fv.default: ; preds = %if.merge.196 fv.case: ; preds = %if.merge.196 %fv.field = extractvalue { i32, { ptr, i64 } } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case17: ; preds = %if.merge.196 @@ -6956,7 +6956,7 @@ if.merge.298: ; preds = %if.then.297, %entry } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %1) #0 { entry: %alloca = alloca [4 x i64], align 8 %ig.tmp = alloca [4 x i64], align 8 @@ -7059,7 +7059,7 @@ if.merge.316: ; preds = %if.then.315, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %1) #0 { entry: %alloca = alloca [8 x i64], align 8 %ig.tmp = alloca [8 x i64], align 8 @@ -7160,7 +7160,7 @@ if.merge.326: ; preds = %if.then.325, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %1) #0 { entry: %alloca = alloca [64 x i64], align 8 %ig.tmp = alloca [64 x i64], align 8 @@ -7810,7 +7810,7 @@ if.merge.450: ; preds = %if.else.449, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 @@ -8060,7 +8060,7 @@ if.merge.477: ; preds = %if.else.476, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 diff --git a/examples/expected/0904-optionals-any-to-string-optional.ir b/examples/expected/0904-optionals-any-to-string-optional.ir index 1300a49..80e9aa7 100644 --- a/examples/expected/0904-optionals-any-to-string-optional.ir +++ b/examples/expected/0904-optionals-any-to-string-optional.ir @@ -25,10 +25,10 @@ @tag_names = private constant [14 x { ptr, i64 }] [{ ptr, i64 } { ptr @tag.str, i64 0 }, { ptr, i64 } { ptr @tag.str.114, i64 8 }, { ptr, i64 } { ptr @tag.str.115, i64 2 }, { ptr, i64 } { ptr @tag.str.116, i64 15 }, { ptr, i64 } { ptr @tag.str.117, i64 13 }, { ptr, i64 } { ptr @tag.str.118, i64 9 }, { ptr, i64 } { ptr @tag.str.119, i64 9 }, { ptr, i64 } { ptr @tag.str.120, i64 15 }, { ptr, i64 } { ptr @tag.str.121, i64 14 }, { ptr, i64 } { ptr @tag.str.122, i64 14 }, { ptr, i64 } { ptr @tag.str.123, i64 11 }, { ptr, i64 } { ptr @tag.str.124, i64 12 }, { ptr, i64 } { ptr @tag.str.125, i64 15 }, { ptr, i64 } { ptr @tag.str.126, i64 12 }] @tn.str = private constant [13 x i8] c"\00" @tn.str.127 = private constant [5 x i8] c"bool\00" -@tn.str.128 = private constant [3 x i8] c"s8\00" -@tn.str.129 = private constant [4 x i8] c"s16\00" -@tn.str.130 = private constant [4 x i8] c"s32\00" -@tn.str.131 = private constant [4 x i8] c"s64\00" +@tn.str.128 = private constant [3 x i8] c"i8\00" +@tn.str.129 = private constant [4 x i8] c"i16\00" +@tn.str.130 = private constant [4 x i8] c"i32\00" +@tn.str.131 = private constant [4 x i8] c"i64\00" @tn.str.132 = private constant [3 x i8] c"u8\00" @tn.str.133 = private constant [4 x i8] c"u16\00" @tn.str.134 = private constant [4 x i8] c"u32\00" @@ -45,7 +45,7 @@ @tn.str.145 = private constant [16 x i8] c"Source_Location\00" @tn.str.146 = private constant [10 x i8] c"Allocator\00" @tn.str.147 = private constant [8 x i8] c"Context\00" -@tn.str.148 = private constant [7 x i8] c"[4]s64\00" +@tn.str.148 = private constant [7 x i8] c"[4]i64\00" @tn.str.149 = private constant [9 x i8] c"[]string\00" @tn.str.150 = private constant [11 x i8] c"CAllocator\00" @tn.str.151 = private constant [12 x i8] c"*CAllocator\00" @@ -70,7 +70,7 @@ @tn.str.170 = private constant [4 x i8] c"*u8\00" @tn.str.171 = private constant [14 x i8] c"ProcessResult\00" @tn.str.172 = private constant [15 x i8] c"?ProcessResult\00" -@tn.str.173 = private constant [5 x i8] c"*s32\00" +@tn.str.173 = private constant [5 x i8] c"*i32\00" @tn.str.174 = private constant [9 x i8] c"SockAddr\00" @tn.str.175 = private constant [10 x i8] c"*SockAddr\00" @tn.str.176 = private constant [5 x i8] c"*u32\00" @@ -86,9 +86,9 @@ @tn.str.186 = private constant [5 x i8] c"[]u8\00" @tn.str.187 = private constant [5 x i8] c"Sink\00" @tn.str.188 = private constant [6 x i8] c"*Sink\00" -@tn.str.189 = private constant [17 x i8] c"(s64, JsonError)\00" +@tn.str.189 = private constant [17 x i8] c"(i64, JsonError)\00" @tn.str.190 = private constant [15 x i8] c"JsonParseError\00" -@tn.str.191 = private constant [22 x i8] c"(s64, JsonParseError)\00" +@tn.str.191 = private constant [22 x i8] c"(i64, JsonParseError)\00" @tn.str.192 = private constant [7 x i8] c"Parser\00" @tn.str.193 = private constant [8 x i8] c"*Parser\00" @tn.str.194 = private constant [25 x i8] c"(string, JsonParseError)\00" @@ -97,7 +97,7 @@ @tn.str.197 = private constant [13 x i8] c"Architecture\00" @tn.str.198 = private constant [13 x i8] c"BuildOptions\00" @tn.str.199 = private constant [11 x i8] c"() -> bool\00" -@tn.str.200 = private constant [5 x i8] c"*s64\00" +@tn.str.200 = private constant [5 x i8] c"*i64\00" @tn.str.201 = private constant [9 x i8] c"CliError\00" @tn.str.202 = private constant [9 x i8] c"FlagSpec\00" @tn.str.203 = private constant [11 x i8] c"[]FlagSpec\00" @@ -110,13 +110,13 @@ @tn.str.210 = private constant [19 x i8] c"(Parsed, CliError)\00" @tn.str.211 = private constant [10 x i8] c"[]Command\00" @tn.str.212 = private constant [6 x i8] c"*Diag\00" -@tn.str.213 = private constant [7 x i8] c"[8]s64\00" +@tn.str.213 = private constant [7 x i8] c"[8]i64\00" @tn.str.214 = private constant [7 x i8] c"[64]u8\00" @tn.str.215 = private constant [7 x i8] c"Sha256\00" @tn.str.216 = private constant [8 x i8] c"*Sha256\00" @tn.str.217 = private constant [8 x i8] c"?[64]u8\00" -@tn.str.218 = private constant [8 x i8] c"[64]s64\00" -@tn.str.219 = private constant [5 x i8] c"?s64\00" +@tn.str.218 = private constant [8 x i8] c"[64]i64\00" +@tn.str.219 = private constant [5 x i8] c"?i64\00" @tn.str.220 = private constant [6 x i8] c"?bool\00" @tn.str.221 = private constant [2 x i8] c"S\00" @tn.str.222 = private constant [13 x i8] c"**CAllocator\00" @@ -129,7 +129,7 @@ @tn.str.229 = private constant [8 x i8] c"*[1]Any\00" @tn.str.230 = private constant [7 x i8] c"*[]Any\00" @tn.str.231 = private constant [6 x i8] c"*bool\00" -@tn.str.232 = private constant [8 x i8] c"*[4]s64\00" +@tn.str.232 = private constant [8 x i8] c"*[4]i64\00" @tn.str.233 = private constant [5 x i8] c"*f64\00" @tn.str.234 = private constant [17 x i8] c"*Source_Location\00" @tn.str.235 = private constant [11 x i8] c"*Allocator\00" @@ -147,9 +147,9 @@ @tn.str.247 = private constant [17 x i8] c"*OperatingSystem\00" @tn.str.248 = private constant [14 x i8] c"*Architecture\00" @tn.str.249 = private constant [15 x i8] c"*[16]FlagValue\00" -@tn.str.250 = private constant [8 x i8] c"*[8]s64\00" +@tn.str.250 = private constant [8 x i8] c"*[8]i64\00" @tn.str.251 = private constant [8 x i8] c"*[64]u8\00" -@tn.str.252 = private constant [9 x i8] c"*[64]s64\00" +@tn.str.252 = private constant [9 x i8] c"*[64]i64\00" @tn.str.253 = private constant [10 x i8] c"*[]string\00" @tn.str.254 = private constant [6 x i8] c"*[]u8\00" @tn.str.255 = private constant [12 x i8] c"*[]FlagSpec\00" @@ -162,7 +162,7 @@ @tn.str.262 = private constant [20 x i8] c"**TrackingAllocator\00" @tn.str.263 = private constant [7 x i8] c"**File\00" @tn.str.264 = private constant [5 x i8] c"**u8\00" -@tn.str.265 = private constant [6 x i8] c"**s32\00" +@tn.str.265 = private constant [6 x i8] c"**i32\00" @tn.str.266 = private constant [11 x i8] c"**SockAddr\00" @tn.str.267 = private constant [6 x i8] c"**u32\00" @tn.str.268 = private constant [10 x i8] c"*[*]Value\00" @@ -171,7 +171,7 @@ @tn.str.271 = private constant [9 x i8] c"**Object\00" @tn.str.272 = private constant [7 x i8] c"**Sink\00" @tn.str.273 = private constant [9 x i8] c"**Parser\00" -@tn.str.274 = private constant [6 x i8] c"**s64\00" +@tn.str.274 = private constant [6 x i8] c"**i64\00" @tn.str.275 = private constant [9 x i8] c"**Parsed\00" @tn.str.276 = private constant [7 x i8] c"**Diag\00" @tn.str.277 = private constant [9 x i8] c"**Sha256\00" @@ -187,7 +187,7 @@ @tn.str.287 = private constant [9 x i8] c"*?string\00" @tn.str.288 = private constant [16 x i8] c"*?ProcessResult\00" @tn.str.289 = private constant [9 x i8] c"*?[64]u8\00" -@tn.str.290 = private constant [6 x i8] c"*?s64\00" +@tn.str.290 = private constant [6 x i8] c"*?i64\00" @tn.str.291 = private constant [7 x i8] c"*?bool\00" @__sx_type_names = private constant [166 x { ptr, i64 }] [{ ptr, i64 } { ptr @tn.str, i64 12 }, { ptr, i64 } { ptr @tn.str.127, i64 4 }, { ptr, i64 } { ptr @tn.str.128, i64 2 }, { ptr, i64 } { ptr @tn.str.129, i64 3 }, { ptr, i64 } { ptr @tn.str.130, i64 3 }, { ptr, i64 } { ptr @tn.str.131, i64 3 }, { ptr, i64 } { ptr @tn.str.132, i64 2 }, { ptr, i64 } { ptr @tn.str.133, i64 3 }, { ptr, i64 } { ptr @tn.str.134, i64 3 }, { ptr, i64 } { ptr @tn.str.135, i64 3 }, { ptr, i64 } { ptr @tn.str.136, i64 3 }, { ptr, i64 } { ptr @tn.str.137, i64 3 }, { ptr, i64 } { ptr @tn.str.138, i64 6 }, { ptr, i64 } { ptr @tn.str.139, i64 3 }, { ptr, i64 } { ptr @tn.str.140, i64 8 }, { ptr, i64 } { ptr @tn.str.141, i64 5 }, { ptr, i64 } { ptr @tn.str.142, i64 5 }, { ptr, i64 } { ptr @tn.str.143, i64 4 }, { ptr, i64 } { ptr @tn.str.144, i64 5 }, { ptr, i64 } { ptr @tn.str.145, i64 15 }, { ptr, i64 } { ptr @tn.str.146, i64 9 }, { ptr, i64 } { ptr @tn.str.147, i64 7 }, { ptr, i64 } { ptr @tn.str.148, i64 6 }, { ptr, i64 } { ptr @tn.str.149, i64 8 }, { ptr, i64 } { ptr @tn.str.150, i64 10 }, { ptr, i64 } { ptr @tn.str.151, i64 11 }, { ptr, i64 } { ptr @tn.str.152, i64 3 }, { ptr, i64 } { ptr @tn.str.153, i64 4 }, { ptr, i64 } { ptr @tn.str.154, i64 10 }, { ptr, i64 } { ptr @tn.str.155, i64 11 }, { ptr, i64 } { ptr @tn.str.156, i64 5 }, { ptr, i64 } { ptr @tn.str.157, i64 6 }, { ptr, i64 } { ptr @tn.str.158, i64 5 }, { ptr, i64 } { ptr @tn.str.159, i64 8 }, { ptr, i64 } { ptr @tn.str.160, i64 9 }, { ptr, i64 } { ptr @tn.str.161, i64 17 }, { ptr, i64 } { ptr @tn.str.162, i64 18 }, { ptr, i64 } { ptr @tn.str.163, i64 8 }, { ptr, i64 } { ptr @tn.str.164, i64 8 }, { ptr, i64 } { ptr @tn.str.165, i64 4 }, { ptr, i64 } { ptr @tn.str.166, i64 5 }, { ptr, i64 } { ptr @tn.str.167, i64 5 }, { ptr, i64 } { ptr @tn.str.168, i64 7 }, { ptr, i64 } { ptr @tn.str.169, i64 10 }, { ptr, i64 } { ptr @tn.str.170, i64 3 }, { ptr, i64 } { ptr @tn.str.171, i64 13 }, { ptr, i64 } { ptr @tn.str.172, i64 14 }, { ptr, i64 } { ptr @tn.str.173, i64 4 }, { ptr, i64 } { ptr @tn.str.174, i64 8 }, { ptr, i64 } { ptr @tn.str.175, i64 9 }, { ptr, i64 } { ptr @tn.str.176, i64 4 }, { ptr, i64 } { ptr @tn.str.177, i64 9 }, { ptr, i64 } { ptr @tn.str.178, i64 5 }, { ptr, i64 } { ptr @tn.str.179, i64 6 }, { ptr, i64 } { ptr @tn.str.180, i64 5 }, { ptr, i64 } { ptr @tn.str.181, i64 6 }, { ptr, i64 } { ptr @tn.str.182, i64 8 }, { ptr, i64 } { ptr @tn.str.183, i64 6 }, { ptr, i64 } { ptr @tn.str.184, i64 9 }, { ptr, i64 } { ptr @tn.str.185, i64 7 }, { ptr, i64 } { ptr @tn.str.186, i64 4 }, { ptr, i64 } { ptr @tn.str.187, i64 4 }, { ptr, i64 } { ptr @tn.str.188, i64 5 }, { ptr, i64 } { ptr @tn.str.189, i64 16 }, { ptr, i64 } { ptr @tn.str.190, i64 14 }, { ptr, i64 } { ptr @tn.str.191, i64 21 }, { ptr, i64 } { ptr @tn.str.192, i64 6 }, { ptr, i64 } { ptr @tn.str.193, i64 7 }, { ptr, i64 } { ptr @tn.str.194, i64 24 }, { ptr, i64 } { ptr @tn.str.195, i64 23 }, { ptr, i64 } { ptr @tn.str.196, i64 15 }, { ptr, i64 } { ptr @tn.str.197, i64 12 }, { ptr, i64 } { ptr @tn.str.198, i64 12 }, { ptr, i64 } { ptr @tn.str.199, i64 10 }, { ptr, i64 } { ptr @tn.str.200, i64 4 }, { ptr, i64 } { ptr @tn.str.201, i64 8 }, { ptr, i64 } { ptr @tn.str.202, i64 8 }, { ptr, i64 } { ptr @tn.str.203, i64 10 }, { ptr, i64 } { ptr @tn.str.204, i64 7 }, { ptr, i64 } { ptr @tn.str.205, i64 9 }, { ptr, i64 } { ptr @tn.str.206, i64 4 }, { ptr, i64 } { ptr @tn.str.207, i64 13 }, { ptr, i64 } { ptr @tn.str.208, i64 6 }, { ptr, i64 } { ptr @tn.str.209, i64 7 }, { ptr, i64 } { ptr @tn.str.210, i64 18 }, { ptr, i64 } { ptr @tn.str.211, i64 9 }, { ptr, i64 } { ptr @tn.str.212, i64 5 }, { ptr, i64 } { ptr @tn.str.213, i64 6 }, { ptr, i64 } { ptr @tn.str.214, i64 6 }, { ptr, i64 } { ptr @tn.str.215, i64 6 }, { ptr, i64 } { ptr @tn.str.216, i64 7 }, { ptr, i64 } { ptr @tn.str.217, i64 7 }, { ptr, i64 } { ptr @tn.str.218, i64 7 }, { ptr, i64 } { ptr @tn.str.219, i64 4 }, { ptr, i64 } { ptr @tn.str.220, i64 5 }, { ptr, i64 } { ptr @tn.str.221, i64 1 }, { ptr, i64 } { ptr @tn.str.222, i64 12 }, { ptr, i64 } { ptr @tn.str.223, i64 6 }, { ptr, i64 } { ptr @tn.str.224, i64 2 }, { ptr, i64 } { ptr @tn.str.225, i64 7 }, { ptr, i64 } { ptr @tn.str.226, i64 5 }, { ptr, i64 } { ptr @tn.str.227, i64 4 }, { ptr, i64 } { ptr @tn.str.228, i64 6 }, { ptr, i64 } { ptr @tn.str.229, i64 7 }, { ptr, i64 } { ptr @tn.str.230, i64 6 }, { ptr, i64 } { ptr @tn.str.231, i64 5 }, { ptr, i64 } { ptr @tn.str.232, i64 7 }, { ptr, i64 } { ptr @tn.str.233, i64 4 }, { ptr, i64 } { ptr @tn.str.234, i64 16 }, { ptr, i64 } { ptr @tn.str.235, i64 10 }, { ptr, i64 } { ptr @tn.str.236, i64 8 }, { ptr, i64 } { ptr @tn.str.237, i64 11 }, { ptr, i64 } { ptr @tn.str.238, i64 14 }, { ptr, i64 } { ptr @tn.str.239, i64 7 }, { ptr, i64 } { ptr @tn.str.240, i64 13 }, { ptr, i64 } { ptr @tn.str.241, i64 9 }, { ptr, i64 } { ptr @tn.str.242, i64 8 }, { ptr, i64 } { ptr @tn.str.243, i64 10 }, { ptr, i64 } { ptr @tn.str.244, i64 9 }, { ptr, i64 } { ptr @tn.str.245, i64 9 }, { ptr, i64 } { ptr @tn.str.246, i64 6 }, { ptr, i64 } { ptr @tn.str.247, i64 16 }, { ptr, i64 } { ptr @tn.str.248, i64 13 }, { ptr, i64 } { ptr @tn.str.249, i64 14 }, { ptr, i64 } { ptr @tn.str.250, i64 7 }, { ptr, i64 } { ptr @tn.str.251, i64 7 }, { ptr, i64 } { ptr @tn.str.252, i64 8 }, { ptr, i64 } { ptr @tn.str.253, i64 9 }, { ptr, i64 } { ptr @tn.str.254, i64 5 }, { ptr, i64 } { ptr @tn.str.255, i64 11 }, { ptr, i64 } { ptr @tn.str.256, i64 10 }, { ptr, i64 } { ptr @tn.str.257, i64 5 }, { ptr, i64 } { ptr @tn.str.258, i64 12 }, { ptr, i64 } { ptr @tn.str.259, i64 7 }, { ptr, i64 } { ptr @tn.str.260, i64 6 }, { ptr, i64 } { ptr @tn.str.261, i64 10 }, { ptr, i64 } { ptr @tn.str.262, i64 19 }, { ptr, i64 } { ptr @tn.str.263, i64 6 }, { ptr, i64 } { ptr @tn.str.264, i64 4 }, { ptr, i64 } { ptr @tn.str.265, i64 5 }, { ptr, i64 } { ptr @tn.str.266, i64 10 }, { ptr, i64 } { ptr @tn.str.267, i64 5 }, { ptr, i64 } { ptr @tn.str.268, i64 9 }, { ptr, i64 } { ptr @tn.str.269, i64 7 }, { ptr, i64 } { ptr @tn.str.270, i64 10 }, { ptr, i64 } { ptr @tn.str.271, i64 8 }, { ptr, i64 } { ptr @tn.str.272, i64 6 }, { ptr, i64 } { ptr @tn.str.273, i64 8 }, { ptr, i64 } { ptr @tn.str.274, i64 5 }, { ptr, i64 } { ptr @tn.str.275, i64 8 }, { ptr, i64 } { ptr @tn.str.276, i64 6 }, { ptr, i64 } { ptr @tn.str.277, i64 8 }, { ptr, i64 } { ptr @tn.str.278, i64 13 }, { ptr, i64 } { ptr @tn.str.279, i64 7 }, { ptr, i64 } { ptr @tn.str.280, i64 3 }, { ptr, i64 } { ptr @tn.str.281, i64 8 }, { ptr, i64 } { ptr @tn.str.282, i64 5 }, { ptr, i64 } { ptr @tn.str.283, i64 8 }, { ptr, i64 } { ptr @tn.str.284, i64 7 }, { ptr, i64 } { ptr @tn.str.285, i64 6 }, { ptr, i64 } { ptr @tn.str.286, i64 6 }, { ptr, i64 } { ptr @tn.str.287, i64 8 }, { ptr, i64 } { ptr @tn.str.288, i64 15 }, { ptr, i64 } { ptr @tn.str.289, i64 8 }, { ptr, i64 } { ptr @tn.str.290, i64 5 }, { ptr, i64 } { ptr @tn.str.291, i64 6 }] @str.292 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1 @@ -553,7 +553,7 @@ @str.650 = private unnamed_addr constant [4 x i8] c"*u8\00", align 1 @str.651 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.652 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.653 = private unnamed_addr constant [5 x i8] c"*s32\00", align 1 +@str.653 = private unnamed_addr constant [5 x i8] c"*i32\00", align 1 @str.654 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.655 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.656 = private unnamed_addr constant [10 x i8] c"*SockAddr\00", align 1 @@ -580,7 +580,7 @@ @str.677 = private unnamed_addr constant [8 x i8] c"*Parser\00", align 1 @str.678 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.679 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.680 = private unnamed_addr constant [5 x i8] c"*s64\00", align 1 +@str.680 = private unnamed_addr constant [5 x i8] c"*i64\00", align 1 @str.681 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.682 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.683 = private unnamed_addr constant [8 x i8] c"*Parsed\00", align 1 @@ -1969,7 +1969,7 @@ dispatch.case.271: ; preds = %match.arm.47 %ua.raw178 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr179 = inttoptr i64 %ua.raw178 to ptr %ua.load180 = load [4 x i64], ptr %ua.ptr179, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %ua.load180) + %callN = call { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %ua.load180) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.269 @@ -1985,7 +1985,7 @@ dispatch.case.273: ; preds = %match.arm.47 %ua.raw186 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr187 = inttoptr i64 %ua.raw186 to ptr %ua.load188 = load [8 x i64], ptr %ua.ptr187, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %ua.load188) + %callN = call { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %ua.load188) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.269 @@ -2001,7 +2001,7 @@ dispatch.case.275: ; preds = %match.arm.47 %ua.raw194 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr195 = inttoptr i64 %ua.raw194 to ptr %ua.load196 = load [64 x i64], ptr %ua.ptr195, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %ua.load196) + %callN = call { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %ua.load196) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.269 @@ -2144,7 +2144,7 @@ dispatch.case.350: ; preds = %match.arm.49 dispatch.case.351: ; preds = %match.arm.49 %ua.raw253 = extractvalue { i64, i64 } %loadN, 1 %iNp254 = inttoptr i64 %ua.raw253 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %iNp254) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %iNp254) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.339 @@ -2207,7 +2207,7 @@ dispatch.case.359: ; preds = %match.arm.49 dispatch.case.360: ; preds = %match.arm.49 %ua.raw280 = extractvalue { i64, i64 } %loadN, 1 %iNp281 = inttoptr i64 %ua.raw280 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %iNp281) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %iNp281) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.339 @@ -2333,7 +2333,7 @@ dispatch.case.484: ; preds = %match.arm.50 %ua.raw333 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr334 = inttoptr i64 %ua.raw333 to ptr %ua.load335 = load { i64, i1 }, ptr %ua.ptr334, align 8 - %callN = call { ptr, i64 } @optional_to_string__opt_s64(ptr %0, { i64, i1 } %ua.load335) + %callN = call { ptr, i64 } @optional_to_string__opt_i64(ptr %0, { i64, i1 } %ua.load335) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.478 @@ -3626,14 +3626,14 @@ fv.case: ; preds = %if.merge.126 fv.case17: ; preds = %if.merge.126 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.126 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.126 @@ -4329,8 +4329,8 @@ fv.default: ; preds = %if.merge.171 fv.case: ; preds = %if.merge.171 %fv.field = extractvalue { i32 } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge } @@ -4413,14 +4413,14 @@ fv.case: ; preds = %if.merge.176 fv.case17: ; preds = %if.merge.176 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.176 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.176 @@ -4505,8 +4505,8 @@ fv.default: ; preds = %if.merge.181 fv.case: ; preds = %if.merge.181 %fv.field = extractvalue { i32, { ptr, i64 } } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case17: ; preds = %if.merge.181 @@ -5997,7 +5997,7 @@ if.merge.268: ; preds = %if.then.267, %entry } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %1) #0 { entry: %alloca = alloca [4 x i64], align 8 %ig.tmp = alloca [4 x i64], align 8 @@ -6100,7 +6100,7 @@ if.merge.286: ; preds = %if.then.285, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %1) #0 { entry: %alloca = alloca [8 x i64], align 8 %ig.tmp = alloca [8 x i64], align 8 @@ -6201,7 +6201,7 @@ if.merge.296: ; preds = %if.then.295, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %1) #0 { entry: %alloca = alloca [64 x i64], align 8 %ig.tmp = alloca [64 x i64], align 8 @@ -6851,7 +6851,7 @@ if.merge.414: ; preds = %if.else.413, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 @@ -7101,7 +7101,7 @@ if.merge.441: ; preds = %if.else.440, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 @@ -7533,7 +7533,7 @@ if.merge.493: ; preds = %entry } ; Function Attrs: nounwind -define internal { ptr, i64 } @optional_to_string__opt_s64(ptr %0, { i64, i1 } %1) #0 { +define internal { ptr, i64 } @optional_to_string__opt_i64(ptr %0, { i64, i1 } %1) #0 { entry: %alloca = alloca { i64, i1 }, align 8 store { i64, i1 } %1, ptr %alloca, align 8 diff --git a/examples/expected/1001-errors-set-typing.stderr b/examples/expected/1001-errors-set-typing.stderr index 52dfe37..160f5d5 100644 --- a/examples/expected/1001-errors-set-typing.stderr +++ b/examples/expected/1001-errors-set-typing.stderr @@ -1,11 +1,11 @@ error: error tag 'error.NotInSet' is not in error set 'ParseErr' - --> /Users/agra/projects/sx/examples/1001-errors-set-typing.sx:13:20 + --> examples/1001-errors-set-typing.sx:13:20 | 13 | c : ParseErr = error.NotInSet; // error: NotInSet not in ParseErr | ^^^^^^^^^^^^^^ error: an error-set value compares only with an `error.X` tag or another error-set value; coerce with `xx` to compare the raw id - --> /Users/agra/projects/sx/examples/1001-errors-set-typing.sx:14:8 + --> examples/1001-errors-set-typing.sx:14:8 | 14 | if c == 42 { return 1; } // error: error-set value vs raw integer | ^ diff --git a/examples/expected/1003-errors-raise-rejections.stderr b/examples/expected/1003-errors-raise-rejections.stderr index 1b46712..b9cc581 100644 --- a/examples/expected/1003-errors-raise-rejections.stderr +++ b/examples/expected/1003-errors-raise-rejections.stderr @@ -1,17 +1,17 @@ error: error tag 'error.NotInSet' is not in error set 'ParseErr' - --> /Users/agra/projects/sx/examples/1003-errors-raise-rejections.sx:17:11 + --> examples/1003-errors-raise-rejections.sx:17:11 | 17 | raise error.NotInSet; // error: NotInSet not in ParseErr | ^^^^^^^^^^^^^^ error: error tag 'error.Weird' is not in caller's error set 'ParseErr' - --> /Users/agra/projects/sx/examples/1003-errors-raise-rejections.sx:24:5 + --> examples/1003-errors-raise-rejections.sx:24:5 | 24 | raise e; // error: OtherErr not subset of ParseErr | ^^^^^^^^ error: `raise` is only valid inside a failable function (a return type with `!` or `!Named`) - --> /Users/agra/projects/sx/examples/1003-errors-raise-rejections.sx:30:5 + --> examples/1003-errors-raise-rejections.sx:30:5 | -30 | raise error.BadDigit; // error: main (-> s32) is not failable +30 | raise error.BadDigit; // error: main (-> i32) is not failable | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/examples/expected/1004-errors-try.ir b/examples/expected/1004-errors-try.ir index 1a76be3..0e36333 100644 --- a/examples/expected/1004-errors-try.ir +++ b/examples/expected/1004-errors-try.ir @@ -27,10 +27,10 @@ @tag_names = private constant [16 x { ptr, i64 }] [{ ptr, i64 } { ptr @tag.str, i64 0 }, { ptr, i64 } { ptr @tag.str.114, i64 8 }, { ptr, i64 } { ptr @tag.str.115, i64 2 }, { ptr, i64 } { ptr @tag.str.116, i64 15 }, { ptr, i64 } { ptr @tag.str.117, i64 13 }, { ptr, i64 } { ptr @tag.str.118, i64 9 }, { ptr, i64 } { ptr @tag.str.119, i64 9 }, { ptr, i64 } { ptr @tag.str.120, i64 15 }, { ptr, i64 } { ptr @tag.str.121, i64 14 }, { ptr, i64 } { ptr @tag.str.122, i64 14 }, { ptr, i64 } { ptr @tag.str.123, i64 11 }, { ptr, i64 } { ptr @tag.str.124, i64 12 }, { ptr, i64 } { ptr @tag.str.125, i64 15 }, { ptr, i64 } { ptr @tag.str.126, i64 12 }, { ptr, i64 } { ptr @tag.str.127, i64 3 }, { ptr, i64 } { ptr @tag.str.128, i64 5 }] @tn.str = private constant [13 x i8] c"\00" @tn.str.129 = private constant [5 x i8] c"bool\00" -@tn.str.130 = private constant [3 x i8] c"s8\00" -@tn.str.131 = private constant [4 x i8] c"s16\00" -@tn.str.132 = private constant [4 x i8] c"s32\00" -@tn.str.133 = private constant [4 x i8] c"s64\00" +@tn.str.130 = private constant [3 x i8] c"i8\00" +@tn.str.131 = private constant [4 x i8] c"i16\00" +@tn.str.132 = private constant [4 x i8] c"i32\00" +@tn.str.133 = private constant [4 x i8] c"i64\00" @tn.str.134 = private constant [3 x i8] c"u8\00" @tn.str.135 = private constant [4 x i8] c"u16\00" @tn.str.136 = private constant [4 x i8] c"u32\00" @@ -47,7 +47,7 @@ @tn.str.147 = private constant [16 x i8] c"Source_Location\00" @tn.str.148 = private constant [10 x i8] c"Allocator\00" @tn.str.149 = private constant [8 x i8] c"Context\00" -@tn.str.150 = private constant [7 x i8] c"[4]s64\00" +@tn.str.150 = private constant [7 x i8] c"[4]i64\00" @tn.str.151 = private constant [9 x i8] c"[]string\00" @tn.str.152 = private constant [11 x i8] c"CAllocator\00" @tn.str.153 = private constant [12 x i8] c"*CAllocator\00" @@ -72,7 +72,7 @@ @tn.str.172 = private constant [4 x i8] c"*u8\00" @tn.str.173 = private constant [14 x i8] c"ProcessResult\00" @tn.str.174 = private constant [15 x i8] c"?ProcessResult\00" -@tn.str.175 = private constant [5 x i8] c"*s32\00" +@tn.str.175 = private constant [5 x i8] c"*i32\00" @tn.str.176 = private constant [9 x i8] c"SockAddr\00" @tn.str.177 = private constant [10 x i8] c"*SockAddr\00" @tn.str.178 = private constant [5 x i8] c"*u32\00" @@ -88,9 +88,9 @@ @tn.str.188 = private constant [5 x i8] c"[]u8\00" @tn.str.189 = private constant [5 x i8] c"Sink\00" @tn.str.190 = private constant [6 x i8] c"*Sink\00" -@tn.str.191 = private constant [17 x i8] c"(s64, JsonError)\00" +@tn.str.191 = private constant [17 x i8] c"(i64, JsonError)\00" @tn.str.192 = private constant [15 x i8] c"JsonParseError\00" -@tn.str.193 = private constant [22 x i8] c"(s64, JsonParseError)\00" +@tn.str.193 = private constant [22 x i8] c"(i64, JsonParseError)\00" @tn.str.194 = private constant [7 x i8] c"Parser\00" @tn.str.195 = private constant [8 x i8] c"*Parser\00" @tn.str.196 = private constant [25 x i8] c"(string, JsonParseError)\00" @@ -99,7 +99,7 @@ @tn.str.199 = private constant [13 x i8] c"Architecture\00" @tn.str.200 = private constant [13 x i8] c"BuildOptions\00" @tn.str.201 = private constant [11 x i8] c"() -> bool\00" -@tn.str.202 = private constant [5 x i8] c"*s64\00" +@tn.str.202 = private constant [5 x i8] c"*i64\00" @tn.str.203 = private constant [9 x i8] c"CliError\00" @tn.str.204 = private constant [9 x i8] c"FlagSpec\00" @tn.str.205 = private constant [11 x i8] c"[]FlagSpec\00" @@ -112,12 +112,12 @@ @tn.str.212 = private constant [19 x i8] c"(Parsed, CliError)\00" @tn.str.213 = private constant [10 x i8] c"[]Command\00" @tn.str.214 = private constant [6 x i8] c"*Diag\00" -@tn.str.215 = private constant [7 x i8] c"[8]s64\00" +@tn.str.215 = private constant [7 x i8] c"[8]i64\00" @tn.str.216 = private constant [7 x i8] c"[64]u8\00" @tn.str.217 = private constant [7 x i8] c"Sha256\00" @tn.str.218 = private constant [8 x i8] c"*Sha256\00" @tn.str.219 = private constant [8 x i8] c"?[64]u8\00" -@tn.str.220 = private constant [8 x i8] c"[64]s64\00" +@tn.str.220 = private constant [8 x i8] c"[64]i64\00" @tn.str.221 = private constant [2 x i8] c"E\00" @tn.str.222 = private constant [13 x i8] c"**CAllocator\00" @tn.str.223 = private constant [7 x i8] c"**void\00" @@ -129,7 +129,7 @@ @tn.str.229 = private constant [8 x i8] c"*[1]Any\00" @tn.str.230 = private constant [7 x i8] c"*[]Any\00" @tn.str.231 = private constant [6 x i8] c"*bool\00" -@tn.str.232 = private constant [8 x i8] c"*[4]s64\00" +@tn.str.232 = private constant [8 x i8] c"*[4]i64\00" @tn.str.233 = private constant [5 x i8] c"*f64\00" @tn.str.234 = private constant [17 x i8] c"*Source_Location\00" @tn.str.235 = private constant [11 x i8] c"*Allocator\00" @@ -147,9 +147,9 @@ @tn.str.247 = private constant [17 x i8] c"*OperatingSystem\00" @tn.str.248 = private constant [14 x i8] c"*Architecture\00" @tn.str.249 = private constant [15 x i8] c"*[16]FlagValue\00" -@tn.str.250 = private constant [8 x i8] c"*[8]s64\00" +@tn.str.250 = private constant [8 x i8] c"*[8]i64\00" @tn.str.251 = private constant [8 x i8] c"*[64]u8\00" -@tn.str.252 = private constant [9 x i8] c"*[64]s64\00" +@tn.str.252 = private constant [9 x i8] c"*[64]i64\00" @tn.str.253 = private constant [10 x i8] c"*[]string\00" @tn.str.254 = private constant [6 x i8] c"*[]u8\00" @tn.str.255 = private constant [12 x i8] c"*[]FlagSpec\00" @@ -162,7 +162,7 @@ @tn.str.262 = private constant [20 x i8] c"**TrackingAllocator\00" @tn.str.263 = private constant [7 x i8] c"**File\00" @tn.str.264 = private constant [5 x i8] c"**u8\00" -@tn.str.265 = private constant [6 x i8] c"**s32\00" +@tn.str.265 = private constant [6 x i8] c"**i32\00" @tn.str.266 = private constant [11 x i8] c"**SockAddr\00" @tn.str.267 = private constant [6 x i8] c"**u32\00" @tn.str.268 = private constant [10 x i8] c"*[*]Value\00" @@ -171,7 +171,7 @@ @tn.str.271 = private constant [9 x i8] c"**Object\00" @tn.str.272 = private constant [7 x i8] c"**Sink\00" @tn.str.273 = private constant [9 x i8] c"**Parser\00" -@tn.str.274 = private constant [6 x i8] c"**s64\00" +@tn.str.274 = private constant [6 x i8] c"**i64\00" @tn.str.275 = private constant [9 x i8] c"**Parsed\00" @tn.str.276 = private constant [7 x i8] c"**Diag\00" @tn.str.277 = private constant [9 x i8] c"**Sha256\00" @@ -548,7 +548,7 @@ @str.643 = private unnamed_addr constant [4 x i8] c"*u8\00", align 1 @str.644 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.645 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.646 = private unnamed_addr constant [5 x i8] c"*s32\00", align 1 +@str.646 = private unnamed_addr constant [5 x i8] c"*i32\00", align 1 @str.647 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.648 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.649 = private unnamed_addr constant [10 x i8] c"*SockAddr\00", align 1 @@ -575,7 +575,7 @@ @str.670 = private unnamed_addr constant [8 x i8] c"*Parser\00", align 1 @str.671 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.672 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.673 = private unnamed_addr constant [5 x i8] c"*s64\00", align 1 +@str.673 = private unnamed_addr constant [5 x i8] c"*i64\00", align 1 @str.674 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.675 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.676 = private unnamed_addr constant [8 x i8] c"*Parsed\00", align 1 @@ -1949,7 +1949,7 @@ dispatch.case.275: ; preds = %match.arm.57 %ua.raw174 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr175 = inttoptr i64 %ua.raw174 to ptr %ua.load176 = load [4 x i64], ptr %ua.ptr175, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %ua.load176) + %callN = call { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %ua.load176) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.273 @@ -1965,7 +1965,7 @@ dispatch.case.277: ; preds = %match.arm.57 %ua.raw182 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr183 = inttoptr i64 %ua.raw182 to ptr %ua.load184 = load [8 x i64], ptr %ua.ptr183, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %ua.load184) + %callN = call { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %ua.load184) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.273 @@ -1981,7 +1981,7 @@ dispatch.case.279: ; preds = %match.arm.57 %ua.raw190 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr191 = inttoptr i64 %ua.raw190 to ptr %ua.load192 = load [64 x i64], ptr %ua.ptr191, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %ua.load192) + %callN = call { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %ua.load192) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.273 @@ -2124,7 +2124,7 @@ dispatch.case.354: ; preds = %match.arm.59 dispatch.case.355: ; preds = %match.arm.59 %ua.raw249 = extractvalue { i64, i64 } %loadN, 1 %iNp250 = inttoptr i64 %ua.raw249 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %iNp250) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %iNp250) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.343 @@ -2187,7 +2187,7 @@ dispatch.case.363: ; preds = %match.arm.59 dispatch.case.364: ; preds = %match.arm.59 %ua.raw276 = extractvalue { i64, i64 } %loadN, 1 %iNp277 = inttoptr i64 %ua.raw276 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %iNp277) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %iNp277) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.343 @@ -3513,7 +3513,7 @@ if.then.8: ; preds = %if.merge.7 if.merge.9: ; preds = %if.then.8, %if.merge.7 %loadN = load i32, ptr %allocaN, align 4 - call void @print__ct_s1c36e8f510df0c92__pack_s32(ptr @__sx_default_context, i32 %loadN) + call void @print__ct_s1c36e8f510df0c92__pack_i32(ptr @__sx_default_context, i32 %loadN) %loadN = load i32, ptr %allocaN, align 4 ret i32 %loadN } @@ -3533,7 +3533,7 @@ entry: } ; Function Attrs: nounwind -define internal void @print__ct_s1c36e8f510df0c92__pack_s32(ptr %0, i32 %1) #0 { +define internal void @print__ct_s1c36e8f510df0c92__pack_i32(ptr %0, i32 %1) #0 { entry: %alloca = alloca { ptr, i64 }, align 8 store { ptr, i64 } { ptr @str.316, i64 15 }, ptr %alloca, align 8 @@ -3541,8 +3541,8 @@ entry: store i32 %1, ptr %allocaN, align 4 %allocaN = alloca [1 x { i64, i64 }], align 8 %load = load i32, ptr %allocaN, align 4 - %sN = sext i32 %load to i64 - %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %load to i64 + %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %igp.ptr = getelementptr { i64, i64 }, ptr %allocaN, i64 0 store { i64, i64 } %ba.val, ptr %igp.ptr, align 8 %allocaN = alloca { ptr, i64 }, align 8 @@ -3560,8 +3560,8 @@ entry: store { ptr, i64 } %callN, ptr %allocaN, align 8 %loadN = load { ptr, i64 }, ptr %allocaN, align 8 %loadN = load i32, ptr %allocaN, align 4 - %sN = sext i32 %loadN to i64 - %ba.val13 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %loadN to i64 + %ba.val13 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %callN = call { ptr, i64 } @any_to_string(ptr %0, { i64, i64 } %ba.val13) %callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN) store { ptr, i64 } %callN, ptr %allocaN, align 8 @@ -3661,14 +3661,14 @@ fv.case: ; preds = %if.merge.135 fv.case17: ; preds = %if.merge.135 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.135 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.135 @@ -4364,8 +4364,8 @@ fv.default: ; preds = %if.merge.180 fv.case: ; preds = %if.merge.180 %fv.field = extractvalue { i32 } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge } @@ -4448,14 +4448,14 @@ fv.case: ; preds = %if.merge.185 fv.case17: ; preds = %if.merge.185 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.185 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.185 @@ -4540,8 +4540,8 @@ fv.default: ; preds = %if.merge.190 fv.case: ; preds = %if.merge.190 %fv.field = extractvalue { i32, { ptr, i64 } } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case17: ; preds = %if.merge.190 @@ -5942,7 +5942,7 @@ if.merge.272: ; preds = %if.then.271, %entry } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %1) #0 { entry: %alloca = alloca [4 x i64], align 8 %ig.tmp = alloca [4 x i64], align 8 @@ -6045,7 +6045,7 @@ if.merge.290: ; preds = %if.then.289, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %1) #0 { entry: %alloca = alloca [8 x i64], align 8 %ig.tmp = alloca [8 x i64], align 8 @@ -6146,7 +6146,7 @@ if.merge.300: ; preds = %if.then.299, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %1) #0 { entry: %alloca = alloca [64 x i64], align 8 %ig.tmp = alloca [64 x i64], align 8 @@ -6796,7 +6796,7 @@ if.merge.418: ; preds = %if.else.417, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 @@ -7046,7 +7046,7 @@ if.merge.445: ; preds = %if.else.444, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 diff --git a/examples/expected/1005-errors-try-rejections.stderr b/examples/expected/1005-errors-try-rejections.stderr index a5ffb9f..69c8f77 100644 --- a/examples/expected/1005-errors-try-rejections.stderr +++ b/examples/expected/1005-errors-try-rejections.stderr @@ -1,17 +1,17 @@ error: `try` is only valid inside a failable function (a return type with `!` or `!Named`) - --> /Users/agra/projects/sx/examples/1005-errors-try-rejections.sx:20:5 + --> examples/1005-errors-try-rejections.sx:20:5 | 20 | try ga(); // error: `try` outside a failable function | ^^^^^^^^ -error: `try` requires a failable expression; operand has type 's32' - --> /Users/agra/projects/sx/examples/1005-errors-try-rejections.sx:26:5 +error: `try` requires a failable expression; operand has type 'i32' + --> examples/1005-errors-try-rejections.sx:26:5 | -26 | try plain(); // error: operand has type s32 (not failable) +26 | try plain(); // error: operand has type i32 (not failable) | ^^^^^^^^^^^ error: error tag 'error.Yb' is not in caller's error set 'A' - --> /Users/agra/projects/sx/examples/1005-errors-try-rejections.sx:32:5 + --> examples/1005-errors-try-rejections.sx:32:5 | 32 | try gb(); // error: Yb not in caller's error set A | ^^^^^^^^ diff --git a/examples/expected/1006-errors-inferred-error-sets.ir b/examples/expected/1006-errors-inferred-error-sets.ir index 3766d54..4b73d52 100644 --- a/examples/expected/1006-errors-inferred-error-sets.ir +++ b/examples/expected/1006-errors-inferred-error-sets.ir @@ -27,10 +27,10 @@ @tag_names = private constant [16 x { ptr, i64 }] [{ ptr, i64 } { ptr @tag.str, i64 0 }, { ptr, i64 } { ptr @tag.str.115, i64 8 }, { ptr, i64 } { ptr @tag.str.116, i64 2 }, { ptr, i64 } { ptr @tag.str.117, i64 15 }, { ptr, i64 } { ptr @tag.str.118, i64 13 }, { ptr, i64 } { ptr @tag.str.119, i64 9 }, { ptr, i64 } { ptr @tag.str.120, i64 9 }, { ptr, i64 } { ptr @tag.str.121, i64 15 }, { ptr, i64 } { ptr @tag.str.122, i64 14 }, { ptr, i64 } { ptr @tag.str.123, i64 14 }, { ptr, i64 } { ptr @tag.str.124, i64 11 }, { ptr, i64 } { ptr @tag.str.125, i64 12 }, { ptr, i64 } { ptr @tag.str.126, i64 15 }, { ptr, i64 } { ptr @tag.str.127, i64 12 }, { ptr, i64 } { ptr @tag.str.128, i64 3 }, { ptr, i64 } { ptr @tag.str.129, i64 3 }] @tn.str = private constant [13 x i8] c"\00" @tn.str.130 = private constant [5 x i8] c"bool\00" -@tn.str.131 = private constant [3 x i8] c"s8\00" -@tn.str.132 = private constant [4 x i8] c"s16\00" -@tn.str.133 = private constant [4 x i8] c"s32\00" -@tn.str.134 = private constant [4 x i8] c"s64\00" +@tn.str.131 = private constant [3 x i8] c"i8\00" +@tn.str.132 = private constant [4 x i8] c"i16\00" +@tn.str.133 = private constant [4 x i8] c"i32\00" +@tn.str.134 = private constant [4 x i8] c"i64\00" @tn.str.135 = private constant [3 x i8] c"u8\00" @tn.str.136 = private constant [4 x i8] c"u16\00" @tn.str.137 = private constant [4 x i8] c"u32\00" @@ -47,7 +47,7 @@ @tn.str.148 = private constant [16 x i8] c"Source_Location\00" @tn.str.149 = private constant [10 x i8] c"Allocator\00" @tn.str.150 = private constant [8 x i8] c"Context\00" -@tn.str.151 = private constant [7 x i8] c"[4]s64\00" +@tn.str.151 = private constant [7 x i8] c"[4]i64\00" @tn.str.152 = private constant [9 x i8] c"[]string\00" @tn.str.153 = private constant [11 x i8] c"CAllocator\00" @tn.str.154 = private constant [12 x i8] c"*CAllocator\00" @@ -72,7 +72,7 @@ @tn.str.173 = private constant [4 x i8] c"*u8\00" @tn.str.174 = private constant [14 x i8] c"ProcessResult\00" @tn.str.175 = private constant [15 x i8] c"?ProcessResult\00" -@tn.str.176 = private constant [5 x i8] c"*s32\00" +@tn.str.176 = private constant [5 x i8] c"*i32\00" @tn.str.177 = private constant [9 x i8] c"SockAddr\00" @tn.str.178 = private constant [10 x i8] c"*SockAddr\00" @tn.str.179 = private constant [5 x i8] c"*u32\00" @@ -88,9 +88,9 @@ @tn.str.189 = private constant [5 x i8] c"[]u8\00" @tn.str.190 = private constant [5 x i8] c"Sink\00" @tn.str.191 = private constant [6 x i8] c"*Sink\00" -@tn.str.192 = private constant [17 x i8] c"(s64, JsonError)\00" +@tn.str.192 = private constant [17 x i8] c"(i64, JsonError)\00" @tn.str.193 = private constant [15 x i8] c"JsonParseError\00" -@tn.str.194 = private constant [22 x i8] c"(s64, JsonParseError)\00" +@tn.str.194 = private constant [22 x i8] c"(i64, JsonParseError)\00" @tn.str.195 = private constant [7 x i8] c"Parser\00" @tn.str.196 = private constant [8 x i8] c"*Parser\00" @tn.str.197 = private constant [25 x i8] c"(string, JsonParseError)\00" @@ -99,7 +99,7 @@ @tn.str.200 = private constant [13 x i8] c"Architecture\00" @tn.str.201 = private constant [13 x i8] c"BuildOptions\00" @tn.str.202 = private constant [11 x i8] c"() -> bool\00" -@tn.str.203 = private constant [5 x i8] c"*s64\00" +@tn.str.203 = private constant [5 x i8] c"*i64\00" @tn.str.204 = private constant [9 x i8] c"CliError\00" @tn.str.205 = private constant [9 x i8] c"FlagSpec\00" @tn.str.206 = private constant [11 x i8] c"[]FlagSpec\00" @@ -112,12 +112,12 @@ @tn.str.213 = private constant [19 x i8] c"(Parsed, CliError)\00" @tn.str.214 = private constant [10 x i8] c"[]Command\00" @tn.str.215 = private constant [6 x i8] c"*Diag\00" -@tn.str.216 = private constant [7 x i8] c"[8]s64\00" +@tn.str.216 = private constant [7 x i8] c"[8]i64\00" @tn.str.217 = private constant [7 x i8] c"[64]u8\00" @tn.str.218 = private constant [7 x i8] c"Sha256\00" @tn.str.219 = private constant [8 x i8] c"*Sha256\00" @tn.str.220 = private constant [8 x i8] c"?[64]u8\00" -@tn.str.221 = private constant [8 x i8] c"[64]s64\00" +@tn.str.221 = private constant [8 x i8] c"[64]i64\00" @tn.str.222 = private constant [2 x i8] c"A\00" @tn.str.223 = private constant [2 x i8] c"!\00" @tn.str.224 = private constant [13 x i8] c"**CAllocator\00" @@ -130,7 +130,7 @@ @tn.str.231 = private constant [8 x i8] c"*[1]Any\00" @tn.str.232 = private constant [7 x i8] c"*[]Any\00" @tn.str.233 = private constant [6 x i8] c"*bool\00" -@tn.str.234 = private constant [8 x i8] c"*[4]s64\00" +@tn.str.234 = private constant [8 x i8] c"*[4]i64\00" @tn.str.235 = private constant [5 x i8] c"*f64\00" @tn.str.236 = private constant [17 x i8] c"*Source_Location\00" @tn.str.237 = private constant [11 x i8] c"*Allocator\00" @@ -148,9 +148,9 @@ @tn.str.249 = private constant [17 x i8] c"*OperatingSystem\00" @tn.str.250 = private constant [14 x i8] c"*Architecture\00" @tn.str.251 = private constant [15 x i8] c"*[16]FlagValue\00" -@tn.str.252 = private constant [8 x i8] c"*[8]s64\00" +@tn.str.252 = private constant [8 x i8] c"*[8]i64\00" @tn.str.253 = private constant [8 x i8] c"*[64]u8\00" -@tn.str.254 = private constant [9 x i8] c"*[64]s64\00" +@tn.str.254 = private constant [9 x i8] c"*[64]i64\00" @tn.str.255 = private constant [10 x i8] c"*[]string\00" @tn.str.256 = private constant [6 x i8] c"*[]u8\00" @tn.str.257 = private constant [12 x i8] c"*[]FlagSpec\00" @@ -163,7 +163,7 @@ @tn.str.264 = private constant [20 x i8] c"**TrackingAllocator\00" @tn.str.265 = private constant [7 x i8] c"**File\00" @tn.str.266 = private constant [5 x i8] c"**u8\00" -@tn.str.267 = private constant [6 x i8] c"**s32\00" +@tn.str.267 = private constant [6 x i8] c"**i32\00" @tn.str.268 = private constant [11 x i8] c"**SockAddr\00" @tn.str.269 = private constant [6 x i8] c"**u32\00" @tn.str.270 = private constant [10 x i8] c"*[*]Value\00" @@ -172,7 +172,7 @@ @tn.str.273 = private constant [9 x i8] c"**Object\00" @tn.str.274 = private constant [7 x i8] c"**Sink\00" @tn.str.275 = private constant [9 x i8] c"**Parser\00" -@tn.str.276 = private constant [6 x i8] c"**s64\00" +@tn.str.276 = private constant [6 x i8] c"**i64\00" @tn.str.277 = private constant [9 x i8] c"**Parsed\00" @tn.str.278 = private constant [7 x i8] c"**Diag\00" @tn.str.279 = private constant [9 x i8] c"**Sha256\00" @@ -554,7 +554,7 @@ @str.650 = private unnamed_addr constant [4 x i8] c"*u8\00", align 1 @str.651 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.652 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.653 = private unnamed_addr constant [5 x i8] c"*s32\00", align 1 +@str.653 = private unnamed_addr constant [5 x i8] c"*i32\00", align 1 @str.654 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.655 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.656 = private unnamed_addr constant [10 x i8] c"*SockAddr\00", align 1 @@ -581,7 +581,7 @@ @str.677 = private unnamed_addr constant [8 x i8] c"*Parser\00", align 1 @str.678 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.679 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.680 = private unnamed_addr constant [5 x i8] c"*s64\00", align 1 +@str.680 = private unnamed_addr constant [5 x i8] c"*i64\00", align 1 @str.681 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.682 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.683 = private unnamed_addr constant [8 x i8] c"*Parsed\00", align 1 @@ -1956,7 +1956,7 @@ dispatch.case.277: ; preds = %match.arm.59 %ua.raw174 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr175 = inttoptr i64 %ua.raw174 to ptr %ua.load176 = load [4 x i64], ptr %ua.ptr175, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %ua.load176) + %callN = call { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %ua.load176) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.275 @@ -1972,7 +1972,7 @@ dispatch.case.279: ; preds = %match.arm.59 %ua.raw182 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr183 = inttoptr i64 %ua.raw182 to ptr %ua.load184 = load [8 x i64], ptr %ua.ptr183, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %ua.load184) + %callN = call { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %ua.load184) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.275 @@ -1988,7 +1988,7 @@ dispatch.case.281: ; preds = %match.arm.59 %ua.raw190 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr191 = inttoptr i64 %ua.raw190 to ptr %ua.load192 = load [64 x i64], ptr %ua.ptr191, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %ua.load192) + %callN = call { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %ua.load192) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.275 @@ -2131,7 +2131,7 @@ dispatch.case.356: ; preds = %match.arm.61 dispatch.case.357: ; preds = %match.arm.61 %ua.raw249 = extractvalue { i64, i64 } %loadN, 1 %iNp250 = inttoptr i64 %ua.raw249 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %iNp250) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %iNp250) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.345 @@ -2194,7 +2194,7 @@ dispatch.case.365: ; preds = %match.arm.61 dispatch.case.366: ; preds = %match.arm.61 %ua.raw276 = extractvalue { i64, i64 } %loadN, 1 %iNp277 = inttoptr i64 %ua.raw276 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %iNp277) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %iNp277) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.345 @@ -3532,7 +3532,7 @@ if.then.10: ; preds = %if.merge.9 if.merge.11: ; preds = %if.then.10, %if.merge.9 %loadN = load i32, ptr %allocaN, align 4 - call void @print__ct_s5a624c50db282f36__pack_s32(ptr @__sx_default_context, i32 %loadN) + call void @print__ct_s5a624c50db282f36__pack_i32(ptr @__sx_default_context, i32 %loadN) %loadN = load i32, ptr %allocaN, align 4 ret i32 %loadN } @@ -3552,7 +3552,7 @@ entry: } ; Function Attrs: nounwind -define internal void @print__ct_s5a624c50db282f36__pack_s32(ptr %0, i32 %1) #0 { +define internal void @print__ct_s5a624c50db282f36__pack_i32(ptr %0, i32 %1) #0 { entry: %alloca = alloca { ptr, i64 }, align 8 store { ptr, i64 } { ptr @str.323, i64 20 }, ptr %alloca, align 8 @@ -3560,8 +3560,8 @@ entry: store i32 %1, ptr %allocaN, align 4 %allocaN = alloca [1 x { i64, i64 }], align 8 %load = load i32, ptr %allocaN, align 4 - %sN = sext i32 %load to i64 - %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %load to i64 + %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %igp.ptr = getelementptr { i64, i64 }, ptr %allocaN, i64 0 store { i64, i64 } %ba.val, ptr %igp.ptr, align 8 %allocaN = alloca { ptr, i64 }, align 8 @@ -3579,8 +3579,8 @@ entry: store { ptr, i64 } %callN, ptr %allocaN, align 8 %loadN = load { ptr, i64 }, ptr %allocaN, align 8 %loadN = load i32, ptr %allocaN, align 4 - %sN = sext i32 %loadN to i64 - %ba.val13 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %loadN to i64 + %ba.val13 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %callN = call { ptr, i64 } @any_to_string(ptr %0, { i64, i64 } %ba.val13) %callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN) store { ptr, i64 } %callN, ptr %allocaN, align 8 @@ -3680,14 +3680,14 @@ fv.case: ; preds = %if.merge.137 fv.case17: ; preds = %if.merge.137 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.137 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.137 @@ -4383,8 +4383,8 @@ fv.default: ; preds = %if.merge.182 fv.case: ; preds = %if.merge.182 %fv.field = extractvalue { i32 } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge } @@ -4467,14 +4467,14 @@ fv.case: ; preds = %if.merge.187 fv.case17: ; preds = %if.merge.187 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.187 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.187 @@ -4559,8 +4559,8 @@ fv.default: ; preds = %if.merge.192 fv.case: ; preds = %if.merge.192 %fv.field = extractvalue { i32, { ptr, i64 } } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case17: ; preds = %if.merge.192 @@ -5961,7 +5961,7 @@ if.merge.274: ; preds = %if.then.273, %entry } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %1) #0 { entry: %alloca = alloca [4 x i64], align 8 %ig.tmp = alloca [4 x i64], align 8 @@ -6064,7 +6064,7 @@ if.merge.292: ; preds = %if.then.291, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %1) #0 { entry: %alloca = alloca [8 x i64], align 8 %ig.tmp = alloca [8 x i64], align 8 @@ -6165,7 +6165,7 @@ if.merge.302: ; preds = %if.then.301, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %1) #0 { entry: %alloca = alloca [64 x i64], align 8 %ig.tmp = alloca [64 x i64], align 8 @@ -6815,7 +6815,7 @@ if.merge.420: ; preds = %if.else.419, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 @@ -7065,7 +7065,7 @@ if.merge.447: ; preds = %if.else.446, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 diff --git a/examples/expected/1007-errors-inferred-widening-reject.stderr b/examples/expected/1007-errors-inferred-widening-reject.stderr index e91759d..fcef9f6 100644 --- a/examples/expected/1007-errors-inferred-widening-reject.stderr +++ b/examples/expected/1007-errors-inferred-widening-reject.stderr @@ -1,5 +1,5 @@ error: error tag 'error.Foo' is not in caller's error set 'A' - --> /Users/agra/projects/sx/examples/1007-errors-inferred-widening-reject.sx:23:5 + --> examples/1007-errors-inferred-widening-reject.sx:23:5 | 23 | try via(); // error: Foo (via's converged set) not in A | ^^^^^^^^^ diff --git a/examples/expected/1009-errors-catch.ir b/examples/expected/1009-errors-catch.ir index 02e53a2..9b9506f 100644 --- a/examples/expected/1009-errors-catch.ir +++ b/examples/expected/1009-errors-catch.ir @@ -27,10 +27,10 @@ @tag_names = private constant [16 x { ptr, i64 }] [{ ptr, i64 } { ptr @tag.str, i64 0 }, { ptr, i64 } { ptr @tag.str.114, i64 8 }, { ptr, i64 } { ptr @tag.str.115, i64 2 }, { ptr, i64 } { ptr @tag.str.116, i64 15 }, { ptr, i64 } { ptr @tag.str.117, i64 13 }, { ptr, i64 } { ptr @tag.str.118, i64 9 }, { ptr, i64 } { ptr @tag.str.119, i64 9 }, { ptr, i64 } { ptr @tag.str.120, i64 15 }, { ptr, i64 } { ptr @tag.str.121, i64 14 }, { ptr, i64 } { ptr @tag.str.122, i64 14 }, { ptr, i64 } { ptr @tag.str.123, i64 11 }, { ptr, i64 } { ptr @tag.str.124, i64 12 }, { ptr, i64 } { ptr @tag.str.125, i64 15 }, { ptr, i64 } { ptr @tag.str.126, i64 12 }, { ptr, i64 } { ptr @tag.str.127, i64 3 }, { ptr, i64 } { ptr @tag.str.128, i64 5 }] @tn.str = private constant [13 x i8] c"\00" @tn.str.129 = private constant [5 x i8] c"bool\00" -@tn.str.130 = private constant [3 x i8] c"s8\00" -@tn.str.131 = private constant [4 x i8] c"s16\00" -@tn.str.132 = private constant [4 x i8] c"s32\00" -@tn.str.133 = private constant [4 x i8] c"s64\00" +@tn.str.130 = private constant [3 x i8] c"i8\00" +@tn.str.131 = private constant [4 x i8] c"i16\00" +@tn.str.132 = private constant [4 x i8] c"i32\00" +@tn.str.133 = private constant [4 x i8] c"i64\00" @tn.str.134 = private constant [3 x i8] c"u8\00" @tn.str.135 = private constant [4 x i8] c"u16\00" @tn.str.136 = private constant [4 x i8] c"u32\00" @@ -47,7 +47,7 @@ @tn.str.147 = private constant [16 x i8] c"Source_Location\00" @tn.str.148 = private constant [10 x i8] c"Allocator\00" @tn.str.149 = private constant [8 x i8] c"Context\00" -@tn.str.150 = private constant [7 x i8] c"[4]s64\00" +@tn.str.150 = private constant [7 x i8] c"[4]i64\00" @tn.str.151 = private constant [9 x i8] c"[]string\00" @tn.str.152 = private constant [11 x i8] c"CAllocator\00" @tn.str.153 = private constant [12 x i8] c"*CAllocator\00" @@ -72,7 +72,7 @@ @tn.str.172 = private constant [4 x i8] c"*u8\00" @tn.str.173 = private constant [14 x i8] c"ProcessResult\00" @tn.str.174 = private constant [15 x i8] c"?ProcessResult\00" -@tn.str.175 = private constant [5 x i8] c"*s32\00" +@tn.str.175 = private constant [5 x i8] c"*i32\00" @tn.str.176 = private constant [9 x i8] c"SockAddr\00" @tn.str.177 = private constant [10 x i8] c"*SockAddr\00" @tn.str.178 = private constant [5 x i8] c"*u32\00" @@ -88,9 +88,9 @@ @tn.str.188 = private constant [5 x i8] c"[]u8\00" @tn.str.189 = private constant [5 x i8] c"Sink\00" @tn.str.190 = private constant [6 x i8] c"*Sink\00" -@tn.str.191 = private constant [17 x i8] c"(s64, JsonError)\00" +@tn.str.191 = private constant [17 x i8] c"(i64, JsonError)\00" @tn.str.192 = private constant [15 x i8] c"JsonParseError\00" -@tn.str.193 = private constant [22 x i8] c"(s64, JsonParseError)\00" +@tn.str.193 = private constant [22 x i8] c"(i64, JsonParseError)\00" @tn.str.194 = private constant [7 x i8] c"Parser\00" @tn.str.195 = private constant [8 x i8] c"*Parser\00" @tn.str.196 = private constant [25 x i8] c"(string, JsonParseError)\00" @@ -99,7 +99,7 @@ @tn.str.199 = private constant [13 x i8] c"Architecture\00" @tn.str.200 = private constant [13 x i8] c"BuildOptions\00" @tn.str.201 = private constant [11 x i8] c"() -> bool\00" -@tn.str.202 = private constant [5 x i8] c"*s64\00" +@tn.str.202 = private constant [5 x i8] c"*i64\00" @tn.str.203 = private constant [9 x i8] c"CliError\00" @tn.str.204 = private constant [9 x i8] c"FlagSpec\00" @tn.str.205 = private constant [11 x i8] c"[]FlagSpec\00" @@ -112,12 +112,12 @@ @tn.str.212 = private constant [19 x i8] c"(Parsed, CliError)\00" @tn.str.213 = private constant [10 x i8] c"[]Command\00" @tn.str.214 = private constant [6 x i8] c"*Diag\00" -@tn.str.215 = private constant [7 x i8] c"[8]s64\00" +@tn.str.215 = private constant [7 x i8] c"[8]i64\00" @tn.str.216 = private constant [7 x i8] c"[64]u8\00" @tn.str.217 = private constant [7 x i8] c"Sha256\00" @tn.str.218 = private constant [8 x i8] c"*Sha256\00" @tn.str.219 = private constant [8 x i8] c"?[64]u8\00" -@tn.str.220 = private constant [8 x i8] c"[64]s64\00" +@tn.str.220 = private constant [8 x i8] c"[64]i64\00" @tn.str.221 = private constant [2 x i8] c"E\00" @tn.str.222 = private constant [13 x i8] c"**CAllocator\00" @tn.str.223 = private constant [7 x i8] c"**void\00" @@ -129,7 +129,7 @@ @tn.str.229 = private constant [8 x i8] c"*[1]Any\00" @tn.str.230 = private constant [7 x i8] c"*[]Any\00" @tn.str.231 = private constant [6 x i8] c"*bool\00" -@tn.str.232 = private constant [8 x i8] c"*[4]s64\00" +@tn.str.232 = private constant [8 x i8] c"*[4]i64\00" @tn.str.233 = private constant [5 x i8] c"*f64\00" @tn.str.234 = private constant [17 x i8] c"*Source_Location\00" @tn.str.235 = private constant [11 x i8] c"*Allocator\00" @@ -147,9 +147,9 @@ @tn.str.247 = private constant [17 x i8] c"*OperatingSystem\00" @tn.str.248 = private constant [14 x i8] c"*Architecture\00" @tn.str.249 = private constant [15 x i8] c"*[16]FlagValue\00" -@tn.str.250 = private constant [8 x i8] c"*[8]s64\00" +@tn.str.250 = private constant [8 x i8] c"*[8]i64\00" @tn.str.251 = private constant [8 x i8] c"*[64]u8\00" -@tn.str.252 = private constant [9 x i8] c"*[64]s64\00" +@tn.str.252 = private constant [9 x i8] c"*[64]i64\00" @tn.str.253 = private constant [10 x i8] c"*[]string\00" @tn.str.254 = private constant [6 x i8] c"*[]u8\00" @tn.str.255 = private constant [12 x i8] c"*[]FlagSpec\00" @@ -162,7 +162,7 @@ @tn.str.262 = private constant [20 x i8] c"**TrackingAllocator\00" @tn.str.263 = private constant [7 x i8] c"**File\00" @tn.str.264 = private constant [5 x i8] c"**u8\00" -@tn.str.265 = private constant [6 x i8] c"**s32\00" +@tn.str.265 = private constant [6 x i8] c"**i32\00" @tn.str.266 = private constant [11 x i8] c"**SockAddr\00" @tn.str.267 = private constant [6 x i8] c"**u32\00" @tn.str.268 = private constant [10 x i8] c"*[*]Value\00" @@ -171,7 +171,7 @@ @tn.str.271 = private constant [9 x i8] c"**Object\00" @tn.str.272 = private constant [7 x i8] c"**Sink\00" @tn.str.273 = private constant [9 x i8] c"**Parser\00" -@tn.str.274 = private constant [6 x i8] c"**s64\00" +@tn.str.274 = private constant [6 x i8] c"**i64\00" @tn.str.275 = private constant [9 x i8] c"**Parsed\00" @tn.str.276 = private constant [7 x i8] c"**Diag\00" @tn.str.277 = private constant [9 x i8] c"**Sha256\00" @@ -550,7 +550,7 @@ @str.645 = private unnamed_addr constant [4 x i8] c"*u8\00", align 1 @str.646 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.647 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.648 = private unnamed_addr constant [5 x i8] c"*s32\00", align 1 +@str.648 = private unnamed_addr constant [5 x i8] c"*i32\00", align 1 @str.649 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.650 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.651 = private unnamed_addr constant [10 x i8] c"*SockAddr\00", align 1 @@ -577,7 +577,7 @@ @str.672 = private unnamed_addr constant [8 x i8] c"*Parser\00", align 1 @str.673 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.674 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.675 = private unnamed_addr constant [5 x i8] c"*s64\00", align 1 +@str.675 = private unnamed_addr constant [5 x i8] c"*i64\00", align 1 @str.676 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.677 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.678 = private unnamed_addr constant [8 x i8] c"*Parsed\00", align 1 @@ -1951,7 +1951,7 @@ dispatch.case.295: ; preds = %match.arm.77 %ua.raw174 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr175 = inttoptr i64 %ua.raw174 to ptr %ua.load176 = load [4 x i64], ptr %ua.ptr175, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %ua.load176) + %callN = call { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %ua.load176) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.293 @@ -1967,7 +1967,7 @@ dispatch.case.297: ; preds = %match.arm.77 %ua.raw182 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr183 = inttoptr i64 %ua.raw182 to ptr %ua.load184 = load [8 x i64], ptr %ua.ptr183, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %ua.load184) + %callN = call { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %ua.load184) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.293 @@ -1983,7 +1983,7 @@ dispatch.case.299: ; preds = %match.arm.77 %ua.raw190 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr191 = inttoptr i64 %ua.raw190 to ptr %ua.load192 = load [64 x i64], ptr %ua.ptr191, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %ua.load192) + %callN = call { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %ua.load192) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.293 @@ -2126,7 +2126,7 @@ dispatch.case.374: ; preds = %match.arm.79 dispatch.case.375: ; preds = %match.arm.79 %ua.raw249 = extractvalue { i64, i64 } %loadN, 1 %iNp250 = inttoptr i64 %ua.raw249 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %iNp250) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %iNp250) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.363 @@ -2189,7 +2189,7 @@ dispatch.case.383: ; preds = %match.arm.79 dispatch.case.384: ; preds = %match.arm.79 %ua.raw276 = extractvalue { i64, i64 } %loadN, 1 %iNp277 = inttoptr i64 %ua.raw276 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %iNp277) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %iNp277) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.363 @@ -3624,7 +3624,7 @@ if.merge.23: ; preds = %if.then.22, %if.mer %addN = add i32 %loadN, %callN store i32 %addN, ptr %alloca, align 4 %loadN = load i32, ptr %alloca, align 4 - call void @print__ct_sbcb4570e4e0d606e__pack_s32(ptr @__sx_default_context, i32 %loadN) + call void @print__ct_sbcb4570e4e0d606e__pack_i32(ptr @__sx_default_context, i32 %loadN) %loadN = load i32, ptr %alloca, align 4 ret i32 %loadN } @@ -3644,7 +3644,7 @@ entry: } ; Function Attrs: nounwind -define internal void @print__ct_sbcb4570e4e0d606e__pack_s32(ptr %0, i32 %1) #0 { +define internal void @print__ct_sbcb4570e4e0d606e__pack_i32(ptr %0, i32 %1) #0 { entry: %alloca = alloca { ptr, i64 }, align 8 store { ptr, i64 } { ptr @str.318, i64 17 }, ptr %alloca, align 8 @@ -3652,8 +3652,8 @@ entry: store i32 %1, ptr %allocaN, align 4 %allocaN = alloca [1 x { i64, i64 }], align 8 %load = load i32, ptr %allocaN, align 4 - %sN = sext i32 %load to i64 - %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %load to i64 + %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %igp.ptr = getelementptr { i64, i64 }, ptr %allocaN, i64 0 store { i64, i64 } %ba.val, ptr %igp.ptr, align 8 %allocaN = alloca { ptr, i64 }, align 8 @@ -3671,8 +3671,8 @@ entry: store { ptr, i64 } %callN, ptr %allocaN, align 8 %loadN = load { ptr, i64 }, ptr %allocaN, align 8 %loadN = load i32, ptr %allocaN, align 4 - %sN = sext i32 %loadN to i64 - %ba.val13 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %loadN to i64 + %ba.val13 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %callN = call { ptr, i64 } @any_to_string(ptr %0, { i64, i64 } %ba.val13) %callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN) store { ptr, i64 } %callN, ptr %allocaN, align 8 @@ -3772,14 +3772,14 @@ fv.case: ; preds = %if.merge.155 fv.case17: ; preds = %if.merge.155 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.155 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.155 @@ -4475,8 +4475,8 @@ fv.default: ; preds = %if.merge.200 fv.case: ; preds = %if.merge.200 %fv.field = extractvalue { i32 } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge } @@ -4559,14 +4559,14 @@ fv.case: ; preds = %if.merge.205 fv.case17: ; preds = %if.merge.205 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.205 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.205 @@ -4651,8 +4651,8 @@ fv.default: ; preds = %if.merge.210 fv.case: ; preds = %if.merge.210 %fv.field = extractvalue { i32, { ptr, i64 } } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case17: ; preds = %if.merge.210 @@ -6053,7 +6053,7 @@ if.merge.292: ; preds = %if.then.291, %entry } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %1) #0 { entry: %alloca = alloca [4 x i64], align 8 %ig.tmp = alloca [4 x i64], align 8 @@ -6156,7 +6156,7 @@ if.merge.310: ; preds = %if.then.309, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %1) #0 { entry: %alloca = alloca [8 x i64], align 8 %ig.tmp = alloca [8 x i64], align 8 @@ -6257,7 +6257,7 @@ if.merge.320: ; preds = %if.then.319, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %1) #0 { entry: %alloca = alloca [64 x i64], align 8 %ig.tmp = alloca [64 x i64], align 8 @@ -6907,7 +6907,7 @@ if.merge.438: ; preds = %if.else.437, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 @@ -7157,7 +7157,7 @@ if.merge.465: ; preds = %if.else.464, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 diff --git a/examples/expected/1010-errors-catch-rejections.stderr b/examples/expected/1010-errors-catch-rejections.stderr index f78a52f..cc5586e 100644 --- a/examples/expected/1010-errors-catch-rejections.stderr +++ b/examples/expected/1010-errors-catch-rejections.stderr @@ -1,5 +1,5 @@ -error: `catch` requires a failable expression; operand has type 's32' +error: `catch` requires a failable expression; operand has type 'i32' --> examples/1010-errors-catch-rejections.sx:11:5 | -11 | plain() catch (e) { return 1; }; // error: operand has type s32 (not failable) +11 | plain() catch (e) { return 1; }; // error: operand has type i32 (not failable) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/examples/expected/1013-errors-value-failable-reject.stderr b/examples/expected/1013-errors-value-failable-reject.stderr index 22c9581..d412c3c 100644 --- a/examples/expected/1013-errors-value-failable-reject.stderr +++ b/examples/expected/1013-errors-value-failable-reject.stderr @@ -1,4 +1,4 @@ -error: `catch` body must produce a value of type 's32' (or diverge with `return` / `raise`) +error: `catch` body must produce a value of type 'i32' (or diverge with `return` / `raise`) --> examples/1013-errors-value-failable-reject.sx:17:10 | 17 | x := parse(-1) catch (e) { print("oops\n") }; // error: body yields no value diff --git a/examples/expected/1015-errors-failable-or-reject.stderr b/examples/expected/1015-errors-failable-or-reject.stderr index 793c9fe..55b9d86 100644 --- a/examples/expected/1015-errors-failable-or-reject.stderr +++ b/examples/expected/1015-errors-failable-or-reject.stderr @@ -1,5 +1,5 @@ error: `or value` requires a value-carrying failable (`-> (T, !)`) — a `-> !` has no success value to fall back to; use `catch` to absorb the error - --> /Users/agra/projects/sx/examples/1015-errors-failable-or-reject.sx:17:10 + --> examples/1015-errors-failable-or-reject.sx:17:10 | 17 | x := must(-1) or 0; // error: `-> !` has no success value to fall back to | ^^^^^^^^ diff --git a/examples/expected/1017-errors-onfail-reject.stderr b/examples/expected/1017-errors-onfail-reject.stderr index 36c0340..3cf373c 100644 --- a/examples/expected/1017-errors-onfail-reject.stderr +++ b/examples/expected/1017-errors-onfail-reject.stderr @@ -1,5 +1,5 @@ error: `onfail` is only valid inside a failable function (a return type with `!` or `!Named`) — use `defer` for unconditional cleanup - --> /Users/agra/projects/sx/examples/1017-errors-onfail-reject.sx:9:5 + --> examples/1017-errors-onfail-reject.sx:9:5 | 9 | onfail print("never fires\n"); // error: onfail outside a failable function | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/examples/expected/1019-errors-failable-discard-reject.stderr b/examples/expected/1019-errors-failable-discard-reject.stderr index c75fbe0..7374304 100644 --- a/examples/expected/1019-errors-failable-discard-reject.stderr +++ b/examples/expected/1019-errors-failable-discard-reject.stderr @@ -1,11 +1,11 @@ error: the error slot of a failable cannot be dropped — bind it (`v, err := …`) and handle it, or use `try` / `catch` - --> /Users/agra/projects/sx/examples/1019-errors-failable-discard-reject.sx:27:13 + --> examples/1019-errors-failable-discard-reject.sx:27:13 | 27 | a, b := pair(5); // ERROR: error slot omitted (3 slots, 2 names) | ^^^^^^^ error: the error slot of a failable cannot be dropped — bind it (`v, err := …`) and handle it, or use `try` / `catch` - --> /Users/agra/projects/sx/examples/1019-errors-failable-discard-reject.sx:28:13 + --> examples/1019-errors-failable-discard-reject.sx:28:13 | 28 | v, _ := parse(5); // ERROR: error slot discarded with `_` | ^^^^^^^^ diff --git a/examples/expected/1020-errors-cleanup-body-restrictions.stderr b/examples/expected/1020-errors-cleanup-body-restrictions.stderr index c34c20d..edef2b6 100644 --- a/examples/expected/1020-errors-cleanup-body-restrictions.stderr +++ b/examples/expected/1020-errors-cleanup-body-restrictions.stderr @@ -1,5 +1,5 @@ error: `return` is not allowed inside a `defer` body — cleanup runs while the function is already exiting, so there is nothing to transfer control to - --> /Users/agra/projects/sx/examples/1020-errors-cleanup-body-restrictions.sx:18:14 + --> examples/1020-errors-cleanup-body-restrictions.sx:18:14 | 18 | defer { return; } // ERROR: return in defer body | ^^^^^^ diff --git a/examples/expected/1022-errors-main-signature-reject.stderr b/examples/expected/1022-errors-main-signature-reject.stderr index fa9e29d..796b24f 100644 --- a/examples/expected/1022-errors-main-signature-reject.stderr +++ b/examples/expected/1022-errors-main-signature-reject.stderr @@ -1,5 +1,5 @@ error: main: return type must be void, an integer, or `!`; got 'string' - --> /Users/agra/projects/sx/examples/1022-errors-main-signature-reject.sx:13:15 + --> examples/1022-errors-main-signature-reject.sx:13:15 | 13 | main :: () -> string { // ERROR: return type must be void, an integer, or `!` | ^^^^^^ diff --git a/examples/expected/1032-errors-assert.stdout b/examples/expected/1032-errors-assert.stdout index beb9089..27e746a 100644 --- a/examples/expected/1032-errors-assert.stdout +++ b/examples/expected/1032-errors-assert.stdout @@ -1,2 +1,2 @@ first assert passed -ASSERTION FAILED at /Users/agra/projects/sx/examples/1032-errors-assert.sx:12: two plus two is not five +ASSERTION FAILED at examples/1032-errors-assert.sx:12: two plus two is not five diff --git a/examples/expected/1042-errors-failable-closure-shape-union-reject.stderr b/examples/expected/1042-errors-failable-closure-shape-union-reject.stderr index 6c4409b..4c15d27 100644 --- a/examples/expected/1042-errors-failable-closure-shape-union-reject.stderr +++ b/examples/expected/1042-errors-failable-closure-shape-union-reject.stderr @@ -1,11 +1,11 @@ error: error tag 'error.Negative' is not in caller's error set 'Small' - --> /Users/agra/projects/sx/examples/1042-errors-failable-closure-shape-union-reject.sx:13:12 + --> examples/1042-errors-failable-closure-shape-union-reject.sx:13:12 | 13 | return try h(x); // Negative, Other ∉ Small → two diagnostics | ^^^^^^^^ error: error tag 'error.Other' is not in caller's error set 'Small' - --> /Users/agra/projects/sx/examples/1042-errors-failable-closure-shape-union-reject.sx:13:12 + --> examples/1042-errors-failable-closure-shape-union-reject.sx:13:12 | 13 | return try h(x); // Negative, Other ∉ Small → two diagnostics | ^^^^^^^^ diff --git a/examples/expected/1043-errors-lambda-raise-annotation-hint.stderr b/examples/expected/1043-errors-lambda-raise-annotation-hint.stderr index 11c936e..d15c4ac 100644 --- a/examples/expected/1043-errors-lambda-raise-annotation-hint.stderr +++ b/examples/expected/1043-errors-lambda-raise-annotation-hint.stderr @@ -1,5 +1,5 @@ error: lambda body raises; declare its return type explicitly with `-> (T, !)` or `-> (T, !Named)` - --> /Users/agra/projects/sx/examples/1043-errors-lambda-raise-annotation-hint.sx:18:61 + --> examples/1043-errors-lambda-raise-annotation-hint.sx:18:61 | -18 | print("{}\n", take(closure((x: s32) -> s32 { if x < 0 { raise error.Neg; } return x; }), -1)); +18 | print("{}\n", take(closure((x: i32) -> i32 { if x < 0 { raise error.Neg; } return x; }), -1)); | ^^^^^^^^^^^^^^^^ diff --git a/examples/expected/1045-errors-closure-var-bare-slot-reject.stderr b/examples/expected/1045-errors-closure-var-bare-slot-reject.stderr index bf5ba16..a1c8cd2 100644 --- a/examples/expected/1045-errors-closure-var-bare-slot-reject.stderr +++ b/examples/expected/1045-errors-closure-var-bare-slot-reject.stderr @@ -1,17 +1,17 @@ error: a closure value cannot be passed as a bare function-pointer `(...) -> ...` — its environment can't be carried across the bare ABI; pass the closure literal directly at the call site, or declare the parameter type as `Closure(...)` - --> /Users/agra/projects/sx/examples/1045-errors-closure-var-bare-slot-reject.sx:23:10 + --> examples/1045-errors-closure-var-bare-slot-reject.sx:23:10 | 23 | _ := bare(inc, 9); // reject: closure value → bare slot | ^^^^^^^^^^^^ error: a closure value cannot be passed as a bare function-pointer `(...) -> ...` — its environment can't be carried across the bare ABI; pass the closure literal directly at the call site, or declare the parameter type as `Closure(...)` - --> /Users/agra/projects/sx/examples/1045-errors-closure-var-bare-slot-reject.sx:24:10 + --> examples/1045-errors-closure-var-bare-slot-reject.sx:24:10 | 24 | _ := baref(inc, 9); // reject: also the ∅-widening crossing | ^^^^^^^^^^^^^ error: a closure value cannot be passed as a bare function-pointer `(...) -> ...` — its environment can't be carried across the bare ABI; pass the closure literal directly at the call site, or declare the parameter type as `Closure(...)` - --> /Users/agra/projects/sx/examples/1045-errors-closure-var-bare-slot-reject.sx:25:10 + --> examples/1045-errors-closure-var-bare-slot-reject.sx:25:10 | 25 | _ := bare(add, 9); // reject: capturing closure → bare slot | ^^^^^^^^^^^^ diff --git a/examples/expected/1047-errors-value-slot-liveness-reject.stderr b/examples/expected/1047-errors-value-slot-liveness-reject.stderr index bdf7a17..7958cc9 100644 --- a/examples/expected/1047-errors-value-slot-liveness-reject.stderr +++ b/examples/expected/1047-errors-value-slot-liveness-reject.stderr @@ -1,11 +1,11 @@ error: value `v` from a failable can be used only where its error `err` is proven absent — guard the use with `if !err { … }`, or return early with `if err { return; }` before reading `v` - --> /Users/agra/projects/sx/examples/1047-errors-value-slot-liveness-reject.sx:22:21 + --> examples/1047-errors-value-slot-liveness-reject.sx:22:21 | 22 | if err { return v; } // REJECTED: err present on this path | ^ error: value `v` from a failable can be used only where its error `err` is proven absent — guard the use with `if !err { … }`, or return early with `if err { return; }` before reading `v` - --> /Users/agra/projects/sx/examples/1047-errors-value-slot-liveness-reject.sx:30:12 + --> examples/1047-errors-value-slot-liveness-reject.sx:30:12 | 30 | return v; // REJECTED: err not proven absent | ^ diff --git a/examples/expected/1049-errors-cleanup-absorption-reject.stderr b/examples/expected/1049-errors-cleanup-absorption-reject.stderr index bb960df..3fcf2bf 100644 --- a/examples/expected/1049-errors-cleanup-absorption-reject.stderr +++ b/examples/expected/1049-errors-cleanup-absorption-reject.stderr @@ -1,11 +1,11 @@ error: a bare failable call in a `defer` body has nowhere to send its error — the block is already exiting; absorb it locally with `catch` or `or ` - --> /Users/agra/projects/sx/examples/1049-errors-cleanup-absorption-reject.sx:14:12 + --> examples/1049-errors-cleanup-absorption-reject.sx:14:12 | 14 | defer failing(); // REJECTED: bare failable in a defer body | ^^^^^^^^^ error: a bare failable call in a `onfail` body has nowhere to send its error — the block is already exiting; absorb it locally with `catch` or `or ` - --> /Users/agra/projects/sx/examples/1049-errors-cleanup-absorption-reject.sx:15:14 + --> examples/1049-errors-cleanup-absorption-reject.sx:15:14 | 15 | onfail { failing(); } // REJECTED: bare failable in an onfail body | ^^^^^^^^^ diff --git a/examples/expected/1100-diagnostics-err-field-not-found.stderr b/examples/expected/1100-diagnostics-err-field-not-found.stderr index 0ae17a4..2c363a9 100644 --- a/examples/expected/1100-diagnostics-err-field-not-found.stderr +++ b/examples/expected/1100-diagnostics-err-field-not-found.stderr @@ -1,5 +1,5 @@ error: field 'bogus' not found on type 'Vec' - --> /Users/agra/projects/sx/examples/1100-diagnostics-err-field-not-found.sx:8:15 + --> examples/1100-diagnostics-err-field-not-found.sx:8:15 | 8 | return xx v.bogus; | ^^^^^^^ diff --git a/examples/expected/1101-diagnostics-err-tuple-oob.stderr b/examples/expected/1101-diagnostics-err-tuple-oob.stderr index d8b4008..0226400 100644 --- a/examples/expected/1101-diagnostics-err-tuple-oob.stderr +++ b/examples/expected/1101-diagnostics-err-tuple-oob.stderr @@ -1,5 +1,5 @@ error: field '42' not found on type 'tuple' - --> /Users/agra/projects/sx/examples/1101-diagnostics-err-tuple-oob.sx:6:15 + --> examples/1101-diagnostics-err-tuple-oob.sx:6:15 | 6 | return xx t.42; | ^^^^ diff --git a/examples/expected/1102-diagnostics-err-dot-shorthand.stderr b/examples/expected/1102-diagnostics-err-dot-shorthand.stderr index 5e553da..e909062 100644 --- a/examples/expected/1102-diagnostics-err-dot-shorthand.stderr +++ b/examples/expected/1102-diagnostics-err-dot-shorthand.stderr @@ -1,5 +1,5 @@ error: cannot infer enum type for '.Foo' — use an explicit type or assign to a typed variable - --> /Users/agra/projects/sx/examples/1102-diagnostics-err-dot-shorthand.sx:5:10 + --> examples/1102-diagnostics-err-dot-shorthand.sx:5:10 | 5 | x := .Foo(1, 2); | ^^^^ diff --git a/examples/expected/1103-diagnostics-err-bad-variant.stderr b/examples/expected/1103-diagnostics-err-bad-variant.stderr index 1503364..2735704 100644 --- a/examples/expected/1103-diagnostics-err-bad-variant.stderr +++ b/examples/expected/1103-diagnostics-err-bad-variant.stderr @@ -1,5 +1,5 @@ error: no variant 'Bogus' on type 'Shape' - --> /Users/agra/projects/sx/examples/1103-diagnostics-err-bad-variant.sx:18:14 + --> examples/1103-diagnostics-err-bad-variant.sx:18:14 | 18 | case .Bogus: (x) { print("bogus={}\n", x); } | ^^^^^^ diff --git a/examples/expected/1104-diagnostics-callconv-mismatch-diagnostic.stderr b/examples/expected/1104-diagnostics-callconv-mismatch-diagnostic.stderr index 7945f1d..b6a2cec 100644 --- a/examples/expected/1104-diagnostics-callconv-mismatch-diagnostic.stderr +++ b/examples/expected/1104-diagnostics-callconv-mismatch-diagnostic.stderr @@ -1,5 +1,5 @@ error: call-convention mismatch: 'sx_handler' is declared with default sx convention but the target type expects callconv(.c) - --> /Users/agra/projects/sx/examples/1104-diagnostics-callconv-mismatch-diagnostic.sx:12:42 + --> examples/1104-diagnostics-callconv-mismatch-diagnostic.sx:12:42 | 12 | fp : (*void) -> *void callconv(.c) = sx_handler; | ^^^^^^^^^^ diff --git a/examples/expected/1105-diagnostics-compile-error.stderr b/examples/expected/1105-diagnostics-compile-error.stderr index 5cccf25..ce78081 100644 --- a/examples/expected/1105-diagnostics-compile-error.stderr +++ b/examples/expected/1105-diagnostics-compile-error.stderr @@ -1,5 +1,5 @@ error: intentional compile error from #run - --> /Users/agra/projects/sx/examples/1105-diagnostics-compile-error.sx:12:6 + --> examples/1105-diagnostics-compile-error.sx:12:6 | 12 | #run compile_error("intentional compile error from #run"); | ^^^^^^^^^^^^^ diff --git a/examples/expected/1106-diagnostics-binop-operand-type-check.stderr b/examples/expected/1106-diagnostics-binop-operand-type-check.stderr index 427e1b1..ebd8f26 100644 --- a/examples/expected/1106-diagnostics-binop-operand-type-check.stderr +++ b/examples/expected/1106-diagnostics-binop-operand-type-check.stderr @@ -1,29 +1,29 @@ -error: cannot apply '+' to operands of type 's64' and 'string' - --> /Users/agra/projects/sx/examples/1106-diagnostics-binop-operand-type-check.sx:19:10 +error: cannot apply '+' to operands of type 'i64' and 'string' + --> examples/1106-diagnostics-binop-operand-type-check.sx:19:10 | -19 | a := n + s; // arithmetic: s64 + string +19 | a := n + s; // arithmetic: i64 + string | ^ -error: cannot apply '*' to operands of type 'string' and 's64' - --> /Users/agra/projects/sx/examples/1106-diagnostics-binop-operand-type-check.sx:20:10 +error: cannot apply '*' to operands of type 'string' and 'i64' + --> examples/1106-diagnostics-binop-operand-type-check.sx:20:10 | -20 | b := s * n; // arithmetic: non-numeric LHS (string * s64) +20 | b := s * n; // arithmetic: non-numeric LHS (string * i64) | ^ -error: cannot apply '<' to operands of type 's64' and 'string' - --> /Users/agra/projects/sx/examples/1106-diagnostics-binop-operand-type-check.sx:21:10 +error: cannot apply '<' to operands of type 'i64' and 'string' + --> examples/1106-diagnostics-binop-operand-type-check.sx:21:10 | -21 | c := n < s; // ordering: s64 < string +21 | c := n < s; // ordering: i64 < string | ^ -error: cannot apply '&' to operands of type 's64' and 'string' - --> /Users/agra/projects/sx/examples/1106-diagnostics-binop-operand-type-check.sx:22:10 +error: cannot apply '&' to operands of type 'i64' and 'string' + --> examples/1106-diagnostics-binop-operand-type-check.sx:22:10 | -22 | d := n & s; // bitwise: s64 & string +22 | d := n & s; // bitwise: i64 & string | ^ -error: cannot apply '<<' to operands of type 's64' and 'string' - --> /Users/agra/projects/sx/examples/1106-diagnostics-binop-operand-type-check.sx:23:10 +error: cannot apply '<<' to operands of type 'i64' and 'string' + --> examples/1106-diagnostics-binop-operand-type-check.sx:23:10 | -23 | e := n << s; // shift: s64 << string +23 | e := n << s; // shift: i64 << string | ^ diff --git a/examples/expected/1107-diagnostics-ref-capture-value-arg-diagnostic.stderr b/examples/expected/1107-diagnostics-ref-capture-value-arg-diagnostic.stderr index 586a717..9866e5e 100644 --- a/examples/expected/1107-diagnostics-ref-capture-value-arg-diagnostic.stderr +++ b/examples/expected/1107-diagnostics-ref-capture-value-arg-diagnostic.stderr @@ -1,5 +1,5 @@ error: by-reference loop capture 'm' has type '*Move', but 'Move' is expected here - --> /Users/agra/projects/sx/examples/1107-diagnostics-ref-capture-value-arg-diagnostic.sx:15:14 + --> examples/1107-diagnostics-ref-capture-value-arg-diagnostic.sx:15:14 | 15 | take(m); | ^ diff --git a/examples/expected/1108-diagnostics-pointer-param-value-arg-diagnostic.stderr b/examples/expected/1108-diagnostics-pointer-param-value-arg-diagnostic.stderr index 2911c93..1be70a6 100644 --- a/examples/expected/1108-diagnostics-pointer-param-value-arg-diagnostic.stderr +++ b/examples/expected/1108-diagnostics-pointer-param-value-arg-diagnostic.stderr @@ -1,7 +1,7 @@ error: argument 'm' has type '*Move', but 'Move' is expected here - --> /Users/agra/projects/sx/examples/1108-diagnostics-pointer-param-value-arg-diagnostic.sx:13:44 + --> examples/1108-diagnostics-pointer-param-value-arg-diagnostic.sx:13:44 | -13 | forward :: (m: *Move) -> s64 { return take(m); } +13 | forward :: (m: *Move) -> i64 { return take(m); } | ^ help: dereference it to pass the value: `m.*` diff --git a/examples/expected/1109-diagnostics-deref-non-pointer-reject.stderr b/examples/expected/1109-diagnostics-deref-non-pointer-reject.stderr index cce8214..ca7dbfc 100644 --- a/examples/expected/1109-diagnostics-deref-non-pointer-reject.stderr +++ b/examples/expected/1109-diagnostics-deref-non-pointer-reject.stderr @@ -1,5 +1,5 @@ error: cannot dereference with `.*`: 'Point' is not a pointer - --> /Users/agra/projects/sx/examples/1109-diagnostics-deref-non-pointer-reject.sx:12:10 + --> examples/1109-diagnostics-deref-non-pointer-reject.sx:12:10 | 12 | q := p.*; // ERROR: `p` is a Point value, not a pointer | ^ diff --git a/examples/expected/1111-diagnostics-nondollar-type-param-rejected.stderr b/examples/expected/1111-diagnostics-nondollar-type-param-rejected.stderr index dffa4bf..f271bf4 100644 --- a/examples/expected/1111-diagnostics-nondollar-type-param-rejected.stderr +++ b/examples/expected/1111-diagnostics-nondollar-type-param-rejected.stderr @@ -1,11 +1,11 @@ error: 'T' is a value parameter, not a type; introduce a generic type parameter with `$T: Type` - --> /Users/agra/projects/sx/examples/1111-diagnostics-nondollar-type-param-rejected.sx:6:37 + --> examples/1111-diagnostics-nondollar-type-param-rejected.sx:6:37 | 6 | idwrap :: (T: Type, f: Closure() -> T) -> T { return f(); } | ^ error: 'T' is a value parameter, not a type; introduce a generic type parameter with `$T: Type` - --> /Users/agra/projects/sx/examples/1111-diagnostics-nondollar-type-param-rejected.sx:6:43 + --> examples/1111-diagnostics-nondollar-type-param-rejected.sx:6:43 | 6 | idwrap :: (T: Type, f: Closure() -> T) -> T { return f(); } | ^ diff --git a/examples/expected/1112-diagnostics-unknown-type-name-rejected.stderr b/examples/expected/1112-diagnostics-unknown-type-name-rejected.stderr index a41cc74..1bf8d55 100644 --- a/examples/expected/1112-diagnostics-unknown-type-name-rejected.stderr +++ b/examples/expected/1112-diagnostics-unknown-type-name-rejected.stderr @@ -1,5 +1,5 @@ error: unknown type 'Coordnate' - --> /Users/agra/projects/sx/examples/1112-diagnostics-unknown-type-name-rejected.sx:8:8 + --> examples/1112-diagnostics-unknown-type-name-rejected.sx:8:8 | 8 | y: Coordnate; // typo for a non-existent type | ^^^^^^^^^ diff --git a/examples/expected/1113-diagnostics-unknown-type-local-var-rejected.stderr b/examples/expected/1113-diagnostics-unknown-type-local-var-rejected.stderr index 8e13b80..995a2b6 100644 --- a/examples/expected/1113-diagnostics-unknown-type-local-var-rejected.stderr +++ b/examples/expected/1113-diagnostics-unknown-type-local-var-rejected.stderr @@ -1,5 +1,5 @@ error: unknown type 'Coordnate' - --> /Users/agra/projects/sx/examples/1113-diagnostics-unknown-type-local-var-rejected.sx:8:8 + --> examples/1113-diagnostics-unknown-type-local-var-rejected.sx:8:8 | 8 | v: Coordnate = 5; | ^^^^^^^^^ diff --git a/examples/expected/1114-diagnostics-unknown-type-nested-closure-rejected.stderr b/examples/expected/1114-diagnostics-unknown-type-nested-closure-rejected.stderr index e9e56f9..f3005b9 100644 --- a/examples/expected/1114-diagnostics-unknown-type-nested-closure-rejected.stderr +++ b/examples/expected/1114-diagnostics-unknown-type-nested-closure-rejected.stderr @@ -1,5 +1,5 @@ error: unknown type 'Coordnate' - --> /Users/agra/projects/sx/examples/1114-diagnostics-unknown-type-nested-closure-rejected.sx:8:14 + --> examples/1114-diagnostics-unknown-type-nested-closure-rejected.sx:8:14 | 8 | bad: Coordnate = ---; | ^^^^^^^^^ diff --git a/examples/expected/1115-diagnostics-cast-value-param-rejected.stderr b/examples/expected/1115-diagnostics-cast-value-param-rejected.stderr index f57fd80..0df3ef6 100644 --- a/examples/expected/1115-diagnostics-cast-value-param-rejected.stderr +++ b/examples/expected/1115-diagnostics-cast-value-param-rejected.stderr @@ -1,5 +1,5 @@ error: 'T' is a value parameter, not a type; introduce a generic type parameter with `$T: Type` - --> /Users/agra/projects/sx/examples/1115-diagnostics-cast-value-param-rejected.sx:7:17 + --> examples/1115-diagnostics-cast-value-param-rejected.sx:7:17 | 7 | return cast(T) x; | ^ diff --git a/examples/expected/1116-diagnostics-tuple-type-nontype-element-rejected.stderr b/examples/expected/1116-diagnostics-tuple-type-nontype-element-rejected.stderr index 4c0516e..248997c 100644 --- a/examples/expected/1116-diagnostics-tuple-type-nontype-element-rejected.stderr +++ b/examples/expected/1116-diagnostics-tuple-type-nontype-element-rejected.stderr @@ -1,5 +1,5 @@ -error: tuple type element is not a type (found `int_literal`); a tuple used as a type must list only types, e.g. `(s32, s32)` +error: tuple type element is not a type (found `int_literal`); a tuple used as a type must list only types, e.g. `(i32, i32)` --> examples/1116-diagnostics-tuple-type-nontype-element-rejected.sx:11:55 | -11 | print("bad tuple type size = {}\n", size_of((s32, 1))); +11 | print("bad tuple type size = {}\n", size_of((i32, 1))); | ^ diff --git a/examples/expected/1118-diagnostics-global-non-const-initializer-rejected.stderr b/examples/expected/1118-diagnostics-global-non-const-initializer-rejected.stderr index e5eed34..993d80b 100644 --- a/examples/expected/1118-diagnostics-global-non-const-initializer-rejected.stderr +++ b/examples/expected/1118-diagnostics-global-non-const-initializer-rejected.stderr @@ -1,5 +1,5 @@ error: global 'g' must be initialized by a compile-time constant --> examples/1118-diagnostics-global-non-const-initializer-rejected.sx:14:11 | -14 | g : s32 = K.x; +14 | g : i32 = K.x; | ^^^ diff --git a/examples/expected/1119-diagnostics-reserved-type-name-as-identifier.stderr b/examples/expected/1119-diagnostics-reserved-type-name-as-identifier.stderr index b15964c..eee1484 100644 --- a/examples/expected/1119-diagnostics-reserved-type-name-as-identifier.stderr +++ b/examples/expected/1119-diagnostics-reserved-type-name-as-identifier.stderr @@ -1,23 +1,23 @@ error: 'u8' is a reserved type name and cannot be used as an identifier - --> /Users/agra/projects/sx/examples/1119-diagnostics-reserved-type-name-as-identifier.sx:9:14 + --> examples/1119-diagnostics-reserved-type-name-as-identifier.sx:9:14 | - 9 | takes_u8 :: (u8: s32) -> s32 { return u8; } + 9 | takes_u8 :: (u8: i32) -> i32 { return u8; } | ^^ -error: 's64' is a reserved type name and cannot be used as an identifier - --> /Users/agra/projects/sx/examples/1119-diagnostics-reserved-type-name-as-identifier.sx:12:5 +error: 'i64' is a reserved type name and cannot be used as an identifier + --> examples/1119-diagnostics-reserved-type-name-as-identifier.sx:12:5 | -12 | s64 : s32 = 3; +12 | i64 : i32 = 3; | ^^^ error: 'bool' is a reserved type name and cannot be used as an identifier - --> /Users/agra/projects/sx/examples/1119-diagnostics-reserved-type-name-as-identifier.sx:13:5 + --> examples/1119-diagnostics-reserved-type-name-as-identifier.sx:13:5 | 13 | bool : bool = true; | ^^^^ error: 'string' is a reserved type name and cannot be used as an identifier - --> /Users/agra/projects/sx/examples/1119-diagnostics-reserved-type-name-as-identifier.sx:14:5 + --> examples/1119-diagnostics-reserved-type-name-as-identifier.sx:14:5 | 14 | string := "x"; | ^^^^^^ diff --git a/examples/expected/1120-diagnostics-imported-reserved-type-name.stderr b/examples/expected/1120-diagnostics-imported-reserved-type-name.stderr index 9b7397d..01a9833 100644 --- a/examples/expected/1120-diagnostics-imported-reserved-type-name.stderr +++ b/examples/expected/1120-diagnostics-imported-reserved-type-name.stderr @@ -1,5 +1,5 @@ -error: 's2' is a reserved type name and cannot be used as an identifier +error: 'i2' is a reserved type name and cannot be used as an identifier --> examples/1120-diagnostics-imported-reserved-type-name/mod.sx:11:5 | -11 | s2 := Box.{ total = 0, count = 0 }; +11 | i2 := Box.{ total = 0, count = 0 }; | ^^ diff --git a/examples/expected/1121-diagnostics-reserved-name-control-flow.stderr b/examples/expected/1121-diagnostics-reserved-name-control-flow.stderr index baad775..7c9e878 100644 --- a/examples/expected/1121-diagnostics-reserved-name-control-flow.stderr +++ b/examples/expected/1121-diagnostics-reserved-name-control-flow.stderr @@ -1,7 +1,7 @@ -error: 's2' is a reserved type name and cannot be used as an identifier +error: 'i2' is a reserved type name and cannot be used as an identifier --> examples/1121-diagnostics-reserved-name-control-flow.sx:18:5 | -18 | s2, rest := pair(); // destructure name +18 | i2, rest := pair(); // destructure name | ^^ error: 'u8' is a reserved type name and cannot be used as an identifier @@ -10,10 +10,10 @@ error: 'u8' is a reserved type name and cannot be used as an identifier 19 | if u8 := maybe() { } // if optional binding | ^^ -error: 's16' is a reserved type name and cannot be used as an identifier +error: 'i16' is a reserved type name and cannot be used as an identifier --> examples/1121-diagnostics-reserved-name-control-flow.sx:20:11 | -20 | while s16 := maybe() { break; } // while optional binding +20 | while i16 := maybe() { break; } // while optional binding | ^^^ error: 'bool' is a reserved type name and cannot be used as an identifier @@ -22,10 +22,10 @@ error: 'bool' is a reserved type name and cannot be used as an identifier 22 | for xs (bool) { } // for capture name | ^^^^ -error: 's32' is a reserved type name and cannot be used as an identifier +error: 'i32' is a reserved type name and cannot be used as an identifier --> examples/1121-diagnostics-reserved-name-control-flow.sx:23:21 | -23 | for xs, 0.. (v, s32) { } // for index name +23 | for xs, 0.. (v, i32) { } // for index name | ^^^ error: 'string' is a reserved type name and cannot be used as an identifier diff --git a/examples/expected/1122-diagnostics-reserved-name-impl-method.stderr b/examples/expected/1122-diagnostics-reserved-name-impl-method.stderr index 393565c..7f5fe52 100644 --- a/examples/expected/1122-diagnostics-reserved-name-impl-method.stderr +++ b/examples/expected/1122-diagnostics-reserved-name-impl-method.stderr @@ -1,11 +1,11 @@ error: 'u8' is a reserved type name and cannot be used as an identifier --> examples/1122-diagnostics-reserved-name-impl-method.sx:19:24 | -19 | go :: (self: *Box, u8: s64) { +19 | go :: (self: *Box, u8: i64) { | ^^ -error: 's2' is a reserved type name and cannot be used as an identifier +error: 'i2' is a reserved type name and cannot be used as an identifier --> examples/1122-diagnostics-reserved-name-impl-method.sx:20:9 | -20 | s2 := Box.{ total = 1 }; +20 | i2 := Box.{ total = 1 }; | ^^ diff --git a/examples/expected/1123-diagnostics-reserved-name-catch-onfail.stderr b/examples/expected/1123-diagnostics-reserved-name-catch-onfail.stderr index e277613..4fb6cc3 100644 --- a/examples/expected/1123-diagnostics-reserved-name-catch-onfail.stderr +++ b/examples/expected/1123-diagnostics-reserved-name-catch-onfail.stderr @@ -1,7 +1,7 @@ -error: 's64' is a reserved type name and cannot be used as an identifier +error: 'i64' is a reserved type name and cannot be used as an identifier --> examples/1123-diagnostics-reserved-name-catch-onfail.sx:20:13 | -20 | onfail (s64) { } // onfail tag binding +20 | onfail (i64) { } // onfail tag binding | ^^^ error: 'u8' is a reserved type name and cannot be used as an identifier diff --git a/examples/expected/1124-diagnostics-imported-reserved-destructure.stderr b/examples/expected/1124-diagnostics-imported-reserved-destructure.stderr index 668ff2c..566d4ac 100644 --- a/examples/expected/1124-diagnostics-imported-reserved-destructure.stderr +++ b/examples/expected/1124-diagnostics-imported-reserved-destructure.stderr @@ -1,5 +1,5 @@ -error: 's2' is a reserved type name and cannot be used as an identifier +error: 'i2' is a reserved type name and cannot be used as an identifier --> examples/1124-diagnostics-imported-reserved-destructure/mod.sx:6:5 | - 6 | s2, rest := pair(); // destructure name in an IMPORTED module + 6 | i2, rest := pair(); // destructure name in an IMPORTED module | ^^ diff --git a/examples/expected/1125-diagnostics-reserved-name-method-param.stderr b/examples/expected/1125-diagnostics-reserved-name-method-param.stderr index d3b4b67..37784a1 100644 --- a/examples/expected/1125-diagnostics-reserved-name-method-param.stderr +++ b/examples/expected/1125-diagnostics-reserved-name-method-param.stderr @@ -1,11 +1,11 @@ error: 'u8' is a reserved type name and cannot be used as an identifier --> examples/1125-diagnostics-reserved-name-method-param.sx:15:28 | -15 | greet :: (self: *Self, u8: s64) -> s64 { +15 | greet :: (self: *Self, u8: i64) -> i64 { | ^^ -error: 's16' is a reserved type name and cannot be used as an identifier +error: 'i16' is a reserved type name and cannot be used as an identifier --> examples/1125-diagnostics-reserved-name-method-param.sx:23:27 | -23 | bump :: (self: *Self, s16: s32) { +23 | bump :: (self: *Self, i16: i32) { | ^^^ diff --git a/examples/expected/1129-diagnostics-array-dim-not-const.stderr b/examples/expected/1129-diagnostics-array-dim-not-const.stderr index d963fa8..961ca4b 100644 --- a/examples/expected/1129-diagnostics-array-dim-not-const.stderr +++ b/examples/expected/1129-diagnostics-array-dim-not-const.stderr @@ -1,5 +1,5 @@ error: type alias 'BadArr' could not be resolved: an array dimension is not a compile-time integer constant --> examples/1129-diagnostics-array-dim-not-const.sx:18:11 | -18 | BadArr :: [get()]s64; +18 | BadArr :: [get()]i64; | ^^^^^^^^^^ diff --git a/examples/expected/1130-diagnostics-array-dim-oversized-u32.stderr b/examples/expected/1130-diagnostics-array-dim-oversized-u32.stderr index 68eda08..4b689b7 100644 --- a/examples/expected/1130-diagnostics-array-dim-oversized-u32.stderr +++ b/examples/expected/1130-diagnostics-array-dim-oversized-u32.stderr @@ -1,5 +1,5 @@ error: array dimension 5000000000 does not fit in u32 --> examples/1130-diagnostics-array-dim-oversized-u32.sx:13:10 | -13 | a : [5000000000]s64 = ---; +13 | a : [5000000000]i64 = ---; | ^^^^^^^^^^ diff --git a/examples/expected/1131-diagnostics-array-dim-oversized-u32-alias.stderr b/examples/expected/1131-diagnostics-array-dim-oversized-u32-alias.stderr index 7de2858..30b025b 100644 --- a/examples/expected/1131-diagnostics-array-dim-oversized-u32-alias.stderr +++ b/examples/expected/1131-diagnostics-array-dim-oversized-u32-alias.stderr @@ -1,5 +1,5 @@ error: array dimension 5000000000 does not fit in u32 --> examples/1131-diagnostics-array-dim-oversized-u32-alias.sx:18:9 | -18 | Big :: [5000000000]s64; +18 | Big :: [5000000000]i64; | ^^^^^^^^^^ diff --git a/examples/expected/1132-diagnostics-array-dim-non-integral-float.stderr b/examples/expected/1132-diagnostics-array-dim-non-integral-float.stderr index a7757e8..c5aafc9 100644 --- a/examples/expected/1132-diagnostics-array-dim-non-integral-float.stderr +++ b/examples/expected/1132-diagnostics-array-dim-non-integral-float.stderr @@ -1,5 +1,5 @@ error: array dimension must be an integer, but '4.5' is a non-integral float --> examples/1132-diagnostics-array-dim-non-integral-float.sx:17:10 | -17 | a : [N]s64 = ---; +17 | a : [N]i64 = ---; | ^ diff --git a/examples/expected/1133-diagnostics-array-dim-negative-float.stderr b/examples/expected/1133-diagnostics-array-dim-negative-float.stderr index d9a5429..c1720d4 100644 --- a/examples/expected/1133-diagnostics-array-dim-negative-float.stderr +++ b/examples/expected/1133-diagnostics-array-dim-negative-float.stderr @@ -1,5 +1,5 @@ error: array dimension must be non-negative, got -2 --> examples/1133-diagnostics-array-dim-negative-float.sx:10:10 | -10 | a : [-2.0]s64 = ---; +10 | a : [-2.0]i64 = ---; | ^^^^ diff --git a/examples/expected/1135-diagnostics-value-param-alias-constraint-overflow.stderr b/examples/expected/1135-diagnostics-value-param-alias-constraint-overflow.stderr index 1954810..84f3347 100644 --- a/examples/expected/1135-diagnostics-value-param-alias-constraint-overflow.stderr +++ b/examples/expected/1135-diagnostics-value-param-alias-constraint-overflow.stderr @@ -4,7 +4,7 @@ error: value 5000000000 does not fit in u32 parameter K 20 | b : Box(5000000000) = ---; | ^^^^^^^^^^ -error: value 300 does not fit in s8 parameter K +error: value 300 does not fit in i8 parameter K --> examples/1135-diagnostics-value-param-alias-constraint-overflow.sx:21:14 | 21 | t : Tiny(300) = ---; diff --git a/examples/expected/1136-diagnostics-array-dim-nonconst-direct-no-crash.stderr b/examples/expected/1136-diagnostics-array-dim-nonconst-direct-no-crash.stderr index 652c701..32d7d93 100644 --- a/examples/expected/1136-diagnostics-array-dim-nonconst-direct-no-crash.stderr +++ b/examples/expected/1136-diagnostics-array-dim-nonconst-direct-no-crash.stderr @@ -1,5 +1,5 @@ error: array dimension must be a compile-time integer constant --> examples/1136-diagnostics-array-dim-nonconst-direct-no-crash.sx:19:10 | -19 | a : [get()]s64 = ---; +19 | a : [get()]i64 = ---; | ^^^^^ diff --git a/examples/expected/1137-diagnostics-value-param-type-fn-no-cascade.stderr b/examples/expected/1137-diagnostics-value-param-type-fn-no-cascade.stderr index 06633c5..2a10fba 100644 --- a/examples/expected/1137-diagnostics-value-param-type-fn-no-cascade.stderr +++ b/examples/expected/1137-diagnostics-value-param-type-fn-no-cascade.stderr @@ -7,11 +7,11 @@ error: unknown type 'NoSuchType' error: value 5000000000 does not fit in u32 parameter K --> examples/1137-diagnostics-value-param-type-fn-no-cascade.sx:23:15 | -23 | a : MakeC(5000000000, s64) = ---; +23 | a : MakeC(5000000000, i64) = ---; | ^^^^^^^^^^ error: generic value parameter 'K' must be a compile-time integer constant --> examples/1137-diagnostics-value-param-type-fn-no-cascade.sx:24:15 | -24 | b : MakeC(get(), s64) = ---; +24 | b : MakeC(get(), i64) = ---; | ^^^^^ diff --git a/examples/expected/1140-diagnostics-reserved-name-const-fn-decl.stderr b/examples/expected/1140-diagnostics-reserved-name-const-fn-decl.stderr index a1595fa..5469004 100644 --- a/examples/expected/1140-diagnostics-reserved-name-const-fn-decl.stderr +++ b/examples/expected/1140-diagnostics-reserved-name-const-fn-decl.stderr @@ -1,11 +1,11 @@ -error: 's2' is a reserved type name and cannot be used as an identifier +error: 'i2' is a reserved type name and cannot be used as an identifier --> examples/1140-diagnostics-reserved-name-const-fn-decl.sx:14:1 | -14 | s2 :: 5; +14 | i2 :: 5; | ^^ error: 'u8' is a reserved type name and cannot be used as an identifier --> examples/1140-diagnostics-reserved-name-const-fn-decl.sx:15:1 | -15 | u8 :: (n: s64) -> s64 { return n + 7; } +15 | u8 :: (n: i64) -> i64 { return n + 7; } | ^^ diff --git a/examples/expected/1141-diagnostics-reserved-name-type-decl.stderr b/examples/expected/1141-diagnostics-reserved-name-type-decl.stderr index 55360ea..d43f043 100644 --- a/examples/expected/1141-diagnostics-reserved-name-type-decl.stderr +++ b/examples/expected/1141-diagnostics-reserved-name-type-decl.stderr @@ -1,19 +1,19 @@ -error: 's8' is a reserved type name and cannot be used as an identifier +error: 'i8' is a reserved type name and cannot be used as an identifier --> examples/1141-diagnostics-reserved-name-type-decl.sx:14:1 | -14 | s8 :: struct { v: s64; } +14 | i8 :: struct { v: i64; } | ^^ -error: 's16' is a reserved type name and cannot be used as an identifier +error: 'i16' is a reserved type name and cannot be used as an identifier --> examples/1141-diagnostics-reserved-name-type-decl.sx:15:1 | -15 | s16 :: enum { A; B; } +15 | i16 :: enum { A; B; } | ^^^ error: 'u16' is a reserved type name and cannot be used as an identifier --> examples/1141-diagnostics-reserved-name-type-decl.sx:16:1 | -16 | u16 :: union { a: s32; b: f32; } +16 | u16 :: union { a: i32; b: f32; } | ^^^ error: 'u32' is a reserved type name and cannot be used as an identifier @@ -22,8 +22,8 @@ error: 'u32' is a reserved type name and cannot be used as an identifier 17 | u32 :: error { Bad, Empty } | ^^^ -error: 's2' is a reserved type name and cannot be used as an identifier +error: 'i2' is a reserved type name and cannot be used as an identifier --> examples/1141-diagnostics-reserved-name-type-decl.sx:18:1 | -18 | s2 : s64 : 5; +18 | i2 : i64 : 5; | ^^ diff --git a/examples/expected/1142-diagnostics-reserved-name-struct-const.stderr b/examples/expected/1142-diagnostics-reserved-name-struct-const.stderr index 81ea977..f2e9f94 100644 --- a/examples/expected/1142-diagnostics-reserved-name-struct-const.stderr +++ b/examples/expected/1142-diagnostics-reserved-name-struct-const.stderr @@ -1,11 +1,11 @@ -error: 's2' is a reserved type name and cannot be used as an identifier +error: 'i2' is a reserved type name and cannot be used as an identifier --> examples/1142-diagnostics-reserved-name-struct-const.sx:14:5 | -14 | s2 :: 5; +14 | i2 :: 5; | ^^ error: 'u8' is a reserved type name and cannot be used as an identifier --> examples/1142-diagnostics-reserved-name-struct-const.sx:15:5 | -15 | u8 : s64 : 9; +15 | u8 : i64 : 9; | ^^ diff --git a/examples/expected/1143-diagnostics-typed-module-const-mismatch.stderr b/examples/expected/1143-diagnostics-typed-module-const-mismatch.stderr index be2e190..516fa0c 100644 --- a/examples/expected/1143-diagnostics-typed-module-const-mismatch.stderr +++ b/examples/expected/1143-diagnostics-typed-module-const-mismatch.stderr @@ -4,22 +4,22 @@ error: type mismatch: constant 'N' is declared 'string' but its initializer is a 24 | N : string : 4; // integer literal where a string is annotated | ^ -error: type mismatch: constant 'F' is declared 's64' but its initializer is a string literal +error: type mismatch: constant 'F' is declared 'i64' but its initializer is a string literal --> examples/1143-diagnostics-typed-module-const-mismatch.sx:25:15 | -25 | F : s64 : "x"; // string literal where an integer is annotated +25 | F : i64 : "x"; // string literal where an integer is annotated | ^^^ -error: type mismatch: constant 'B' is declared 's64' but its initializer is a boolean literal +error: type mismatch: constant 'B' is declared 'i64' but its initializer is a boolean literal --> examples/1143-diagnostics-typed-module-const-mismatch.sx:26:15 | -26 | B : s64 : true; // boolean literal where an integer is annotated +26 | B : i64 : true; // boolean literal where an integer is annotated | ^^^^ -error: cannot implicitly narrow non-integral float '1.5' to 's64'; use an explicit cast (`xx`/`cast`) +error: cannot implicitly narrow non-integral float '1.5' to 'i64'; use an explicit cast (`xx`/`cast`) --> examples/1143-diagnostics-typed-module-const-mismatch.sx:27:15 | -27 | G : s64 : 1.5; // float literal where an integer is annotated +27 | G : i64 : 1.5; // float literal where an integer is annotated | ^^^ error: type mismatch: constant 'E' is declared 'string' but its initializer is an integer expression @@ -34,14 +34,14 @@ error: type mismatch: constant 'V' is declared 'string' but its initializer is a 29 | V : string : -M; // integer (unary) expression where a string is annotated | ^^ -error: cannot implicitly narrow non-integral float '2.5' to 's64'; use an explicit cast (`xx`/`cast`) +error: cannot implicitly narrow non-integral float '2.5' to 'i64'; use an explicit cast (`xx`/`cast`) --> examples/1143-diagnostics-typed-module-const-mismatch.sx:30:15 | -30 | BAD : s64 : M + 0.5; // mixed int+float (int LHS) → f64, rejected vs s64 +30 | BAD : i64 : M + 0.5; // mixed int+float (int LHS) → f64, rejected vs i64 | ^^^^^^^ -error: cannot implicitly narrow non-integral float '2.5' to 's64'; use an explicit cast (`xx`/`cast`) +error: cannot implicitly narrow non-integral float '2.5' to 'i64'; use an explicit cast (`xx`/`cast`) --> examples/1143-diagnostics-typed-module-const-mismatch.sx:31:15 | -31 | BAD2 : s64 : 0.5 + M; // mixed float+int (float LHS) → f64, rejected vs s64 — order-independent +31 | BAD2 : i64 : 0.5 + M; // mixed float+int (float LHS) → f64, rejected vs i64 — order-independent | ^^^^^^^ diff --git a/examples/expected/1146-diagnostics-nonintegral-float-to-int.stderr b/examples/expected/1146-diagnostics-nonintegral-float-to-int.stderr index ab1aa0b..df4bbdc 100644 --- a/examples/expected/1146-diagnostics-nonintegral-float-to-int.stderr +++ b/examples/expected/1146-diagnostics-nonintegral-float-to-int.stderr @@ -1,71 +1,71 @@ -error: cannot implicitly narrow non-integral float '1.5' to 's64'; use an explicit cast (`xx`/`cast`) +error: cannot implicitly narrow non-integral float '1.5' to 'i64'; use an explicit cast (`xx`/`cast`) --> examples/1146-diagnostics-nonintegral-float-to-int.sx:40:16 | -40 | y : s64 = 1.5; // non-integral float LITERAL local → error +40 | y : i64 = 1.5; // non-integral float LITERAL local → error | ^^^ -error: cannot implicitly narrow non-integral float '2.5' to 's64'; use an explicit cast (`xx`/`cast`) +error: cannot implicitly narrow non-integral float '2.5' to 'i64'; use an explicit cast (`xx`/`cast`) --> examples/1146-diagnostics-nonintegral-float-to-int.sx:41:16 | -41 | ye : s64 = M + 0.5; // non-integral int-const-EXPRESSION local → error +41 | ye : i64 = M + 0.5; // non-integral int-const-EXPRESSION local → error | ^^^^^^^ -error: cannot implicitly narrow non-integral float '2.75' to 's64'; use an explicit cast (`xx`/`cast`) +error: cannot implicitly narrow non-integral float '2.75' to 'i64'; use an explicit cast (`xx`/`cast`) --> examples/1146-diagnostics-nonintegral-float-to-int.sx:42:16 | -42 | yf : s64 = F + 0.25; // non-integral float-const-LEAF local → error +42 | yf : i64 = F + 0.25; // non-integral float-const-LEAF local → error | ^^^^^^^^ -error: cannot implicitly narrow non-integral float '0.5' to 's64'; use an explicit cast (`xx`/`cast`) +error: cannot implicitly narrow non-integral float '0.5' to 'i64'; use an explicit cast (`xx`/`cast`) --> examples/1146-diagnostics-nonintegral-float-to-int.sx:43:16 | -43 | yn : s64 = f64.true_min + 0.5; // non-integral numeric-limit float expr → error +43 | yn : i64 = f64.true_min + 0.5; // non-integral numeric-limit float expr → error | ^^^^^^^^^^^^^^^^^^ -error: cannot implicitly narrow non-integral float '1.5' to 's64'; use an explicit cast (`xx`/`cast`) +error: cannot implicitly narrow non-integral float '1.5' to 'i64'; use an explicit cast (`xx`/`cast`) --> examples/1146-diagnostics-nonintegral-float-to-int.sx:44:16 | -44 | ym : s64 = 5.5 % 2.0; // non-integral float `%` remainder (1.5) → error +44 | ym : i64 = 5.5 % 2.0; // non-integral float `%` remainder (1.5) → error | ^^^^^^^^^ error: array dimension must be an integer, but '2.75' is a non-integral float --> examples/1146-diagnostics-nonintegral-float-to-int.sx:45:11 | -45 | ad : [F + 0.25]s64 = ---; // non-integral float-const-LEAF array DIMENSION → error +45 | ad : [F + 0.25]i64 = ---; // non-integral float-const-LEAF array DIMENSION → error | ^^^^^^^^ -error: cannot implicitly narrow non-integral float '3.5' to 's64'; use an explicit cast (`xx`/`cast`) +error: cannot implicitly narrow non-integral float '3.5' to 'i64'; use an explicit cast (`xx`/`cast`) --> examples/1146-diagnostics-nonintegral-float-to-int.sx:30:16 | -30 | f : s64 = 3.5; // non-integral float LITERAL field default → error +30 | f : i64 = 3.5; // non-integral float LITERAL field default → error | ^^^ -error: cannot implicitly narrow non-integral float '2.5' to 's64'; use an explicit cast (`xx`/`cast`) +error: cannot implicitly narrow non-integral float '2.5' to 'i64'; use an explicit cast (`xx`/`cast`) --> examples/1146-diagnostics-nonintegral-float-to-int.sx:31:16 | -31 | fe : s64 = M + 0.5; // non-integral int-const-EXPR field default → error +31 | fe : i64 = M + 0.5; // non-integral int-const-EXPR field default → error | ^^^^^^^ -error: cannot implicitly narrow non-integral float '2.75' to 's64'; use an explicit cast (`xx`/`cast`) +error: cannot implicitly narrow non-integral float '2.75' to 'i64'; use an explicit cast (`xx`/`cast`) --> examples/1146-diagnostics-nonintegral-float-to-int.sx:32:16 | -32 | ff : s64 = F + 0.25; // non-integral float-const-LEAF field default → error +32 | ff : i64 = F + 0.25; // non-integral float-const-LEAF field default → error | ^^^^^^^^ -error: cannot implicitly narrow non-integral float '2.5' to 's64'; use an explicit cast (`xx`/`cast`) +error: cannot implicitly narrow non-integral float '2.5' to 'i64'; use an explicit cast (`xx`/`cast`) --> examples/1146-diagnostics-nonintegral-float-to-int.sx:35:23 | -35 | badLit :: (x : s64 = 2.5) -> s64 { return x; } // non-integral LITERAL param default → error +35 | badLit :: (x : i64 = 2.5) -> i64 { return x; } // non-integral LITERAL param default → error | ^^^ -error: cannot implicitly narrow non-integral float '2.5' to 's64'; use an explicit cast (`xx`/`cast`) +error: cannot implicitly narrow non-integral float '2.5' to 'i64'; use an explicit cast (`xx`/`cast`) --> examples/1146-diagnostics-nonintegral-float-to-int.sx:36:23 | -36 | badExpr :: (x : s64 = M + 0.5) -> s64 { return x; } // non-integral int-const-EXPR param default → error +36 | badExpr :: (x : i64 = M + 0.5) -> i64 { return x; } // non-integral int-const-EXPR param default → error | ^^^^^^^ -error: cannot implicitly narrow non-integral float '2.75' to 's64'; use an explicit cast (`xx`/`cast`) +error: cannot implicitly narrow non-integral float '2.75' to 'i64'; use an explicit cast (`xx`/`cast`) --> examples/1146-diagnostics-nonintegral-float-to-int.sx:37:23 | -37 | badFlt :: (x : s64 = F + 0.25) -> s64 { return x; } // non-integral float-const-LEAF param default → error +37 | badFlt :: (x : i64 = F + 0.25) -> i64 { return x; } // non-integral float-const-LEAF param default → error | ^^^^^^^^ diff --git a/examples/expected/1147-diagnostics-float-division-narrowing.stderr b/examples/expected/1147-diagnostics-float-division-narrowing.stderr index 962bf4c..ac84f8f 100644 --- a/examples/expected/1147-diagnostics-float-division-narrowing.stderr +++ b/examples/expected/1147-diagnostics-float-division-narrowing.stderr @@ -1,41 +1,41 @@ -error: cannot implicitly narrow non-integral float '2.5' to 's64'; use an explicit cast (`xx`/`cast`) +error: cannot implicitly narrow non-integral float '2.5' to 'i64'; use an explicit cast (`xx`/`cast`) --> examples/1147-diagnostics-float-division-narrowing.sx:31:11 | -31 | K : s64 : 5.0 / 2.0; // 2.5 non-integral float-DIVISION const → error +31 | K : i64 : 5.0 / 2.0; // 2.5 non-integral float-DIVISION const → error | ^^^^^^^^^ -error: cannot implicitly narrow non-integral float '2.5' to 's64'; use an explicit cast (`xx`/`cast`) +error: cannot implicitly narrow non-integral float '2.5' to 'i64'; use an explicit cast (`xx`/`cast`) --> examples/1147-diagnostics-float-division-narrowing.sx:40:19 | -40 | local : s64 = 5.0 / 2.0; // non-integral float-DIVISION local → error +40 | local : i64 = 5.0 / 2.0; // non-integral float-DIVISION local → error | ^^^^^^^^^ error: array dimension must be an integer, but '2.5' is a non-integral float --> examples/1147-diagnostics-float-division-narrowing.sx:41:12 | -41 | dim : [5.0 / 2.0]s64 = ---; // non-integral float-DIVISION array dimension → error +41 | dim : [5.0 / 2.0]i64 = ---; // non-integral float-DIVISION array dimension → error | ^^^^^^^^^ -error: cannot implicitly narrow non-integral float '2.5' to 's64'; use an explicit cast (`xx`/`cast`) +error: cannot implicitly narrow non-integral float '2.5' to 'i64'; use an explicit cast (`xx`/`cast`) --> examples/1147-diagnostics-float-division-narrowing.sx:42:18 | -42 | cdiv : s64 = ME / 2; // untyped float-EXPR const division (5.0/2 = 2.5) → error +42 | cdiv : i64 = ME / 2; // untyped float-EXPR const division (5.0/2 = 2.5) → error | ^^^^^^ error: array dimension must be an integer, but '2.5' is a non-integral float --> examples/1147-diagnostics-float-division-narrowing.sx:43:13 | -43 | cdim : [ME / 2]s64 = ---; // same, at the count path → error +43 | cdim : [ME / 2]i64 = ---; // same, at the count path → error | ^^^^^^ -error: cannot implicitly narrow non-integral float '2.5' to 's64'; use an explicit cast (`xx`/`cast`) +error: cannot implicitly narrow non-integral float '2.5' to 'i64'; use an explicit cast (`xx`/`cast`) --> examples/1147-diagnostics-float-division-narrowing.sx:34:15 | -34 | f : s64 = 5.0 / 2.0; // non-integral float-DIVISION field default → error +34 | f : i64 = 5.0 / 2.0; // non-integral float-DIVISION field default → error | ^^^^^^^^^ -error: cannot implicitly narrow non-integral float '2.5' to 's64'; use an explicit cast (`xx`/`cast`) +error: cannot implicitly narrow non-integral float '2.5' to 'i64'; use an explicit cast (`xx`/`cast`) --> examples/1147-diagnostics-float-division-narrowing.sx:37:24 | -37 | badParam :: (x : s64 = 5.0 / 2.0) -> s64 { return x; } // float-DIVISION param default → error +37 | badParam :: (x : i64 = 5.0 / 2.0) -> i64 { return x; } // float-DIVISION param default → error | ^^^^^^^^^ diff --git a/examples/expected/1148-diagnostics-value-shadow-field-dim-not-const.stderr b/examples/expected/1148-diagnostics-value-shadow-field-dim-not-const.stderr index c3e549d..02d6dd1 100644 --- a/examples/expected/1148-diagnostics-value-shadow-field-dim-not-const.stderr +++ b/examples/expected/1148-diagnostics-value-shadow-field-dim-not-const.stderr @@ -1,5 +1,5 @@ error: array dimension must be a compile-time integer constant --> examples/1148-diagnostics-value-shadow-field-dim-not-const.sx:27:13 | -27 | arr : [`s8.max]f32 = ---; +27 | arr : [`i8.max]f32 = ---; | ^^^^^^ diff --git a/examples/expected/1156-diagnostics-int-literal-out-of-range.stderr b/examples/expected/1156-diagnostics-int-literal-out-of-range.stderr index dc21a45..c7c10bf 100644 --- a/examples/expected/1156-diagnostics-int-literal-out-of-range.stderr +++ b/examples/expected/1156-diagnostics-int-literal-out-of-range.stderr @@ -1,7 +1,7 @@ -error: integer literal 300 does not fit in s8 (range -128..127) — use an explicit `xx` / `cast` to truncate +error: integer literal 300 does not fit in i8 (range -128..127) — use an explicit `xx` / `cast` to truncate --> examples/1156-diagnostics-int-literal-out-of-range.sx:8:14 | - 8 | x : s8 = 300; + 8 | x : i8 = 300; | ^^^ error: integer literal 256 does not fit in u8 (range 0..255) — use an explicit `xx` / `cast` to truncate diff --git a/examples/expected/1160-diagnostics-array-const-runtime-element.stderr b/examples/expected/1160-diagnostics-array-const-runtime-element.stderr index 077ef76..781f4a3 100644 --- a/examples/expected/1160-diagnostics-array-const-runtime-element.stderr +++ b/examples/expected/1160-diagnostics-array-const-runtime-element.stderr @@ -1,7 +1,7 @@ error: constant 'BAD' must be initialized by compile-time constant elements --> examples/1160-diagnostics-array-const-runtime-element.sx:8:16 | - 8 | BAD : [2]s64 : .[1, f()]; + 8 | BAD : [2]i64 : .[1, f()]; | ^^^^^^^^^ error: unresolved 'BAD' (in examples/1160-diagnostics-array-const-runtime-element.sx fn main) diff --git a/examples/expected/1161-diagnostics-array-const-dim-mismatch.stderr b/examples/expected/1161-diagnostics-array-const-dim-mismatch.stderr index 68d258e..994ea9c 100644 --- a/examples/expected/1161-diagnostics-array-const-dim-mismatch.stderr +++ b/examples/expected/1161-diagnostics-array-const-dim-mismatch.stderr @@ -1,7 +1,7 @@ error: constant 'BAD' declares [3] elements but its initializer has 2 --> examples/1161-diagnostics-array-const-dim-mismatch.sx:6:16 | - 6 | BAD : [3]s64 : .[1, 2]; + 6 | BAD : [3]i64 : .[1, 2]; | ^^^^^^^ error: unresolved 'BAD' (in examples/1161-diagnostics-array-const-dim-mismatch.sx fn main) diff --git a/examples/expected/1209-ffi-01-primitives.stdout b/examples/expected/1209-ffi-01-primitives.stdout index 0f98f39..3a4bf4f 100644 --- a/examples/expected/1209-ffi-01-primitives.stdout +++ b/examples/expected/1209-ffi-01-primitives.stdout @@ -1,6 +1,6 @@ ffi_id_int(-42) = -42 ffi_id_short(-1234) = -1234 -ffi_id_s64(huge) = 9000000000000000000 +ffi_id_i64(huge) = 9000000000000000000 ffi_id_uint(0xDEADBEEF) = 3735928559 ffi_id_ushort(0xFFFF) = 65535 ffi_id_u64(0x7FEE...) = 9218551421072305134 diff --git a/examples/expected/1220-ffi-c-import-reserved-name-params.stdout b/examples/expected/1220-ffi-c-import-reserved-name-params.stdout index 7c90d43..447b666 100644 --- a/examples/expected/1220-ffi-c-import-reserved-name-params.stdout +++ b/examples/expected/1220-ffi-c-import-reserved-name-params.stdout @@ -1,4 +1,4 @@ pick(10,20,0) = 10 pick(10,20,1) = 20 sum(10,20) = 30 -s2(4) bare = 104 +i2(4) bare = 104 diff --git a/examples/expected/1319-ffi-objc-property-sx-defined.ir b/examples/expected/1319-ffi-objc-property-sx-defined.ir index 66358d2..6effbdc 100644 --- a/examples/expected/1319-ffi-objc-property-sx-defined.ir +++ b/examples/expected/1319-ffi-objc-property-sx-defined.ir @@ -35,10 +35,10 @@ @tag_names = private constant [14 x { ptr, i64 }] [{ ptr, i64 } { ptr @tag.str, i64 0 }, { ptr, i64 } { ptr @tag.str.151, i64 8 }, { ptr, i64 } { ptr @tag.str.152, i64 2 }, { ptr, i64 } { ptr @tag.str.153, i64 15 }, { ptr, i64 } { ptr @tag.str.154, i64 13 }, { ptr, i64 } { ptr @tag.str.155, i64 9 }, { ptr, i64 } { ptr @tag.str.156, i64 9 }, { ptr, i64 } { ptr @tag.str.157, i64 15 }, { ptr, i64 } { ptr @tag.str.158, i64 14 }, { ptr, i64 } { ptr @tag.str.159, i64 14 }, { ptr, i64 } { ptr @tag.str.160, i64 11 }, { ptr, i64 } { ptr @tag.str.161, i64 12 }, { ptr, i64 } { ptr @tag.str.162, i64 15 }, { ptr, i64 } { ptr @tag.str.163, i64 12 }] @tn.str = private constant [13 x i8] c"\00" @tn.str.164 = private constant [5 x i8] c"bool\00" -@tn.str.165 = private constant [3 x i8] c"s8\00" -@tn.str.166 = private constant [4 x i8] c"s16\00" -@tn.str.167 = private constant [4 x i8] c"s32\00" -@tn.str.168 = private constant [4 x i8] c"s64\00" +@tn.str.165 = private constant [3 x i8] c"i8\00" +@tn.str.166 = private constant [4 x i8] c"i16\00" +@tn.str.167 = private constant [4 x i8] c"i32\00" +@tn.str.168 = private constant [4 x i8] c"i64\00" @tn.str.169 = private constant [3 x i8] c"u8\00" @tn.str.170 = private constant [4 x i8] c"u16\00" @tn.str.171 = private constant [4 x i8] c"u32\00" @@ -55,7 +55,7 @@ @tn.str.182 = private constant [16 x i8] c"Source_Location\00" @tn.str.183 = private constant [10 x i8] c"Allocator\00" @tn.str.184 = private constant [8 x i8] c"Context\00" -@tn.str.185 = private constant [7 x i8] c"[4]s64\00" +@tn.str.185 = private constant [7 x i8] c"[4]i64\00" @tn.str.186 = private constant [9 x i8] c"[]string\00" @tn.str.187 = private constant [11 x i8] c"CAllocator\00" @tn.str.188 = private constant [12 x i8] c"*CAllocator\00" @@ -80,7 +80,7 @@ @tn.str.207 = private constant [4 x i8] c"*u8\00" @tn.str.208 = private constant [14 x i8] c"ProcessResult\00" @tn.str.209 = private constant [15 x i8] c"?ProcessResult\00" -@tn.str.210 = private constant [5 x i8] c"*s32\00" +@tn.str.210 = private constant [5 x i8] c"*i32\00" @tn.str.211 = private constant [9 x i8] c"SockAddr\00" @tn.str.212 = private constant [10 x i8] c"*SockAddr\00" @tn.str.213 = private constant [5 x i8] c"*u32\00" @@ -96,9 +96,9 @@ @tn.str.223 = private constant [5 x i8] c"[]u8\00" @tn.str.224 = private constant [5 x i8] c"Sink\00" @tn.str.225 = private constant [6 x i8] c"*Sink\00" -@tn.str.226 = private constant [17 x i8] c"(s64, JsonError)\00" +@tn.str.226 = private constant [17 x i8] c"(i64, JsonError)\00" @tn.str.227 = private constant [15 x i8] c"JsonParseError\00" -@tn.str.228 = private constant [22 x i8] c"(s64, JsonParseError)\00" +@tn.str.228 = private constant [22 x i8] c"(i64, JsonParseError)\00" @tn.str.229 = private constant [7 x i8] c"Parser\00" @tn.str.230 = private constant [8 x i8] c"*Parser\00" @tn.str.231 = private constant [25 x i8] c"(string, JsonParseError)\00" @@ -107,7 +107,7 @@ @tn.str.234 = private constant [13 x i8] c"Architecture\00" @tn.str.235 = private constant [13 x i8] c"BuildOptions\00" @tn.str.236 = private constant [11 x i8] c"() -> bool\00" -@tn.str.237 = private constant [5 x i8] c"*s64\00" +@tn.str.237 = private constant [5 x i8] c"*i64\00" @tn.str.238 = private constant [9 x i8] c"CliError\00" @tn.str.239 = private constant [9 x i8] c"FlagSpec\00" @tn.str.240 = private constant [11 x i8] c"[]FlagSpec\00" @@ -120,12 +120,12 @@ @tn.str.247 = private constant [19 x i8] c"(Parsed, CliError)\00" @tn.str.248 = private constant [10 x i8] c"[]Command\00" @tn.str.249 = private constant [6 x i8] c"*Diag\00" -@tn.str.250 = private constant [7 x i8] c"[8]s64\00" +@tn.str.250 = private constant [7 x i8] c"[8]i64\00" @tn.str.251 = private constant [7 x i8] c"[64]u8\00" @tn.str.252 = private constant [7 x i8] c"Sha256\00" @tn.str.253 = private constant [8 x i8] c"*Sha256\00" @tn.str.254 = private constant [8 x i8] c"?[64]u8\00" -@tn.str.255 = private constant [8 x i8] c"[64]s64\00" +@tn.str.255 = private constant [8 x i8] c"[64]i64\00" @tn.str.256 = private constant [9 x i8] c"NSString\00" @tn.str.257 = private constant [10 x i8] c"*NSString\00" @tn.str.258 = private constant [10 x i8] c"Closure()\00" @@ -144,7 +144,7 @@ @tn.str.271 = private constant [8 x i8] c"*[1]Any\00" @tn.str.272 = private constant [7 x i8] c"[3]Any\00" @tn.str.273 = private constant [8 x i8] c"*[3]Any\00" -@tn.str.274 = private constant [8 x i8] c"*[4]s64\00" +@tn.str.274 = private constant [8 x i8] c"*[4]i64\00" @tn.str.275 = private constant [5 x i8] c"*f64\00" @tn.str.276 = private constant [17 x i8] c"*Source_Location\00" @tn.str.277 = private constant [11 x i8] c"*Allocator\00" @@ -163,9 +163,9 @@ @tn.str.290 = private constant [17 x i8] c"*OperatingSystem\00" @tn.str.291 = private constant [14 x i8] c"*Architecture\00" @tn.str.292 = private constant [15 x i8] c"*[16]FlagValue\00" -@tn.str.293 = private constant [8 x i8] c"*[8]s64\00" +@tn.str.293 = private constant [8 x i8] c"*[8]i64\00" @tn.str.294 = private constant [8 x i8] c"*[64]u8\00" -@tn.str.295 = private constant [9 x i8] c"*[64]s64\00" +@tn.str.295 = private constant [9 x i8] c"*[64]i64\00" @tn.str.296 = private constant [10 x i8] c"*[]string\00" @tn.str.297 = private constant [6 x i8] c"*[]u8\00" @tn.str.298 = private constant [12 x i8] c"*[]FlagSpec\00" @@ -178,7 +178,7 @@ @tn.str.305 = private constant [20 x i8] c"**TrackingAllocator\00" @tn.str.306 = private constant [7 x i8] c"**File\00" @tn.str.307 = private constant [5 x i8] c"**u8\00" -@tn.str.308 = private constant [6 x i8] c"**s32\00" +@tn.str.308 = private constant [6 x i8] c"**i32\00" @tn.str.309 = private constant [11 x i8] c"**SockAddr\00" @tn.str.310 = private constant [6 x i8] c"**u32\00" @tn.str.311 = private constant [10 x i8] c"*[*]Value\00" @@ -187,7 +187,7 @@ @tn.str.314 = private constant [9 x i8] c"**Object\00" @tn.str.315 = private constant [7 x i8] c"**Sink\00" @tn.str.316 = private constant [9 x i8] c"**Parser\00" -@tn.str.317 = private constant [6 x i8] c"**s64\00" +@tn.str.317 = private constant [6 x i8] c"**i64\00" @tn.str.318 = private constant [9 x i8] c"**Parsed\00" @tn.str.319 = private constant [7 x i8] c"**Diag\00" @tn.str.320 = private constant [9 x i8] c"**Sha256\00" @@ -598,7 +598,7 @@ @str.722 = private unnamed_addr constant [4 x i8] c"*u8\00", align 1 @str.723 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.724 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.725 = private unnamed_addr constant [5 x i8] c"*s32\00", align 1 +@str.725 = private unnamed_addr constant [5 x i8] c"*i32\00", align 1 @str.726 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.727 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.728 = private unnamed_addr constant [10 x i8] c"*SockAddr\00", align 1 @@ -625,7 +625,7 @@ @str.749 = private unnamed_addr constant [8 x i8] c"*Parser\00", align 1 @str.750 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.751 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.752 = private unnamed_addr constant [5 x i8] c"*s64\00", align 1 +@str.752 = private unnamed_addr constant [5 x i8] c"*i64\00", align 1 @str.753 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.754 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.755 = private unnamed_addr constant [8 x i8] c"*Parsed\00", align 1 @@ -2071,7 +2071,7 @@ dispatch.case.291: ; preds = %match.arm.55 %ua.raw186 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr187 = inttoptr i64 %ua.raw186 to ptr %ua.load188 = load [4 x i64], ptr %ua.ptr187, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %ua.load188) + %callN = call { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %ua.load188) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.289 @@ -2087,7 +2087,7 @@ dispatch.case.293: ; preds = %match.arm.55 %ua.raw194 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr195 = inttoptr i64 %ua.raw194 to ptr %ua.load196 = load [8 x i64], ptr %ua.ptr195, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %ua.load196) + %callN = call { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %ua.load196) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.289 @@ -2103,7 +2103,7 @@ dispatch.case.295: ; preds = %match.arm.55 %ua.raw202 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr203 = inttoptr i64 %ua.raw202 to ptr %ua.load204 = load [64 x i64], ptr %ua.ptr203, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %ua.load204) + %callN = call { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %ua.load204) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.289 @@ -2254,7 +2254,7 @@ dispatch.case.376: ; preds = %match.arm.57 dispatch.case.377: ; preds = %match.arm.57 %ua.raw265 = extractvalue { i64, i64 } %loadN, 1 %iNp266 = inttoptr i64 %ua.raw265 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %iNp266) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %iNp266) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.365 @@ -2317,7 +2317,7 @@ dispatch.case.385: ; preds = %match.arm.57 dispatch.case.386: ; preds = %match.arm.57 %ua.raw292 = extractvalue { i64, i64 } %loadN, 1 %iNp293 = inttoptr i64 %ua.raw292 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %iNp293) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %iNp293) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.365 @@ -3823,7 +3823,7 @@ if.merge.3: ; preds = %or.merge.1 if.then.41: ; preds = %if.merge.3 %loadN = load i32, ptr %allocaN, align 4 - call void @print__ct_s39d1c95f7ad02cfe__pack_s32(ptr @__sx_default_context, i32 %loadN) + call void @print__ct_s39d1c95f7ad02cfe__pack_i32(ptr @__sx_default_context, i32 %loadN) ret i32 1 if.merge.42: ; preds = %if.merge.3 @@ -3847,7 +3847,7 @@ if.merge.44: ; preds = %if.merge.42 %loadN = load i32, ptr %allocaN, align 4 %loadN = load i32, ptr %allocaN, align 4 %loadN = load i32, ptr %allocaN, align 4 - call void @print__ct_se44eb1a972327e7d__pack_s32_s32_s32(ptr @__sx_default_context, i32 %loadN, i32 %loadN, i32 %loadN) + call void @print__ct_se44eb1a972327e7d__pack_i32_i32_i32(ptr @__sx_default_context, i32 %loadN, i32 %loadN, i32 %loadN) ret i32 0 } @@ -3897,7 +3897,7 @@ entry: } ; Function Attrs: nounwind -define internal void @print__ct_s39d1c95f7ad02cfe__pack_s32(ptr %0, i32 %1) #0 { +define internal void @print__ct_s39d1c95f7ad02cfe__pack_i32(ptr %0, i32 %1) #0 { entry: %alloca = alloca { ptr, i64 }, align 8 store { ptr, i64 } { ptr @str.364, i64 30 }, ptr %alloca, align 8 @@ -3905,8 +3905,8 @@ entry: store i32 %1, ptr %allocaN, align 4 %allocaN = alloca [1 x { i64, i64 }], align 8 %load = load i32, ptr %allocaN, align 4 - %sN = sext i32 %load to i64 - %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %load to i64 + %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %igp.ptr = getelementptr { i64, i64 }, ptr %allocaN, i64 0 store { i64, i64 } %ba.val, ptr %igp.ptr, align 8 %allocaN = alloca { ptr, i64 }, align 8 @@ -3924,8 +3924,8 @@ entry: store { ptr, i64 } %callN, ptr %allocaN, align 8 %loadN = load { ptr, i64 }, ptr %allocaN, align 8 %loadN = load i32, ptr %allocaN, align 4 - %sN = sext i32 %loadN to i64 - %ba.val13 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %loadN to i64 + %ba.val13 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %callN = call { ptr, i64 } @any_to_string(ptr %0, { i64, i64 } %ba.val13) %callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN) store { ptr, i64 } %callN, ptr %allocaN, align 8 @@ -3980,7 +3980,7 @@ entry: } ; Function Attrs: nounwind -define internal void @print__ct_se44eb1a972327e7d__pack_s32_s32_s32(ptr %0, i32 %1, i32 %2, i32 %3) #0 { +define internal void @print__ct_se44eb1a972327e7d__pack_i32_i32_i32(ptr %0, i32 %1, i32 %2, i32 %3) #0 { entry: %alloca = alloca { ptr, i64 }, align 8 store { ptr, i64 } { ptr @str.370, i64 28 }, ptr %alloca, align 8 @@ -3992,18 +3992,18 @@ entry: store i32 %3, ptr %allocaN, align 4 %allocaN = alloca [3 x { i64, i64 }], align 8 %load = load i32, ptr %allocaN, align 4 - %sN = sext i32 %load to i64 - %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %load to i64 + %ba.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %igp.ptr = getelementptr { i64, i64 }, ptr %allocaN, i64 0 store { i64, i64 } %ba.val, ptr %igp.ptr, align 8 %loadN = load i32, ptr %allocaN, align 4 - %sN = sext i32 %loadN to i64 - %ba.val7 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %loadN to i64 + %ba.val7 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %igp.ptr8 = getelementptr { i64, i64 }, ptr %allocaN, i64 1 store { i64, i64 } %ba.val7, ptr %igp.ptr8, align 8 %loadN = load i32, ptr %allocaN, align 4 - %sN = sext i32 %loadN to i64 - %ba.val11 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %loadN to i64 + %ba.val11 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %igp.ptr12 = getelementptr { i64, i64 }, ptr %allocaN, i64 2 store { i64, i64 } %ba.val11, ptr %igp.ptr12, align 8 %allocaN = alloca { ptr, i64 }, align 8 @@ -4021,8 +4021,8 @@ entry: store { ptr, i64 } %callN, ptr %allocaN, align 8 %loadN = load { ptr, i64 }, ptr %allocaN, align 8 %loadN = load i32, ptr %allocaN, align 4 - %sN = sext i32 %loadN to i64 - %ba.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %loadN to i64 + %ba.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %callN = call { ptr, i64 } @any_to_string(ptr %0, { i64, i64 } %ba.val23) %callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN) store { ptr, i64 } %callN, ptr %allocaN, align 8 @@ -4033,8 +4033,8 @@ entry: store { ptr, i64 } %callN, ptr %allocaN, align 8 %loadN = load { ptr, i64 }, ptr %allocaN, align 8 %loadN = load i32, ptr %allocaN, align 4 - %sN = sext i32 %loadN to i64 - %ba.val33 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %loadN to i64 + %ba.val33 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %callN = call { ptr, i64 } @any_to_string(ptr %0, { i64, i64 } %ba.val33) %callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN) store { ptr, i64 } %callN, ptr %allocaN, align 8 @@ -4045,8 +4045,8 @@ entry: store { ptr, i64 } %callN, ptr %allocaN, align 8 %loadN = load { ptr, i64 }, ptr %allocaN, align 8 %loadN = load i32, ptr %allocaN, align 4 - %sN = sext i32 %loadN to i64 - %ba.val43 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %loadN to i64 + %ba.val43 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 %callN = call { ptr, i64 } @any_to_string(ptr %0, { i64, i64 } %ba.val43) %callN = call { ptr, i64 } @concat(ptr %0, { ptr, i64 } %loadN, { ptr, i64 } %callN) store { ptr, i64 } %callN, ptr %allocaN, align 8 @@ -4146,14 +4146,14 @@ fv.case: ; preds = %if.merge.136 fv.case17: ; preds = %if.merge.136 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.136 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.136 @@ -4849,8 +4849,8 @@ fv.default: ; preds = %if.merge.181 fv.case: ; preds = %if.merge.181 %fv.field = extractvalue { i32 } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge } @@ -4933,14 +4933,14 @@ fv.case: ; preds = %if.merge.186 fv.case17: ; preds = %if.merge.186 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.186 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.186 @@ -5025,8 +5025,8 @@ fv.default: ; preds = %if.merge.191 fv.case: ; preds = %if.merge.191 %fv.field = extractvalue { i32, { ptr, i64 } } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case17: ; preds = %if.merge.191 @@ -6339,20 +6339,20 @@ fv.case: ; preds = %if.merge.271 fv.case17: ; preds = %if.merge.271 %fv.field18 = extractvalue { { ptr, ptr, ptr }, i32, i32, i32 } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.271 %fv.field21 = extractvalue { { ptr, ptr, ptr }, i32, i32, i32 } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.271 %fv.field25 = extractvalue { { ptr, ptr, ptr }, i32, i32, i32 } %loadN, 3 - %sN = sext i32 %fv.field25 to i64 - %fv.val27 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field25 to i64 + %fv.val27 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge } @@ -6630,7 +6630,7 @@ if.merge.288: ; preds = %if.then.287, %entry } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %1) #0 { entry: %alloca = alloca [4 x i64], align 8 %ig.tmp = alloca [4 x i64], align 8 @@ -6733,7 +6733,7 @@ if.merge.307: ; preds = %if.then.306, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %1) #0 { entry: %alloca = alloca [8 x i64], align 8 %ig.tmp = alloca [8 x i64], align 8 @@ -6834,7 +6834,7 @@ if.merge.317: ; preds = %if.then.316, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %1) #0 { entry: %alloca = alloca [64 x i64], align 8 %ig.tmp = alloca [64 x i64], align 8 @@ -7537,7 +7537,7 @@ if.merge.443: ; preds = %if.else.442, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 @@ -7787,7 +7787,7 @@ if.merge.470: ; preds = %if.else.469, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 diff --git a/examples/expected/1332-ffi-objc-call-06-sret-return.ir b/examples/expected/1332-ffi-objc-call-06-sret-return.ir index cb657eb..f606353 100644 --- a/examples/expected/1332-ffi-objc-call-06-sret-return.ir +++ b/examples/expected/1332-ffi-objc-call-06-sret-return.ir @@ -26,10 +26,10 @@ @tag_names = private constant [14 x { ptr, i64 }] [{ ptr, i64 } { ptr @tag.str, i64 0 }, { ptr, i64 } { ptr @tag.str.151, i64 8 }, { ptr, i64 } { ptr @tag.str.152, i64 2 }, { ptr, i64 } { ptr @tag.str.153, i64 15 }, { ptr, i64 } { ptr @tag.str.154, i64 13 }, { ptr, i64 } { ptr @tag.str.155, i64 9 }, { ptr, i64 } { ptr @tag.str.156, i64 9 }, { ptr, i64 } { ptr @tag.str.157, i64 15 }, { ptr, i64 } { ptr @tag.str.158, i64 14 }, { ptr, i64 } { ptr @tag.str.159, i64 14 }, { ptr, i64 } { ptr @tag.str.160, i64 11 }, { ptr, i64 } { ptr @tag.str.161, i64 12 }, { ptr, i64 } { ptr @tag.str.162, i64 15 }, { ptr, i64 } { ptr @tag.str.163, i64 12 }] @tn.str = private constant [13 x i8] c"\00" @tn.str.164 = private constant [5 x i8] c"bool\00" -@tn.str.165 = private constant [3 x i8] c"s8\00" -@tn.str.166 = private constant [4 x i8] c"s16\00" -@tn.str.167 = private constant [4 x i8] c"s32\00" -@tn.str.168 = private constant [4 x i8] c"s64\00" +@tn.str.165 = private constant [3 x i8] c"i8\00" +@tn.str.166 = private constant [4 x i8] c"i16\00" +@tn.str.167 = private constant [4 x i8] c"i32\00" +@tn.str.168 = private constant [4 x i8] c"i64\00" @tn.str.169 = private constant [3 x i8] c"u8\00" @tn.str.170 = private constant [4 x i8] c"u16\00" @tn.str.171 = private constant [4 x i8] c"u32\00" @@ -46,7 +46,7 @@ @tn.str.182 = private constant [16 x i8] c"Source_Location\00" @tn.str.183 = private constant [10 x i8] c"Allocator\00" @tn.str.184 = private constant [8 x i8] c"Context\00" -@tn.str.185 = private constant [7 x i8] c"[4]s64\00" +@tn.str.185 = private constant [7 x i8] c"[4]i64\00" @tn.str.186 = private constant [9 x i8] c"[]string\00" @tn.str.187 = private constant [11 x i8] c"CAllocator\00" @tn.str.188 = private constant [12 x i8] c"*CAllocator\00" @@ -71,7 +71,7 @@ @tn.str.207 = private constant [4 x i8] c"*u8\00" @tn.str.208 = private constant [14 x i8] c"ProcessResult\00" @tn.str.209 = private constant [15 x i8] c"?ProcessResult\00" -@tn.str.210 = private constant [5 x i8] c"*s32\00" +@tn.str.210 = private constant [5 x i8] c"*i32\00" @tn.str.211 = private constant [9 x i8] c"SockAddr\00" @tn.str.212 = private constant [10 x i8] c"*SockAddr\00" @tn.str.213 = private constant [5 x i8] c"*u32\00" @@ -87,9 +87,9 @@ @tn.str.223 = private constant [5 x i8] c"[]u8\00" @tn.str.224 = private constant [5 x i8] c"Sink\00" @tn.str.225 = private constant [6 x i8] c"*Sink\00" -@tn.str.226 = private constant [17 x i8] c"(s64, JsonError)\00" +@tn.str.226 = private constant [17 x i8] c"(i64, JsonError)\00" @tn.str.227 = private constant [15 x i8] c"JsonParseError\00" -@tn.str.228 = private constant [22 x i8] c"(s64, JsonParseError)\00" +@tn.str.228 = private constant [22 x i8] c"(i64, JsonParseError)\00" @tn.str.229 = private constant [7 x i8] c"Parser\00" @tn.str.230 = private constant [8 x i8] c"*Parser\00" @tn.str.231 = private constant [25 x i8] c"(string, JsonParseError)\00" @@ -98,7 +98,7 @@ @tn.str.234 = private constant [13 x i8] c"Architecture\00" @tn.str.235 = private constant [13 x i8] c"BuildOptions\00" @tn.str.236 = private constant [11 x i8] c"() -> bool\00" -@tn.str.237 = private constant [5 x i8] c"*s64\00" +@tn.str.237 = private constant [5 x i8] c"*i64\00" @tn.str.238 = private constant [9 x i8] c"CliError\00" @tn.str.239 = private constant [9 x i8] c"FlagSpec\00" @tn.str.240 = private constant [11 x i8] c"[]FlagSpec\00" @@ -111,12 +111,12 @@ @tn.str.247 = private constant [19 x i8] c"(Parsed, CliError)\00" @tn.str.248 = private constant [10 x i8] c"[]Command\00" @tn.str.249 = private constant [6 x i8] c"*Diag\00" -@tn.str.250 = private constant [7 x i8] c"[8]s64\00" +@tn.str.250 = private constant [7 x i8] c"[8]i64\00" @tn.str.251 = private constant [7 x i8] c"[64]u8\00" @tn.str.252 = private constant [7 x i8] c"Sha256\00" @tn.str.253 = private constant [8 x i8] c"*Sha256\00" @tn.str.254 = private constant [8 x i8] c"?[64]u8\00" -@tn.str.255 = private constant [8 x i8] c"[64]s64\00" +@tn.str.255 = private constant [8 x i8] c"[64]i64\00" @tn.str.256 = private constant [9 x i8] c"NSString\00" @tn.str.257 = private constant [10 x i8] c"*NSString\00" @tn.str.258 = private constant [10 x i8] c"Closure()\00" @@ -133,7 +133,7 @@ @tn.str.269 = private constant [8 x i8] c"*Triple\00" @tn.str.270 = private constant [7 x i8] c"[3]Any\00" @tn.str.271 = private constant [8 x i8] c"*[3]Any\00" -@tn.str.272 = private constant [8 x i8] c"*[4]s64\00" +@tn.str.272 = private constant [8 x i8] c"*[4]i64\00" @tn.str.273 = private constant [5 x i8] c"*f64\00" @tn.str.274 = private constant [17 x i8] c"*Source_Location\00" @tn.str.275 = private constant [11 x i8] c"*Allocator\00" @@ -151,9 +151,9 @@ @tn.str.287 = private constant [17 x i8] c"*OperatingSystem\00" @tn.str.288 = private constant [14 x i8] c"*Architecture\00" @tn.str.289 = private constant [15 x i8] c"*[16]FlagValue\00" -@tn.str.290 = private constant [8 x i8] c"*[8]s64\00" +@tn.str.290 = private constant [8 x i8] c"*[8]i64\00" @tn.str.291 = private constant [8 x i8] c"*[64]u8\00" -@tn.str.292 = private constant [9 x i8] c"*[64]s64\00" +@tn.str.292 = private constant [9 x i8] c"*[64]i64\00" @tn.str.293 = private constant [10 x i8] c"*[]string\00" @tn.str.294 = private constant [6 x i8] c"*[]u8\00" @tn.str.295 = private constant [12 x i8] c"*[]FlagSpec\00" @@ -166,7 +166,7 @@ @tn.str.302 = private constant [20 x i8] c"**TrackingAllocator\00" @tn.str.303 = private constant [7 x i8] c"**File\00" @tn.str.304 = private constant [5 x i8] c"**u8\00" -@tn.str.305 = private constant [6 x i8] c"**s32\00" +@tn.str.305 = private constant [6 x i8] c"**i32\00" @tn.str.306 = private constant [11 x i8] c"**SockAddr\00" @tn.str.307 = private constant [6 x i8] c"**u32\00" @tn.str.308 = private constant [10 x i8] c"*[*]Value\00" @@ -175,7 +175,7 @@ @tn.str.311 = private constant [9 x i8] c"**Object\00" @tn.str.312 = private constant [7 x i8] c"**Sink\00" @tn.str.313 = private constant [9 x i8] c"**Parser\00" -@tn.str.314 = private constant [6 x i8] c"**s64\00" +@tn.str.314 = private constant [6 x i8] c"**i64\00" @tn.str.315 = private constant [9 x i8] c"**Parsed\00" @tn.str.316 = private constant [7 x i8] c"**Diag\00" @tn.str.317 = private constant [9 x i8] c"**Sha256\00" @@ -572,7 +572,7 @@ @str.705 = private unnamed_addr constant [4 x i8] c"*u8\00", align 1 @str.706 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.707 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.708 = private unnamed_addr constant [5 x i8] c"*s32\00", align 1 +@str.708 = private unnamed_addr constant [5 x i8] c"*i32\00", align 1 @str.709 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.710 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.711 = private unnamed_addr constant [10 x i8] c"*SockAddr\00", align 1 @@ -599,7 +599,7 @@ @str.732 = private unnamed_addr constant [8 x i8] c"*Parser\00", align 1 @str.733 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.734 = private unnamed_addr constant [5 x i8] c"null\00", align 1 -@str.735 = private unnamed_addr constant [5 x i8] c"*s64\00", align 1 +@str.735 = private unnamed_addr constant [5 x i8] c"*i64\00", align 1 @str.736 = private unnamed_addr constant [4 x i8] c"@0x\00", align 1 @str.737 = private unnamed_addr constant [5 x i8] c"null\00", align 1 @str.738 = private unnamed_addr constant [8 x i8] c"*Parsed\00", align 1 @@ -2006,7 +2006,7 @@ dispatch.case.277: ; preds = %match.arm.47 %ua.raw182 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr183 = inttoptr i64 %ua.raw182 to ptr %ua.load184 = load [4 x i64], ptr %ua.ptr183, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %ua.load184) + %callN = call { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %ua.load184) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.275 @@ -2022,7 +2022,7 @@ dispatch.case.279: ; preds = %match.arm.47 %ua.raw190 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr191 = inttoptr i64 %ua.raw190 to ptr %ua.load192 = load [8 x i64], ptr %ua.ptr191, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %ua.load192) + %callN = call { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %ua.load192) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.275 @@ -2038,7 +2038,7 @@ dispatch.case.281: ; preds = %match.arm.47 %ua.raw198 = extractvalue { i64, i64 } %loadN, 1 %ua.ptr199 = inttoptr i64 %ua.raw198 to ptr %ua.load200 = load [64 x i64], ptr %ua.ptr199, align 8 - %callN = call { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %ua.load200) + %callN = call { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %ua.load200) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.275 @@ -2189,7 +2189,7 @@ dispatch.case.362: ; preds = %match.arm.49 dispatch.case.363: ; preds = %match.arm.49 %ua.raw261 = extractvalue { i64, i64 } %loadN, 1 %iNp262 = inttoptr i64 %ua.raw261 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %iNp262) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %iNp262) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.351 @@ -2252,7 +2252,7 @@ dispatch.case.371: ; preds = %match.arm.49 dispatch.case.372: ; preds = %match.arm.49 %ua.raw288 = extractvalue { i64, i64 } %loadN, 1 %iNp289 = inttoptr i64 %ua.raw288 to ptr - %callN = call { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %iNp289) + %callN = call { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %iNp289) store { ptr, i64 } %callN, ptr %allocaN, align 8 br label %dispatch.merge.351 @@ -3726,7 +3726,7 @@ entry: %sgN = extractvalue { i64, i64, i64 } %loadN, 1 %loadN = load { i64, i64, i64 }, ptr %allocaN, align 8 %sgN = extractvalue { i64, i64, i64 } %loadN, 2 - call void @print__ct_s337be2777a405332__pack_s64_s64_s64(ptr @__sx_default_context, i64 %sg, i64 %sgN, i64 %sgN) + call void @print__ct_s337be2777a405332__pack_i64_i64_i64(ptr @__sx_default_context, i64 %sg, i64 %sgN, i64 %sgN) ret i32 0 } @@ -3797,7 +3797,7 @@ entry: } ; Function Attrs: nounwind -define internal void @print__ct_s337be2777a405332__pack_s64_s64_s64(ptr %0, i64 %1, i64 %2, i64 %3) #0 { +define internal void @print__ct_s337be2777a405332__pack_i64_i64_i64(ptr %0, i64 %1, i64 %2, i64 %3) #0 { entry: %alloca = alloca { ptr, i64 }, align 8 store { ptr, i64 } { ptr @str.360, i64 22 }, ptr %alloca, align 8 @@ -3957,14 +3957,14 @@ fv.case: ; preds = %if.merge.127 fv.case17: ; preds = %if.merge.127 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.127 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.127 @@ -4660,8 +4660,8 @@ fv.default: ; preds = %if.merge.172 fv.case: ; preds = %if.merge.172 %fv.field = extractvalue { i32 } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge } @@ -4744,14 +4744,14 @@ fv.case: ; preds = %if.merge.177 fv.case17: ; preds = %if.merge.177 %fv.field18 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 1 - %sN = sext i32 %fv.field18 to i64 - %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field18 to i64 + %fv.val19 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case20: ; preds = %if.merge.177 %fv.field21 = extractvalue { { ptr, i64 }, i32, i32, { ptr, i64 }, { ptr, i64 } } %loadN, 2 - %sN = sext i32 %fv.field21 to i64 - %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field21 to i64 + %fv.val23 = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case24: ; preds = %if.merge.177 @@ -4836,8 +4836,8 @@ fv.default: ; preds = %if.merge.182 fv.case: ; preds = %if.merge.182 %fv.field = extractvalue { i32, { ptr, i64 } } %loadN, 0 - %sN = sext i32 %fv.field to i64 - %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %sN, 1 + %iN = sext i32 %fv.field to i64 + %fv.val = insertvalue { i64, i64 } { i64 4, i64 undef }, i64 %iN, 1 br label %fv.merge fv.case17: ; preds = %if.merge.182 @@ -6374,7 +6374,7 @@ if.merge.274: ; preds = %if.then.273, %entry } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_4_s64(ptr %0, [4 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_4_i64(ptr %0, [4 x i64] %1) #0 { entry: %alloca = alloca [4 x i64], align 8 %ig.tmp = alloca [4 x i64], align 8 @@ -6477,7 +6477,7 @@ if.merge.293: ; preds = %if.then.292, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_8_s64(ptr %0, [8 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_8_i64(ptr %0, [8 x i64] %1) #0 { entry: %alloca = alloca [8 x i64], align 8 %ig.tmp = alloca [8 x i64], align 8 @@ -6578,7 +6578,7 @@ if.merge.303: ; preds = %if.then.302, %while } ; Function Attrs: nounwind -define internal { ptr, i64 } @array_to_string__AR_64_s64(ptr %0, [64 x i64] %1) #0 { +define internal { ptr, i64 } @array_to_string__AR_64_i64(ptr %0, [64 x i64] %1) #0 { entry: %alloca = alloca [64 x i64], align 8 %ig.tmp = alloca [64 x i64], align 8 @@ -7281,7 +7281,7 @@ if.merge.428: ; preds = %if.else.427, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s32(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i32(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 @@ -7531,7 +7531,7 @@ if.merge.455: ; preds = %if.else.454, %if.th } ; Function Attrs: nounwind -define internal { ptr, i64 } @pointer_to_string__ptr_s64(ptr %0, ptr %1) #0 { +define internal { ptr, i64 } @pointer_to_string__ptr_i64(ptr %0, ptr %1) #0 { entry: %alloca = alloca ptr, align 8 store ptr %1, ptr %alloca, align 8 diff --git a/examples/expected/1344-ffi-objc-dsl-04-mismatch.stderr b/examples/expected/1344-ffi-objc-dsl-04-mismatch.stderr index 4340394..daa13e2 100644 --- a/examples/expected/1344-ffi-objc-dsl-04-mismatch.stderr +++ b/examples/expected/1344-ffi-objc-dsl-04-mismatch.stderr @@ -1,5 +1,5 @@ error: Obj-C selector for 'SxProbeMismatch.something_extra' has 2 keyword(s) but the call passes 1 argument(s); split the sx method name on '_' so it produces exactly 1 keyword(s), or override with `#selector("...")` - --> /Users/agra/projects/sx/examples/1344-ffi-objc-dsl-04-mismatch.sx:18:14 + --> examples/1344-ffi-objc-dsl-04-mismatch.sx:18:14 | 18 | n := inst.something_extra(7); | ^^^^^^^^^^^^^^^^^^^^ diff --git a/examples/expected/1410-ffi-jni-call-11-unsupported-return-diag.stderr b/examples/expected/1410-ffi-jni-call-11-unsupported-return-diag.stderr index 0459e83..b1296b0 100644 --- a/examples/expected/1410-ffi-jni-call-11-unsupported-return-diag.stderr +++ b/examples/expected/1410-ffi-jni-call-11-unsupported-return-diag.stderr @@ -1,5 +1,5 @@ -error: JNI method 'Buf.get' returns 's8', which isn't supported by the JNI call-method lowering yet — only void/bool/s32/s64/f32/f64 and pointers are wired up - --> /Users/agra/projects/sx/examples/1410-ffi-jni-call-11-unsupported-return-diag.sx:24:14 +error: JNI method 'Buf.get' returns 'i8', which isn't supported by the JNI call-method lowering yet — only void/bool/i32/i64/f32/f64 and pointers are wired up + --> examples/1410-ffi-jni-call-11-unsupported-return-diag.sx:24:14 | 24 | _ := b.get(); | ^^^^^ diff --git a/examples/probes/pack-expansion-parses.sx b/examples/probes/pack-expansion-parses.sx index 3c97b05..3984d64 100644 --- a/examples/probes/pack-expansion-parses.sx +++ b/examples/probes/pack-expansion-parses.sx @@ -20,5 +20,5 @@ ca1 :: () => f(..xs); ca2 :: () => f(..xs.value); // 4. Closure-sig position — `Closure(..Ts)` / `Closure(..Ts.Arg)`: -cs1 :: (cb: Closure(..Ts) -> s32) => cb; -cs2 :: (cb: Closure(..sources.T) -> s32) => cb; +cs1 :: (cb: Closure(..Ts) -> i32) => cb; +cs2 :: (cb: Closure(..sources.T) -> i32) => cb; diff --git a/examples/probes/tuple-baseline.sx b/examples/probes/tuple-baseline.sx index e465f1b..d4977dd 100644 --- a/examples/probes/tuple-baseline.sx +++ b/examples/probes/tuple-baseline.sx @@ -10,13 +10,13 @@ #import "modules/std.sx"; -Listenable :: struct { value: s64; } // stand-in element struct -Combined :: struct { sources: (s32, s32); } // tuple-typed field (Decision 2) +Listenable :: struct { value: i64; } // stand-in element struct +Combined :: struct { sources: (i32, i32); } // tuple-typed field (Decision 2) -swap :: (a: s64, b: s64) -> (s64, s64) { (b, a) } -fst :: (t: (s64, s64)) -> s64 { t.0 } +swap :: (a: i64, b: i64) -> (i64, i64) { (b, a) } +fst :: (t: (i64, i64)) -> i64 { t.0 } -main :: () -> s32 { +main :: () -> i32 { // ── Block A — primitives (WORKS) ─────────────────────────────── pair := (40, 2); // inferred positional print("A.idx {} {}\n", pair.0, pair.1); @@ -24,7 +24,7 @@ main :: () -> s32 { print("A.named {} {} {}\n", named.x, named.0, named.1); one := (42,); // 1-tuple print("A.one {}\n", one.0); - a : s64 = pair.0; // element into typed local + a : i64 = pair.0; // element into typed local print("A.local {}\n", a); // ── Block B — storage in a struct field (WORKS; core of Decision 2) diff --git a/issues/0030-extern-global-declarations.md b/issues/0030-extern-global-declarations.md index e0c8a72..1436392 100644 --- a/issues/0030-extern-global-declarations.md +++ b/issues/0030-extern-global-declarations.md @@ -39,7 +39,7 @@ sx-defined globals shared across sx modules. ```sx #import "modules/std.sx"; extern g_x : *void; // want: a reference to a global defined elsewhere -main :: () -> s32 { 0; } +main :: () -> i32 { 0; } ``` `./zig-out/bin/sx run …` → `error: expected '::', ':=', or ':' after identifier` diff --git a/issues/0030-extern-global-declarations.sx b/issues/0030-extern-global-declarations.sx index 810288e..c9e4641 100644 --- a/issues/0030-extern-global-declarations.sx +++ b/issues/0030-extern-global-declarations.sx @@ -11,4 +11,4 @@ extern g_x : *void; -main :: () -> s32 { 0; } +main :: () -> i32 { 0; } diff --git a/issues/0041-pointer-type-not-parsed-as-expression.md b/issues/0041-pointer-type-not-parsed-as-expression.md index 7a08c00..26e09c9 100644 --- a/issues/0041-pointer-type-not-parsed-as-expression.md +++ b/issues/0041-pointer-type-not-parsed-as-expression.md @@ -42,7 +42,7 @@ worth pinning down because: ```sx #import "modules/std.sx"; -main :: () -> s32 { +main :: () -> i32 { n := size_of(*u8); // error: unexpected token in expression print("{}\n", n); 0; @@ -56,7 +56,7 @@ Also fails on the alias form: Ptr :: *u8; // error: unexpected token in expression -main :: () -> s32 { 0; } +main :: () -> i32 { 0; } ``` Both `sx run` and `sx build` reject identically. @@ -104,7 +104,7 @@ class of "ptr type as type-expression value" is unsupported. > handles `*` prefix. Today it likely returns a `unary_op > { op = deref, operand = … }` AST node. > - Look at how lower.zig's `resolveTypeArg` consumes the AST node -> for `size_of(s32)` — what AST shape does it expect for a type +> for `size_of(i32)` — what AST shape does it expect for a type > literal? Probably an `identifier` whose name resolves to a type. > - The fix should extend `resolveTypeArg` to also accept a > `unary_op { op = deref, ... }` and treat it as "pointer to diff --git a/issues/0042-const-decl-type-aliases-not-resolved-as-identifier.md b/issues/0042-const-decl-type-aliases-not-resolved-as-identifier.md index be6e6b1..9b36fd8 100644 --- a/issues/0042-const-decl-type-aliases-not-resolved-as-identifier.md +++ b/issues/0042-const-decl-type-aliases-not-resolved-as-identifier.md @@ -1,6 +1,6 @@ -# issue-0042 — Const-decl type aliases (`MyInt :: s32;`) silently return `.s64` from `size_of` / `align_of` +# issue-0042 — Const-decl type aliases (`MyInt :: i32;`) silently return `.i64` from `size_of` / `align_of` -**FIXED.** `MyInt :: s32; size_of(MyInt)` now returns `4` +**FIXED.** `MyInt :: i32; size_of(MyInt)` now returns `4` correctly. The `resolveTypeArg` `.identifier` branch consults `type_alias_map` before falling through. The fix landed alongside the broader alias-resolution work tracked in @@ -14,28 +14,28 @@ Below preserved as a record of the original problem. A type alias declared via `Foo :: SomeType;` is registered in the lowering's `type_alias_map` but is **never consulted** when the alias name is later used as a type argument to `size_of` / `align_of`. The -fallback returns `.s64` (8 bytes) — which coincidentally produces a +fallback returns `.i64` (8 bytes) — which coincidentally produces a correct result for any alias whose underlying type is 8 bytes -(`*T`, `f64`, function pointers, `s64`, `u64`), silently masking the +(`*T`, `f64`, function pointers, `i64`, `u64`), silently masking the bug for years. Observed: ``` -size_of(s32) = 4 ← direct, correct +size_of(i32) = 4 ← direct, correct size_of(MyInt) = 8 ← via alias, WRONG (expected 4) ``` -Where `MyInt :: s32;`. +Where `MyInt :: i32;`. ## Reproduction ```sx #import "modules/std.sx"; -MyInt :: s32; +MyInt :: i32; -main :: () -> s32 { - print("direct: {}\n", size_of(s32)); // 4 +main :: () -> i32 { + print("direct: {}\n", size_of(i32)); // 4 print("alias: {}\n", size_of(MyInt)); // 8 — should be 4 0; } @@ -53,9 +53,9 @@ alias: 8 issue-0041 work extends the const-decl alias path to register pointer, optional, array, slice, many-pointer, and function-type aliases (`Ptr :: *u8;`, `Maybe :: ?u8;`, `Arr :: [3]u8;`, -`Cb :: (s32) -> s32;`). Every one of those aliases ends up in +`Cb :: (i32) -> i32;`). Every one of those aliases ends up in `type_alias_map`, then `size_of()` falls through the same -`.identifier` branch that ignores the map — returning `.s64` (8). +`.identifier` branch that ignores the map — returning `.i64` (8). For pointer and function-type aliases this is coincidentally right (8 bytes). For optional, array, etc. it produces silently-wrong sizes (`size_of(Maybe) = 8` instead of 2; @@ -77,7 +77,7 @@ would ship subtly broken. > if (tb.get(id.name)) |ty| return ty; > } > const name_id = self.module.types.internString(id.name); -> return self.module.types.findByName(name_id) orelse .s64; +> return self.module.types.findByName(name_id) orelse .i64; > }, > ``` > @@ -96,7 +96,7 @@ would ship subtly broken. > > Why two branches: an `.identifier` AST node is what parsePrimary > emits for non-keyword names; `.type_expr` is what it emits for -> built-in primitive names recognised by `Type.fromName` (`s32`, +> built-in primitive names recognised by `Type.fromName` (`i32`, > `u8`, etc.) and for the `f32`/`f64`/`Type` keywords. User-defined > alias names like `MyInt` and `Ptr` flow through `.identifier`. > @@ -111,7 +111,7 @@ would ship subtly broken. > } > if (self.type_alias_map.get(id.name)) |alias_ty| return alias_ty; > const name_id = self.module.types.internString(id.name); -> return self.module.types.findByName(name_id) orelse .s64; +> return self.module.types.findByName(name_id) orelse .i64; > }, > ``` > @@ -125,7 +125,7 @@ would ship subtly broken. > > **Possible adjacency:** the issue may extend to `align_of` > (likely same call path) and to type-alias chains -> (`A :: s32; B :: A;` — does B resolve through A's alias entry?). +> (`A :: i32; B :: A;` — does B resolve through A's alias entry?). > Worth pinning down with a test once the primary fix lands. ## Plan-level impact diff --git a/issues/0043-lazy-lower-loses-foreign-class-method-dispatch.md b/issues/0043-lazy-lower-loses-foreign-class-method-dispatch.md index e5d9ce0..006dd29 100644 --- a/issues/0043-lazy-lower-loses-foreign-class-method-dispatch.md +++ b/issues/0043-lazy-lower-loses-foreign-class-method-dispatch.md @@ -83,7 +83,7 @@ caller :: (self: *void, _cmd: *void, scene: *void, b: *void, c: *void) callconv( } } -main :: () -> s32 { 0; } +main :: () -> i32 { 0; } ``` Build: diff --git a/issues/0044-sx-defined-objc-class-method-self-param-must-be-named-self.md b/issues/0044-sx-defined-objc-class-method-self-param-must-be-named-self.md index 92d289d..e8c3367 100644 --- a/issues/0044-sx-defined-objc-class-method-self-param-must-be-named-self.md +++ b/issues/0044-sx-defined-objc-class-method-self-param-must-be-named-self.md @@ -47,7 +47,7 @@ Foo :: #objc_class("SxFooSelfTest") { } } -main :: () -> s32 { +main :: () -> i32 { inline if OS == .macos { f := Foo.alloc().init(); result := f.poke(); diff --git a/issues/0045-pack-fn-call-llvm-verifier-failure.md b/issues/0045-pack-fn-call-llvm-verifier-failure.md index 7aad6f9..acf65e6 100644 --- a/issues/0045-pack-fn-call-llvm-verifier-failure.md +++ b/issues/0045-pack-fn-call-llvm-verifier-failure.md @@ -27,10 +27,10 @@ than corrupt IR. # Reproduction ```sx -foo :: (..$args) -> s64 { return 42; } +foo :: (..$args) -> i64 { return 42; } -main :: () -> s32 { - n : s64 = foo(); +main :: () -> i32 { + n : i64 = foo(); return 0; } ``` @@ -58,7 +58,7 @@ at first use. But the existing monomorphisation machinery binds a single TypeId per `$T` name — it has no notion of a *pack* (a variable-length list of TypeIds bound positionally). When the call site tries to monomorphise with the call's args, the body's -`args` parameter gets resolved to a single (probably default `.s64`) +`args` parameter gets resolved to a single (probably default `.i64`) TypeId, but the call-site arg-packing path (`packVariadicCallArgs`) treats it as a regular `..T` slice — the two views disagree and the emitted IR is malformed. diff --git a/issues/0046-comptime-fn-nested-print-with-return.md b/issues/0046-comptime-fn-nested-print-with-return.md index 1ee14c6..4e811f3 100644 --- a/issues/0046-comptime-fn-nested-print-with-return.md +++ b/issues/0046-comptime-fn-nested-print-with-return.md @@ -11,7 +11,7 @@ and tripped a null pointer store at `storeAtRawPtr`. The pack-fn face of this bug (filed as face 2) was fixed incidentally by step 2b's mono refactor — pack-fn calls bypass the inline-return-slot setup entirely. Plain -`($x: s32)` comptime fns stay on the inline path; the +`($x: i32)` comptime fns stay on the inline path; the `createComptimeFunction` save/restore fix covers that path. Regression test: @@ -25,8 +25,8 @@ two shapes depending on the comptime-param flavour: | Outer fn shape | Failure | |---|---| -| `helper :: ($x: s32) -> s64 { print("inside\n"); return 42; }` (plain comptime) | Panic: `cast causes pointer to be null` at `src/ir/interp.zig:207 storeAtRawPtr`. | -| `dump :: (..$args) -> s64 { n := args[0]; print("got {}\n", n); return n; }` (pack-fn) | Compile error: `unresolved 'result'` at fake span `1:5` (inside the inserted code). | +| `helper :: ($x: i32) -> i64 { print("inside\n"); return 42; }` (plain comptime) | Panic: `cast causes pointer to be null` at `src/ir/interp.zig:207 storeAtRawPtr`. | +| `dump :: (..$args) -> i64 { n := args[0]; print("got {}\n", n); return n; }` (pack-fn) | Compile error: `unresolved 'result'` at fake span `1:5` (inside the inserted code). | Both vanish if you remove either the nested `print(...)` OR the `return X;` statement: @@ -56,19 +56,19 @@ and it isn't. #import "modules/std.sx"; // Face 1 — interp panic: -helper :: ($x: s32) -> s64 { +helper :: ($x: i32) -> i64 { print("inside\n"); return 42; } // Face 2 — "unresolved 'result'": -dump :: (..$args) -> s64 { - n : s64 = args[0]; +dump :: (..$args) -> i64 { + n : i64 = args[0]; print("got {}\n", n); return n; } -main :: () -> s32 { +main :: () -> i32 { n := helper(7); // ← panic in interp print("{}\n", dump(7)); // ← "unresolved 'result'" return 0; @@ -84,7 +84,7 @@ in the same program. same pattern hit a different fatal stage (LLVM verifier) before the fix. The fix exposed it; it didn't create it. - Not caused by step 2a (pack typed indexing, commit `cd36784`): - Face 1 reproduces with a plain `($x: s32)` comptime fn, no + Face 1 reproduces with a plain `($x: i32)` comptime fn, no pack involved. - Not exercised by any test in the suite today. `format`/`print` use arrow form or `#insert`-only bodies — no `return` in a diff --git a/issues/0047-run-output-on-stderr-runtime-on-stdout.md b/issues/0047-run-output-on-stderr-runtime-on-stdout.md index 700cb0b..b0c2fcd 100644 --- a/issues/0047-run-output-on-stderr-runtime-on-stdout.md +++ b/issues/0047-run-output-on-stderr-runtime-on-stdout.md @@ -27,7 +27,7 @@ configure :: () { } #run configure(); -main :: () -> s32 { +main :: () -> i32 { print("hello from runtime\n"); return 0; } diff --git a/issues/0048-bare-pack-args-slice-loses-len-across-call.md b/issues/0048-bare-pack-args-slice-loses-len-across-call.md index 351d031..a04196e 100644 --- a/issues/0048-bare-pack-args-slice-loses-len-across-call.md +++ b/issues/0048-bare-pack-args-slice-loses-len-across-call.md @@ -28,14 +28,14 @@ Block literal source. With this bug, the builder receives an empty slice and emits the empty-pack source for every call shape, silently producing wrong block trampolines. -Baseline regression check (not affected): a hand-built `[]s64` +Baseline regression check (not affected): a hand-built `[]i64` slice round-trips correctly across the same kind of call: ```sx -walk :: (xs: []s64) -> s64 { return xs.len; } +walk :: (xs: []i64) -> i64 { return xs.len; } main :: () { - arr : [3]s64 = .{10, 20, 30}; - sl : []s64 = arr; + arr : [3]i64 = .{10, 20, 30}; + sl : []i64 = arr; print("call: {}\n", walk(sl)); // prints 3 — works } ``` @@ -71,7 +71,7 @@ Cleaner repro that contrasts inline vs callee: ```sx #import "modules/std.sx"; -walk :: (args: []Any) -> s64 { return args.len; } +walk :: (args: []Any) -> i64 { return args.len; } probe :: (..$args) -> string { inline_list := $args; @@ -105,7 +105,7 @@ Suspected area: - `src/ir/lower.zig` — `buildPackSliceValue` / `materialisePackSlice`. - Whether the slice aggregate it returns is the same shape sx uses - for an ordinary slice — `{ ptr: *T, len: s64 }` in field order + for an ordinary slice — `{ ptr: *T, len: i64 }` in field order used by `.len` reads at consumer sites. - Whether the slice survives the function-call ABI: the callee reads the slice fields from its frame's slot for the argument; @@ -123,7 +123,7 @@ What to check first: the slice aggregate produced by `buildPackSliceValue` — not at the underlying `alloca [N x Any]` (which would be the data pointer, not the slice). -3. Compare with the `[]s64` round-trip path that works — what's +3. Compare with the `[]i64` round-trip path that works — what's different about how the slice is bound at the call site? Verification step after fix: diff --git a/issues/0052-slice-of-protocol-variadic-not-erased.md b/issues/0052-slice-of-protocol-variadic-not-erased.md index d06b976..28165a6 100644 --- a/issues/0052-slice-of-protocol-variadic-not-erased.md +++ b/issues/0052-slice-of-protocol-variadic-not-erased.md @@ -17,14 +17,14 @@ Bus error at address 0x3fff ```sx #import "modules/std.sx"; Show :: protocol { show :: () -> string; } -A :: struct { x: s64; } +A :: struct { x: i64; } impl Show for A { show :: (self: *A) -> string => "A"; } each :: (..xs: []Show) -> void { i := 0; while i < xs.len { print("{}\n", xs[i].show()); i = i + 1; } } -main :: () -> s32 { each(A.{ x = 1 }, A.{ x = 2 }); 0; } +main :: () -> i32 { each(A.{ x = 1 }, A.{ x = 2 }); 0; } ``` # Root cause diff --git a/issues/0053-comptime-pack-spread-into-any-slice.md b/issues/0053-comptime-pack-spread-into-any-slice.md index 86a91b7..e5af920 100644 --- a/issues/0053-comptime-pack-spread-into-any-slice.md +++ b/issues/0053-comptime-pack-spread-into-any-slice.md @@ -23,9 +23,9 @@ materialising a single `[]Any` slice for the one `items` parameter. ```sx #import "modules/std.sx"; -log_count :: (items: []Any) -> s64 { return items.len; } -forward :: (..$args) -> s64 { return log_count(..args); } -main :: () -> s32 { print("{}\n", forward(1, "hi", 2.5)); return 0; } +log_count :: (items: []Any) -> i64 { return items.len; } +forward :: (..$args) -> i64 { return log_count(..args); } +main :: () -> i32 { print("{}\n", forward(1, "hi", 2.5)); return 0; } ``` Expected: `3` (the pack spreads into the `[]Any` slice, like calling @@ -38,7 +38,7 @@ the cleaner spelling is an **`xx` cast**, which already means "erase/convert to the expected type": ```sx -forward :: (..$args) -> s64 { return log_count(xx args); } // target: []Any +forward :: (..$args) -> i64 { return log_count(xx args); } // target: []Any ``` `xx args` (target-typed) should materialize the pack into the expected slice: @@ -62,7 +62,7 @@ Declare the forwarder as the **slice** variadic instead of a pack — then it's already a runtime `[]Any` and forwards directly: ```sx -forward :: (..args: []Any) -> s64 { return log_count(args); } // works -> 3 +forward :: (..args: []Any) -> i64 { return log_count(args); } // works -> 3 ``` This is what `examples/162-pack-bare-args.sx` demonstrates. diff --git a/issues/0054-generic-struct-to-param-protocol-erasure.md b/issues/0054-generic-struct-to-param-protocol-erasure.md index c8b5859..8c57a6d 100644 --- a/issues/0054-generic-struct-to-param-protocol-erasure.md +++ b/issues/0054-generic-struct-to-param-protocol-erasure.md @@ -5,7 +5,7 @@ was a general pre-existing bug — `self.x` failed on *any* generic-struct impl method.) 2. `createProtocolThunk` monomorphizes the template method for a generic-struct - instance (`Combined.get` → `Combined__s64_s64.get` with the instance + instance (`Combined.get` → `Combined__i64_i64.get` with the instance bindings), so the erasure vtable dispatches instead of an `unreachable` thunk. `xx c` (Combined → VL($R)) now dispatches correctly. The *full* canonical `map` @@ -27,18 +27,18 @@ This is the last piece of the canonical `map` (`return xx c;`). ```sx #import "modules/std.sx"; VL :: protocol(T: Type) { get :: () -> T; } -IntCell :: struct { v: s64; } -impl VL(s64) for IntCell { get :: (self: *IntCell) -> s64 => self.v; } +IntCell :: struct { v: i64; } +impl VL(i64) for IntCell { get :: (self: *IntCell) -> i64 => self.v; } Combined :: struct($R: Type, ..$Ts: []Type) { sources: (..VL(Ts)); value: $R; } impl VL($R) for Combined($R, ..$Ts) { get :: (self: *Combined) -> $R => self.value; } -make :: (..sources: VL) -> VL(s64) { - c : Combined(s64, ..sources.T) = ---; +make :: (..sources: VL) -> VL(i64) { + c : Combined(i64, ..sources.T) = ---; c.value = 99; c.sources = (..sources); - return xx c; // Combined__s64_s64 -> VL(s64) + return xx c; // Combined__i64_i64 -> VL(i64) } -main :: () -> s32 { +main :: () -> i32 { r := make(IntCell.{ v = 1 }); print("{}\n", r.get()); // expect 99; instead traps 0; @@ -53,11 +53,11 @@ diagnostic — so an impl *was* matched), but the JIT traps on `r.get()`. `param_impl_map` is keyed by **concrete** `(protocol, target_args_mangled, source_mangled)`. The impl `impl VL($R) for Combined($R, ..$Ts)` is generic on both sides — its source mangles to a generic `Combined` (with `$R`/`$Ts`), not -the concrete `Combined__s64_s64`. Erasing `Combined__s64_s64 → VL(s64)` looks up -`(VL, s64, Combined__s64_s64)`, which doesn't key-match the generic impl; some +the concrete `Combined__i64_i64`. Erasing `Combined__i64_i64 → VL(i64)` looks up +`(VL, i64, Combined__i64_i64)`, which doesn't key-match the generic impl; some looser path still produces a protocol value, but its vtable slot for `get` -isn't bound to the monomorphized `Combined__s64_s64.get` (which returns -`self.value` as `$R`=s64). Calling through it traps. +isn't bound to the monomorphized `Combined__i64_i64.get` (which returns +`self.value` as `$R`=i64). Calling through it traps. The fix needs generic-impl matching + per-instance monomorphization for protocol erasure: when erasing a concrete generic-struct instance to a parameterized @@ -75,7 +75,7 @@ and fill the vtable with the resulting fn-ptrs. Compare: # Verification The reproduction should print `99`. Plain (non-generic) struct → parameterized -protocol erasure already works (`examples/206`: `xx IntCell -> VL(s64)`); the gap +protocol erasure already works (`examples/206`: `xx IntCell -> VL(i64)`); the gap is specifically a *generic-struct* source matched via a *generic* impl. # Status diff --git a/issues/0055-binary-arith-no-operand-type-check.md b/issues/0055-binary-arith-no-operand-type-check.md index 2dba552..6b2d8dd 100644 --- a/issues/0055-binary-arith-no-operand-type-check.md +++ b/issues/0055-binary-arith-no-operand-type-check.md @@ -1,4 +1,4 @@ -# 0055 — binary arithmetic accepts mismatched operand types (`s64 + string`) +# 0055 — binary arithmetic accepts mismatched operand types (`i64 + string`) **FIXED** (`examples/214-binop-operand-type-check.sx`). `lowerBinaryOp` in [src/ir/lower.zig](../src/ir/lower.zig) now checks operand-type @@ -7,13 +7,13 @@ predicates that pass `.unresolved` through (so a type we couldn't infer is never falsely diagnosed) but reject a concretely incompatible operand: - **arithmetic** `+ - * / %` → `isArithOperand` (numeric / vector / - pointer). Without it `s64 + string` lowered as `add : s64` and + pointer). Without it `i64 + string` lowered as `add : i64` and reinterpreted the string's bytes — garbage. - **ordering** `< <= > >=` → `isOrderingOperand` (numeric / enum / pointer - / bool / vector). Without it `s64 < string` fed mismatched LLVM types to + / bool / vector). Without it `i64 < string` fed mismatched LLVM types to `icmp` and tripped the verifier. - **bitwise / shift** `& | ^ << >>` → `isBitwiseOperand` (integer / enum / - bool / vector). Without it `s64 & string` reinterpreted the bytes. + bool / vector). Without it `i64 & string` reinterpreted the bytes. On mismatch it emits `cannot apply '' to operands of type '' and ''` and returns a placeholder sentinel instead of the corrupting op. @@ -25,27 +25,27 @@ check. Legitimate mixes — flags-enum bitwise (`.read | .write`, Still NOT covered (left deliberately): equality `==` / `!=`, whose path is heavily special-cased (string `str_eq`, `Any` unbox, `optional == null`). -`s64 == string` still slips through. Folding a compatibility check into +`i64 == string` still slips through. Folding a compatibility check into that path without regressing the special cases is a separate change — open a fresh issue if it bites. ## Symptom Binary arithmetic operators (`+`, `-`, `*`, `/`, `%`) perform **no -operand-type compatibility check**. `s64 + string` compiles cleanly and +operand-type compatibility check**. `i64 + string` compiles cleanly and runs, reinterpreting the `string` operand's bytes (pointer/len) as an integer. -- **Observed:** `a + c` where `a: s64`, `c: string` compiles and prints a +- **Observed:** `a + c` where `a: i64`, `c: string` compiles and prints a garbage number (e.g. `4346102832` — `40 + `). - **Expected:** a type-error diagnostic, e.g. - `cannot apply '+' to operands of type 's64' and 'string'`. + `cannot apply '+' to operands of type 'i64' and 'string'`. Surfaced in `examples/213-canonical-map.sx`: a third source `v3: StrCell` (`VL(string)`) was added so the mapper became `(a, b, c) => a + b + c` -with `a, b: s64` and `c: string`. The canonical `map` infers the closure +with `a, b: i64` and `c: string`. The canonical `map` infers the closure params from the projected pack element types, so `a + b + c` is -`s64 + s64 + string` — which should reject. Instead `r.get()` prints +`i64 + i64 + string` — which should reject. Instead `r.get()` prints garbage (`4312977714`). > Note: the working-tree copy of `examples/213` also contains a *separate* @@ -62,10 +62,10 @@ Minimal, standalone (only `modules/std.sx`): ```sx #import "modules/std.sx"; -main :: () -> s32 { - a : s64 = 40; +main :: () -> i32 { + a : i64 = 40; c : string = "it should error"; - r := a + c; // expected: type error (s64 + string) + r := a + c; // expected: type error (i64 + string) print("{}\n", r); // actual: prints garbage, e.g. 4346102832 0; } @@ -84,8 +84,8 @@ $ ./zig-out/bin/sx run repro.sx > (`var ty = lhs_ty;` ~L2680), then at the final `switch (bop.op)` (~L2735) > emits `.add => self.builder.add(lhs, rhs, ty)` (and `.sub/.mul/.div/.mod`) > with that LHS-derived `ty` — never verifying `rhs_ty` is compatible. For -> `s64 + string`, `ty = .s64` and the `string` rhs Ref is fed to an -> `add : s64`, reinterpreting its bytes as an integer. +> `i64 + string`, `ty = .i64` and the `string` rhs Ref is fed to an +> `add : i64`, reinterpreting its bytes as an integer. > > The fix: before the arithmetic `switch` arms, for the arithmetic ops > (`add/sub/mul/div/mod`) check that `lhs_ty` and `rhs_ty` are diff --git a/issues/0056-param-impl-not-deduped-across-diamond-import.md b/issues/0056-param-impl-not-deduped-across-diamond-import.md index 9457cf4..3856ea4 100644 --- a/issues/0056-param-impl-not-deduped-across-diamond-import.md +++ b/issues/0056-param-impl-not-deduped-across-diamond-import.md @@ -14,13 +14,13 @@ not be imported through more than one path. Under a diamond — ``` main ─┬─ mid_a ─┐ - └─ mid_b ─┴─ common (holds `impl Into(Wrapped) for s64`) + └─ mid_b ─┴─ common (holds `impl Into(Wrapped) for i64`) ``` — compilation failed with: ``` -error: duplicate impl 'Into' for source 's64' in .../common.sx +error: duplicate impl 'Into' for source 'i64' in .../common.sx ``` This bit the moment `modules/std/objc.sx` (imported by `main.sx`, @@ -48,10 +48,10 @@ imported through any diamond. `examples/issue-0056/common.sx`: ```sx -Wrapped :: struct { v: s64; } +Wrapped :: struct { v: i64; } -impl Into(Wrapped) for s64 { - convert :: (self: s64) -> Wrapped { +impl Into(Wrapped) for i64 { + convert :: (self: i64) -> Wrapped { return .{ v = self }; } } @@ -64,8 +64,8 @@ impl Into(Wrapped) for s64 { #import "issue-0056/mid_a.sx"; #import "issue-0056/mid_b.sx"; -main :: () -> s32 { - w : Wrapped = xx 7; // pre-fix: duplicate impl 'Into' for source 's64' +main :: () -> i32 { + w : Wrapped = xx 7; // pre-fix: duplicate impl 'Into' for source 'i64' print("{}\n", w.v); // post-fix: prints 7 0; } diff --git a/issues/0057-xx-any-arg-in-imported-module-fn-segfaults.md b/issues/0057-xx-any-arg-in-imported-module-fn-segfaults.md index 77b4e9c..4a5284b 100644 --- a/issues/0057-xx-any-arg-in-imported-module-fn-segfaults.md +++ b/issues/0057-xx-any-arg-in-imported-module-fn-segfaults.md @@ -27,7 +27,7 @@ module**. The identical code works (a) inline in the main file, and (b) in an imported module if the arg is passed *without* `xx` (auto-boxed). - **Observed:** `Segmentation fault at address 0x1...` in `__platform_memmove`, - via `runJITFromObject` (target.zig:244). Crashes for any int width (s32, u64). + via `runJITFromObject` (target.zig:244). Crashes for any int width (i32, u64). - **Expected:** prints the formatted string, same as the auto-boxed / inline forms. @@ -38,9 +38,9 @@ imported module if the arg is passed *without* `xx` (auto-boxed). ```sx #import "std.sx"; -build :: (n: s32) -> string { +build :: (n: i32) -> string { result := "x:\n"; - i : s32 = 0; + i : i32 = 0; while i < n { line := format(" item {}\n", xx i); // <-- xx cast to Any is the trigger result = concat(result, line); @@ -55,7 +55,7 @@ Driver (e.g. `.sx-tmp/repro.sx`): ```sx #import "modules/std.sx"; m :: #import "modules/zz_repro.sx"; -main :: () -> s32 { print("[{}]", m.build(2)); return 0; } +main :: () -> i32 { print("[{}]", m.build(2)); return 0; } ``` Run: `./zig-out/bin/sx run .sx-tmp/repro.sx` → segfault. @@ -65,7 +65,7 @@ Run: `./zig-out/bin/sx run .sx-tmp/repro.sx` → segfault. - **Auto-box works:** change `xx i` → `i` in the module → prints fine. - **Inline works:** put the same `build` body (with `xx i`) directly in the driver's `main` (no import) → prints fine. -- **Width-independent:** `xx` on an `s32` or a `u64` both crash. +- **Width-independent:** `xx` on an `i32` or a `u64` both crash. - So the trigger is specifically: **explicit `xx ` → Any as a variadic `format`/`print` arg, in a function that lives in an imported module.** diff --git a/issues/0059-expr-lambda-inferred-return-unresolved-type.md b/issues/0059-expr-lambda-inferred-return-unresolved-type.md index 21138dc..9c6cba0 100644 --- a/issues/0059-expr-lambda-inferred-return-unresolved-type.md +++ b/issues/0059-expr-lambda-inferred-return-unresolved-type.md @@ -3,7 +3,7 @@ > **✅ RESOLVED.** Root cause: `resolveReturnType` ([src/ir/lower.zig]) infers a > no-annotation function's return type from its body, but the body references the > function's own params — which weren't in `self.scope` yet (they're bound later, -> at body lowering). So `inferExprType` couldn't resolve `x` in `(x: s32) => x * 2` +> at body lowering). So `inferExprType` couldn't resolve `x` in `(x: i32) => x * 2` > and returned `.unresolved`, which reached LLVM emission. It only slipped through > when a same-named binding happened to linger in scope from earlier lowering. > Fix: bind the function's plain annotated value params into a temporary scope @@ -28,7 +28,7 @@ thread … panic: unresolved type reached LLVM emission — a type resolution fa - **Observed:** the lambda's `func.ret` is `.unresolved` when `declareFunction` runs, so emission panics (SIGABRT, exit 134). -- **Expected:** the inferred return type (`s32` here) is resolved before +- **Expected:** the inferred return type (`i32` here) is resolved before emission; the program prints `14` and exits 0. ## Reproduction @@ -38,7 +38,7 @@ thread … panic: unresolved type reached LLVM emission — a type resolution fa ```sx #import "modules/std.sx"; -f :: (x: s32) => x * 2; // inferred return type +f :: (x: i32) => x * 2; // inferred return type main :: () { print("{}\n", f(7)); // want: 14 @@ -50,25 +50,25 @@ main :: () { ### Key contrasts (narrowing clues) -- **Explicit return type works:** `f :: (x: s32) -> s32 => x * 2;` → prints `14`, +- **Explicit return type works:** `f :: (x: i32) -> i32 => x * 2;` → prints `14`, exit 0. - **The same lambda inside a large program works:** the old monolithic - `50-smoke.sx` contained `double :: (x: s32) => x * 2;` as a local const and ran + `50-smoke.sx` contained `double :: (x: i32) => x * 2;` as a local const and ran clean (exit 0). The panic only appears when the expr-bodied inferred-return lambda is compiled in a *small* module (minimal file, or as the first/only such function). This strongly suggests the return-type inference for `=>` lambdas is triggered as a side effect of some other pass that the large file happens to run and the minimal file does not — rather than being driven unconditionally for every expr-bodied lambda. -- Both the **top-level** form (`f :: (x: s32) => x * 2;`) and the **local-const** +- Both the **top-level** form (`f :: (x: i32) => x * 2;`) and the **local-const** form (inside `main`) panic identically. ## Investigation prompt (paste into a fresh session) -> An expression-bodied lambda `f :: (x: s32) => x * 2;` with an inferred return +> An expression-bodied lambda `f :: (x: i32) => x * 2;` with an inferred return > type panics at `src/ir/emit_llvm.zig:4594` ("unresolved type reached LLVM > emission") because `func.ret` is still `.unresolved` when `declareFunction` -> (emit_llvm.zig:1658) emits it. Adding an explicit `-> s32` fixes it, and the +> (emit_llvm.zig:1658) emits it. Adding an explicit `-> i32` fixes it, and the > same lambda compiled inside a large module (the old 50-smoke.sx) resolves fine > — so the inferred-return resolution for `=>` lambdas is running only > conditionally. @@ -95,7 +95,7 @@ main :: () { Blocks the `50-smoke.sx` split (test-layout migration, Phase 2): the **functions** section exercises exactly this construct -(`double :: (x: s32) => x * 2;`), so it cannot be extracted into a standalone +(`double :: (x: i32) => x * 2;`), so it cannot be extracted into a standalone example until this is fixed. Working around it (adding an explicit return type) would stop testing inferred-return lambdas and hide the bug, so per the project's impassable rule the split is paused here. diff --git a/issues/0060-closure-literal-composition-miscompiles.md b/issues/0060-closure-literal-composition-miscompiles.md index 1b0f315..69316b4 100644 --- a/issues/0060-closure-literal-composition-miscompiles.md +++ b/issues/0060-closure-literal-composition-miscompiles.md @@ -23,8 +23,8 @@ > arrow, direct + `Closure(...)` param). > > **Remaining E5.1 follow-up (not 0060):** calling a **bare** failable -> function-type param (`cb: (s64) -> (s64, !E)`) resolves the call result as -> `unresolved` (the idiomatic `Closure(s64) -> (s64, !E)` form works); the +> function-type param (`cb: (i64) -> (i64, !E)`) resolves the call result as +> `unresolved` (the idiomatic `Closure(i64) -> (i64, !E)` form works); the > non-failable→failable widening adapter is currently *rejected* rather than > generated; and the program-wide SCC union per closure shape is unimplemented. @@ -39,10 +39,10 @@ non-failable closures miscompile too. ```sx #import "modules/std.sx"; -apply :: (f: (s64) -> s64) -> s64 { return f(5); } +apply :: (f: (i64) -> i64) -> i64 { return f(5); } main :: () { - print("block={}\n", apply(closure((x: s64) -> s64 { return x * 2; }))); // want 10 - print("arrow={}\n", apply(closure((x: s64) -> s64 => x * 2))); // want 10 + print("block={}\n", apply(closure((x: i64) -> i64 { return x * 2; }))); // want 10 + print("arrow={}\n", apply(closure((x: i64) -> i64 => x * 2))); // want 10 } ``` @@ -50,7 +50,7 @@ main :: () { - **Actual:** `block=192`, `arrow=20` (exit 0 — silent miscompile, no diagnostic). **Working contrast:** `examples/0302-closures-closures.sx` — -`apply :: (f, x) -> s64 { return f(x); }` called as `apply(closure(... => ...), 10)` +`apply :: (f, x) -> i64 { return f(x); }` called as `apply(closure(... => ...), 10)` works. There the piped value arrives as a *separate* argument; here the callee calls the closure param with a *literal*, and the literal/closure-env marshalling is wrong. Likely an env/arg-slot mixup when a closure literal is materialized as a @@ -77,7 +77,7 @@ Two further gaps sit on top of 0060: called** ones work end-to-end (success / `catch` / `or` all correct). 2. **Arrow-body failable closures miscompile.** After the parser patch, - `n := closure((x: s64) -> (s64, !E) => x + 1); n(40) catch e 0` returns `0` + `n := closure((x: i64) -> (i64, !E) => x + 1); n(40) catch e 0` returns `0` instead of `41` — the value slot reads as undef/0. Block-body equivalents are correct, so it's an arrow-body (`=>`) failable-closure lowering bug (the expression-body return isn't assembled into the `{value, error}` tuple @@ -88,8 +88,8 @@ Two further gaps sit on top of 0060: ## Investigation prompt (paste into a fresh session) > Closure literals passed as a function-type argument miscompile when the callee -> calls them: `apply :: (f: (s64)->s64) -> s64 { return f(5); }` then -> `apply(closure((x: s64) -> s64 { return x*2; }))` prints 192 (want 10); the +> calls them: `apply :: (f: (i64)->i64) -> i64 { return f(5); }` then +> `apply(closure((x: i64) -> i64 { return x*2; }))` prints 192 (want 10); the > arrow form prints 20. The working pattern (examples/0302) passes the value as a > separate arg. Suspect the closure-literal-as-call-argument lowering: the > closure env / the inner call's constant argument is marshalled into the wrong diff --git a/issues/0061-dead-code-after-terminator-stmt.md b/issues/0061-dead-code-after-terminator-stmt.md index 2583dec..518d5e6 100644 --- a/issues/0061-dead-code-after-terminator-stmt.md +++ b/issues/0061-dead-code-after-terminator-stmt.md @@ -28,7 +28,7 @@ Expected: the dead statements are dropped (unreachable); the program compiles and runs. This blocked ERR E5.1: the canonical failable-closure form from the plan, -`closure((x) -> (s32, !) { raise error.X; return x; })`, has a dead `return x;` +`closure((x) -> (i32, !) { raise error.X; return x; })`, has a dead `return x;` after the unconditional `raise` and tripped the verifier. ## Reproduction @@ -37,7 +37,7 @@ Minimal (non-failable — the bug is general, not error-specific): ```sx #import "modules/std.sx"; -main :: () -> s32 { return 0; print("dead\n"); } +main :: () -> i32 { return 0; print("dead\n"); } ``` Failable facet (the form that blocked E5.1): @@ -45,8 +45,8 @@ Failable facet (the form that blocked E5.1): ```sx #import "modules/std.sx"; E :: error { Neg } -top :: (x: s64) -> (s64, !E) { raise error.Neg; return x; } -main :: () -> s32 { print("r={}\n", top(5) catch e 0); return 0; } +top :: (x: i64) -> (i64, !E) { raise error.Neg; return x; } +main :: () -> i32 { print("r={}\n", top(5) catch e 0); return 0; } ``` Both abort with "Terminator found in the middle of a basic block". A diff --git a/issues/0062-generic-failable-return-not-monomorphized.md b/issues/0062-generic-failable-return-not-monomorphized.md index 5ebb11c..b0d1cde 100644 --- a/issues/0062-generic-failable-return-not-monomorphized.md +++ b/issues/0062-generic-failable-return-not-monomorphized.md @@ -9,9 +9,9 @@ > > ```sx > wrap :: ($T: Type, f: Closure() -> (T, !E)) -> (T, !E) { return try f(); } -> wrap(s32, closure(() -> (s32, !E) { return 7; })) catch e -1 // 7 -> r, err := wrap(s32, closure(() -> (s32, !E) { return 9; })) // r=9 -> wrap(s32, closure(() -> (s32, !E) { raise error.Bad; })) catch e -1 // -1 +> wrap(i32, closure(() -> (i32, !E) { return 7; })) catch e -1 // 7 +> r, err := wrap(i32, closure(() -> (i32, !E) { return 9; })) // r=9 +> wrap(i32, closure(() -> (i32, !E) { raise error.Bad; })) catch e -1 // -1 > ``` > > The only real (separate, orthogonal) defect found: a NON-`$` `T: Type` function @@ -30,7 +30,7 @@ failable return tuple during monomorphization. Observed two ways: - Consumed via destructure: the success value renders as `T{}` (the literal generic type name) instead of the concrete value, and the error slot is wrong. -Expected: `T` is bound to the concrete monomorphization type (`s32`), the success +Expected: `T` is bound to the concrete monomorphization type (`i32`), the success value flows through as `7`, and the error slot is `0` on success. ## Reproduction @@ -40,9 +40,9 @@ value flows through as `7`, and the error slot is `0` on success. E :: error { Bad } wrap :: (T: type, f: Closure() -> (T, !E)) -> (T, !E) { return try f(); } -main :: () -> s32 { +main :: () -> i32 { // catch form → LLVM phi type mismatch: - r := wrap(s32, closure(() -> (s32, !E) { return 7; })) catch e -1; + r := wrap(i32, closure(() -> (i32, !E) { return 7; })) catch e -1; print("{}\n", r); // want 7 return 0; } @@ -51,8 +51,8 @@ main :: () -> s32 { Destructure form (same root cause, different surfacing): ```sx -r, err := wrap(s32, closure(() -> (s32, !E) { return 7; })); -print("{} {}\n", r, xx err); // prints "T{} s64"; want "7 0" +r, err := wrap(i32, closure(() -> (i32, !E) { return 7; })); +print("{} {}\n", r, xx err); // prints "T{} i64"; want "7 0" ``` ## Investigation prompt diff --git a/issues/0063-free-fn-ufcs-pointer-param-passes-by-value.md b/issues/0063-free-fn-ufcs-pointer-param-passes-by-value.md index 736d0f8..3721b3e 100644 --- a/issues/0063-free-fn-ufcs-pointer-param-passes-by-value.md +++ b/issues/0063-free-fn-ufcs-pointer-param-passes-by-value.md @@ -27,7 +27,7 @@ The UFCS auto-address-of (`p.bump()` → `bump(@p)`) does not kick in for free functions; the receiver is loaded by value instead of having its address taken. The same method defined **inside** the struct works fine — so this is specific to free-function UFCS, not method calls in general. Not failable-specific (the -repro is a plain `-> s32`), so this is orthogonal to ERR. +repro is a plain `-> i32`), so this is orthogonal to ERR. Expected: `p.bump()` on a `*Parser`-first-param free function takes `@p`'s address, matching the in-struct method behavior. @@ -36,17 +36,17 @@ address, matching the in-struct method behavior. ```sx #import "modules/std.sx"; -Parser :: struct { pos: s32; } -bump :: (p: *Parser) -> s32 { p.pos += 1; return p.pos; } // FREE fn, pointer first param +Parser :: struct { pos: i32; } +bump :: (p: *Parser) -> i32 { p.pos += 1; return p.pos; } // FREE fn, pointer first param -main :: () -> s32 { +main :: () -> i32 { p := Parser.{ pos = 0 }; print("{}\n", p.bump()); // LLVM signature mismatch return 0; } ``` -Control (works): move `bump` inside `Parser :: struct { … bump :: (p: *Parser) -> s32 { … } }`. +Control (works): move `bump` inside `Parser :: struct { … bump :: (p: *Parser) -> i32 { … } }`. Also fails with an explicit `bump(@p)` — so the explicit address-of of a local struct into a pointer param is the underlying miscompile, not just the UFCS sugar. diff --git a/issues/0064-nondollar-type-param-silent-empty-struct.md b/issues/0064-nondollar-type-param-silent-empty-struct.md index d720717..ea04bd7 100644 --- a/issues/0064-nondollar-type-param-silent-empty-struct.md +++ b/issues/0064-nondollar-type-param-silent-empty-struct.md @@ -50,8 +50,8 @@ produces garbage (the value renders as `T{}`), with no diagnostic. ```sx idwrap :: (T: Type, f: Closure() -> T) -> T { return f(); } -main :: () -> s32 { - print("{}\n", idwrap(s32, closure(() -> s32 { return 7; }))); // prints "T{}", want 7 +main :: () -> i32 { + print("{}\n", idwrap(i32, closure(() -> i32 { return 7; }))); // prints "T{}", want 7 return 0; } ``` diff --git a/issues/0065-block-expr-destructure-decl-parse.md b/issues/0065-block-expr-destructure-decl-parse.md index f69587c..dcdc09c 100644 --- a/issues/0065-block-expr-destructure-decl-parse.md +++ b/issues/0065-block-expr-destructure-decl-parse.md @@ -39,7 +39,7 @@ in binding position doesn't parse" note in `current/CHECKPOINT-ERR.md` #import "modules/std.sx"; E :: error { Bad } -val :: () -> (s32, !E) { return 5; } +val :: () -> (i32, !E) { return 5; } f :: () -> !E { defer { @@ -49,7 +49,7 @@ f :: () -> !E { return; } -main :: () -> s32 { return 0; } +main :: () -> i32 { return 0; } ``` Also reproduces with no `defer`, as a plain value block: diff --git a/issues/0066-match-arm-negative-literal-phi-width.md b/issues/0066-match-arm-negative-literal-phi-width.md index f40b7a5..a7a8028 100644 --- a/issues/0066-match-arm-negative-literal-phi-width.md +++ b/issues/0066-match-arm-negative-literal-phi-width.md @@ -31,19 +31,19 @@ regression example (0040); the example sidesteps it with positive arm values. ## Reproduction ```sx -classify :: (n: s32) -> s32 { +classify :: (n: i32) -> i32 { if n == { case 0: 100; case 1: 10; else: -1; // ← negated literal arm → phi width mismatch } } -main :: () -> s32 { classify(1) } +main :: () -> i32 { classify(1) } ``` Expected: compiles, `classify(1)` returns 10. Actual: LLVM verification failure. -Workaround: give the arm an explicitly-typed value (`else: { x : s32 = -1; x }`) +Workaround: give the arm an explicitly-typed value (`else: { x : i32 = -1; x }`) or avoid the negation. ## Investigation prompt @@ -52,7 +52,7 @@ Look at the match-as-value lowering in `src/ir/lower.zig` (`lowerMatch`, the `has_value_merge` path ~line 4500, and the arm `result_type` inference ~line 11698). The arm value is lowered via `lowerBlockValue(arm.body)` then `coerceToType(v, v_ty, result_type)`. For a negated-literal arm the value's -type comes out narrower than `result_type` (s64 here), and the coercion path +type comes out narrower than `result_type` (i64 here), and the coercion path that should widen it before the `br merge_bb, {v}` either runs against the wrong target or is skipped — so the phi gets an i32 operand under an i64 result. Make the arm value coerce to the merge's `result_type` consistently (mirror how the diff --git a/issues/0067-tuple-literal-type-nontype-fallback.md b/issues/0067-tuple-literal-type-nontype-fallback.md index 66435ba..69afa89 100644 --- a/issues/0067-tuple-literal-type-nontype-fallback.md +++ b/issues/0067-tuple-literal-type-nontype-fallback.md @@ -3,12 +3,12 @@ > **RESOLVED** (2026-06-02). > **Root cause:** `type_bridge.resolveTupleLiteralAsType` treated a tuple literal > as a tuple TYPE and, for any element that wasn't type-shaped, emitted a -> `std.debug.print` and substituted `.s64` for that field — a silent fabricated +> `std.debug.print` and substituted `.i64` for that field — a silent fabricated > type (the forbidden silent-fallback pattern). The stateful caller > (`Lowering.resolveTypeArg`, used by `size_of`) delegated `.tuple_literal` -> straight to that path, so `size_of((s32, 1))` compiled and printed `16`. +> straight to that path, so `size_of((i32, 1))` compiled and printed `16`. > **Fix:** -> - `type_bridge.resolveTupleLiteralAsType` now returns `.unresolved` (no `.s64`, +> - `type_bridge.resolveTupleLiteralAsType` now returns `.unresolved` (no `.i64`, > no debug print) when any element is not type-shaped — it refuses to fabricate > a tuple. (type_bridge is stateless, so this is the binding-free backstop.) > - New stateful `Lowering.resolveTupleLiteralTypeArg` validates each element via @@ -17,14 +17,14 @@ > `resolveTypeArg` (size_of/align_of/…) and the `resolveTypeWithBindings` > name-fallback; type_bridge builds the tuple only after validation passes. > **Regression test:** `examples/1116-diagnostics-tuple-type-nontype-element-rejected.sx` -> (exit 1 + diagnostic). Valid `(s32, s32)` still works +> (exit 1 + diagnostic). Valid `(i32, i32)` still works > (`examples/0115-types-compound-type-in-expression.sx`). Suite 351/0. ## Symptom -`size_of((s32, 1))` treats the tuple literal as a tuple TYPE even though `1` is +`size_of((i32, 1))` treats the tuple literal as a tuple TYPE even though `1` is not a type. The compiler prints an internal `type_bridge` debug line, then -silently substitutes `.s64` for that slot and compiles successfully. +silently substitutes `.i64` for that slot and compiles successfully. Observed: @@ -41,8 +41,8 @@ with no fabricated tuple type and no successful run. ```sx #import "modules/std.sx"; -main :: () -> s32 { - print("bad tuple type size = {}\n", size_of((s32, 1))); +main :: () -> i32 { + print("bad tuple type size = {}\n", size_of((i32, 1))); 0 } ``` @@ -59,27 +59,27 @@ scratch file under `.sx-tmp/`. ## Investigation prompt Fix issue 0067: tuple literals reinterpreted as tuple types must reject non-type -elements instead of silently fabricating `.s64` fields. +elements instead of silently fabricating `.i64` fields. Suspected area: - `src/ir/type_bridge.zig`, `resolveTupleLiteralAsType` - The current non-type branch does `std.debug.print(...)` and - `field_ids.append(alloc, .s64)`, which violates the compiler fallback rules. + `field_ids.append(alloc, .i64)`, which violates the compiler fallback rules. - Related callers: `type_bridge.resolveAstType` for `.tuple_literal`, and `Lowering.resolveTypeWithBindings` fallback paths that reach `type_bridge`. Likely fix: -- Replace the `.s64` substitution with a real diagnostic path and an +- Replace the `.i64` substitution with a real diagnostic path and an unmistakable failure result (`.unresolved`, or a nullable/result return that forces callers to handle the failure). - Make the diagnostic user-facing via the lowering diagnostics plumbing, not `std.debug.print`. - Preserve the valid behavior pinned by `examples/0115-types-compound-type-in-expression.sx`, - where `(s32, s32)` in a type-demanding site resolves as a tuple type. + where `(i32, i32)` in a type-demanding site resolves as a tuple type. Verification: - Add a focused diagnostics example in the `11xx` block for - `size_of((s32, 1))` expecting exit 1 and a clear diagnostic. + `size_of((i32, 1))` expecting exit 1 and a clear diagnostic. - Run: ```sh diff --git a/issues/0068-value-const-used-as-type-suppresses-unknown-type.md b/issues/0068-value-const-used-as-type-suppresses-unknown-type.md index 1340c55..990c23f 100644 --- a/issues/0068-value-const-used-as-type-suppresses-unknown-type.md +++ b/issues/0068-value-const-used-as-type-suppresses-unknown-type.md @@ -39,7 +39,7 @@ fabricated empty-struct type. NotAType :: 123; -main :: () -> s32 { +main :: () -> i32 { v: NotAType = ---; print("value = {}\n", v); return 0; diff --git a/issues/0069-forward-identifier-type-alias-falsely-unknown.md b/issues/0069-forward-identifier-type-alias-falsely-unknown.md index 0c4e5ae..7a9374b 100644 --- a/issues/0069-forward-identifier-type-alias-falsely-unknown.md +++ b/issues/0069-forward-identifier-type-alias-falsely-unknown.md @@ -3,7 +3,7 @@ > **RESOLVED.** Root cause: `Lowering.scanDecls`' `.identifier` alias branch only > registered `A :: B` into `ProgramIndex.type_alias_map` when `B` was already > known (in `type_alias_map` or the `TypeTable`). A forward target declared later -> (`MyChain :: MyInt; MyInt :: s32;`) was never present during the single forward +> (`MyChain :: MyInt; MyInt :: i32;`) was never present during the single forward > scan, so the alias name went unregistered and the A2.4 unknown-type pass — which > treats `type_alias_map` keys as declared types — flagged its uses. > Fix: added a fixpoint post-pass `resolveForwardIdentifierAliases` at the end of @@ -20,17 +20,17 @@ though the same alias chain works when ordered after its target. Observed: `MyChain` is diagnosed as an unknown type. -Expected: `MyChain :: MyInt; MyInt :: s32;` should resolve `MyChain` to `s32` +Expected: `MyChain :: MyInt; MyInt :: i32;` should resolve `MyChain` to `i32` when used in a type annotation, matching the existing ordered-chain behavior -(`MyInt :: s32; MyChain :: MyInt;`). +(`MyInt :: i32; MyChain :: MyInt;`). ## Reproduction ```sx MyChain :: MyInt; -MyInt :: s32; +MyInt :: i32; -main :: () -> s32 { +main :: () -> i32 { v: MyChain = 7; return v; } @@ -64,11 +64,11 @@ Context: - This surfaced while re-reviewing `8770145`, the issue-0068 fix. That fix correctly stopped arbitrary value consts (`NotAType :: 123`) from satisfying the unknown-type check. -- Ordered identifier aliases still work: `MyInt :: s32; MyChain :: MyInt;`. +- Ordered identifier aliases still work: `MyInt :: i32; MyChain :: MyInt;`. - `.call` type aliases still work: `Vec3 :: Vec(3, f32);` and `Foo :: Complex(u32);`. - The failing shape is specifically a forward identifier alias: - `MyChain :: MyInt; MyInt :: s32;`. + `MyChain :: MyInt; MyInt :: i32;`. Suspected area: - `src/ir/lower.zig`, `Lowering.scanDecls`, especially the `.identifier` alias diff --git a/issues/0070-forward-alias-global-annotation-before-fixpoint.md b/issues/0070-forward-alias-global-annotation-before-fixpoint.md index f9650cc..ed821e0 100644 --- a/issues/0070-forward-alias-global-annotation-before-fixpoint.md +++ b/issues/0070-forward-alias-global-annotation-before-fixpoint.md @@ -4,7 +4,7 @@ > fixpoint runs at the END of `Lowering.scanDecls`, but the same scan loop > resolved top-level `var_decl` global annotations (and typed module-constant > annotations) via `self.resolveType(ta)` BEFORE that fixpoint ran — so a forward -> alias (`A :: B; B :: s32; g : A = 7;`) was still absent from +> alias (`A :: B; B :: i32; g : A = 7;`) was still absent from > `type_alias_map`, `resolveType` fabricated an empty-struct stub, and the global > got a type mismatching its initializer at LLVM verification (the typed-const > path silently mistyped the constant instead). @@ -30,18 +30,18 @@ LLVM verification failed: Global variable initializer type does not match global ptr @g ``` -Expected: `A :: B; B :: s32; g : A = 7;` should type `g` as `s32` and compile/run +Expected: `A :: B; B :: i32; g : A = 7;` should type `g` as `i32` and compile/run the same way as the ordered alias form. ## Reproduction ```sx A :: B; -B :: s32; +B :: i32; g : A = 7; -main :: () -> s32 { +main :: () -> i32 { return g; } ``` @@ -63,7 +63,7 @@ annotation must resolve before that global's type is registered. Context: - Issue 0069 (`49a383d`) added `Lowering.resolveForwardIdentifierAliases`, a fixpoint post-pass at the end of `scanDecls`, to resolve top-level - identifier-RHS aliases like `A :: B; B :: s32;`. + identifier-RHS aliases like `A :: B; B :: i32;`. - That works for aliases used later in function bodies because the A2.4 unknown-type pass and body lowering run after `scanDecls`. - But top-level `var_decl` annotations are resolved inside the same `scanDecls` @@ -92,9 +92,9 @@ Verification: ```sx A :: B; -B :: s32; +B :: i32; g : A = 7; -main :: () -> s32 { return g; } +main :: () -> i32 { return g; } ``` - Keep `examples/0132-types-forward-type-alias.sx`, diff --git a/issues/0071-global-initializer-module-const-silent-zero.md b/issues/0071-global-initializer-module-const-silent-zero.md index add2e31..89f1fc0 100644 --- a/issues/0071-global-initializer-module-const-silent-zero.md +++ b/issues/0071-global-initializer-module-const-silent-zero.md @@ -35,12 +35,12 @@ supported. #import "modules/std.sx"; A :: B; -B :: s32; +B :: i32; K : A : 42; g : A = K; -main :: () -> s32 { +main :: () -> i32 { print("g={}\n", g); return g; } @@ -82,7 +82,7 @@ Likely fix: the global's declared type. - If some initializer shape cannot be represented as a global constant yet, emit a diagnostic instead of returning `null` / zero-initializing. -- Do not regress issue 0070: `A :: B; B :: s32; g : A = 7;` and +- Do not regress issue 0070: `A :: B; B :: i32; g : A = 7;` and `K : A : 35;` must still resolve through the converged alias map. - Preserve literal, array literal, struct literal, and foreign-global behavior. @@ -92,10 +92,10 @@ Verification: ```sx #import "modules/std.sx"; A :: B; -B :: s32; +B :: i32; K : A : 42; g : A = K; -main :: () -> s32 { print("g={}\n", g); return g; } +main :: () -> i32 { print("g={}\n", g); return g; } ``` - Keep these green: diff --git a/issues/0072-global-field-access-const-initializer-silent-zero.md b/issues/0072-global-field-access-const-initializer-silent-zero.md index 9c2af07..86aaa0d 100644 --- a/issues/0072-global-field-access-const-initializer-silent-zero.md +++ b/issues/0072-global-field-access-const-initializer-silent-zero.md @@ -35,14 +35,14 @@ initializer loudly if field-access global constants are not supported yet. #import "modules/std.sx"; Point :: struct { - x: s32; - y: s32; + x: i32; + y: i32; } K : Point : Point.{ x = 9, y = 4 }; -g : s32 = K.x; +g : i32 = K.x; -main :: () -> s32 { +main :: () -> i32 { print("g={}\n", g); return g; } @@ -68,7 +68,7 @@ Context: (`K : A : 42; g : A = K;`) and diagnoses identifiers that are not usable constants. - A remaining non-identifier expression shape still falls through silently: - `K : Point : Point.{ x = 9, y = 4 }; g : s32 = K.x;` emits a null global + `K : Point : Point.{ x = 9, y = 4 }; g : i32 = K.x;` emits a null global initializer payload and runs as `g=0`. Suspected area: diff --git a/issues/0073-closure-literal-in-defer-segfault.md b/issues/0073-closure-literal-in-defer-segfault.md index 33ee4ee..7e992a7 100644 --- a/issues/0073-closure-literal-in-defer-segfault.md +++ b/issues/0073-closure-literal-in-defer-segfault.md @@ -54,7 +54,7 @@ work :: () { defer { cb := () { return; }; } } -main :: () -> s32 { +main :: () -> i32 { work(); return 0; } diff --git a/issues/0074-ffi-arg-type-void-fallback.md b/issues/0074-ffi-arg-type-void-fallback.md index e10efd9..430ea8a 100644 --- a/issues/0074-ffi-arg-type-void-fallback.md +++ b/issues/0074-ffi-arg-type-void-fallback.md @@ -6,7 +6,7 @@ > `abiCoerceParamType` → `coerceArg` treat as a legitimate (void-typed) foreign > argument, corrupting the call ABI with no diagnostic. Fix: one shared resolver > `LLVMEmitter.argIRTypeOrFail` ([src/ir/emit_llvm.zig]) returns the dedicated -> `.unresolved` sentinel on a failed lookup — never `.void`/`.s64` — so the failure +> `.unresolved` sentinel on a failed lookup — never `.void`/`.i64` — so the failure > cannot masquerade as a real type and trips `toLLVMType`'s existing hard `@panic` > tripwire at the call site. All four sites > ([src/ir/emit_llvm.zig] JNI constructor; [src/backend/llvm/ops.zig] objc_msgSend, diff --git a/issues/0075-reflection-builtin-s64-type-fallback.md b/issues/0075-reflection-builtin-i64-type-fallback.md similarity index 86% rename from issues/0075-reflection-builtin-s64-type-fallback.md rename to issues/0075-reflection-builtin-i64-type-fallback.md index e8d9818..638b104 100644 --- a/issues/0075-reflection-builtin-s64-type-fallback.md +++ b/issues/0075-reflection-builtin-i64-type-fallback.md @@ -1,7 +1,7 @@ > **RESOLVED** (2026-06-03) > **Root cause:** the `type_name` / `type_eq` reflection builtins resolved their -> `Type` arg's IR type with `getRefIRType(...) orelse TypeId.s64`, then gated `== .any` -> — so a failed must-succeed lookup silently became "bare i64" (`.s64 != .any`), +> `Type` arg's IR type with `getRefIRType(...) orelse TypeId.i64`, then gated `== .any` +> — so a failed must-succeed lookup silently became "bare i64" (`.i64 != .any`), > reading the wrong value with no diagnostic. > **Fix:** added the sibling classifier `LLVMEmitter.reflectArgRepr` > (`src/ir/emit_llvm.zig`) which routes the lookup through `argIRTypeOrFail` → @@ -16,18 +16,18 @@ > `.void` (null-ptr / undef-i64). Left in place with an invariant comment. > **Regression test:** `src/ir/emit_llvm.test.zig` — "emit: reflectArgRepr surfaces > .unresolved for an unresolvable reflection arg ref (issue 0075)" (fail-before with -> `orelse .s64` → `.bare`; pass-after → `.unresolved`). +> `orelse .i64` → `.bare`; pass-after → `.unresolved`). -# 0075 — silent `getRefIRType(...) orelse TypeId.s64` fallback in reflection builtins +# 0075 — silent `getRefIRType(...) orelse TypeId.i64` fallback in reflection builtins ## Symptom **One-line:** The `type_name` and `type_eq` reflection builtins resolve their Type -argument's IR type via `getRefIRType(...) orelse TypeId.s64` — the forbidden -silent-type-lookup fallback (`.s64` is the exact issue-0042 sentinel the project +argument's IR type via `getRefIRType(...) orelse TypeId.i64` — the forbidden +silent-type-lookup fallback (`.i64` is the exact issue-0042 sentinel the project rules name) — so a failed must-succeed lookup silently decides "not boxed (`!= .any`)" and mis-handles the value with no diagnostic. -**Observed (primary — must fix):** `self.e.getRefIRType(...) orelse TypeId.s64` at: +**Observed (primary — must fix):** `self.e.getRefIRType(...) orelse TypeId.i64` at: - `src/backend/llvm/ops.zig:1023` (`.type_name` builtin — `arg_ir_ty`, gates the `== .any` boxed-extract vs bare-i64 decision) - `src/backend/llvm/ops.zig:1049` (`.type_eq` builtin — first operand) @@ -35,8 +35,8 @@ and mis-handles the value with no diagnostic. `getRefIRType` (`src/ir/emit_llvm.zig:2229`, `?TypeId`) returns `null` only when a ref is neither a function param nor a block instruction result — a must-not-happen case -for a real builtin argument. On `null` the code defaults to `.s64`, then tests -`arg_ir_ty == .any`; the `.s64` default silently means "treat as a bare TypeId index, +for a real builtin argument. On `null` the code defaults to `.i64`, then tests +`arg_ir_ty == .any`; the `.i64` default silently means "treat as a bare TypeId index, not a boxed `Any`", so a genuinely-boxed arg whose lookup failed would skip the `ExtractValue` and use the wrong value — silent miscompile, no diagnostic. @@ -55,36 +55,36 @@ issue 0074), never a real-type default. stating the invariant. ## Audited — intentional language defaults (NO action; documented so they aren't re-flagged) -- `src/ir/lower.zig:4855` — `int_literal => constInt(lit.value, info.ty orelse .s64)`: - an untyped integer literal defaulting to `s64` is standard language semantics, not a +- `src/ir/lower.zig:4855` — `int_literal => constInt(lit.value, info.ty orelse .i64)`: + an untyped integer literal defaulting to `i64` is standard language semantics, not a lookup failure. - `src/ir/lower.zig:4856` — `float_literal => constFloat(..., info.ty orelse .f64)`: untyped float literal defaults to `f64` — language semantics. -- `src/ir/type_bridge.zig:334` — `.tag_type = tag_type orelse .s64`: documented +- `src/ir/type_bridge.zig:334` — `.tag_type = tag_type orelse .i64`: documented ("enum unions are always tagged (default i64)") — an intentional default tag type, not a swallowed lookup. ## Provenance / scope Pre-existing, NOT introduced by the arch-refactor. Discovered during the **issue-0074 -fix** (the fix worker surfaced the reflection `.s64` fallbacks as a separate pattern +fix** (the fix worker surfaced the reflection `.i64` fallbacks as a separate pattern outside 0074's FFI-arg scope) and confirmed by a manager sweep -(`rg "orelse \.(s64|void|...)" src`). Filed per the IMPASSIBLE RULE (existing +(`rg "orelse \.(i64|void|...)" src`). Filed per the IMPASSIBLE RULE (existing default-returns that swallow a lookup failure → file, don't fix in place). ## Reproduction Latent / static (same nature as 0074): well-formed IR always gives a builtin arg a -resolvable type, so the `.s64` default can't be driven at runtime today — which is why +resolvable type, so the `.i64` default can't be driven at runtime today — which is why it's dangerous (a future IR change would silently miscompile `type_name`/`type_eq`). Exercised by the comptime/reflection examples; the fix must keep the suite at 361/0. ## Investigation prompt (ready to paste into a fresh session) > In `/Users/agra/projects/sx`, the `.type_name` and `.type_eq` reflection builtins in > `src/backend/llvm/ops.zig` (lines 1023, 1049, 1055) resolve a Type argument's IR type -> with the forbidden silent fallback `getRefIRType(...) orelse TypeId.s64`, used to gate +> with the forbidden silent fallback `getRefIRType(...) orelse TypeId.i64`, used to gate > a `== .any` boxed-vs-bare decision. Issue 0074 already added the shared resolver > `LLVMEmitter.argIRTypeOrFail` (`src/ir/emit_llvm.zig`) returning the dedicated > `.unresolved` sentinel on a failed lookup. Route these three sites through that helper -> (or a sibling) so a failed lookup yields `.unresolved` — never `.s64`; then `==.any` +> (or a sibling) so a failed lookup yields `.unresolved` — never `.i64`; then `==.any` > is false for `.unresolved` AND you must make the unresolved case loud (diagnostic via > `self.diagnostics.addFmt(.err, span, ...)` or a hard tripwire), not silently "bare > i64". Also resolve the borderline `lower.zig:2527/2528` `target_type orelse .void` @@ -94,4 +94,4 @@ Exercised by the comptime/reflection examples; the fix must keep the suite at 36 > bash tests/run_examples.sh` stays 361/0; add a `*.test.zig` regression test asserting > the loud `.unresolved` path for a `type_name`/`type_eq` arg with an unresolvable ref > (fail-before/pass-after). Expected new behavior: an unresolved reflection-builtin arg -> type surfaces loudly, never silently defaults to `.s64`. +> type surfaces loudly, never silently defaults to `.i64`. diff --git a/issues/0076-stack-struct-addrof-passed-by-value.md b/issues/0076-stack-struct-addrof-passed-by-value.md index fe2013e..3a02564 100644 --- a/issues/0076-stack-struct-addrof-passed-by-value.md +++ b/issues/0076-stack-struct-addrof-passed-by-value.md @@ -46,9 +46,9 @@ > `Param.name_span`. > > **Regression tests:** -> - `examples/0125-types-type-named-var-rejected.sx` — `:=` form (`s2`) rejected. +> - `examples/0125-types-type-named-var-rejected.sx` — `:=` form (`i2`) rejected. > - `examples/1119-diagnostics-reserved-type-name-as-identifier.sx` — parameter -> (`u8`), typed-local (`s64`, `bool`), and `:=` (`string`) forms rejected. +> (`u8`), typed-local (`i64`, `bool`), and `:=` (`string`) forms rejected. > - `examples/1121-diagnostics-reserved-name-control-flow.sx` — destructure name, > `if` / `while` optional bindings, `for` capture + index names, match-arm > capture. @@ -65,12 +65,12 @@ > streaming with non-reserved names (`hasher`, `ctx`) accumulates correctly via > both `update(@h, …)` and `h.update(…)`. > -> Pre-existing example `examples/0904-...` declared locals `s1`/`s2` (incidental +> Pre-existing example `examples/0904-...` declared locals `i1`/`i2` (incidental > names); renamed to `filled`/`empty`. > > **Coverage extension (issue 0077).** The first landing scoped the binding > check to main-file decls (matching the unknown-type check's trusted-imports -> convention); an imported module could still declare `s2 := …` and hit the +> convention); an imported module could still declare `i2 := …` and hit the > original LLVM verifier abort. The reserved-name binding diagnostic now runs > over EVERY compiled module — imported user modules (descending the > `namespace_decl` an `mod :: #import` wraps) AND the stdlib `library/` — and @@ -81,11 +81,11 @@ ## Symptom (how it first surfaced) -A local variable whose name is lexically a type — e.g. `s2` (the `sN` -arbitrary-width signed-int syntax: `Type.fromName("s2")` → `s(2)`), or `u8`, -`s64`, etc. — is accepted as a variable. Because such a name parses as a +A local variable whose name is lexically a type — e.g. `i2` (the `sN` +arbitrary-width signed-int syntax: `Type.fromName("i2")` → `s(2)`), or `u8`, +`i64`, etc. — is accepted as a variable. Because such a name parses as a `.type_expr` (not `.identifier`), the address-of family of lowering sites -(`@s2`, the autoref `s2.update(...)` receiver, a bare `f(s2)` at a `*T` param, +(`@i2`, the autoref `i2.update(...)` receiver, a bare `f(i2)` at a `*T` param, global function-pointer args) does NOT recognize it as a scoped local and falls through to value lowering — loading the whole aggregate and passing it **by value** to a `ptr` parameter: @@ -104,7 +104,7 @@ any of this — the `.identifier` paths already work correctly. The language is **accepting reserved/builtin type names as identifiers** in the first place. `sN`/`uN` (arbitrary-width ints) and the named builtins -(`bool`, `string`, `void`, `f32`, `f64`, `s8`/`s16`/`s32`/`s64`, +(`bool`, `string`, `void`, `f32`, `f64`, `i8`/`i16`/`i32`/`i64`, `u8`/`u16`/`u32`/`u64`, …) are reserved type names; declaring a variable with such a name is meaningless and produces the mis-lowering above. Patching each address-of site to tolerate the name (the rejected `bareVarName` approach) is @@ -135,14 +135,14 @@ type-shaped name can reach them). ```sx #import "modules/std.sx"; -Sha256 :: struct { h:[8]u64; block:[64]u8; block_len:s64=0; total_len:u64=0; } +Sha256 :: struct { h:[8]u64; block:[64]u8; block_len:i64=0; total_len:u64=0; } init :: () -> Sha256 { s:Sha256=---; s.block_len=0; s.total_len=0; s } update :: (self:*Sha256, data:string) { self.total_len += data.len; } -main :: () -> s32 { s2 := init(); update(@s2, "."); print("total_len={}\n", s2.total_len); return 0; } +main :: () -> i32 { i2 := init(); update(@i2, "."); print("total_len={}\n", i2.total_len); return 0; } ``` `./zig-out/bin/sx run ` today → LLVM verifier abort. -**Expected after fix:** a clean compile-time diagnostic that `s2` is a reserved +**Expected after fix:** a clean compile-time diagnostic that `i2` is a reserved type name and cannot be an identifier (exit non-zero, readable error — NOT an LLVM abort, NOT a silent copy). The same program with a non-reserved name (`hasher := init(); update(@hasher, ".")`) must compile and print `total_len=1`. @@ -150,7 +150,7 @@ LLVM abort, NOT a silent copy). The same program with a non-reserved name ## Verification 1. Pinned diagnostics test(s) asserting the error for representative reserved - names used as identifiers: `s2`, `u8`, `s64`, `bool`, `string` (declaration + names used as identifiers: `i2`, `u8`, `i64`, `bool`, `string` (declaration forms: `:=`, typed local, and a parameter name). Capture the diagnostic text in `expected/`. 2. A positive test: the same `*self` streaming pattern with NON-reserved names @@ -165,6 +165,6 @@ LLVM abort, NOT a silent copy). The same program with a non-reserved name ## Provenance Discovered by the `distribution` flow (P1.2 pure-sx SHA-256), whose minimal repro -happened to name a local `s2`. Real SHA-256 code with names like `hasher`/`ctx` +happened to name a local `i2`. Real SHA-256 code with names like `hasher`/`ctx` is unaffected on the current compiler — so the P1.2 "blocker" was a naming artifact, and this issue is really a missing-diagnostic correctness bug. diff --git a/issues/0077-imported-reserved-type-name-binding.md b/issues/0077-imported-reserved-type-name-binding.md index e5733d7..98b8d53 100644 --- a/issues/0077-imported-reserved-type-name-binding.md +++ b/issues/0077-imported-reserved-type-name-binding.md @@ -4,7 +4,7 @@ > > **Root cause:** the reserved-name binding diagnostic (issue 0076) only ran > over main-file decls (`UnknownTypeChecker.run`'s `main_file` filter). An -> imported module's `s2 := …` was never checked and reached lowering, where the +> imported module's `i2 := …` was never checked and reached lowering, where the > address-of family loaded the whole aggregate and passed it by value to a > `*Box` param — LLVM verifier abort. > @@ -27,7 +27,7 @@ > > **Regression test:** `examples/1120-diagnostics-imported-reserved-type-name.sx` > (+ companion `1120-diagnostics-imported-reserved-type-name/mod.sx`) — an -> imported module declaring `s2 := …` now emits the clean diagnostic at the +> imported module declaring `i2 := …` now emits the clean diagnostic at the > import's declaration site (exit 1), not an LLVM abort. ## Symptom @@ -36,7 +36,7 @@ An imported module can still declare a parameter or `var` binding whose name is reserved/builtin type name. Observed: the imported-module repro below reaches lowering and fails LLVM verification by passing a loaded struct value to a `*Box` parameter. Expected: the same declaration-site diagnostic used for -main-file issue 0076 should reject the imported module's `s2` binding before +main-file issue 0076 should reject the imported module's `i2` binding before lowering. ## Reproduction @@ -49,18 +49,18 @@ Create these two files under the repo root, then run ```sx #import "modules/std.sx"; -Box :: struct { total: s64 = 0; count: s64 = 0; } +Box :: struct { total: i64 = 0; count: i64 = 0; } -update :: (self: *Box, n: s64) { +update :: (self: *Box, n: i64) { self.total += n; self.count += 1; } -run_imported_reserved_name :: () -> s32 { - s2 := Box.{ total = 0, count = 0 }; - update(@s2, 5); - s2.update(7); - print("imported s2 total={} count={}\n", s2.total, s2.count); +run_imported_reserved_name :: () -> i32 { + i2 := Box.{ total = 0, count = 0 }; + update(@i2, 5); + i2.update(7); + print("imported i2 total={} count={}\n", i2.total, i2.count); return 0; } ``` @@ -71,7 +71,7 @@ run_imported_reserved_name :: () -> s32 { #import "modules/std.sx"; mod :: #import ".sx-tmp/issue0077_mod.sx"; -main :: () -> s32 { +main :: () -> i32 { return mod.run_imported_reserved_name(); } ``` @@ -99,5 +99,5 @@ reserved-name bindings in `library/` (for example `u1 := ...` in newly illegal under the corrected rule. Verification: run the two-file repro above and expect a clean diagnostic at the -imported module's `s2 := ...` declaration, not LLVM verification failure. Then +imported module's `i2 := ...` declaration, not LLVM verification failure. Then run `zig build`, `zig build test`, and `bash tests/run_examples.sh`. diff --git a/issues/0079-global-array-element-store-dropped.md b/issues/0079-global-array-element-store-dropped.md index e6d6ee7..261b2d0 100644 --- a/issues/0079-global-array-element-store-dropped.md +++ b/issues/0079-global-array-element-store-dropped.md @@ -46,11 +46,11 @@ global[0] via fn=10 (want 111) ```sx #import "modules/std.sx"; -g : [3]s64 = .[10, 20, 30]; -write_global :: (i: s64, v: s64) { g[i] = v; } +g : [3]i64 = .[10, 20, 30]; +write_global :: (i: i64, v: i64) { g[i] = v; } main :: () { - loc : [3]s64 = .[10, 20, 30]; + loc : [3]i64 = .[10, 20, 30]; loc[1] = 222; print("local[1]={}\n", loc[1]); // 222 (correct) g[1] = 222; diff --git a/issues/0080-global-array-struct-literal-initializer-zero.md b/issues/0080-global-array-struct-literal-initializer-zero.md index e5dddb7..6ed73da 100644 --- a/issues/0080-global-array-struct-literal-initializer-zero.md +++ b/issues/0080-global-array-struct-literal-initializer-zero.md @@ -43,13 +43,13 @@ constant shape is unsupported. #import "modules/std.sx"; Pair :: struct { - a: s64; - b: s64; + a: i64; + b: i64; } pairs : [2]Pair = .[ .{ a = 1, b = 2 }, .{ a = 3, b = 4 } ]; -main :: () -> s32 { +main :: () -> i32 { print("pairs[0]={},{}\n", pairs[0].a, pairs[0].b); print("pairs[1]={},{}\n", pairs[1].a, pairs[1].b); if pairs[0].a == 1 and pairs[0].b == 2 and pairs[1].a == 3 and pairs[1].b == 4 { diff --git a/issues/0081-global-aggregate-null-literal-rejected.md b/issues/0081-global-aggregate-null-literal-rejected.md index 863f9d5..d664293 100644 --- a/issues/0081-global-aggregate-null-literal-rejected.md +++ b/issues/0081-global-aggregate-null-literal-rejected.md @@ -8,7 +8,7 @@ > `constStructLiteral` / `constArrayLiteral` and made the whole aggregate look > non-constant, so `globalInitValue` rejected it with "must be initialized by a > compile-time constant". A `null` is a compile-time constant (the zero -> pointer) and a top-level scalar pointer global (`p : *s64 = null;`) already +> pointer) and a top-level scalar pointer global (`p : *i64 = null;`) already > serialized fine — only the nested-aggregate path was wrong. > **Fix:** add `.null_literal => .null_val` to `constExprValue` so a null leaf > serializes to a constant zero pointer. Made the LLVM constant emitters @@ -39,8 +39,8 @@ as a constant zero pointer the same way a top-level pointer global does. #import "modules/std.sx"; Box :: struct { - p: *s64; - marker: s64; + p: *i64; + marker: i64; } boxes : [2]Box = .[ @@ -48,7 +48,7 @@ boxes : [2]Box = .[ .{ p = null, marker = 22 }, ]; -main :: () -> s32 { +main :: () -> i32 { print("ptrs={} {} markers={} {}\n", boxes[0].p == null, boxes[1].p == null, diff --git a/issues/0082-global-enum-literal-initializer-zeroes.md b/issues/0082-global-enum-literal-initializer-zeroes.md index 4f9893b..cff9294 100644 --- a/issues/0082-global-enum-literal-initializer-zeroes.md +++ b/issues/0082-global-enum-literal-initializer-zeroes.md @@ -48,7 +48,7 @@ Color :: enum u8 { red; green; blue; } chosen : Color = .green; -main :: () -> s32 { +main :: () -> i32 { print("chosen={}\n", chosen); if chosen == .green { print("PASS\n"); diff --git a/issues/0083-named-const-array-dimension-miscompiled.md b/issues/0083-named-const-array-dimension-miscompiled.md index 97ff9ef..e85e6a9 100644 --- a/issues/0083-named-const-array-dimension-miscompiled.md +++ b/issues/0083-named-const-array-dimension-miscompiled.md @@ -15,21 +15,21 @@ > resolution path (direct local decls, struct fields, function params/returns), > but the *stateless* registration-time resolver (`type_bridge`, used for type > aliases `Arr :: [N]T` and inline union/enum field types) still resolved the -> named dim with a silent `else 0` — so `Arr :: [N]s64; a : Arr` and -> `union { a: [N]s64 }` were still miscompiled. Fix: the module-global const +> named dim with a silent `else 0` — so `Arr :: [N]i64; a : Arr` and +> `union { a: [N]i64 }` were still miscompiled. Fix: the module-global const > table (`ProgramIndex.module_const_map`) is now threaded into `type_bridge` > alongside the alias map, so `StatelessInner.resolveArrayLen` resolves a named > module-const dim to the same length everywhere. The remaining unresolvable case > (a computed/comptime dimension on the binding-free path) bails LOUDLY instead of > fabricating a 0 length. Files: `src/ir/type_resolver.zig`, `src/ir/lower.zig`, > `src/ir/type_bridge.zig`. Regression: `examples/0140-types-named-const-array-dim.sx` -> (direct + type-alias + nested `[N][M]T` + union-field dims, s64 / string / +> (direct + type-alias + nested `[N][M]T` + union-field dims, i64 / string / > struct element types). > > **Root-cause close-out (attempt 3).** Attempt 2 threaded the const map into > `type_bridge` but the map wasn't fully populated when an alias resolved its > dimension: type aliases (`Arr :: [N]T`) resolve EAGERLY in scanDecls pass 1, -> while TYPED consts (`N : s64 : 16`) register only in pass 2 and a +> while TYPED consts (`N : i64 : 16`) register only in pass 2 and a > forward-declared untyped const (`Arr :: [N]T; N :: 16`) hadn't registered yet > either — so the stateless resolver saw an empty table, printed a non-fatal > warning, fabricated length 0, and CONTINUED to garbage / a segfault. Three @@ -46,7 +46,7 @@ > `src/ir/program_index.zig`, `src/ir/lower.zig`, `src/ir/type_bridge.zig`, > `src/ir/type_resolver.zig`. Regressions: > `examples/0143-types-typed-const-array-dim.sx` (typed-const dim direct + via -> alias for s64/string/struct, forward-ref alias, nested) and +> alias for i64/string/struct, forward-ref alias, nested) and > `examples/1129-diagnostics-array-dim-not-const.sx` (an unresolvable computed dim > halts with a clean diagnostic + non-zero exit, not a fabricated 0-length array). > @@ -70,7 +70,7 @@ > `src/ir/lower.zig`, `src/ir/type_bridge.zig`. Regression: > `examples/0144-types-const-expr-array-dim.sx` (every expression form, direct vs > alias, scalar / string / struct element types); `1129` re-pointed at a genuinely -> non-const dimension (`[get()]s64`, a runtime call) so it still proves the +> non-const dimension (`[get()]i64`, a runtime call) so it still proves the > stateless clean-halt. > > **Unified comptime-int evaluator (attempt 5).** Attempts 1–4 fixed the array @@ -106,7 +106,7 @@ > > **Value-param type functions + oversized guard (attempt 6).** Two remaining > siblings in the comptime-int path. (1) A type-RETURNING function with a value -> param used as a TYPE annotation (`b : Make(N, s64)` where `Make :: ($K: u32, +> param used as a TYPE annotation (`b : Make(N, i64)` where `Make :: ($K: u32, > $T: Type) -> Type { return [K]T; }`) was rejected "unknown type 'N'" because > the unknown-type checker walked the value-param position as a type name, AND the > parameterized-type-annotation path never routed to `instantiateTypeFunction` @@ -116,8 +116,8 @@ > binder's value/type classification); `resolveParameterizedWithBindings` routes > a type-returning-function name to `instantiateTypeFunction`; and that binder > resolves a general return-type expression (`return [K]T`) with bindings active. -> `Make(N, s64)`, `Make(M + 1, s64)`, and `Make(3, s64)` now resolve to one -> `[3]s64`. (2) Oversized dim/lane folds (`[5_000_000_000]`) panicked the +> `Make(N, i64)`, `Make(M + 1, i64)`, and `Make(3, i64)` now resolve to one +> `[3]i64`. (2) Oversized dim/lane folds (`[5_000_000_000]`) panicked the > compiler — fixed under issue 0087 via the shared range-checked > `program_index.foldDimU32` gate. Files: `src/ir/semantic_diagnostics.zig`, > `src/ir/lower.zig`, `src/ir/program_index.zig`, `src/ir/type_bridge.zig`. @@ -125,10 +125,10 @@ > > **Diagnostic-accuracy parity (attempt 7).** The fold + layout were correct, but > the two paths still DIVERGED on the error MESSAGE for an oversized dim. The -> direct form (`a : [5_000_000_000]s64`) reported the accurate "array dimension +> direct form (`a : [5_000_000_000]i64`) reported the accurate "array dimension > 5000000000 does not fit in u32" (from the stateful `resolveArrayLen`, which > branches on `foldDimU32`'s `.too_large` / `.below_min` / `.not_const` variants), -> but the type-ALIAS form (`Big :: [5_000_000_000]s64`) reported a FALSE "an array +> but the type-ALIAS form (`Big :: [5_000_000_000]i64`) reported a FALSE "an array > dimension is not a compile-time integer constant" — because the stateless > `resolveArrayLen` collapsed every non-`.ok` `DimU32` to `null`, so the > alias-registration site had only one generic message to emit. Fix: a single @@ -147,7 +147,7 @@ > **Integral-float counts + value-param range gate (attempt 8, Agra ruling).** > Two finishing items on the shared count path. (1) An *integral* compile-time > FLOAT used as a count (array dim, Vector lane, value-param, `inline for` bound) -> was wrongly rejected — `N : f64 : 4.0`, `N :: 4.0`, and `[4.0]s64` all said +> was wrongly rejected — `N : f64 : 4.0`, `N :: 4.0`, and `[4.0]i64` all said > "must be a compile-time integer constant". The shared evaluator now folds an > integral float to its integer at the single leaf > (`program_index.floatToIntExact`, used by both the `.float_literal` arm of @@ -175,7 +175,7 @@ > `Box(5_000_000_000)` with `$K: Count` compiled and bound a truncated value. The > gate (`Lowering.resolveValueParamArg`, shared by BOTH binders — struct + > type-fn) now resolves the constraint to its underlying builtin -> (`canonicalIntConstraintName`: `Count` → u32, `Small` → s8) before +> (`canonicalIntConstraintName`: `Count` → u32, `Small` → i8) before > range-checking, so an aliased integer constraint behaves exactly like the > builtin it names. (2) A named const with an EXPRESSION RHS (`M :: 2; N :: M + 1`) > did not fold as a count — `program_index.moduleConstInt` read only a LITERAL RHS @@ -192,14 +192,14 @@ > `src/ir/lower.zig`. Regressions: `examples/0146-types-comptime-count-matrix.sx` > (the full positive matrix — every consumer × representative leaf form), > `examples/1135-diagnostics-value-param-alias-constraint-overflow.sx` (aliased -> u32 + s8 overflow), `examples/1136-diagnostics-array-dim-nonconst-direct-no-crash.sx` +> u32 + i8 overflow), `examples/1136-diagnostics-array-dim-nonconst-direct-no-crash.sx` > (direct non-const dim halts cleanly, no fabrication / panic); the cascade > cleanup also tightened `examples/1502`/`1503` to one diagnostic each. > > **Final convergence — type-fn binder parity (attempt 10).** One last cell of > the count surface still diverged from the struct binder. A FAILED value-param > bind on a type-RETURNING FUNCTION (`MakeC :: ($K: Count, $T: Type) -> Type -> { return [K]T; }`; `a : MakeC(5_000_000_000, s64)`) emitted its correct range +> { return [K]T; }`; `a : MakeC(5_000_000_000, i64)`) emitted its correct range > diagnostic, but `instantiateTypeFunction` then returned `null`, so > `resolveParameterizedWithBindings` fell through to the empty-struct *placeholder* > named `MakeC`. The binding `a` got that placeholder type, so a downstream @@ -216,7 +216,7 @@ ## Symptom A fixed array whose dimension is a module-global integer constant (`N :: 16; a : [N]T`) miscompiles element access: reads/writes compute a wrong address. -With `s64` elements `a[0]` returns GARBAGE (silent); with slice/pointer element +With `i64` elements `a[0]` returns GARBAGE (silent); with slice/pointer element types (`[N]string`) it Bus-errors. The identical program with a LITERAL dimension (`a : [16]T`) is correct. Silent-miscompile class (cf. 0079–0082). @@ -224,7 +224,7 @@ types (`[N]string`) it Bus-errors. The identical program with a LITERAL dimensio ```sx #import "modules/std.sx"; N :: 16; -main :: () { a : [N]s64 = ---; a[0] = 7; print("a0={}\n", a[0]); } +main :: () { a : [N]i64 = ---; a[0] = 7; print("a0={}\n", a[0]); } ``` `./zig-out/bin/sx run` prints `a0=8472789232` (garbage); want `a0=7`. Replacing `[N]` with `[16]` prints `7`. diff --git a/issues/0084-slice-literal-direct-call-arg-miscompiled.md b/issues/0084-slice-literal-direct-call-arg-miscompiled.md index 0a6ec71..f4ff34b 100644 --- a/issues/0084-slice-literal-direct-call-arg-miscompiled.md +++ b/issues/0084-slice-literal-direct-call-arg-miscompiled.md @@ -6,13 +6,13 @@ > path (`coerceCallArgs` → `coerceToType` → `CoercionResolver.classify`) had no > array→slice arm, so `classify([N]T, []T)` returned `.none` and the raw array > value was passed where a slice was expected — the callee read its {ptr,len} -> header off the wrong bytes (returned 0 / garbage, segfaulted for `[]s64`). Fix: +> header off the wrong bytes (returned 0 / garbage, segfaulted for `[]i64`). Fix: > `classify` now returns a new `.array_to_slice` plan for `[N]T → []T` (same > element type), and `coerceToType` emits the existing `array_to_slice` op, which > materializes the array into addressable storage and builds the slice header — > identical to the local-bound path. Files: `src/ir/conversions.zig`, > `src/ir/lower.zig`. Regression: `examples/0141-types-slice-literal-direct-call-arg.sx` -> (string + numeric `[]s64`, direct vs local-bound). +> (string + numeric `[]i64`, direct vs local-bound). ## Symptom A `.[...]` array/slice literal passed DIRECTLY as a call argument yields a slice @@ -23,7 +23,7 @@ passing the local is correct. ## Reproduction ```sx #import "modules/std.sx"; -show :: (xs: []string) -> s64 { n:=0; i:=0; while i i64 { n:=0; i:=0; while i literal coercion the var-decl / call-arg paths already run. The coercion > recurses with the nesting, so `[][]T` and deeper materialize at every level. > Files: `src/ir/lower.zig` (`lowerArrayLiteral`). Regression: -> `examples/0142-types-nested-slice-literal-elements.sx` (`[][]s64` + `[][]string`, +> `examples/0142-types-nested-slice-literal-elements.sx` (`[][]i64` + `[][]string`, > local-bound AND direct-call-argument forms). ## Symptom Nested array/slice literals such as `.[.[1, 2], .[3, 4]]` miscompile when the -expected element type is a slice (`[][]s64`). Observed: both the local-bound and +expected element type is a slice (`[][]i64`). Observed: both the local-bound and direct-call forms segfault while indexing the inner slice. Expected: both forms materialize each inner `[N]T` literal as a `[]T` slice and print the same value. @@ -25,12 +25,12 @@ materialize each inner `[N]T` literal as a `[]T` slice and print the same value. ```sx #import "modules/std.sx"; -sum_nested :: (xss: [][]s64) -> s64 { +sum_nested :: (xss: [][]i64) -> i64 { return xss[0][1] + xss[1][0]; } main :: () { - local : [][]s64 = .[.[1, 2], .[3, 4]]; + local : [][]i64 = .[.[1, 2], .[3, 4]]; print("local={}\n", sum_nested(local)); print("direct={}\n", sum_nested(.[.[1, 2], .[3, 4]])); } diff --git a/issues/0087-oversized-comptime-int-dimension-panics.md b/issues/0087-oversized-comptime-int-dimension-panics.md index 52f1505..ebffedc 100644 --- a/issues/0087-oversized-comptime-int-dimension-panics.md +++ b/issues/0087-oversized-comptime-int-dimension-panics.md @@ -35,7 +35,7 @@ not fit in u32" / "Vector lane count must fit in u32", and no compiler panic. #import "modules/std.sx"; main :: () { - a : [5000000000]s64 = ---; + a : [5000000000]i64 = ---; print("{}\n", a.len); } ``` diff --git a/issues/0088-typed-module-const-annotation-mismatch.md b/issues/0088-typed-module-const-annotation-mismatch.md index 1cd2d12..0f23a06 100644 --- a/issues/0088-typed-module-const-annotation-mismatch.md +++ b/issues/0088-typed-module-const-annotation-mismatch.md @@ -1,7 +1,7 @@ > **RESOLVED (F0.7)** — A typed module-level constant whose initializer does not > match its annotation is now rejected at the declaration with a clear > `type mismatch` diagnostic, killing both symptoms (the `print(N)` segfault and -> the `[N]s64` → 4 fold). +> the `[N]i64` → 4 fold). > > **Root cause.** `registerTypedModuleConst` (`src/ir/lower.zig`) stored the > annotation type on the const but never checked the initializer literal against @@ -9,7 +9,7 @@ > `emitModuleConst` then stamped the `int_literal` with the `string` type (a > bogus pointer → segfault at the use site), and `program_index.moduleConstInt` > folded the const into an integer COUNT by inspecting the `int_literal` node -> alone, ignoring `ModuleConstInfo.ty` (so `[N]s64` folded to 4). +> alone, ignoring `ModuleConstInfo.ty` (so `[N]i64` folded to 4). > > Both LITERAL initializers (`N : string : 4`) and const-EXPRESSION initializers > (`M :: 2; N : string : M + 2`, `V : string : -M`) are rejected — the validation @@ -17,18 +17,18 @@ > > **Mixed-numeric escape closed at the type-system root (attempt 3).** The > type-based validation reuses `inferExprType`, which inferred a non-comparison -> binary op from its LHS alone — so `BAD : s64 : M + 0.5` (s64 + f64) inferred -> `s64` and was accepted+truncated, while `0.5 + M` inferred `f64` and was +> binary op from its LHS alone — so `BAD : i64 : M + 0.5` (i64 + f64) inferred +> `i64` and was accepted+truncated, while `0.5 + M` inferred `f64` and was > rejected: operand-order-dependent. The fix is in the binary-op arm of > `ExprTyper.inferType` (`src/ir/expr_typer.zig`): arithmetic / bitwise / shift > ops now infer the PROMOTED result of `(lhs, rhs)` via `Lowering.arithResultType` > — the same int×float → float rule `lowerBinaryOp` already applied for the > value (extracted from its inline block into a shared helper, so the two can't > diverge). `M + 0.5` now infers `f64` in either operand order, so the typed-const -> validation rejects it against an `s64` annotation with no special-casing in the +> validation rejects it against an `i64` annotation with no special-casing in the > validation logic itself. This was a pre-existing inference bug broader than > typed consts (it also mis-formatted `print("{}", M + 0.5)` as a truncated int); -> the typed-LOCAL `y : s64 = 1.5` → 1 narrowing is a SEPARATE assignment-coercion +> the typed-LOCAL `y : i64 = 1.5` → 1 narrowing is a SEPARATE assignment-coercion > bug tracked as issue 0095. > > **Fix per file.** @@ -56,13 +56,13 @@ > > **Regression tests.** > - `examples/1143-diagnostics-typed-module-const-mismatch.sx` — negative: eight -> mismatch shapes — four literal (`int→string`, `string→s64`, `bool→s64`, -> `float→s64`), two const-expression (`M + 2 → string`, `-M → string`), and two -> mixed-numeric (`s64 : M + 0.5` and `s64 : 0.5 + M`, rejected in BOTH operand +> mismatch shapes — four literal (`int→string`, `string→i64`, `bool→i64`, +> `float→i64`), two const-expression (`M + 2 → string`, `-M → string`), and two +> mixed-numeric (`i64 : M + 0.5` and `i64 : 0.5 + M`, rejected in BOTH operand > orders) — each emit a `type mismatch` diagnostic, exit 1. > - `examples/0162-types-typed-module-const-roundtrip.sx` — positive: valid typed -> consts (`s64` as count + printed, `f32` from int, `f32` float, `string`, -> `*void` null, const-expression `s64 : M + 2` used as a count + printed, +> consts (`i64` as count + printed, `f32` from int, `f32` float, `string`, +> `*void` null, const-expression `i64 : M + 2` used as a count + printed, > `f32 : M + 2`, plus mixed-numeric `f64 : M + 0.5` and `f64 : 0.5 + M` folding > to 2.5 in both orders) compile, fold, and print correctly. > - `examples/0163-types-mixed-numeric-promotion.sx` — positive: pins the @@ -105,7 +105,7 @@ Related count-surface manifestation: N : string : 4; main :: () { - a : [N]s64 = ---; + a : [N]i64 = ---; print("{}\n", a.len); } ``` diff --git a/issues/0089-backtick-raw-identifier.md b/issues/0089-backtick-raw-identifier.md index bb7d1a0..494af6c 100644 --- a/issues/0089-backtick-raw-identifier.md +++ b/issues/0089-backtick-raw-identifier.md @@ -7,7 +7,7 @@ > never the reserved keyword/type." The backtick is never part of the name's text. > > 1. **Backtick raw identifier.** The lexer recognises a leading backtick -> (`` `s2 ``) and emits an `.identifier` token whose span excludes the backtick, +> (`` `i2 ``) and emits an `.identifier` token whose span excludes the backtick, > carrying a `Token.is_raw` flag ([src/lexer.zig], [src/token.zig]). The flag > threads through `ast.Identifier`, `ast.TypeExpr`, and EVERY binding / capture / > declaration node ([src/ast.zig]): `VarDecl` / `ConstDecl` / `Param` / `FnDecl` @@ -19,19 +19,19 @@ > `NamespaceDecl` / `ImportDecl` / `CImportDecl` / `LibraryDecl`. > > - **Value position.** The parser skips `Type.fromName` for a raw identifier -> in expression position ([src/parser.zig] `parsePrimary`), so `` `s2 `` is a +> in expression position ([src/parser.zig] `parsePrimary`), so `` `i2 `` is a > value identifier; a later bare reference resolves to the binding. > - **Type position.** `parseTypeExpr` sets the raw flag on the type ATOM and > lets it flow through the SAME continuations as a bare name (attempt 5), so a -> raw reference parameterizes a reserved-spelled template (`` `s2(s64) ``) and +> raw reference parameterizes a reserved-spelled template (`` `i2(i64) ``) and > composes under the pointer / optional / slice wrappers; `ParameterizedTypeExpr` > carries `is_raw` and `resolveParameterizedWithBindings` skips the `Vector` > intrinsic when raw. Resolution skips the builtin classifier > (`TypeResolver.resolveNamed`'s `skip_builtin`, threaded from `te.is_raw` in > [src/ir/lower.zig] and [src/ir/type_bridge.zig]) and looks up a -> `` `s2 ``-declared type (struct / enum / union / alias), else a NORMAL -> "unknown type 's2'" error (`UnknownTypeChecker.reportIfUnknownType` skips the -> builtin-name exemption when raw). A bare `s2` in type position is still the +> `` `i2 ``-declared type (struct / enum / union / alias), else a NORMAL +> "unknown type 'i2'" error (`UnknownTypeChecker.reportIfUnknownType` skips the +> builtin-name exemption when raw). A bare `i2` in type position is still the > builtin int. The SECOND (editor/LSP) classifier in [src/sema.zig] > (`Type.fromTypeExpr` / `resolveTypeNode` / `resolveTypeNameStr`) honors > `is_raw` too, so a backtick reserved-name annotation resolves to the user type @@ -40,9 +40,9 @@ > `PointerTypeInfo` / `OptionalTypeInfo` / `SliceTypeInfo` / `ManyPointerTypeInfo` > / `ArrayTypeInfo` each store a REQUIRED `is_raw` ([src/types.zig], no default, > so a future construction site cannot drop it) that every `resolveTypeNameStr` -> call passes as its `skip_builtin` — so `` *`s2 ``, `` ?`s2 ``, `` [N]`s2 ``, -> `` []`s2 ``, `` [*]`s2 `` field-access / unwrap / index / deref in the editor -> index all reach the user type instead of reclassifying the inner `s2` to the +> call passes as its `skip_builtin` — so `` *`i2 ``, `` ?`i2 ``, `` [N]`i2 ``, +> `` []`i2 ``, `` [*]`i2 `` field-access / unwrap / index / deref in the editor +> index all reach the user type instead of reclassifying the inner `i2` to the > builtin (the divergence the DIRECT-only attempt left for compound forms). > - **Declaration position.** A bare reserved-name declaration of EVERY kind > still errors (issue 0076 preserved); the backtick form is exempt. The check @@ -54,7 +54,7 @@ > symmetry is enforced structurally for the bug-prone node: `ConstDecl`'s > `name_span` + `is_raw` carry NO default (attempt 5), so the compiler rejects > any construction site — including the two struct-body const forms (untyped -> `` `s2 :: 5 `` and typed `` `s2 : T : v ``) that previously dropped both — +> `` `i2 :: 5 `` and typed `` `i2 : T : v ``) that previously dropped both — > that omits them. `FnDecl` is built at every parser site through `parseFnDecl`, > whose `name_is_raw` is a REQUIRED parameter (the equivalent guarantee); the > type decls likewise route through parse-functions taking `name_is_raw`. @@ -66,31 +66,31 @@ > / `union_decl` / `enum_decl` / `protocol_decl` arms > ([src/ir/semantic_diagnostics.zig]) check only the *type* name (and method > *params*), not field / tag / variant / method-signature names. The backtick -> is optional there (`obj.s2` and `` obj.`s2 `` resolve to the same member). +> is optional there (`obj.i2` and `` obj.`i2 `` resolve to the same member). > This bare member-name exemption covers only the **identifier-classified** -> reserved spellings — `s1`..`s64`, `u1`..`u64`, `bool`, `string`, `void`, +> reserved spellings — `i1`..`i64`, `u1`..`u64`, `bool`, `string`, `void`, > `usize`, `isize`, `Any` — which all lex as ordinary identifiers. The two > **keyword-classified** spellings, `f32` and `f64`, are lexer keywords > ([src/token.zig]), and a member-name slot requires an identifier token > ([src/parser.zig]); a bare `f32` / `f64` is therefore rejected at parse > (`expected field name in struct`) even in a member position, and still needs -> the backtick there too — `` struct { `f32: s64; } `` / `` union { `f64: … } `` -> / `` protocol { `f32 :: () -> s64; } `` work as field / tag / method names. +> the backtick there too — `` struct { `f32: i64; } `` / `` union { `f64: … } `` +> / `` protocol { `f32 :: () -> i64; } `` work as field / tag / method names. > The exemption stops at member *definitions*: an `impl` method is a real > function reached through the `impl_block` → `fn_decl` arm, so a -> reserved-spelled impl method needs the backtick (`` `s2 :: (self) ``), no +> reserved-spelled impl method needs the backtick (`` `i2 :: (self) ``), no > more exempt than a free function (cf. `examples/1122`). Pinned by > `examples/0158-types-reserved-name-member-exempt.sx`. > 2. **`#import c` foreign-name exemption.** `c_import.zig` synthesizes foreign > `#foreign` decls with `Param.is_raw = true` (and the synthesized `FnDecl` > `is_raw = true`), so generated C names that collide with reserved type names -> (`s1`, `s2`) import unedited and a reserved-name foreign fn is bare-callable. +> (`i1`, `i2`) import unedited and a reserved-name foreign fn is bare-callable. > > **Bare-callable foreign / backtick fn.** `lowerCall` rewrites a `.type_expr` > callee to an identifier when a function **of RAW provenance** of that name is in > scope ([src/ir/lower.zig]) — scoped to the callee `FnDecl`'s `is_raw` flag, so it > only ever fires for a backtick / `#import c` foreign fn (the decl check guarantees -> no bare reserved-name fn exists). `s2(4)` resolves to the function (`TypeName(val)` +> no bare reserved-name fn exists). `i2(4)` resolves to the function (`TypeName(val)` > is not a cast). > > **Regression tests.** `examples/0151-types-backtick-raw-identifier.sx` (every @@ -98,7 +98,7 @@ > control-flow / capture form), `examples/0153-types-backtick-const-fn-decl.sx` > (backtick `::` const + fn decl, bare + backtick call), > `examples/0154-types-backtick-raw-type-reference.sx` (raw in TYPE position — -> struct / enum / union / alias decl + reference; bare `s2` still the int), +> struct / enum / union / alias decl + reference; bare `i2` still the int), > `examples/0155-types-backtick-typed-const-union-tag.sx` (typed const + union tag), > `examples/0156-types-backtick-struct-const.sx` (struct-body const, untyped + typed), > `examples/0157-types-backtick-parameterized-raw-type.sx` (raw parameterized type + @@ -117,8 +117,8 @@ > caret on the name). Backtick lexer + `resolveNamed(skip_builtin)` unit tests in > `src/lexer.zig` / `src/ir/type_resolver.test.zig`; the editor/LSP raw-type > resolution (the second classifier) is pinned in `src/sema.test.zig` — the direct -> case plus raw provenance through every compound shape (`` *`s2 `` field access, -> `` ?`s2 `` unwrap, `` [N]`s2 `` index, parameterized `` `s2(s64) ``), each with a +> case plus raw provenance through every compound shape (`` *`i2 `` field access, +> `` ?`i2 `` unwrap, `` [N]`i2 `` index, parameterized `` `i2(i64) ``), each with a > bare-spelling control that stays the builtin (fail-before verified). > > The original report is preserved below. @@ -129,12 +129,12 @@ Importing non-sx source whose names collide with sx reserved type names is rejected. `library/modules/stb_truetype.sx` is a `#import c { ... }` block over a -vendored C header (`vendors/stb_truetype/stb_truetype.h`); C identifiers `s1`, -`s2` (which collide with sx's signed-int type keywords `s1`..`sN`) produce: +vendored C header (`vendors/stb_truetype/stb_truetype.h`); C identifiers `i1`, +`i2` (which collide with sx's signed-int type keywords `i1`..`sN`) produce: ``` -error: 's1' is a reserved type name and cannot be used as an identifier -error: 's2' is a reserved type name and cannot be used as an identifier +error: 'i1' is a reserved type name and cannot be used as an identifier +error: 'i2' is a reserved type name and cannot be used as an identifier ``` The user cannot hand-edit these — they are generated from the vendored C header. @@ -143,13 +143,13 @@ identifier even when it wants to. ## Root cause -The parser classifies any reserved-type-name spelling (`s2`, `u8`, `f64`, …) as a +The parser classifies any reserved-type-name spelling (`i2`, `u8`, `f64`, …) as a `.type_expr` via `name_class.Type.fromName`, never as an `.identifier`. The F0.1 / issue-0076 fix added `UnknownTypeChecker.checkBindingName` (`src/ir/semantic_diagnostics.zig`) to reject a value binding / param spelled as a reserved type name (the `.type_expr`-vs-`.identifier` mismatch otherwise breaks address-of / autoref lowering). F0.1 deliberately extended this check to imported -declarations — which is what now fires on the C-imported `s1`/`s2`. +declarations — which is what now fires on the C-imported `i1`/`i2`. ## Desired behaviour (Agra ruling) @@ -164,12 +164,12 @@ mechanisms: reserved-name rule: ```sx - `s2 := 2.5; // OK — identifier "s2", distinct from the s2 signed-int type - s2 := 2.5; // ERROR — bare s2 is still the reserved type name + `i2 := 2.5; // OK — identifier "i2", distinct from the i2 signed-int type + i2 := 2.5; // ERROR — bare i2 is still the reserved type name ``` Prefix form (single leading backtick on the identifier). The raw identifier's - TEXT is `s2` (the backtick is not part of the name). A bare `s2` used as a TYPE + TEXT is `i2` (the backtick is not part of the name). A bare `i2` used as a TYPE remains the signed-int type. ## Reproduction @@ -179,10 +179,10 @@ sx-side (minimal): ```sx #import "modules/std.sx"; main :: () { - `s2 := 2.5; // must compile: identifier s2 = 2.5 - print("{}\n", `s2); // 2.5 + `i2 := 2.5; // must compile: identifier i2 = 2.5 + print("{}\n", `i2); // 2.5 } ``` -Import-side: a `#import c` block over a header declaring `int s1, s2;` (or +Import-side: a `#import c` block over a header declaring `int i1, i2;` (or `stb_truetype.sx`) must NOT emit the reserved-type-name error. diff --git a/issues/0090-int-formatter-extremes.md b/issues/0090-int-formatter-extremes.md index 66b58a3..78f787d 100644 --- a/issues/0090-int-formatter-extremes.md +++ b/issues/0090-int-formatter-extremes.md @@ -1,21 +1,21 @@ # 0090 — integer formatter can't render i64::MIN or unsigned all-ones > STATUS: RESOLVED (F0.8). Both extremes now render correctly: -> `s64.min` → `-9223372036854775808`, `u64.max` → `18446744073709551615`. +> `i64.min` → `-9223372036854775808`, `u64.max` → `18446744073709551615`. > > **Root cause.** > - Symptom 1 (i64::MIN): `std.int_to_string` computed the magnitude as -> `0 - n`, which overflows for `s64::MIN` (its magnitude is -> unrepresentable as a positive s64) — the value stayed negative, the +> `0 - n`, which overflows for `i64::MIN` (its magnitude is +> unrepresentable as a positive i64) — the value stayed negative, the > `while v > 0` loop ran zero times, and only the `-` was emitted. > - Symptom 2 (unsigned all-ones): `any_to_string`'s `case int:` arm -> formatted every integer as s64 (`int_to_string(xx val)`); there was no -> way to tell a `u64` from an `s64`, so an all-ones u64 printed as `-1`. +> formatted every integer as i64 (`int_to_string(xx val)`); there was no +> way to tell a `u64` from an `i64`, so an all-ones u64 printed as `-1`. > > **Fix per file.** > - `library/modules/std.sx` — `int_to_string` now extracts digits straight > from `n` (taking `|n % 10|` per digit, `n` truncates toward zero) so it -> never negates `s64::MIN`. Added `uint_to_string` (unsigned decimal via +> never negates `i64::MIN`. Added `uint_to_string` (unsigned decimal via > long-division-by-10 over four 16-bit limbs) and `decompose_u16x4` (the > shared 16-bit-limb split, now reused by `int_to_hex_string` too). > `any_to_string`'s `case int:` routes through the new @@ -35,7 +35,7 @@ > table built from `isUnsignedInt`; runtime arm GEPs in at the TypeId. > > **Regression test.** `examples/0046-basic-int-formatter-extremes.sx` -> pins both extremes plus a width spread (s8/s16/s32 + u8/u16/u32/u64, +> pins both extremes plus a width spread (i8/i16/i32 + u8/u16/u32/u64, > mins/maxes, 0, ordinary values). Unit tests: `isUnsignedInt` in > `src/ir/types.test.zig`. > @@ -67,13 +67,13 @@ > accepts an `Any` argument (the formatter passes `val: Any`), but the dynamic > `type_name` / `type_is_unsigned` path still read the Any's payload as a > TypeId index unconditionally — correct only when the Any holds a *Type -> value*. For an Any holding a *value* (`av : Any = 6`, runtime tag `s64`, +> value*. For an Any holding a *value* (`av : Any = 6`, runtime tag `i64`, > payload `6`) it reported `types[6]` (`u8`): `type_name(av)` → `"u8"`, > `type_is_unsigned(av)` → `true`. Per Agra's ruling ("Any is a type AND a > value, so it's expected to work"), both builtins now branch on the Any's > runtime tag: tag `== .any` → the box is a Type value, use the payload as the > TypeId; otherwise the tag IS the held value's type. So `type_name(av)` → -> `"s64"`, `type_is_unsigned(av)` → `false`, while `type_name(type_of(x))` +> `"i64"`, `type_is_unsigned(av)` → `false`, while `type_name(type_of(x))` > still names the held type. The formatter is unchanged (it already passed > `type_of(val)`, a proper Type value). > - `src/ir/interp.zig` — shared `Value.reflectTypeId` (the tag-branching @@ -93,7 +93,7 @@ ## Symptom -`print("{}", x)` mis-renders the integer extremes the s64-based formatter can't +`print("{}", x)` mis-renders the integer extremes the i64-based formatter can't represent: - `i64::MIN` (`-9223372036854775808`) prints a bare `-` (the minus sign with NO digits). @@ -115,8 +115,8 @@ root reason. ## Root cause (suspected) -The integer-to-string path is `s64`-based (`std.int_to_string` / the `{}` formatter -takes `s64`): it negates the value to print the sign, but `-i64::MIN` overflows, and +The integer-to-string path is `i64`-based (`std.int_to_string` / the `{}` formatter +takes `i64`): it negates the value to print the sign, but `-i64::MIN` overflows, and it has no unsigned-aware path so an all-ones u64 is read as `-1`. Needs a width/ signedness-aware integer formatter (format by the value's actual integer TYPE: unsigned types print the unsigned decimal; signed `MIN` is handled without negating). diff --git a/issues/0092-raw-reserved-value-numeric-limit-shadow.md b/issues/0092-raw-reserved-value-numeric-limit-shadow.md index 0c1520d..fe4b552 100644 --- a/issues/0092-raw-reserved-value-numeric-limit-shadow.md +++ b/issues/0092-raw-reserved-value-numeric-limit-shadow.md @@ -17,13 +17,13 @@ > guard so inferred types match lowering (avoids the issue-0083 two-resolver > desync). > -> Bare `f64.epsilon` / `s32.max` (no shadowing binding) still fold — the parser +> Bare `f64.epsilon` / `i32.max` (no shadowing binding) still fold — the parser > classifies a bare builtin name as a `.type_expr` (parser.zig:2743), so the > bare receiver is never value-shadowed even in a scope where `` `f64 `` is > bound. Float-only-on-int and non-numeric-receiver errors are unchanged. > > Regression: `examples/0161-types-numeric-limit-value-shadow.sx` (raw -> `` `f64 ``/`` `s32 ``/`` `u8 `` value reads coexisting with bare folds) + +> `` `f64 ``/`` `i32 ``/`` `u8 `` value reads coexisting with bare folds) + > unit test in `src/ir/expr_typer.test.zig`. NL.1 (`examples/0148`) / NL.2 > (`examples/0159`, `examples/0160`) unregressed. @@ -33,7 +33,7 @@ Field access on a raw reserved-spelled value binding is interpreted as a builtin type numeric-limit access instead of an ordinary value field access. Observed: -the repro prints `0.000000 2147483647` (`f64.epsilon` / `s32.max`). Expected: +the repro prints `0.000000 2147483647` (`f64.epsilon` / `i32.max`). Expected: it prints `12 78` from the `Box` fields. ## Reproduction @@ -41,12 +41,12 @@ it prints `12 78` from the `Box` fields. ```sx #import "modules/std.sx"; -Box :: struct { epsilon: s64; max: s64; } +Box :: struct { epsilon: i64; max: i64; } -main :: () -> s32 { +main :: () -> i32 { `f64 := Box.{ epsilon = 12, max = 34 }; - `s32 := Box.{ epsilon = 56, max = 78 }; - print("{} {}\n", `f64.epsilon, `s32.max); + `i32 := Box.{ epsilon = 56, max = 78 }; + print("{} {}\n", `f64.epsilon, `i32.max); return 0; } ``` @@ -68,7 +68,7 @@ intercept for actual type receivers (`.type_expr`, and bare reserved integer names with no value binding). If raw provenance is available in the AST, using it to disambiguate is also acceptable, but the observable rule must be that `` `f64.epsilon `` reads the value field when `` `f64 `` is a value binding, -while bare `f64.epsilon` / `s32.max` still fold as numeric limits. +while bare `f64.epsilon` / `i32.max` still fold as numeric limits. Verification: pin a regression test from the repro above. It should print `12 78`. Also verify the existing numeric-limit examples still pass: diff --git a/issues/0093-global-raw-value-numeric-limit-shadow.md b/issues/0093-global-raw-value-numeric-limit-shadow.md index cc412d0..9c6da17 100644 --- a/issues/0093-global-raw-value-numeric-limit-shadow.md +++ b/issues/0093-global-raw-value-numeric-limit-shadow.md @@ -21,14 +21,14 @@ > - `src/ir/expr_typer.zig` — numeric-limit inference arm: the `shadowed` > check now calls the same helper. > -> A bare `f64.epsilon` / `s32.max` (a `.type_expr` receiver, never an +> A bare `f64.epsilon` / `i32.max` (a `.type_expr` receiver, never an > `.identifier`) still folds, even when a global or module-const raw value of > the same spelling exists — the bare receiver is never value-shadowed. > Float-only-on-int and non-numeric-receiver errors are unchanged. > > Regression: `examples/0161-types-numeric-limit-value-shadow.sx` now exercises -> all three binding kinds — a GLOBAL `` `f32 ``, a MODULE-CONST `` `s16 ``, and -> LOCAL `` `f64 ``/`` `s32 ``/`` `u8 `` — each reading its field while the bare +> all three binding kinds — a GLOBAL `` `f32 ``, a MODULE-CONST `` `i16 ``, and +> LOCAL `` `f64 ``/`` `i32 ``/`` `u8 `` — each reading its field while the bare > spelling still folds. Unit test `src/ir/expr_typer.test.zig` pins the global > + module-const sources. NL.1 (`examples/0148`) / NL.2 (`examples/0159`, > `examples/0160`) unregressed. @@ -40,20 +40,20 @@ Field access on a **global** raw reserved-spelled value binding is interpreted as a builtin type numeric-limit access instead of an ordinary value field access. Observed: the repro prints `0.000000 2147483647` (`f64.epsilon` / -`s32.max`). Expected: it prints `12 78` from the `Box` fields. +`i32.max`). Expected: it prints `12 78` from the `Box` fields. ## Reproduction ```sx #import "modules/std.sx"; -Box :: struct { epsilon: s64; max: s64; } +Box :: struct { epsilon: i64; max: i64; } `f64 := Box.{ epsilon = 12, max = 34 }; -`s32 := Box.{ epsilon = 56, max = 78 }; +`i32 := Box.{ epsilon = 56, max = 78 }; -main :: () -> s32 { - print("{} {}\n", `f64.epsilon, `s32.max); +main :: () -> i32 { + print("{} {}\n", `f64.epsilon, `i32.max); return 0; } ``` @@ -66,7 +66,7 @@ at `Lowering.lowerNumericLimit` and the new issue-0092 guard around `Scope.lookup`. That guard returns `null` for a shadowing local, but global raw bindings are registered in `ProgramIndex.global_names` (and module constants in `ProgramIndex.module_const_map`), not in `Scope`, so an `.identifier` receiver -whose text is `f64` / `s32` still folds to a numeric limit before ordinary +whose text is `f64` / `i32` still folds to a numeric limit before ordinary global field lowering can read the value. Mirror the same rule in `src/ir/expr_typer.zig` so inferred types match lowering. @@ -74,7 +74,7 @@ Likely fix: for `.identifier` numeric-limit receivers, prefer any in-scope value binding source over the builtin-type fold: lexical `Scope.lookup`, global values (`program_index.global_names`), and module value constants where applicable. Keep `.type_expr` receivers folding as type receivers, so bare `f64.epsilon` and -`s32.max` still fold even when a raw global value of the same spelling exists. +`i32.max` still fold even when a raw global value of the same spelling exists. Verification: pin the repro above as a regression. It should print `12 78`. Also verify the existing numeric-limit examples still pass: diff --git a/issues/0094-missing-struct-field-assignment-unresolved-panic.md b/issues/0094-missing-struct-field-assignment-unresolved-panic.md index 6049c49..ecebb8e 100644 --- a/issues/0094-missing-struct-field-assignment-unresolved-panic.md +++ b/issues/0094-missing-struct-field-assignment-unresolved-panic.md @@ -7,15 +7,15 @@ > so a pointer-to-`.unresolved` reached LLVM emission and tripped the > `src/backend/llvm/types.zig` tripwire. The nested lvalue-pointer path > (`Lowering.lowerExprAsPtr`'s `.field_access` fallback) had the sibling defect: -> on a miss it returned `structGepTyped(obj_ptr, 0, .s64, obj_ty)` — a silent -> field-0/`.s64` default. +> on a miss it returned `structGepTyped(obj_ptr, 0, .i64, obj_ty)` — a silent +> field-0/`.i64` default. > > **Fix (`src/ir/lower.zig`):** all three lvalue field-store sites — single > assignment, address-of, and multi-target assignment — route field resolution > through one shared helper, `fieldLvaluePtr(obj_ptr, obj_ty, field)`, which > resolves struct fields, union/tagged-union direct fields, promoted > anonymous-struct union members, tuple elements, and vector lanes (reusing -> `vectorLaneIndex`), and returns `null` (no field 0 / `.unresolved` /`.s64` +> `vectorLaneIndex`), and returns `null` (no field 0 / `.unresolved` /`.i64` > default) when nothing matches. Each caller emits the read path's > field-not-found diagnostic (`emitFieldError`) on a `null` result: > 1. `lowerAssignment` `.field_access` target — delegates to `fieldLvaluePtr`; @@ -23,7 +23,7 @@ > deleted (issue-0083 two-resolver divergence removed). > 2. `lowerExprAsPtr` `.field_access` — delegates to `fieldLvaluePtr`, so the > address-of path resolves promoted union members (`@v.x`) — not only direct -> union fields — and a genuine miss errors. The `.s64` sentinel is gone. +> union fields — and a genuine miss errors. The `.i64` sentinel is gone. > 3. `lowerMultiAssign` `.field_access` target — replaced its struct-only loop > (which defaulted `field_idx 0` / `field_ty .unresolved` on a miss, silently > storing into field 0 — `p.q, y = 2, 3` printed `x=2 y=3`) with the shared @@ -65,7 +65,7 @@ Expected: a normal compile error like `field 'q' not found on type 'Point'`, mat ## Reproduction ```sx -Point :: struct { x: s64; } +Point :: struct { x: i64; } main :: () { p := Point.{ x = 1 }; @@ -81,6 +81,6 @@ panic: unresolved type reached LLVM emission — a type resolution failure was n ## Investigation prompt Fix issue 0094 in the sx compiler: assigning to a missing struct field (`p.q = 2`) panics with `.unresolved` reaching LLVM emission instead of emitting a field-not-found diagnostic. -Suspected area: `src/ir/lower.zig`, especially `Lowering.lowerAssignment`'s `.field_access` target path around the struct-field lookup (`field_ty` starts as `.unresolved`, no matched field diagnoses, then `ptrTo(field_ty)` is stored) and the related `Lowering.lowerExprAsPtr` field-access fallback that returns `structGepTyped(obj_ptr, 0, .s64, obj_ty)` on lookup failure. The fix should make failed lvalue field lookup loud, reusing `emitFieldError(obj_ty, field, span)` or equivalent, and should not use `.s64`, `.void`, or any real type as a sentinel. +Suspected area: `src/ir/lower.zig`, especially `Lowering.lowerAssignment`'s `.field_access` target path around the struct-field lookup (`field_ty` starts as `.unresolved`, no matched field diagnoses, then `ptrTo(field_ty)` is stored) and the related `Lowering.lowerExprAsPtr` field-access fallback that returns `structGepTyped(obj_ptr, 0, .i64, obj_ty)` on lookup failure. The fix should make failed lvalue field lookup loud, reusing `emitFieldError(obj_ty, field, span)` or equivalent, and should not use `.i64`, `.void`, or any real type as a sentinel. Verification: run the repro and expect exit 1 with a source diagnostic `field 'q' not found on type 'Point'`; no LLVM panic. Then run `zig build`, `zig build test`, and `bash tests/run_examples.sh`. diff --git a/issues/0095-typed-local-float-int-narrowing.md b/issues/0095-typed-local-float-int-narrowing.md index 0e820e3..0068092 100644 --- a/issues/0095-typed-local-float-int-narrowing.md +++ b/issues/0095-typed-local-float-int-narrowing.md @@ -26,7 +26,7 @@ > > **Completion (F0.11 attempt 2)** — the direct-`const_float` coerce arm only > caught a float LITERAL; a non-integral const-folded float EXPRESSION -> (`local/field/param : s64 = M + 0.5`) still truncated silently. Closed by: +> (`local/field/param : i64 = M + 0.5`) still truncated silently. Closed by: > - New `program_index.evalConstFloatExpr` — the f64 counterpart to > `evalConstIntExpr`, delegating every integer subtree back to it (no parallel > integer logic), adding only the float literal / negate / `+ - * /` arms. @@ -44,7 +44,7 @@ > > **Completion (F0.11 attempt 3)** — attempt 2 resolved INT-const-expr leaves > (`M + 0.5`, `M :: 2`), but a non-integral result via a FLOAT-const leaf -> (`F : f64 : 2.5; y : s64 = F + 0.25` = 2.75) still truncated silently: +> (`F : f64 : 2.5; y : i64 = F + 0.25` = 2.75) still truncated silently: > `evalConstFloatExpr` delegated only integer leaves to `evalConstIntExpr` and had > no float-const leaf arm. Closed by completing the evaluator: > - `program_index.moduleConstFloat` — the f64 twin of `moduleConstInt` (same @@ -60,11 +60,11 @@ > `floatToIntExact` (the SAME facility `foldComptimeFloatInit` uses) instead of > the int-only `evalComptimeInt`, which folded leaf-by-leaf in `i64` and so > rejected an integral SUM built from a non-integral float leaf -> (`K : s64 : F + 1.5` = 4.0). Integral float-const-leaf consts now FOLD; +> (`K : i64 : F + 1.5` = 4.0). Integral float-const-leaf consts now FOLD; > non-integral ones still error with the unified wording. > - Out of scope (consistent with the int evaluator): a LOCAL `::` const leaf is > resolved as a scope ref, not through the const tables, so neither -> `evalConstIntExpr` nor `evalConstFloatExpr` folds it — a local `M : s64 : 2` +> `evalConstIntExpr` nor `evalConstFloatExpr` folds it — a local `M : i64 : 2` > in `M + 0.5` and a local `F : f64 : 2.5` in `F + 0.25` both still truncate > identically. Float now matches int exactly at that boundary. > @@ -73,7 +73,7 @@ > DIMENSION / count path still diverged: it folded a DIRECT integral float literal > (`[4.0]`, `[N]` with `N : f64 : 4.0`) yet rejected an INTEGRAL expression built > from a non-integral float-const leaf (`[F + 1.5]` = 4.0, or `[K]` with -> `K : s64 : F + 1.5`) as "must be a compile-time integer constant" — because the +> `K : i64 : F + 1.5`) as "must be a compile-time integer constant" — because the > dim fold used the int-only `evalConstIntExpr`, never the float-aware path. Closed > by routing the count fold through the SAME facility the other four sites use: > - New `program_index.foldCountI64` — the single int-or-integral-float count fold: @@ -87,8 +87,8 @@ > integer constant" — the cast-escape advice the binding sites give does not apply > in a dimension position, so the dim wording omits it. `reportDimError`, the > Vector-lane resolver, and the top-level array-alias diagnostic all handle the -> new variant, so the DIRECT (`a : [F + 0.25]s64`) and type-ALIAS -> (`Arr :: [F + 0.25]s64`) forms emit the identical message. +> new variant, so the DIRECT (`a : [F + 0.25]i64`) and type-ALIAS +> (`Arr :: [F + 0.25]i64`) forms emit the identical message. > - `type_bridge.StatelessInner.lookupFloatName` (routed through `moduleConstFloat`) > is the float twin of its `lookupDimName`, so the registration-time alias path > folds a float-const-leaf dimension to the SAME count as the stateful direct @@ -99,7 +99,7 @@ > literal / int-const-expr / float-const-leaf forms, but `evalConstFloatExpr` still > LAGGED `evalConstIntExpr`: the int evaluator resolves a numeric-limit field-access > leaf (`f64.true_min`, `f64.max`) via `type_resolver.integerLimitFor`, but the -> float evaluator had no parallel arm, so `y : s64 = f64.true_min + 0.5` (= 0.5) +> float evaluator had no parallel arm, so `y : i64 = f64.true_min + 0.5` (= 0.5) > truncated silently to 0 (the direct `f64.true_min` already errored via the IR-level > `constFloatInfo` path, but the *expression* form escaped). Closed by bringing the > two evaluators to PARITY: @@ -109,7 +109,7 @@ > `integerLimitFor` arm. Integer limits / `.len` are still resolved by the > int delegation, so only the float-limit case lands here. > - The audit also surfaced a missing `%` arm: the int evaluator folds `.mod` but -> the float one did not, so `y : s64 = 5.5 % 2.0` (= 1.5) truncated silently to 1. +> the float one did not, so `y : i64 = 5.5 % 2.0` (= 1.5) truncated silently to 1. > `evalConstFloatExpr` now handles `.mod` via `@rem` (matching `evalConstIntExpr` > and codegen's `frem`; `6.0 % 4.0` folds to 2 via the int delegation, `5.5 % 2.0` > = 1.5 is rejected). The two evaluators are now at full leaf/operator parity, so @@ -127,9 +127,9 @@ > `examples/0162-types-typed-module-const-roundtrip.sx`, and the aligned const > diagnostic in `examples/1143-diagnostics-typed-module-const-mismatch.sx` > (G / BAD / BAD2 stay errors with the new wording). The array-dimension site is -> pinned in the same two examples: 0168 adds `[F + 1.5]s64`, `[KF]s64` -> (`KF : s64 : F + 1.5`), and a type-alias `ArrFE :: [F + 1.5]s64` all folding to -> len 4; 1146 adds `[F + 0.25]s64` erroring; `examples/1132` now expects the +> pinned in the same two examples: 0168 adds `[F + 1.5]i64`, `[KF]i64` +> (`KF : i64 : F + 1.5`), and a type-alias `ArrFE :: [F + 1.5]i64` all folding to +> len 4; 1146 adds `[F + 0.25]i64` erroring; `examples/1132` now expects the > precise non-integral-float dim wording. Unit: > `program_index.test.zig` "evalConstFloatExpr folds comptime float expressions" > (covers the float-const leaf: `F` → 2.5, `F + 0.25` → 2.75, `F + 1.5` → 4.0; @@ -138,7 +138,7 @@ > → 1.5 / `% 0.0` → null) and "foldCountI64 / foldDimU32 fold an integral float > count, reject a non-integral one" (the count fold + the `non_integral_float` / > `below_min` distinction). Attempt 5 also extends 0168 (positive: `f64.max - -> f64.max` → 0, `6.0 % 4.0` → 2, integer-limit `s8.max`/`[u8.max]` unregressed, +> f64.max` → 0, `6.0 % 4.0` → 2, integer-limit `i8.max`/`[u8.max]` unregressed, > `xx` escapes for both new forms) and 1146 (negative: `f64.true_min + 0.5` and > `5.5 % 2.0` error at a binding site). > @@ -174,7 +174,7 @@ > `evalConstFloatExpr` / `evalConstIntExpr` did NOT — so once the read flowed into > an integer binding, the float folder returned the BUILTIN `f64.epsilon` > (2.22e-16) and the rule wrongly errored ("narrow non-integral float -> '0.0000…0002220446049250313'"), and the integer folder turned `` `s8.max `` as an +> '0.0000…0002220446049250313'"), and the integer folder turned `` `i8.max `` as an > array dimension into the builtin `127` (a fabricated 127-element array) instead > of an ordinary runtime field read. Closed at the single root: both evaluators' > field-access arms now mirror `isFloatValuedExpr`'s `is_raw` guard — a raw @@ -182,11 +182,11 @@ > falls through to the ordinary runtime field read. A raw value-shadow is a > mutable-local field (a subsequent `` `f64.epsilon = 4.0 `` is observable), so it > is genuinely runtime and must not be const-folded: it now behaves EXACTLY like a -> plainly-named field read — `` `f64.epsilon `` narrowing into `s64` truncates to +> plainly-named field read — `` `f64.epsilon `` narrowing into `i64` truncates to > its field value (`11.5` → `11`, identical to `b.epsilon`, NOT a non-integral -> error on the builtin limit), and `` `s8.max `` as an array dimension is rejected +> error on the builtin limit), and `` `i8.max `` as an array dimension is rejected > as a non-constant count (identical to `b.max`). The bare builtin path is -> unchanged (`f64.epsilon`, `s8.max`, `[u8.max]` still fold). Regression: +> unchanged (`f64.epsilon`, `i8.max`, `[u8.max]` still fold). Regression: > `examples/0169-types-value-shadow-field-narrowing.sx` (positive — raw float-field > read narrows/truncates, mutation proves runtime, bare limit still folds), > `examples/1148-diagnostics-value-shadow-field-dim-not-const.sx` (negative — raw @@ -198,18 +198,18 @@ A typed LOCAL (and likely typed param/field) silently truncates a floating-point initializer to an integer annotation instead of rejecting or requiring an explicit cast. Observed: -- `y : s64 = 1.5;` → y == 1 (float literal truncated, no diagnostic) -- `y : s64 = 2 + 0.5;` → y == 2 (float-valued expr truncated, no diagnostic) +- `y : i64 = 1.5;` → y == 1 (float literal truncated, no diagnostic) +- `y : i64 = 2 + 0.5;` → y == 2 (float-valued expr truncated, no diagnostic) Expected: a type-mismatch / narrowing diagnostic (consistent with typed MODULE CONSTS, -which after F0.7 reject `N : s64 : 1.5` and `N : s64 : M + 0.5`). Today consts are strict +which after F0.7 reject `N : i64 : 1.5` and `N : i64 : M + 0.5`). Today consts are strict but locals are lenient — an inconsistency. ## Reproduction ```sx #import "modules/std.sx"; main :: () { - y : s64 = 1.5; + y : i64 = 1.5; print("{}\n", y); // prints 1 } ``` @@ -221,7 +221,7 @@ registerTypedModuleConst + typedConstInitFits/constExprInitFits). Make typed-loc assignment-coercion consistent: either reject a non-integral float→int initializer with a diagnostic (matching the const path) or require an explicit `xx`/cast. Suspected area: the assignment / typed-binding coercion path (coerceToType ladder, specs.md §"coercion") in -src/ir/lower.zig. Verify `y : s64 = 1.5` errors (or requires a cast); confirm integral-float +src/ir/lower.zig. Verify `y : i64 = 1.5` errors (or requires a cast); confirm integral-float folding rules (specs.md: `4.0`→4 ok, `4.5` rejected) stay consistent. Then gate. ## Disposition diff --git a/issues/0097-enum-value-failable-error-slot-corruption.md b/issues/0097-enum-value-failable-error-slot-corruption.md index a9cabcc..e59cdb6 100644 --- a/issues/0097-enum-value-failable-error-slot-corruption.md +++ b/issues/0097-enum-value-failable-error-slot-corruption.md @@ -18,7 +18,7 @@ value resolves against `failableSuccessType(ret_ty)` (the value type / value-tup literal gets its real ordinal and the success-return path appends the `0` error slot; an **explicit full failable tuple** literal (`return (v..., e)`, arity == full-tuple field count) keeps the full-tuple target so its trailing error element resolves against the error set and is -forwarded as-is. The s32 case was already correct because integer literals don't resolve variants +forwarded as-is. The i32 case was already correct because integer literals don't resolve variants against `target_type`. Two follow-up defects from the first cut of this fix were corrected (attempt-2 review): @@ -50,7 +50,7 @@ Below preserved as a record of the original problem. A value-failable function `-> (EnumType, !ErrSet)` writes a **garbage nonzero tag into the error slot on the SUCCESS path**. Per specs.md the error channel must be `0` on success ("0 in the -error slot means no error"). Every **runtime read** of the slot on success (`cast(s64) err`, bare +error slot means no error"). Every **runtime read** of the slot on success (`cast(i64) err`, bare `if err`, `err == error.X`, and therefore `error_tag_name(err)`) reports a false error. Only the path-sensitive compile-time proof `if !err` reads correctly (it is tied to the SSA value, not a runtime load of the slot), which is why it masks the bug. @@ -71,12 +71,12 @@ pick :: (s: string) -> (Color, !E) { raise error.Nope; } -main :: () -> s32 { +main :: () -> i32 { c, e := pick("red"); // SUCCESS -> error slot MUST be 0 - print("error e (int) = {}\n", cast(s64) e); // EXPECT 0 ; BUG prints 1 + print("error e (int) = {}\n", cast(i64) e); // EXPECT 0 ; BUG prints 1 if e { print("bare-if e: ERROR (WRONG)\n"); } else { print("bare-if e: ok\n"); } if e == error.Nope { print("e == Nope (WRONG)\n"); } else { print("e != Nope (ok)\n"); } - if !e { print("guard !e: value c (int) = {}\n", cast(s64) c); } // c = 0 = .red (CORRECT) + if !e { print("guard !e: value c (int) = {}\n", cast(i64) c); } // c = 0 = .red (CORRECT) return 0; } ``` @@ -96,14 +96,14 @@ e != Nope (ok) guard !e: value c (int) = 0 ``` -## Contrast — the IDENTICAL shape with an s32 value is CORRECT +## Contrast — the IDENTICAL shape with an i32 value is CORRECT ```sx -pick :: (n: s32) -> (s32, !E) { if n > 0 { return n; } raise error.Nope; } +pick :: (n: i32) -> (i32, !E) { if n > 0 { return n; } raise error.Nope; } // v, e := pick(5); → error slot = 0 (correct); bare-if e: ok ``` The split is **enum-value-specific** because only an enum literal (`return .variant`) resolves its -tag against `target_type`. An integer literal does not, so the s32 path never got mis-stamped with +tag against `target_type`. An integer literal does not, so the i32 path never got mis-stamped with the failable-tuple type and never took the false forwarding branch. ## Root cause (confirmed at ground truth) @@ -115,6 +115,6 @@ failable tuple). The LLVM IR on the success path was: ret { i64, i32 } { i64 0, i32 undef } ; error slot UNDEF, not 0 (.blue gave i64 0 too — value lost) ``` -vs. the s32 case which already produced `ret { i32, i32 } { i32 7, i32 0 }`. After narrowing the +vs. the i32 case which already produced `ret { i32, i32 } { i32 7, i32 0 }`. After narrowing the return target to the value type, the enum success path produces `ret { i64, i32 } zeroinitializer` (value 0 = `.red`, error slot 0), and `.blue` correctly carries ordinal 2. diff --git a/issues/0100-cross-module-same-name-fn-lowering-collision.md b/issues/0100-cross-module-same-name-fn-lowering-collision.md index 9dfc1fd..0b36c7e 100644 --- a/issues/0100-cross-module-same-name-fn-lowering-collision.md +++ b/issues/0100-cross-module-same-name-fn-lowering-collision.md @@ -50,7 +50,7 @@ from **its own module's flat import** was rejected: ``` m :: #import "m.sx"; // m.sx: `#import "helper.sx"; foo :: () { helper() }` -main :: () -> s32 { print("{}\n", m.foo()); 0 } // → 'helper' is not visible +main :: () -> i32 { print("{}\n", m.foo()); 0 } // → 'helper' is not visible ``` **Fix** (`src/ir/program_index.zig`, `src/ir/lower.zig`): @@ -81,8 +81,8 @@ lowering and the caller's own trailing statements / `return` were treated as dead-after-terminator: ``` -m :: #import "m.sx"; // m.sx: `#import "helper.sx"; foo :: () -> s64 { if true { return helper(); } return 0; }` -main :: () -> s32 { +m :: #import "m.sx"; // m.sx: `#import "helper.sx"; foo :: () -> i64 { if true { return helper(); } return 0; }` +main :: () -> i32 { x := m.foo(); print("after\n"); // dropped return 0; // → error: body produces no value @@ -132,7 +132,7 @@ exits 0 after. 0719 and 0720 stay green. cli :: #import "modules/std/cli.sx"; json :: #import "modules/std/json.sx"; -main :: () -> s32 { +main :: () -> i32 { gpa := GPA.init(); arena := Arena.init(xx gpa, 8192); defer arena.deinit(); diff --git a/issues/0101-postfix-bang-field-miscompile.md b/issues/0101-postfix-bang-field-miscompile.md index ce6cb61..c65a5d2 100644 --- a/issues/0101-postfix-bang-field-miscompile.md +++ b/issues/0101-postfix-bang-field-miscompile.md @@ -10,7 +10,7 @@ bug: `opt!.method()` failed to resolve the method at all (`error: unresolved ```sx #import "modules/std.sx"; -S :: struct { id: string; n: s64; } +S :: struct { id: string; n: i64; } mk :: () -> ?S { return S.{ id = "hello", n = 42 }; } main :: () { print("chained: {}\n", mk()!.id); // observed: garbage (e.g. 8362783136) @@ -28,8 +28,8 @@ typed Ref into a slot and `v.field` reads it back. But the *chained* form never materializes a slot: `lowerFieldAccess` re-derives the receiver type via `inferExprType(fa.object)` (= `inferExprType(mk()!)`), got `.unresolved`, and the struct-field lookup on `.unresolved` failed — `mk()!.id` was typed -`.unresolved`/`s64` and its value emitted as `undef` (the print monomorphized -`pack_s64` with `i64 undef`, surfacing as a stale stack address). The method +`.unresolved`/`i64` and its value emitted as `undef` (the print monomorphized +`pack_i64` with `i64 undef`, surfacing as a stale stack address). The method chain failed for the same reason: receiver typing returned `.unresolved`, so method resolution found nothing. @@ -56,9 +56,9 @@ One arm fixes all of them. ```sx #import "modules/std.sx"; -Inner :: struct { tag: string; k: s64; } +Inner :: struct { tag: string; k: i64; } S :: struct { - id: string; n: s64; inner: Inner; + id: string; n: i64; inner: Inner; greet :: (self: *S) -> string { return self.id; } } mk :: () -> ?S { return S.{ id = "hello", n = 42, inner = Inner.{ tag = "deep", k = 7 } }; } diff --git a/issues/0106-namespaced-import-bare-visibility-over-permissive.md b/issues/0106-namespaced-import-bare-visibility-over-permissive.md index 2f7f24a..9d24caa 100644 --- a/issues/0106-namespaced-import-bare-visibility-over-permissive.md +++ b/issues/0106-namespaced-import-bare-visibility-over-permissive.md @@ -78,13 +78,13 @@ byte-identical requirement cannot hold until this bug is fixed. ```sx // m.sx -secret :: () -> s64 { 7 } +secret :: () -> i64 { 7 } ``` ```sx // main.sx m :: #import "m.sx"; -main :: () -> s32 { +main :: () -> i32 { x := secret(); // bare; `secret` is only namespaced-imported as `m.secret` 0 } @@ -103,7 +103,7 @@ main :: () -> s32 { ```sx // main.sx std :: #import "modules/std.sx"; -main :: () -> s32 { +main :: () -> i32 { std.print("hello\n"); // legit qualified call 0 } diff --git a/issues/0108-defer-skipped-on-break-continue.md b/issues/0108-defer-skipped-on-break-continue.md index c1ff684..068a322 100644 --- a/issues/0108-defer-skipped-on-break-continue.md +++ b/issues/0108-defer-skipped-on-break-continue.md @@ -40,7 +40,7 @@ all share `lowerBreak`/`lowerContinue`. ```sx #import "modules/std.sx"; -main :: () -> s32 { +main :: () -> i32 { for 0..3: (i) { defer print("cleanup {}\n", i); if i == 1 { break; } diff --git a/issues/0109-loop-body-alloca-stack-growth.md b/issues/0109-loop-body-alloca-stack-growth.md index 98e4059..5f55476 100644 --- a/issues/0109-loop-body-alloca-stack-growth.md +++ b/issues/0109-loop-body-alloca-stack-growth.md @@ -34,7 +34,7 @@ iterations; stack usage is static per frame regardless of trip count. This hits three shapes, all confirmed: -1. user locals declared in a loop body (`buf : [128]s64 = ---;`), +1. user locals declared in a loop body (`buf : [128]i64 = ---;`), 2. nested loops (inner `for`'s `idx_slot` alloca sits in the outer body), 3. compiler temporaries spilled in the body (e.g. `index_get`'s `ig.tmp` — see issue 0110 for the for-over-array case specifically). @@ -46,10 +46,10 @@ Repro A — body local (`issues/0109-loop-body-alloca-stack-growth.sx`): ```sx #import "modules/std.sx"; -main :: () -> s32 { +main :: () -> i32 { sum := 0; for 0..1000000: (i) { - buf : [128]s64 = ---; + buf : [128]i64 = ---; buf[0] = i; sum += buf[0]; } @@ -68,7 +68,7 @@ Repro B — pure nested loops, zero user locals: ```sx #import "modules/std.sx"; -main :: () -> s32 { +main :: () -> i32 { n := 0; for 0..3000000: (i) { for 0..1: (j) { n += 1; } diff --git a/issues/0110-for-array-by-value-full-array-spill.md b/issues/0110-for-array-by-value-full-array-spill.md index c1c36bf..f1991c9 100644 --- a/issues/0110-for-array-by-value-full-array-spill.md +++ b/issues/0110-for-array-by-value-full-array-spill.md @@ -3,7 +3,7 @@ **Root cause:** `lowerFor`'s by-value element fetch emitted `index_get` on the array *value*; the emitter realizes that as spill-whole-array-to-temp + GEP one element, per iteration — O(N²) bytes copied (and pre-0109, per-iteration stack -growth that segfaulted a `[4096]s64` loop). +growth that segfaulted a `[4096]i64` loop). **Fix:** in `src/ir/lower/control_flow.zig` `lowerFor`, when the iterable is an array with addressable storage (`getExprAlloca` hit, and the iterable was not @@ -25,8 +25,8 @@ mutation leaves the array untouched). lowers the element fetch as `index_get` on the array *value*, which the LLVM emitter realizes as: load the whole array as an SSA value, spill it to a fresh `ig.tmp` alloca, GEP one element. Per iteration. Observed: a `for` over -a `[4096]s64` array segfaults (4096 iterations × 32KB spill = ~134MB of stack -— see issue 0109 for why body allocas never unwind); a `[256]s64` version +a `[4096]i64` array segfaults (4096 iterations × 32KB spill = ~134MB of stack +— see issue 0109 for why body allocas never unwind); a `[256]i64` version completes but copies 256 × 2KB = 512KB to read 2KB of data. Expected: O(1) stack, O(N) total work — GEP into the array's existing storage and load the single element. @@ -42,8 +42,8 @@ copying. By-value should reuse the same base and just add a load. ```sx #import "modules/std.sx"; -main :: () -> s32 { - arr : [4096]s64 = ---; +main :: () -> i32 { + arr : [4096]i64 = ---; i := 0; while i < 4096 { arr[i] = i; i += 1; } sum := 0; diff --git a/issues/0111-int-literal-local-adopts-fn-return-type.md b/issues/0111-int-literal-local-adopts-fn-return-type.md index 9cfe990..b067bfb 100644 --- a/issues/0111-int-literal-local-adopts-fn-return-type.md +++ b/issues/0111-int-literal-local-adopts-fn-return-type.md @@ -3,19 +3,19 @@ **Root cause:** `lowerFunctionBodyInto` sets `self.target_type = ret_ty` for the whole body (for the implicit trailing return), the `.int_literal` arm adopts any integer `target_type`, and the unannotated paths of `lowerVarDecl` / `lowerDestructureDecl` -lowered their initializer without clearing it — so `x := 0` in a `-> s32`/`-> s8` -function was typed s32/s8 and `big := 3000000000` silently wrapped. +lowered their initializer without clearing it — so `x := 0` in a `-> i32`/`-> i8` +function was typed i32/i8 and `big := 3000000000` silently wrapped. **Fix:** both decl paths now save/clear/restore `target_type` around the initializer `lowerExpr` (`src/ir/lower/stmt.zig`); a declaration without annotation provides no -target, so literals take their spec defaults (s64/f64). Trailing-expression and +target, so literals take their spec defaults (i64/f64). Trailing-expression and `return` coercion to the return type are untouched. -**Regression test:** `examples/0173-types-int-literal-default-s64.sx` (f.x/g.x/main.x, -destructured a/b all print `s64`; `big` prints `3000000000`). +**Regression test:** `examples/0173-types-int-literal-default-i64.sx` (f.x/g.x/main.x, +destructured a/b all print `i64`; `big` prints `3000000000`). **Note (not fixed here):** the `.int_literal` arm still wraps a literal that does not -fit an explicitly-annotated integer target (`x : s8 = 300`) with no diagnostic — +fit an explicitly-annotated integer target (`x : i8 = 300`) with no diagnostic — filed separately as issue 0112. --- @@ -24,42 +24,42 @@ filed separately as issue 0112. **Symptom.** A local declared `x := ` (no annotation) inside a function whose return type is an integer type T gets typed as **T**, not the -spec'd default. `f :: () -> s32 { x := 0; ... }` gives `x: s32`; -`g :: () -> s8 { x := 0; ... }` gives `x: s8`. Expected (specs.md §"Integer -literals default to `s64`", lines 240 / 1428): `s64` in all of these — the +spec'd default. `f :: () -> i32 { x := 0; ... }` gives `x: i32`; +`g :: () -> i8 { x := 0; ... }` gives `x: i8`. Expected (specs.md §"Integer +literals default to `i64`", lines 240 / 1428): `i64` in all of these — the declaration has no target type. Inside a `-> void` function the same decl -correctly infers `s64`. +correctly infers `i64`. Consequences are silent and severe: - All arithmetic through such locals wraps at the narrowed width: - `x := 0; x += 3000000000;` inside `main :: () -> s32` prints `-1294967296`. + `x := 0; x += 3000000000;` inside `main :: () -> i32` prints `-1294967296`. - A large literal initializer truncates with **no diagnostic**: - `big := 3000000000;` inside a `-> s32` fn binds `big` to s32 = `-1294967296`. -- Blast radius: every `main :: () -> s32 { ... }` in the corpus types every - unannotated int-literal local as s32 — long-running counters/accumulators + `big := 3000000000;` inside a `-> i32` fn binds `big` to i32 = `-1294967296`. +- Blast radius: every `main :: () -> i32 { ... }` in the corpus types every + unannotated int-literal local as i32 — long-running counters/accumulators in such functions are one overflow away from wrong results. Discovered because issue 0109's verification loop (`sum` over 1M iterations in a - `-> s32` main) printed the 32-bit-wrapped sum after the segfault was fixed. + `-> i32` main) printed the 32-bit-wrapped sum after the segfault was fixed. ## Reproduction ```sx #import "modules/std.sx"; -f :: () -> s32 { +f :: () -> i32 { x := 0; print("f.x: {}\n", type_name(type_of(x))); 0 } -g :: () -> s8 { +g :: () -> i8 { x := 0; print("g.x: {}\n", type_name(type_of(x))); 0 } -big_host :: () -> s32 { +big_host :: () -> i32 { big := 3000000000; print("big: {} = {}\n", type_name(type_of(big)), big); 0 @@ -74,9 +74,9 @@ main :: () { } ``` -- **Observed** (current master): `f.x: s32`, `g.x: s8`, - `big: s32 = -1294967296`, `main.x: s64`. -- **Expected**: `s64` for all four; `big` prints `3000000000`. +- **Observed** (current master): `f.x: i32`, `g.x: i8`, + `big: i32 = -1294967296`, `main.x: i64`. +- **Expected**: `i64` for all four; `big` prints `3000000000`. Repro co-located: `issues/0111-int-literal-local-adopts-fn-return-type.sx` (standalone version of the above; unpinned until fixed). @@ -95,14 +95,14 @@ Three-link chain, all confirmed by reading: 3. `src/ir/lower/stmt.zig` ~335-348 (`lowerVarDecl`, unannotated path): lowers the initializer with whatever `target_type` is in scope and takes the decl's type from the lowered ref. The annotated path overwrites - `target_type` with the annotation (which is why `y : s64 = 0` is immune); + `target_type` with the annotation (which is why `y : i64 = 0` is immune); the unannotated path inherits the function-return context it should never see. ## Investigation prompt (paste into a fresh session) > Fix issue 0111: unannotated int-literal locals adopt the enclosing -> function's integer return type instead of the s64 default. Root cause chain +> function's integer return type instead of the i64 default. Root cause chain > is in the issue (decl.zig ~2149 body-wide `target_type = ret_ty`; > expr.zig ~1499 `.int_literal` adopting it; stmt.zig ~335 unannotated > `lowerVarDecl` not clearing it). Fix shape: in `lowerVarDecl`'s @@ -112,7 +112,7 @@ Three-link chain, all confirmed by reading: > also shouldn't inherit the return-type context (e.g. expression statements, > `lowerMultiAssign` / `lowerDestructureDecl` unannotated paths) and apply the > same clear where applicable. Do NOT touch the trailing-expression / -> `return` paths — `f :: () -> s32 { 0 }` must keep coercing the tail to the +> `return` paths — `f :: () -> i32 { 0 }` must keep coercing the tail to the > return type. > > Separately consider (same fix or follow-up per scope): the `.int_literal` @@ -121,7 +121,7 @@ Three-link chain, all confirmed by reading: > (`floatToIntExact` precedent) instead of silently truncating. > > Verify: run `issues/0111-int-literal-local-adopts-fn-return-type.sx` — -> expect `s64` for f.x / g.x / big / main.x and `big = 3000000000`. Then +> expect `i64` for f.x / g.x / big / main.x and `big = 3000000000`. Then > `zig build && zig build test && bash tests/run_examples.sh` against > EXISTING snapshots: any diff means an example was silently relying on > narrowed locals — review each (the change is user-visible only via @@ -132,8 +132,8 @@ Three-link chain, all confirmed by reading: > 0110 (for-loop codegen resource bugs). The 0109 emitter change (entry-block > alloca hoisting) is already applied in the working tree, builds, and fixes > both 0109 repros — but its regression example (1M-iteration `sum` -> accumulation in `main :: () -> s32`) cannot produce the documented expected -> output (`sum=499999500000`) until locals stop narrowing to s32, and +> accumulation in `main :: () -> i32`) cannot produce the documented expected +> output (`sum=499999500000`) until locals stop narrowing to i32, and > suite/.ir snapshot regen must not run on a compiler with this live > miscompile. After 0111 lands, resume: finalize 0109 (suite + .ir review + > regression example + commit), then 0110, then 0108 per their issue files. diff --git a/issues/0112-int-literal-out-of-range-silent-wrap.md b/issues/0112-int-literal-out-of-range-silent-wrap.md index 6dfb313..8ef17f4 100644 --- a/issues/0112-int-literal-out-of-range-silent-wrap.md +++ b/issues/0112-int-literal-out-of-range-silent-wrap.md @@ -18,14 +18,14 @@ Coverage via the shared arm: decls, assignments, call args, struct-literal fields, struct constants, globals. **Behavior change:** `examples/0300-closures-lambda.sx` passed `133` to an -`s3` param and pinned the wrapped `-3`; updated to a fitting value. +`i3` param and pinned the wrapped `-3`; updated to a fitting value. **Regression tests:** `examples/1156-diagnostics-int-literal-out-of-range.sx` (both faces diagnosed in one run) and `examples/0174-types-int-literal-boundaries.sx` (extreme in-range values, width-64 types, `xx`/`cast` escapes, call args). -**Found during the fix:** negated-literal GLOBAL initializers (`g : s64 = -1;`) +**Found during the fix:** negated-literal GLOBAL initializers (`g : i64 = -1;`) are rejected as non-constant — pre-existing gap, filed as issue 0113. --- @@ -33,10 +33,10 @@ are rejected as non-constant — pre-existing gap, filed as issue 0113. # 0112 — out-of-range int literal silently wraps into a narrower annotated target **Symptom.** An integer literal that does not fit its explicitly-annotated -integer target truncates with no diagnostic: `x : s8 = 300;` binds 44, +integer target truncates with no diagnostic: `x : i8 = 300;` binds 44, `y : u8 = 256;` binds 0. Expected: a compile-time error (the value is known exactly at compile time; this is the integer analogue of the float→int -narrowing rule, which errors on non-exact `y : s64 = 1.5`). +narrowing rule, which errors on non-exact `y : i64 = 1.5`). Split from issue 0111 (whose fix removed the *implicit* narrowing — an unannotated `x := 0` no longer adopts the fn return type — but the explicit @@ -48,7 +48,7 @@ annotation path keeps wrapping). #import "modules/std.sx"; main :: () { - x : s8 = 300; + x : i8 = 300; print("x: {}\n", x); y : u8 = 256; print("y: {}\n", y); @@ -58,7 +58,7 @@ main :: () { - **Observed** (current master): prints `x: 44` / `y: 0`, exit 0, no diagnostic. - **Expected**: compile error per literal, e.g. - `integer literal 300 does not fit in s8 (range -128..127)`, and the analog + `integer literal 300 does not fit in i8 (range -128..127)`, and the analog for `256` / `u8 (range 0..255)`. Repro co-located: `issues/0112-int-literal-out-of-range-silent-wrap.sx` @@ -72,7 +72,7 @@ value truncates at LLVM emission width. The annotated-decl path (`lowerVarDecl` with `type_annotation`, `src/ir/lower/stmt.zig` ~255) sets `target_type` to the annotation before lowering the initializer, so every annotated narrow decl funnels through this arm. Assignments to narrow -lvalues (`b = 300` where `b: s8`) reach the same arm via `lowerAssignment`'s +lvalues (`b = 300` where `b: i8`) reach the same arm via `lowerAssignment`'s LHS-derived target and likely need the same check. ## Investigation prompt (paste into a fresh session) @@ -84,15 +84,15 @@ LHS-derived target and likely need the same check. > table knows both; mirror the bounds logic used by > `TypeResolver.integerLimitFor`). On overflow emit a diagnostic via > `self.diagnostics.addFmt(.err, node.span, ...)` naming the literal, the -> type, and its range — do NOT silently fall back to s64 (REJECTED PATTERNS: +> type, and its range — do NOT silently fall back to i64 (REJECTED PATTERNS: > no silent fallback defaults); still return a `constInt` of the target type > so lowering continues to surface further errors. Audit sibling literal > sinks that bypass this arm (comptime folds, `lowerStructConstant`, global > initializers) for the same check. > > Verify: `issues/0112-int-literal-out-of-range-silent-wrap.sx` errors with -> two diagnostics (s8/300, u8/256); boundary values still compile -> (`x : s8 = -128` / `127`, `y : u8 = 0` / `255`, `m : u64` large literals). +> two diagnostics (i8/300, u8/256); boundary values still compile +> (`x : i8 = -128` / `127`, `y : u8 = 0` / `255`, `m : u64` large literals). > `zig build && zig build test && bash tests/run_examples.sh` — any example > that relied on silent wrapping must be reviewed individually. Promote the > repro per the resolution flow (likely `examples/11xx-diagnostics-...`). diff --git a/issues/0113-negative-literal-global-initializer-rejected.md b/issues/0113-negative-literal-global-initializer-rejected.md index 137577f..01eb5ff 100644 --- a/issues/0113-negative-literal-global-initializer-rejected.md +++ b/issues/0113-negative-literal-global-initializer-rejected.md @@ -7,10 +7,10 @@ compile-time constant" — even though `constExprValue` already folds **Fix:** a `.unary_op` arm routes the initializer through `constExprValue`; the folded value follows the direct-literal rules — `checkIntLiteralFits` on -ints (`g : s8 = -300;` gets the range diagnostic, not "non-constant"), and a +ints (`g : i8 = -300;` gets the range diagnostic, not "non-constant"), and a negated float at an integer global narrows only when integral -(`g : s64 = -4.0;` → -4; `-4.5` errors). Binary-op initializers -(`g : s32 = 2 + 3;`) remain unsupported and keep the specific +(`g : i64 = -4.0;` → -4; `-4.5` errors). Binary-op initializers +(`g : i32 = 2 + 3;`) remain unsupported and keep the specific "must be initialized by a compile-time constant" diagnostic — const-expr folding for those is a separate feature if ever wanted. @@ -22,18 +22,18 @@ folding for those is a separate feature if ever wanted. # 0113 — negative-literal global initializer rejected as "not a compile-time constant" **Symptom.** A top-level global initialized with a negated literal fails to -compile: `g : s64 = -1;` errors +compile: `g : i64 = -1;` errors `global 'g' must be initialized by a compile-time constant`. Expected: a negated literal is a compile-time constant; the global serializes to -1. -Positive literals work (`g : s64 = 1;`). Locals are unaffected -(`x : s64 = -1;` inside a function is fine — lowerExpr folds the negate). +Positive literals work (`g : i64 = 1;`). Locals are unaffected +(`x : i64 = -1;` inside a function is fine — lowerExpr folds the negate). ## Reproduction ```sx #import "modules/std.sx"; -g : s64 = -1; +g : i64 = -1; main :: () { print("{}\n", g); @@ -58,20 +58,20 @@ chance. ## Investigation prompt (paste into a fresh session) -> Fix issue 0113: `g : s64 = -1;` (and const-expression initializers like -> `g : s64 = 2 + 3;`) are rejected as non-constant globals. In +> Fix issue 0113: `g : i64 = -1;` (and const-expression initializers like +> `g : i64 = 2 + 3;`) are rejected as non-constant globals. In > `src/ir/lower/decl.zig` `globalInitValue`, route `.unary_op` and > `.binary_op` initializers through the same const-expression evaluation the > `.identifier` arm uses (`constExprValue`, or the > `program_index.evalConstFloatExpr`-family used by `typedConstInitFits` > ~878) before falling into the catch-all diagnostic. Apply the int-literal > fits-check (`checkIntLiteralFits`) to the folded value against the -> global's type — `g : s8 = -300;` must produce the range diagnostic, not a +> global's type — `g : i8 = -300;` must produce the range diagnostic, not a > wrap and not "non-constant". Negative bounds in `typedConstInitFits` > already admit unary_op shapes; keep both checks consistent. > -> Verify: the repro prints -1; `g2 : s8 = -300;` errors with the range -> message; `g3 : s32 = 2 + 3;` initializes to 5 (or, if expression globals +> Verify: the repro prints -1; `g2 : i8 = -300;` errors with the range +> message; `g3 : i32 = 2 + 3;` initializes to 5 (or, if expression globals > are deliberately unsupported, keeps a SPECIFIC diagnostic saying so). > `zig build && zig build test && bash tests/run_examples.sh`. Promote the > repro per the resolution flow. diff --git a/issues/0114-namespace-alias-transitive-first-wins.md b/issues/0114-namespace-alias-transitive-first-wins.md index 89d39cd..91fe5e3 100644 --- a/issues/0114-namespace-alias-transitive-first-wins.md +++ b/issues/0114-namespace-alias-transitive-first-wins.md @@ -30,7 +30,7 @@ plus a REJECTED-PATTERNS silent first-wins. ```sx // target.sx -helper :: () -> s64 { 7 } +helper :: () -> i64 { 7 } ``` ```sx // facade.sx diff --git a/issues/0115-same-name-const-scalar-array-collision.md b/issues/0115-same-name-const-scalar-array-collision.md index 99e03ec..e05e875 100644 --- a/issues/0115-same-name-const-scalar-array-collision.md +++ b/issues/0115-same-name-const-scalar-array-collision.md @@ -19,8 +19,8 @@ > the full std namespace tail is enabled on top. **Symptom.** When two modules in one program declare a same-named module -const with DIFFERENT shapes (scalar `K : s64 : 4` vs array -`K : [4]s64 : .[...]`), resolution conflates them instead of selecting +const with DIFFERENT shapes (scalar `K : i64 : 4` vs array +`K : [4]i64 : .[...]`), resolution conflates them instead of selecting per-author: - **Observed (minimal repro below)**: compiler PANIC — `unresolved type @@ -30,7 +30,7 @@ per-author: own scalar `K` reads as the other module's array global (prints the array's address or the whole array). Seen corpus-wide when `hash :: #import "modules/std/hash.sx"` (hash.sx declares the SHA-256 - `K : [64]s64` table) is added to the std.sx namespace tail: examples + `K : [64]i64` table) is added to the std.sx namespace tail: examples 0786/0787/0788/0789/0791/0793/0794 (same-name-const family), 0162, 0168 all read hash's `K` instead of their own. - **Expected**: own-wins / per-author const selection (the documented F2 @@ -45,15 +45,15 @@ consts are robust across every module pulled into every program. ```sx // h.sx -K : [4]s64 : .[11, 22, 33, 44]; -use_k :: () -> s64 { K[2] } +K : [4]i64 : .[11, 22, 33, 44]; +use_k :: () -> i64 { K[2] } ``` ```sx // main.sx #import "modules/std.sx"; h :: #import "h.sx"; -K : s64 : 4; +K : i64 : 4; main :: () { print("K={} h.use_k={}\n", K, h.use_k()); } ``` @@ -100,7 +100,7 @@ flat-imports std.sx. The panic variant above is the minimal entry point.) Same-name module consts are selected own-wins via `selectModuleConst` (F2, src/ir/lower/expr.zig ~1641) over `module_const_map` — but ARRAY -consts lower as GLOBALS (`@K = internal global [4 x s64]`), registered in +consts lower as GLOBALS (`@K = internal global [4 x i64]`), registered in a different, still last-wins registry (find it: grep the lowering for where a top-level array const becomes a module global — likely `lowerGlobalDecl` / the global-var map in src/ir/lower/decl.zig). The diff --git a/issues/0116-const-write-not-rejected.md b/issues/0116-const-write-not-rejected.md index 9024dc1..9dbef17 100644 --- a/issues/0116-const-write-not-rejected.md +++ b/issues/0116-const-write-not-rejected.md @@ -24,7 +24,7 @@ program crashes at runtime. ```sx #import "modules/std.sx"; -Color :: struct { r, g, b: s64; } +Color :: struct { r, g, b: i64; } WHITE :: Color.{ r = 255, g = 255, b = 255 }; main :: () { diff --git a/issues/0117-pointer-to-array-index-unresolved-panic.md b/issues/0117-pointer-to-array-index-unresolved-panic.md index 4cf09e7..32711bb 100644 --- a/issues/0117-pointer-to-array-index-unresolved-panic.md +++ b/issues/0117-pointer-to-array-index-unresolved-panic.md @@ -36,8 +36,8 @@ pointer-to-array. #import "modules/std.sx"; main :: () { - k : [4]s64 = .[11, 22, 33, 44]; - p := @k; // *[4]s64 + k : [4]i64 = .[11, 22, 33, 44]; + p := @k; // *[4]i64 print("{}\n", p[2]); // expected 33; panics at emission today } ``` diff --git a/issues/0118-cast-compound-type-arg-unresolved.md b/issues/0118-cast-compound-type-arg-unresolved.md index e5ba36a..e86ae99 100644 --- a/issues/0118-cast-compound-type-arg-unresolved.md +++ b/issues/0118-cast-compound-type-arg-unresolved.md @@ -6,7 +6,7 @@ > `lowerExpr`'s catch-all `unknown_expr` error. Fixed by giving the six > compound type-expr shapes (`*T`, `[*]T`, `[]T`, `?T`, `[N]T`, fn types) a > first-class `const_type` lowering arm in `src/ir/lower/expr.zig`, -> mirroring named types (`t : Type = *s64;` now works like `t : Type = +> mirroring named types (`t : Type = *i64;` now works like `t : Type = > f64;`). (2) The cast handler's private static-type gate only accepted > bare names — replaced with the canonical `isStaticTypeArg` > (`src/ir/lower/call.zig`), so static compound casts route through @@ -17,26 +17,26 @@ ## Symptom -`cast(T) expr` with a COMPOUND static type argument (`*s64`, `[]u8`, `?s32`, -`[*]s64`, `[4]s64`, …) fails to compile with a junk diagnostic pointing at the +`cast(T) expr` with a COMPOUND static type argument (`*i64`, `[]u8`, `?i32`, +`[*]i64`, `[4]i64`, …) fails to compile with a junk diagnostic pointing at the type argument. Observed: ``` error: unresolved 'unknown_expr' (in probe.sx fn main) --> probe.sx:5:21 | - 5 | q : *s64 = cast(*s64) p; + 5 | q : *i64 = cast(*i64) p; | ^^^^ ``` Expected: the cast resolves the type argument statically and routes through -`coerceExplicit` (for `cast(*s64) p` where `p : *s64`, a no-op), exactly as it -does for bare names (`cast(s32) 3.14` works). The spec places no scalar-only +`coerceExplicit` (for `cast(*i64) p` where `p : *i64`, a no-op), exactly as it +does for bare names (`cast(i32) 3.14` works). The spec places no scalar-only restriction on `cast(Type)` (specs.md "cast(Type) expr — prefix operator that converts expr to Type"). Pre-existing on master (verified on a clean build of 679653f) — independent of -the in-flight const-pointer work; plain `*s64` reproduces it. +the in-flight const-pointer work; plain `*i64` reproduces it. ## Reproduction @@ -45,8 +45,8 @@ the in-flight const-pointer work; plain `*s64` reproduces it. main :: () { x := 42; - p : *s64 = @x; - q : *s64 = cast(*s64) p; // error: unresolved 'unknown_expr' + p : *i64 = @x; + q : *i64 = cast(*i64) p; // error: unresolved 'unknown_expr' print("{}\n", q.*); // expected: 42 } ``` @@ -64,8 +64,8 @@ builtin path, which cannot resolve it and surfaces the catch-all The codebase already has the canonical gate: `Lowering.isStaticTypeArg` (`src/ir/lower/generic.zig:206`), which `type_name` / `type_eq` use — it -accepts the full compound-shape set (this is why `type_name(*s64)` folds -fine while `cast(*s64)` dies). The fix likely: replace the private +accepts the full compound-shape set (this is why `type_name(*i64)` folds +fine while `cast(*i64)` dies). The fix likely: replace the private `is_static_type` block with `self.isStaticTypeArg(type_arg)` (keeping the scope-shadow semantics: an identifier bound to a runtime `Type` variable must still route to the runtime-dispatch path used by `case`-arm `cast(type)` — @@ -74,7 +74,7 @@ dispatch"). Then `resolveTypeArg` already handles the compound shapes. Verification: 1. Run the repro above — expect `42`, exit 0. -2. Sanity: `cast([]u8)`, `cast(?s32)`, `cast([*]s64)` forms resolve. +2. Sanity: `cast([]u8)`, `cast(?i32)`, `cast([*]i64)` forms resolve. 3. `bash tests/run_examples.sh` — the `case`-arm runtime-dispatch examples (any_to_string formatting suite) must stay green, proving the runtime-`Type`-variable path still falls through to the builtin. diff --git a/issues/0119-ufcs-generic-free-function-unresolved.md b/issues/0119-ufcs-generic-free-function-unresolved.md index b71de38..386a624 100644 --- a/issues/0119-ufcs-generic-free-function-unresolved.md +++ b/issues/0119-ufcs-generic-free-function-unresolved.md @@ -32,7 +32,7 @@ Observed (one probe, all three failures): - `xs.sum_all()` (concrete fn, slice receiver) → **works** - `xs.first_of()` (generic `[]$T` fn, slice receiver) → `unresolved 'first_of'` -- `p.pick(s32)` (generic `$T: Type` fn, struct receiver) → `unresolved 'pick'` +- `p.pick(i32)` (generic `$T: Type` fn, struct receiver) → `unresolved 'pick'` - `a.create(Session)` (generic fn, protocol-value receiver) → `unresolved 'create'` Expected: specs.md §UFCS promises the rewrite unconditionally ("When @@ -53,7 +53,7 @@ first_of :: (xs: []$T) -> T { xs[0] } main :: () { arr := .[1, 2, 3]; - xs : []s64 = arr; + xs : []i64 = arr; print("{}\n", first_of(xs)); // 1 — direct call works print("{}\n", xs.first_of()); // error: unresolved 'first_of' } @@ -84,7 +84,7 @@ concrete fns. Verification: 1. The repro above prints `1` twice, exit 0. -2. Matrix probe: generic-on-struct (`p.pick(s32)`), generic-on-slice +2. Matrix probe: generic-on-struct (`p.pick(i32)`), generic-on-slice (`xs.first_of()`), generic-on-protocol-value (`a.create(Session)` with `create :: (a: Allocator, $T: Type) -> *T`) all dispatch; concrete UFCS unchanged. diff --git a/issues/0120-generic-struct-alias-head-unresolved-panic.md b/issues/0120-generic-struct-alias-head-unresolved-panic.md index 9092cf8..785d2b9 100644 --- a/issues/0120-generic-struct-alias-head-unresolved-panic.md +++ b/issues/0120-generic-struct-alias-head-unresolved-panic.md @@ -29,7 +29,7 @@ `Alias :: Box;` where `Box` is a generic struct (`struct ($T: Type)`) lowers without any diagnostic, and instantiating through the alias -(`Alias(s64).{ ... }`) reaches LLVM emission with an `.unresolved` +(`Alias(i64).{ ... }`) reaches LLVM emission with an `.unresolved` type — the backend tripwire panics: ``` @@ -81,7 +81,7 @@ Box :: struct ($T: Type) { BoxAlias :: Box; main :: () { - b := BoxAlias(s64).{ item = 3 }; + b := BoxAlias(i64).{ item = 3 }; print("{}\n", b.item); } ``` @@ -99,14 +99,14 @@ Box :: struct ($T: Type) { BoxAlias :: Box; main :: () { - b := BoxAlias(s64).{ item = 3 }; + b := BoxAlias(i64).{ item = 3 }; print("{}\n", b.get()); } ``` Cross-module variant (`rich.sx` declares `Box`; `facade.sx` has `r :: #import "rich.sx"; Box :: r.Box;`; a consumer flat-importing -facade.sx gets `type 'Box' is not visible` at `Box(s64).{ ... }`). +facade.sx gets `type 'Box' is not visible` at `Box(i64).{ ... }`). ## Investigation prompt @@ -139,8 +139,8 @@ declaring module with ordinary own-decl visibility so one-level flat-import carry works (mirror whatever makes `Thing :: r.Thing;` re-export correctly today). Mind collision semantics (own-wins / ambiguity) and that the alias must also work as a plain type head in -annotations (`x: BoxAlias(s64)`), nested generics -(`List(BoxAlias(s64))` if applicable), and method/UFCS dispatch on +annotations (`x: BoxAlias(i64)`), nested generics +(`List(BoxAlias(i64))` if applicable), and method/UFCS dispatch on instantiations through the alias. Motivating context: the std.sx-as-pure-re-exports restructure wants diff --git a/issues/0121-pack-fn-alias-unresolved.md b/issues/0121-pack-fn-alias-unresolved.md index 0745a7f..a44b588 100644 --- a/issues/0121-pack-fn-alias-unresolved.md +++ b/issues/0121-pack-fn-alias-unresolved.md @@ -51,7 +51,7 @@ deep.) ```sx #import "modules/std.sx"; -pack_sum :: (..$args) -> s64 { +pack_sum :: (..$args) -> i64 { args[0] + args[1] } sum_alias :: pack_sum; diff --git a/issues/0122-whole-program-passes-ambient-source-context.md b/issues/0122-whole-program-passes-ambient-source-context.md index bd55554..f1d0d11 100644 --- a/issues/0122-whole-program-passes-ambient-source-context.md +++ b/issues/0122-whole-program-passes-ambient-source-context.md @@ -44,7 +44,7 @@ Against the pre-fix compiler with the re-export std.sx: ```sx #import "modules/std.sx"; -Point :: struct { x, y: s32; } +Point :: struct { x, y: i32; } main :: () { f := closure((p: Point) -> Point => Point.{ x = p.x + 1, y = p.y }); r := f(Point.{ x = 1, y = 2 }); diff --git a/issues/0123-call-arity-unchecked.md b/issues/0123-call-arity-unchecked.md index a3e0560..5ff1bf0 100644 --- a/issues/0123-call-arity-unchecked.md +++ b/issues/0123-call-arity-unchecked.md @@ -41,12 +41,12 @@ Both directions are broken, on every plain dispatch path probed: - too MANY args, bare call: `concat("a", "b", "c")` (std's `concat` takes 2 strings) → LLVM verifier failure. -- too FEW args, bare call: `add2(1)` with `add2 :: (a: s64, b: s64)` +- too FEW args, bare call: `add2(1)` with `add2 :: (a: i64, b: i64)` → same. - methods / ufcs dot-calls: same shape, receiver included. Worse: a trailing-default param on a plain struct method or a ufcs fn is never filled on the dot-call path (`p.scaled()` with - `scaled :: (self: Point, k: s64 = 2)` emits a 1-arg call to a + `scaled :: (self: Point, k: i64 = 2)` emits a 1-arg call to a 2-param fn — bare calls fill defaults via `expandCallDefaults`, the method/ufcs sites never run `appendDefaultArgs`). @@ -62,7 +62,7 @@ C variadics, `#compiler` / `#builtin` bodies. ```sx #import "modules/std.sx"; -main :: () -> s32 { +main :: () -> i32 { s := concat("a", "b", "c"); // concat takes (a: string, b: string) out(s); return 0; diff --git a/issues/0124-large-stack-array-aggregate-ops-crash-llvm.md b/issues/0124-large-stack-array-aggregate-ops-crash-llvm.md index 3eb88e4..fdb6203 100644 --- a/issues/0124-large-stack-array-aggregate-ops-crash-llvm.md +++ b/issues/0124-large-stack-array-aggregate-ops-crash-llvm.md @@ -16,7 +16,7 @@ > (`any_to_string`'s per-array-type arms pass the array by value — any > 64K+ array type + any `{}` print still crashes). > Regression test: `examples/0055-basic-large-stack-array.sx` -> ([65536]u8 write/read loops + [131072]s64 first/last — `sx build` +> ([65536]u8 write/read loops + [131072]i64 first/last — `sx build` > segfaulted pre-fix). 22 `.ir` snapshots re-pinned (removed undef > stores / `ig.tmp` spills → in-place gep+load; reviewed > instruction-shape-only). Gates: zig build test 426/426, suite @@ -59,12 +59,12 @@ replaced by in-place access the module compiles. ```sx #import "modules/std.sx"; -f :: (fd: s32) { +f :: (fd: i32) { buf : [65536]u8 = ---; if buf[0] > 0 { out("x\n"); } } -main :: () -> s32 { +main :: () -> i32 { f(1); return 0; } diff --git a/issues/0125-any-to-string-array-arms-by-value.md b/issues/0125-any-to-string-array-arms-by-value.md index 1e49088..7d00044 100644 --- a/issues/0125-any-to-string-array-arms-by-value.md +++ b/issues/0125-any-to-string-array-arms-by-value.md @@ -44,7 +44,7 @@ f :: () { out(string.{ ptr = @buf[0], len = 1 }); } -main :: () -> s32 { +main :: () -> i32 { f(); print("{}\n", 5); return 0; diff --git a/issues/0126-array-arg-slice-generic-param-unbound.md b/issues/0126-array-arg-slice-generic-param-unbound.md index 8ce324f..1c8c3b5 100644 --- a/issues/0126-array-arg-slice-generic-param-unbound.md +++ b/issues/0126-array-arg-slice-generic-param-unbound.md @@ -30,11 +30,11 @@ during emission instead of compiling (or diagnosing). (src/backend/llvm/types.zig:175, via `emitIndexGet` in the monomorphized body). - **Expected**: the array coerces to a slice at the `[]T` param — the - same promotion a CONCRETE `[]s64` param (and a `[]s64`-annotated + same promotion a CONCRETE `[]i64` param (and a `[]i64`-annotated local) already performs — so `T` binds from the array's element type and the call compiles. -Passing an actual slice works (`s : []s64 = a; first(s)` prints the +Passing an actual slice works (`s : []i64 = a; first(s)` prints the element); only the direct array spelling breaks, and only for generic slice params. @@ -47,8 +47,8 @@ first :: (xs: []$T) -> T { return xs[0]; } -main :: () -> s32 { - a : [3]s64 = ---; +main :: () -> i32 { + a : [3]i64 = ---; a[0] = 7; a[1] = 8; a[2] = 9; v := first(a); print("{}\n", v); @@ -56,7 +56,7 @@ main :: () -> s32 { } ``` -Observed at master 837b5d3: the panic above. With `s : []s64 = a; +Observed at master 837b5d3: the panic above. With `s : []i64 = a; first(s)` it prints `7`. ## Investigation prompt diff --git a/issues/0127-namespaced-generic-call-result-unbound-stub.md b/issues/0127-namespaced-generic-call-result-unbound-stub.md index f4f36db..d1814f3 100644 --- a/issues/0127-namespaced-generic-call-result-unbound-stub.md +++ b/issues/0127-namespaced-generic-call-result-unbound-stub.md @@ -7,13 +7,13 @@ > the bare-identifier path routes generics through > `inferGenericReturnType`. Lowering dispatched the right mono (the > value was correct); only the planned result type was wrong, so -> pack-fn callers (print's Any boxing) mis-tagged it — and a non-s64 +> pack-fn callers (print's Any boxing) mis-tagged it — and a non-i64 > binding (f64) failed LLVM verification outright, the pack being > monomorphized for the stub while the call returned `double`. Fix: > both arms now classify a `type_params.len > 0` callee as > `.generic_fn` and infer the return type through the call's bindings, > mirroring the flat path. Regression test: -> `examples/0213-generics-namespaced-call-result.sx` (s64 + f64 +> `examples/0213-generics-namespaced-call-result.sx` (i64 + f64 > bindings via print, concrete type flowing into arithmetic; pre-fix: > `T{}` boxing / LLVM verification failure — both demonstrated). > Gates: zig build test 426/426, suite 595/595, distribution repo diff --git a/library/modules/build.sx b/library/modules/build.sx index a421f14..9f3e7f7 100644 --- a/library/modules/build.sx +++ b/library/modules/build.sx @@ -3,7 +3,7 @@ Architecture :: enum { aarch64; x86_64; wasm32; wasm64; unknown; } OS : OperatingSystem = .unknown; ARCH : Architecture = .unknown; -POINTER_SIZE : s64 = 8; +POINTER_SIZE : i64 = 8; BuildOptions :: struct #compiler { add_link_flag :: (self: BuildOptions, flag: [:0]u8); @@ -18,9 +18,9 @@ BuildOptions :: struct #compiler { // zipped under `/` at the APK root. Idiomatic chess form is // `opts.add_asset_dir("assets", "assets")`. add_asset_dir :: (self: BuildOptions, src: [:0]u8, dest: [:0]u8); - asset_dir_count :: (self: BuildOptions) -> s64; - asset_dir_src_at :: (self: BuildOptions, i: s64) -> string; - asset_dir_dest_at :: (self: BuildOptions, i: s64) -> string; + asset_dir_count :: (self: BuildOptions) -> i64; + asset_dir_src_at :: (self: BuildOptions, i: i64) -> string; + asset_dir_dest_at :: (self: BuildOptions, i: i64) -> string; // Post-link callback. Registers a sx function the compiler will // invoke after `target.link()` returns. Used by the sx-side @@ -67,10 +67,10 @@ BuildOptions :: struct #compiler { // `framework_path_at(0..framework_path_count())` into // `/Frameworks/`. Slice returns aren't natively expressible // through the compiler-hook bridge yet, hence the indexed form. - framework_count :: (self: BuildOptions) -> s64; - framework_at :: (self: BuildOptions, i: s64) -> string; - framework_path_count :: (self: BuildOptions) -> s64; - framework_path_at :: (self: BuildOptions, i: s64) -> string; + framework_count :: (self: BuildOptions) -> i64; + framework_at :: (self: BuildOptions, i: i64) -> string; + framework_path_count :: (self: BuildOptions) -> i64; + framework_path_at :: (self: BuildOptions, i: i64) -> string; // Android APK bundling parameters. `manifest_path` overrides the // bundler's auto-generated AndroidManifest.xml; `keystore_path` @@ -86,9 +86,9 @@ BuildOptions :: struct #compiler { // for each entry writes a `.java` file at // `/java/.java`, compiles via javac + d8, and // bundles the resulting classes.dex into the APK. - jni_main_count :: (self: BuildOptions) -> s64; - jni_main_foreign_path_at :: (self: BuildOptions, i: s64) -> string; - jni_main_java_source_at :: (self: BuildOptions, i: s64) -> string; + jni_main_count :: (self: BuildOptions) -> i64; + jni_main_foreign_path_at :: (self: BuildOptions, i: i64) -> string; + jni_main_java_source_at :: (self: BuildOptions, i: i64) -> string; } build_options :: () -> BuildOptions #compiler; diff --git a/library/modules/ffi/objc.sx b/library/modules/ffi/objc.sx index 9cfa028..108204c 100644 --- a/library/modules/ffi/objc.sx +++ b/library/modules/ffi/objc.sx @@ -26,8 +26,8 @@ SEL :: *void; // Apple's `BOOL` is a signed char (NOT sx's built-in `bool`, which is // LLVM `i1`). Obj-C method signatures that take or return `BOOL` cross -// the FFI boundary as `s8`. -BOOL :: s8; +// the FFI boundary as `i8`. +BOOL :: i8; // On macOS libobjc is auto-loaded by libSystem; on iOS it isn't, so we // link it explicitly. Foundation registers NSString etc. with the runtime, diff --git a/library/modules/ffi/objc_block.sx b/library/modules/ffi/objc_block.sx index 2033f19..a56c8d7 100644 --- a/library/modules/ffi/objc_block.sx +++ b/library/modules/ffi/objc_block.sx @@ -32,8 +32,8 @@ // it wraps. Total = 48 bytes. Block :: struct { isa: *void; - flags: s32; - reserved: s32; + flags: i32; + reserved: i32; invoke: *void; descriptor: *void; sx_env: *void; @@ -95,7 +95,7 @@ impl Into(Block) for Closure(..$args) -> $R { build_block_convert :: (args: []Type, $ret: Type) -> string { ret_name := type_name(ret); code := "__invoke :: (block_self: *Block"; - i : s64 = 0; + i : i64 = 0; while i < args.len { code = concat(code, ", arg"); code = concat(code, int_to_string(i)); diff --git a/library/modules/ffi/opengl.sx b/library/modules/ffi/opengl.sx index 6dd9399..8077c1e 100644 --- a/library/modules/ffi/opengl.sx +++ b/library/modules/ffi/opengl.sx @@ -2,8 +2,8 @@ // No #library needed — caller provides a loader (e.g. SDL_GL_GetProcAddress) // Constants -GL_FALSE :s32: 0; -GL_TRUE :s32: 1; +GL_FALSE :i32: 0; +GL_TRUE :i32: 1; GL_DEPTH_TEST :u32: 0x0B71; GL_CULL_FACE :u32: 0x0B44; GL_BLEND :u32: 0x0BE2; @@ -29,35 +29,35 @@ glClearColor : (f32, f32, f32, f32) -> void callconv(.c) = ---; glClear : (u32) -> void callconv(.c) = ---; glEnable : (u32) -> void callconv(.c) = ---; glDisable : (u32) -> void callconv(.c) = ---; -glViewport : (s32, s32, s32, s32) -> void callconv(.c) = ---; +glViewport : (i32, i32, i32, i32) -> void callconv(.c) = ---; glFlush : () -> void callconv(.c) = ---; -glDrawArrays : (u32, s32, s32) -> void callconv(.c) = ---; +glDrawArrays : (u32, i32, i32) -> void callconv(.c) = ---; glPolygonMode : (u32, u32) -> void callconv(.c) = ---; glLineWidth : (f32) -> void callconv(.c) = ---; glCreateShader : (u32) -> u32 callconv(.c) = ---; -glShaderSource : (u32, s32, *[:0]u8, *s32) -> void callconv(.c) = ---; +glShaderSource : (u32, i32, *[:0]u8, *i32) -> void callconv(.c) = ---; glCompileShader : (u32) -> void callconv(.c) = ---; -glGetShaderiv : (u32, u32, *s32) -> void callconv(.c) = ---; -glGetShaderInfoLog : (u32, s32, *s32, [*]u8) -> void callconv(.c) = ---; +glGetShaderiv : (u32, u32, *i32) -> void callconv(.c) = ---; +glGetShaderInfoLog : (u32, i32, *i32, [*]u8) -> void callconv(.c) = ---; glCreateProgram : () -> u32 callconv(.c) = ---; glAttachShader : (u32, u32) -> void callconv(.c) = ---; glLinkProgram : (u32) -> void callconv(.c) = ---; -glGetProgramiv : (u32, u32, *s32) -> void callconv(.c) = ---; -glGetProgramInfoLog : (u32, s32, *s32, [*]u8) -> void callconv(.c) = ---; +glGetProgramiv : (u32, u32, *i32) -> void callconv(.c) = ---; +glGetProgramInfoLog : (u32, i32, *i32, [*]u8) -> void callconv(.c) = ---; glUseProgram : (u32) -> void callconv(.c) = ---; glDeleteShader : (u32) -> void callconv(.c) = ---; -glGenVertexArrays : (s32, *u32) -> void callconv(.c) = ---; -glGenBuffers : (s32, *u32) -> void callconv(.c) = ---; +glGenVertexArrays : (i32, *u32) -> void callconv(.c) = ---; +glGenBuffers : (i32, *u32) -> void callconv(.c) = ---; glBindVertexArray : (u32) -> void callconv(.c) = ---; glBindBuffer : (u32, u32) -> void callconv(.c) = ---; glBufferData : (u32, isize, *void, u32) -> void callconv(.c) = ---; -glVertexAttribPointer : (u32, s32, u32, u8, s32, *void) -> void callconv(.c) = ---; +glVertexAttribPointer : (u32, i32, u32, u8, i32, *void) -> void callconv(.c) = ---; glEnableVertexAttribArray : (u32) -> void callconv(.c) = ---; -glGetUniformLocation : (u32, [*]u8) -> s32 callconv(.c) = ---; -glUniformMatrix4fv : (s32, s32, u8, [*]f32) -> void callconv(.c) = ---; -glUniform3f : (s32, f32, f32, f32) -> void callconv(.c) = ---; +glGetUniformLocation : (u32, [*]u8) -> i32 callconv(.c) = ---; +glUniformMatrix4fv : (i32, i32, u8, [*]f32) -> void callconv(.c) = ---; +glUniform3f : (i32, f32, f32, f32) -> void callconv(.c) = ---; glDepthFunc : (u32) -> void callconv(.c) = ---; -glUniform1f : (s32, f32) -> void callconv(.c) = ---; +glUniform1f : (i32, f32) -> void callconv(.c) = ---; GL_LESS :u32: 0x0201; GL_LEQUAL :u32: 0x0203; GL_SCISSOR_TEST :u32: 0x0C11; @@ -76,26 +76,26 @@ GL_RED :u32: 0x1903; GL_R8 :u32: 0x8229; GL_UNPACK_ALIGNMENT :u32: 0x0CF5; -glScissor : (s32, s32, s32, s32) -> void callconv(.c) = ---; +glScissor : (i32, i32, i32, i32) -> void callconv(.c) = ---; glBufferSubData : (u32, isize, isize, *void) -> void callconv(.c) = ---; -glGenTextures : (s32, *u32) -> void callconv(.c) = ---; +glGenTextures : (i32, *u32) -> void callconv(.c) = ---; glBindTexture : (u32, u32) -> void callconv(.c) = ---; -glTexImage2D : (u32, s32, s32, s32, s32, s32, u32, u32, *void) -> void callconv(.c) = ---; -glTexParameteri : (u32, u32, s32) -> void callconv(.c) = ---; +glTexImage2D : (u32, i32, i32, i32, i32, i32, u32, u32, *void) -> void callconv(.c) = ---; +glTexParameteri : (u32, u32, i32) -> void callconv(.c) = ---; glBlendFunc : (u32, u32) -> void callconv(.c) = ---; -glReadPixels : (s32, s32, s32, s32, u32, u32, *void) -> void callconv(.c) = ---; +glReadPixels : (i32, i32, i32, i32, u32, u32, *void) -> void callconv(.c) = ---; glActiveTexture : (u32) -> void callconv(.c) = ---; -glUniform1i : (s32, s32) -> void callconv(.c) = ---; -glPixelStorei : (u32, s32) -> void callconv(.c) = ---; -glTexSubImage2D : (u32, s32, s32, s32, s32, s32, u32, u32, *void) -> void callconv(.c) = ---; -glDeleteTextures : (s32, *u32) -> void callconv(.c) = ---; +glUniform1i : (i32, i32) -> void callconv(.c) = ---; +glPixelStorei : (u32, i32) -> void callconv(.c) = ---; +glTexSubImage2D : (u32, i32, i32, i32, i32, i32, u32, u32, *void) -> void callconv(.c) = ---; +glDeleteTextures : (i32, *u32) -> void callconv(.c) = ---; -glGenFramebuffers : (s32, *u32) -> void callconv(.c) = ---; -glGenRenderbuffers : (s32, *u32) -> void callconv(.c) = ---; +glGenFramebuffers : (i32, *u32) -> void callconv(.c) = ---; +glGenRenderbuffers : (i32, *u32) -> void callconv(.c) = ---; glBindFramebuffer : (u32, u32) -> void callconv(.c) = ---; glBindRenderbuffer : (u32, u32) -> void callconv(.c) = ---; glFramebufferRenderbuffer : (u32, u32, u32, u32) -> void callconv(.c) = ---; -glGetRenderbufferParameteriv : (u32, u32, *s32) -> void callconv(.c) = ---; +glGetRenderbufferParameteriv : (u32, u32, *i32) -> void callconv(.c) = ---; glCheckFramebufferStatus : (u32) -> u32 callconv(.c) = ---; GL_TEXTURE_WRAP_S :u32: 0x2802; @@ -173,7 +173,7 @@ create_program :: (vert_src: [:0]u8, frag_src: [:0]u8) -> u32 { glAttachShader(prog, fs); glLinkProgram(prog); - status : s32 = 0; + status : i32 = 0; glGetProgramiv(prog, GL_LINK_STATUS, @status); if status == GL_FALSE { log_buf: [512]u8 = ---; @@ -190,7 +190,7 @@ compile_shader :: (shader_type : u32, source: [:0]u8) -> u32 { glShaderSource(shader, 1, source, null); glCompileShader(shader); - status : s32 = 0; + status : i32 = 0; glGetShaderiv(shader, GL_COMPILE_STATUS, @status); if status == GL_FALSE { log_buf : [512]u8 = ---; diff --git a/library/modules/ffi/raylib.sx b/library/modules/ffi/raylib.sx index 80e0d3d..1aa62ff 100644 --- a/library/modules/ffi/raylib.sx +++ b/library/modules/ffi/raylib.sx @@ -8,7 +8,7 @@ Vector2 :: struct { x, y: f32; } -InitWindow :: (width: s32, height: s32, title: [:0]u8) -> void #foreign raylib; +InitWindow :: (width: i32, height: i32, title: [:0]u8) -> void #foreign raylib; CloseWindow :: () -> void #foreign raylib; WindowShouldClose :: () -> bool #foreign raylib; BeginDrawing :: () -> void #foreign raylib; diff --git a/library/modules/ffi/sdl3.sx b/library/modules/ffi/sdl3.sx index 74ac60e..2af5886 100644 --- a/library/modules/ffi/sdl3.sx +++ b/library/modules/ffi/sdl3.sx @@ -9,19 +9,19 @@ SDL_WINDOW_RESIZABLE :u64: 0x20; SDL_WINDOW_HIGH_PIXEL_DENSITY :u64: 0x2000; // SDL_GLAttr (enum starting at 0) -SDL_GL_DOUBLEBUFFER :s32: 5; -SDL_GL_DEPTH_SIZE :s32: 6; -SDL_GL_CONTEXT_MAJOR_VERSION :s32: 17; -SDL_GL_CONTEXT_MINOR_VERSION :s32: 18; -SDL_GL_CONTEXT_FLAGS :s32: 19; -SDL_GL_CONTEXT_PROFILE_MASK :s32: 20; +SDL_GL_DOUBLEBUFFER :i32: 5; +SDL_GL_DEPTH_SIZE :i32: 6; +SDL_GL_CONTEXT_MAJOR_VERSION :i32: 17; +SDL_GL_CONTEXT_MINOR_VERSION :i32: 18; +SDL_GL_CONTEXT_FLAGS :i32: 19; +SDL_GL_CONTEXT_PROFILE_MASK :i32: 20; // SDL_GLProfile -SDL_GL_CONTEXT_PROFILE_CORE :s32: 0x1; -SDL_GL_CONTEXT_PROFILE_ES :s32: 0x4; +SDL_GL_CONTEXT_PROFILE_CORE :i32: 0x1; +SDL_GL_CONTEXT_PROFILE_ES :i32: 0x4; // SDL_GLContextFlag -SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG :s32: 0x2; +SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG :i32: 0x2; // SDL_Keycode — virtual key codes (layout-dependent) SDL_Keycode :: enum u32 { @@ -220,8 +220,8 @@ SDL_Keycode :: enum u32 { SDL_WindowData :: struct { timestamp: u64; // event time in nanoseconds window_id: u32; - data1: s32; // event-dependent: x position for moved, width for resized - data2: s32; // event-dependent: y position for moved, height for resized + data1: i32; // event-dependent: x position for moved, width for resized + data2: i32; // event-dependent: y position for moved, height for resized } SDL_Keymod :: enum flags u16 { @@ -322,14 +322,14 @@ SDL_Event :: enum struct { tag: u32; _: u32; payload: [30]u32; } { // Functions SDL_Init :: (flags: u32) -> bool #foreign; SDL_Quit :: () -> void #foreign; -SDL_CreateWindow :: (title: [:0]u8, w: s32, h: s32, flags: u64) -> *void #foreign; +SDL_CreateWindow :: (title: [:0]u8, w: i32, h: i32, flags: u64) -> *void #foreign; SDL_DestroyWindow :: (window: *void) -> void #foreign; -SDL_GL_SetAttribute :: (attr: s32, value: s32) -> bool #foreign; +SDL_GL_SetAttribute :: (attr: i32, value: i32) -> bool #foreign; SDL_GL_CreateContext :: (window: *void) -> *void #foreign; SDL_GL_DestroyContext :: (context: *void) -> bool #foreign; SDL_GL_MakeCurrent :: (window: *void, context: *void) -> bool #foreign; SDL_GL_SwapWindow :: (window: *void) -> bool #foreign; -SDL_GL_SetSwapInterval :: (interval: s32) -> bool #foreign; +SDL_GL_SetSwapInterval :: (interval: i32) -> bool #foreign; SDL_GL_GetProcAddress :: (proc: [:0]u8) -> *void #foreign; SDL_PollEvent :: (event: *SDL_Event) -> bool #foreign; SDL_AddEventWatch :: (filter: *void, userdata: *void) -> bool #foreign; @@ -338,15 +338,15 @@ SDL_GetPerformanceCounter :: () -> u64 #foreign; SDL_GetPerformanceFrequency :: () -> u64 #foreign; SDL_Delay :: (ms: u32) -> void #foreign; SDL_GetWindowDisplayScale :: (window: *void) -> f32 #foreign; -SDL_GetWindowSize :: (window: *void, w: *s32, h: *s32) -> bool #foreign; -SDL_SetWindowSize :: (window: *void, w: s32, h: s32) -> bool #foreign; -SDL_GetWindowSizeInPixels :: (window: *void, w: *s32, h: *s32) -> bool #foreign; +SDL_GetWindowSize :: (window: *void, w: *i32, h: *i32) -> bool #foreign; +SDL_SetWindowSize :: (window: *void, w: i32, h: i32) -> bool #foreign; +SDL_GetWindowSizeInPixels :: (window: *void, w: *i32, h: *i32) -> bool #foreign; SDL_Rect :: struct { - x: s32; - y: s32; - w: s32; - h: s32; + x: i32; + y: i32; + w: i32; + h: i32; } SDL_GetPrimaryDisplay :: () -> u32 #foreign; diff --git a/library/modules/ffi/wasm.sx b/library/modules/ffi/wasm.sx index 3486f13..5c06ade 100644 --- a/library/modules/ffi/wasm.sx +++ b/library/modules/ffi/wasm.sx @@ -1,4 +1,4 @@ libc :: #library "c"; -emscripten_set_main_loop :: (func: *void, fps: s32, sim_infinite: s32) #foreign libc; -emscripten_run_script_int :: (script: [:0]u8) -> s32 #foreign libc; +emscripten_set_main_loop :: (func: *void, fps: i32, sim_infinite: i32) #foreign libc; +emscripten_run_script_int :: (script: [:0]u8) -> i32 #foreign libc; diff --git a/library/modules/gpu/api.sx b/library/modules/gpu/api.sx index 115d99a..33e5ba2 100644 --- a/library/modules/gpu/api.sx +++ b/library/modules/gpu/api.sx @@ -11,10 +11,10 @@ GPU :: protocol { // Bind the GPU to a backend-specific render target (e.g. a // CAMetalLayer on iOS). pixel_w/pixel_h are the drawable's pixel // dimensions; call resize when they change. - init :: (target: *void, pixel_w: s32, pixel_h: s32) -> bool; + init :: (target: *void, pixel_w: i32, pixel_h: i32) -> bool; shutdown :: (); - resize :: (pixel_w: s32, pixel_h: s32); + resize :: (pixel_w: i32, pixel_h: i32); begin_frame :: (clear: ClearColor) -> bool; @@ -26,17 +26,17 @@ GPU :: protocol { end_frame :: (target_time: f64); create_shader :: (vsrc: string, fsrc: string) -> ShaderHandle; - create_buffer :: (size_bytes: s64) -> BufferHandle; - update_buffer :: (buf: BufferHandle, data: *void, size_bytes: s64); + create_buffer :: (size_bytes: i64) -> BufferHandle; + update_buffer :: (buf: BufferHandle, data: *void, size_bytes: i64); // Sub-buffer write at a byte offset. Required for Metal where re-using // the same buffer slice across multiple draws in a single command // encoder is a race: the GPU executes draws asynchronously and reads // shared-storage buffer contents at execution time, so the LAST writer // wins if every flush targets offset 0. Renderers that issue more than // one draw per frame must advance their write offset between flushes. - update_buffer_at :: (buf: BufferHandle, data: *void, size_bytes: s64, byte_offset: s64); - create_texture :: (w: s32, h: s32, format: TextureFormat, pixels: *void) -> TextureHandle; - update_texture_region :: (tex: TextureHandle, x: s32, y: s32, w: s32, h: s32, pixels: *void); + update_buffer_at :: (buf: BufferHandle, data: *void, size_bytes: i64, byte_offset: i64); + create_texture :: (w: i32, h: i32, format: TextureFormat, pixels: *void) -> TextureHandle; + update_texture_region :: (tex: TextureHandle, x: i32, y: i32, w: i32, h: i32, pixels: *void); // Release a GPU resource. Implementations release the backing object and // null the slot so the handle becomes inert. Calling with handle 0 or @@ -49,9 +49,9 @@ GPU :: protocol { set_shader :: (sh: ShaderHandle); set_vertex_buffer :: (buf: BufferHandle); set_texture :: (slot: u32, tex: TextureHandle); - set_vertex_constants :: (slot: u32, data: *void, size_bytes: s64); - set_scissor :: (x: s32, y: s32, w: s32, h: s32); + set_vertex_constants :: (slot: u32, data: *void, size_bytes: i64); + set_scissor :: (x: i32, y: i32, w: i32, h: i32); disable_scissor :: (); - draw_triangles :: (vertex_offset: s32, vertex_count: s32); + draw_triangles :: (vertex_offset: i32, vertex_count: i32); } diff --git a/library/modules/gpu/gles3.sx b/library/modules/gpu/gles3.sx index 05dc2d8..6ab0b02 100644 --- a/library/modules/gpu/gles3.sx +++ b/library/modules/gpu/gles3.sx @@ -48,13 +48,13 @@ Gles3TextureSlot :: struct { Gles3ShaderSlot :: struct { program: u32 = 0; - proj_loc: s32 = 0 - 1; - tex_loc: s32 = 0 - 1; + proj_loc: i32 = 0 - 1; + tex_loc: i32 = 0 - 1; } Gles3Gpu :: struct { - pixel_w: s32 = 0; - pixel_h: s32 = 0; + pixel_w: i32 = 0; + pixel_h: i32 = 0; // The renderer's vertex layout is fixed (see file header). One VAO, // reused across every set_vertex_buffer. @@ -82,7 +82,7 @@ impl GPU for Gles3Gpu { // single shared VAO. Must be called once the EGL context is // current (AndroidPlatform.run_frame_loop ensures this before // invoking the user's per-frame closure). `target` is unused. - init :: (self: *Gles3Gpu, target: *void, pixel_w: s32, pixel_h: s32) -> bool { + init :: (self: *Gles3Gpu, target: *void, pixel_w: i32, pixel_h: i32) -> bool { inline if OS != .android { return false; } self.pixel_w = pixel_w; self.pixel_h = pixel_h; @@ -110,7 +110,7 @@ impl GPU for Gles3Gpu { // happens when the NativeActivity tears down). } - resize :: (self: *Gles3Gpu, pixel_w: s32, pixel_h: s32) { + resize :: (self: *Gles3Gpu, pixel_w: i32, pixel_h: i32) { self.pixel_w = pixel_w; self.pixel_h = pixel_h; } @@ -145,7 +145,7 @@ impl GPU for Gles3Gpu { xx self.shaders.len } - create_buffer :: (self: *Gles3Gpu, size_bytes: s64) -> BufferHandle { + create_buffer :: (self: *Gles3Gpu, size_bytes: i64) -> BufferHandle { inline if OS != .android { return 0; } if size_bytes <= 0 { return 0; } b : u32 = 0; @@ -156,7 +156,7 @@ impl GPU for Gles3Gpu { xx self.buffers.len } - update_buffer :: (self: *Gles3Gpu, handle: BufferHandle, data: *void, size_bytes: s64) { + update_buffer :: (self: *Gles3Gpu, handle: BufferHandle, data: *void, size_bytes: i64) { inline if OS != .android { return; } buf := gles3_lookup_buffer(self, handle); if buf == 0 { return; } @@ -166,7 +166,7 @@ impl GPU for Gles3Gpu { glBufferSubData(GL_ARRAY_BUFFER, 0, xx size_bytes, data); } - update_buffer_at :: (self: *Gles3Gpu, handle: BufferHandle, data: *void, size_bytes: s64, byte_offset: s64) { + update_buffer_at :: (self: *Gles3Gpu, handle: BufferHandle, data: *void, size_bytes: i64, byte_offset: i64) { inline if OS != .android { return; } buf := gles3_lookup_buffer(self, handle); if buf == 0 { return; } @@ -177,12 +177,12 @@ impl GPU for Gles3Gpu { glBufferSubData(GL_ARRAY_BUFFER, xx byte_offset, xx size_bytes, data); } - create_texture :: (self: *Gles3Gpu, w: s32, h: s32, format: TextureFormat, pixels: *void) -> TextureHandle { + create_texture :: (self: *Gles3Gpu, w: i32, h: i32, format: TextureFormat, pixels: *void) -> TextureHandle { inline if OS != .android { return 0; } if w <= 0 { return 0; } if h <= 0 { return 0; } - internal_fmt : s32 = 0; + internal_fmt : i32 = 0; ext_fmt : u32 = 0; bpp : u32 = 0; if format == .rgba8 { @@ -210,10 +210,10 @@ impl GPU for Gles3Gpu { xx self.textures.len } - update_texture_region :: (self: *Gles3Gpu, handle: TextureHandle, x: s32, y: s32, w: s32, h: s32, pixels: *void) { + update_texture_region :: (self: *Gles3Gpu, handle: TextureHandle, x: i32, y: i32, w: i32, h: i32, pixels: *void) { inline if OS != .android { return; } if handle == 0 { return; } - h64 : s64 = xx handle; + h64 : i64 = xx handle; if h64 > self.textures.len { return; } slot := self.textures.items[handle - 1]; if slot.tex == 0 { return; } @@ -235,7 +235,7 @@ impl GPU for Gles3Gpu { destroy_texture :: (self: *Gles3Gpu, tex: TextureHandle) { inline if OS != .android { return; } if tex == 0 { return; } - h64 : s64 = xx tex; + h64 : i64 = xx tex; if h64 > self.textures.len { return; } t := self.textures.items[tex - 1].tex; if t == 0 { return; } @@ -248,7 +248,7 @@ impl GPU for Gles3Gpu { set_shader :: (self: *Gles3Gpu, handle: ShaderHandle) { inline if OS != .android { return; } if handle == 0 { return; } - h64 : s64 = xx handle; + h64 : i64 = xx handle; if h64 > self.shaders.len { return; } prog := self.shaders.items[handle - 1].program; if prog == 0 { return; } @@ -280,14 +280,14 @@ impl GPU for Gles3Gpu { inline if OS != .android { return; } if slot != 0 { return; } // renderer only uses unit 0 if handle == 0 { return; } - h64 : s64 = xx handle; + h64 : i64 = xx handle; if h64 > self.textures.len { return; } t := self.textures.items[handle - 1].tex; if t == 0 { return; } glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, t); if self.current_shader != 0 { - cs64 : s64 = xx self.current_shader; + cs64 : i64 = xx self.current_shader; if cs64 <= self.shaders.len { loc := self.shaders.items[self.current_shader - 1].tex_loc; if loc >= 0 { glUniform1i(loc, 0); } @@ -298,19 +298,19 @@ impl GPU for Gles3Gpu { // For slot 1 + 64 bytes the renderer is uploading the 4x4 projection // matrix into `uniform mat4 uProj`. Look up via the current shader's // cached uniform location. - set_vertex_constants :: (self: *Gles3Gpu, slot: u32, data: *void, size_bytes: s64) { + set_vertex_constants :: (self: *Gles3Gpu, slot: u32, data: *void, size_bytes: i64) { inline if OS != .android { return; } if slot != 1 { return; } if size_bytes != 64 { return; } if self.current_shader == 0 { return; } - cs64 : s64 = xx self.current_shader; + cs64 : i64 = xx self.current_shader; if cs64 > self.shaders.len { return; } loc := self.shaders.items[self.current_shader - 1].proj_loc; if loc < 0 { return; } glUniformMatrix4fv(loc, 1, 0, xx data); } - set_scissor :: (self: *Gles3Gpu, x: s32, y: s32, w: s32, h: s32) { + set_scissor :: (self: *Gles3Gpu, x: i32, y: i32, w: i32, h: i32) { inline if OS != .android { return; } glEnable(GL_SCISSOR_TEST); glScissor(x, self.pixel_h - (y + h), w, h); @@ -321,7 +321,7 @@ impl GPU for Gles3Gpu { glDisable(GL_SCISSOR_TEST); } - draw_triangles :: (self: *Gles3Gpu, vertex_offset: s32, vertex_count: s32) { + draw_triangles :: (self: *Gles3Gpu, vertex_offset: i32, vertex_count: i32) { inline if OS != .android { return; } if vertex_count <= 0 { return; } glDrawArrays(GL_TRIANGLES, vertex_offset, vertex_count); @@ -331,7 +331,7 @@ impl GPU for Gles3Gpu { gles3_lookup_buffer :: (self: *Gles3Gpu, handle: u32) -> u32 { inline if OS != .android { return 0; } if handle == 0 { return 0; } - h64 : s64 = xx handle; + h64 : i64 = xx handle; if h64 > self.buffers.len { return 0; } self.buffers.items[handle - 1] } diff --git a/library/modules/gpu/metal.sx b/library/modules/gpu/metal.sx index 36d475b..4287547 100644 --- a/library/modules/gpu/metal.sx +++ b/library/modules/gpu/metal.sx @@ -75,8 +75,8 @@ MetalGPU :: struct { device: *void = null; // id queue: *void = null; // id layer: *void = null; // CAMetalLayer* - pixel_w: s32 = 0; - pixel_h: s32 = 0; + pixel_w: i32 = 0; + pixel_h: i32 = 0; // Per-frame transients. Live only between begin_frame and end_frame. drawable: *void = null; // id @@ -100,7 +100,7 @@ impl GPU for MetalGPU { // UIKit hands us a layer), then re-call `init(layer, w, h)` once the // CAMetalLayer is available. The second call only updates the layer // ref + dims; device/queue are preserved. - init :: (self: *MetalGPU, target: *void, pixel_w: s32, pixel_h: s32) -> bool { + init :: (self: *MetalGPU, target: *void, pixel_w: i32, pixel_h: i32) -> bool { inline if OS != .ios { return false; } if target != null { self.layer = target; @@ -116,7 +116,7 @@ impl GPU for MetalGPU { // would send `release` to queue + device. } - resize :: (self: *MetalGPU, pixel_w: s32, pixel_h: s32) { + resize :: (self: *MetalGPU, pixel_w: i32, pixel_h: i32) { self.pixel_w = pixel_w; self.pixel_h = pixel_h; inline if OS == .ios { @@ -145,29 +145,29 @@ impl GPU for MetalGPU { metal_create_shader_ios(self, vsrc) } - create_buffer :: (self: *MetalGPU, size_bytes: s64) -> BufferHandle { + create_buffer :: (self: *MetalGPU, size_bytes: i64) -> BufferHandle { inline if OS != .ios { return 0; } metal_create_buffer_ios(self, size_bytes) } - update_buffer :: (self: *MetalGPU, buf: BufferHandle, data: *void, size_bytes: s64) { + update_buffer :: (self: *MetalGPU, buf: BufferHandle, data: *void, size_bytes: i64) { inline if OS == .ios { metal_update_buffer_ios(self, buf, data, size_bytes); } } - update_buffer_at :: (self: *MetalGPU, buf: BufferHandle, data: *void, size_bytes: s64, byte_offset: s64) { + update_buffer_at :: (self: *MetalGPU, buf: BufferHandle, data: *void, size_bytes: i64, byte_offset: i64) { inline if OS == .ios { metal_update_buffer_at_ios(self, buf, data, size_bytes, byte_offset); } } - create_texture :: (self: *MetalGPU, w: s32, h: s32, format: TextureFormat, pixels: *void) -> TextureHandle { + create_texture :: (self: *MetalGPU, w: i32, h: i32, format: TextureFormat, pixels: *void) -> TextureHandle { inline if OS != .ios { return 0; } metal_create_texture_ios(self, w, h, format, pixels) } - update_texture_region :: (self: *MetalGPU, tex: TextureHandle, x: s32, y: s32, w: s32, h: s32, pixels: *void) { + update_texture_region :: (self: *MetalGPU, tex: TextureHandle, x: i32, y: i32, w: i32, h: i32, pixels: *void) { inline if OS == .ios { metal_update_texture_region_ios(self, tex, x, y, w, h, pixels); } @@ -213,13 +213,13 @@ impl GPU for MetalGPU { } } - set_vertex_constants :: (self: *MetalGPU, slot: u32, data: *void, size_bytes: s64) { + set_vertex_constants :: (self: *MetalGPU, slot: u32, data: *void, size_bytes: i64) { inline if OS == .ios { metal_set_vertex_constants_ios(self, slot, data, size_bytes); } } - set_scissor :: (self: *MetalGPU, x: s32, y: s32, w: s32, h: s32) { + set_scissor :: (self: *MetalGPU, x: i32, y: i32, w: i32, h: i32) { inline if OS == .ios { metal_set_scissor_ios(self, x, y, w, h); } @@ -231,7 +231,7 @@ impl GPU for MetalGPU { } } - draw_triangles :: (self: *MetalGPU, vertex_offset: s32, vertex_count: s32) { + draw_triangles :: (self: *MetalGPU, vertex_offset: i32, vertex_count: i32) { inline if OS == .ios { metal_draw_triangles_ios(self, vertex_offset, vertex_count); } @@ -446,7 +446,7 @@ metal_create_shader_ios :: (self: *MetalGPU, src: string) -> u32 { // Shared-memory MTLBuffer (CPU + GPU visible on UMA hardware). `contents` // returns the mapped pointer for memcpy uploads. -metal_create_buffer_ios :: (self: *MetalGPU, size_bytes: s64) -> u32 { +metal_create_buffer_ios :: (self: *MetalGPU, size_bytes: i64) -> u32 { inline if OS != .ios { return 0; } if self.device == null { return 0; } if size_bytes <= 0 { return 0; } @@ -462,7 +462,7 @@ metal_create_buffer_ios :: (self: *MetalGPU, size_bytes: s64) -> u32 { xx self.buffers.len } -metal_update_buffer_ios :: (self: *MetalGPU, handle: u32, data: *void, size_bytes: s64) { +metal_update_buffer_ios :: (self: *MetalGPU, handle: u32, data: *void, size_bytes: i64) { inline if OS != .ios { return; } buf := metal_lookup_buffer(self, handle); if buf == null { return; } @@ -475,7 +475,7 @@ metal_update_buffer_ios :: (self: *MetalGPU, handle: u32, data: *void, size_byte memcpy(dst, data, size_bytes); } -metal_update_buffer_at_ios :: (self: *MetalGPU, handle: u32, data: *void, size_bytes: s64, byte_offset: s64) { +metal_update_buffer_at_ios :: (self: *MetalGPU, handle: u32, data: *void, size_bytes: i64, byte_offset: i64) { inline if OS != .ios { return; } buf := metal_lookup_buffer(self, handle); if buf == null { return; } @@ -489,7 +489,7 @@ metal_update_buffer_at_ios :: (self: *MetalGPU, handle: u32, data: *void, size_b // Add byte_offset via integer arithmetic — `@dst[i]` on `[*]u8` // already does this, but we keep this form explicit so a future // pointer-arithmetic regression here can't hide. - base_i : s64 = xx base; + base_i : i64 = xx base; dst_at : *void = xx (base_i + byte_offset); memcpy(dst_at, data, size_bytes); } @@ -497,7 +497,7 @@ metal_update_buffer_at_ios :: (self: *MetalGPU, handle: u32, data: *void, size_b metal_lookup_buffer :: (self: *MetalGPU, handle: u32) -> *void { inline if OS != .ios { return null; } if handle == 0 { return null; } - h64 : s64 = xx handle; + h64 : i64 = xx handle; if h64 > self.buffers.len { return null; } self.buffers.items[handle - 1] } @@ -505,14 +505,14 @@ metal_lookup_buffer :: (self: *MetalGPU, handle: u32) -> *void { metal_lookup_shader :: (self: *MetalGPU, handle: u32) -> *void { inline if OS != .ios { return null; } if handle == 0 { return null; } - h64 : s64 = xx handle; + h64 : i64 = xx handle; if h64 > self.shaders.len { return null; } self.shaders.items[handle - 1] } // ── Textures ───────────────────────────────────────────────────────────── -metal_create_texture_ios :: (self: *MetalGPU, w: s32, h: s32, format: TextureFormat, pixels: *void) -> u32 { +metal_create_texture_ios :: (self: *MetalGPU, w: i32, h: i32, format: TextureFormat, pixels: *void) -> u32 { inline if OS != .ios { return 0; } if self.device == null { return 0; } if w <= 0 { return 0; } @@ -557,10 +557,10 @@ metal_create_texture_ios :: (self: *MetalGPU, w: s32, h: s32, format: TextureFor xx self.textures.len } -metal_update_texture_region_ios :: (self: *MetalGPU, handle: u32, x: s32, y: s32, w: s32, h: s32, pixels: *void) { +metal_update_texture_region_ios :: (self: *MetalGPU, handle: u32, x: i32, y: i32, w: i32, h: i32, pixels: *void) { inline if OS != .ios { return; } if handle == 0 { return; } - h64 : s64 = xx handle; + h64 : i64 = xx handle; if h64 > self.textures.len { return; } slot := self.textures.items[handle - 1]; if slot.tex == null { return; } @@ -592,7 +592,7 @@ metal_update_texture_region_ios :: (self: *MetalGPU, handle: u32, x: s32, y: s32 metal_destroy_shader_ios :: (self: *MetalGPU, handle: u32) { inline if OS != .ios { return; } if handle == 0 { return; } - h64 : s64 = xx handle; + h64 : i64 = xx handle; if h64 > self.shaders.len { return; } obj := self.shaders.items[handle - 1]; if obj == null { return; } @@ -604,7 +604,7 @@ metal_destroy_shader_ios :: (self: *MetalGPU, handle: u32) { metal_destroy_buffer_ios :: (self: *MetalGPU, handle: u32) { inline if OS != .ios { return; } if handle == 0 { return; } - h64 : s64 = xx handle; + h64 : i64 = xx handle; if h64 > self.buffers.len { return; } obj := self.buffers.items[handle - 1]; if obj == null { return; } @@ -616,7 +616,7 @@ metal_destroy_buffer_ios :: (self: *MetalGPU, handle: u32) { metal_destroy_texture_ios :: (self: *MetalGPU, handle: u32) { inline if OS != .ios { return; } if handle == 0 { return; } - h64 : s64 = xx handle; + h64 : i64 = xx handle; if h64 > self.textures.len { return; } obj := self.textures.items[handle - 1].tex; if obj == null { return; } @@ -651,7 +651,7 @@ metal_set_texture_ios :: (self: *MetalGPU, slot: u32, h: u32) { inline if OS != .ios { return; } if self.encoder == null { return; } if h == 0 { return; } - h64 : s64 = xx h; + h64 : i64 = xx h; if h64 > self.textures.len { return; } tex := self.textures.items[h - 1].tex; if tex == null { return; } @@ -660,7 +660,7 @@ metal_set_texture_ios :: (self: *MetalGPU, slot: u32, h: u32) { msg(self.encoder, sel_registerName("setFragmentTexture:atIndex:".ptr), tex, xx slot); } -metal_set_vertex_constants_ios :: (self: *MetalGPU, slot: u32, data: *void, size_bytes: s64) { +metal_set_vertex_constants_ios :: (self: *MetalGPU, slot: u32, data: *void, size_bytes: i64) { inline if OS != .ios { return; } if self.encoder == null { return; } if data == null { return; } @@ -671,7 +671,7 @@ metal_set_vertex_constants_ios :: (self: *MetalGPU, slot: u32, data: *void, size data, xx size_bytes, xx slot); } -metal_set_scissor_ios :: (self: *MetalGPU, x: s32, y: s32, w: s32, h: s32) { +metal_set_scissor_ios :: (self: *MetalGPU, x: i32, y: i32, w: i32, h: i32) { inline if OS != .ios { return; } if self.encoder == null { return; } rect : MTLScissorRect = .{ x = xx x, y = xx y, width = xx w, height = xx h }; @@ -690,7 +690,7 @@ metal_disable_scissor_ios :: (self: *MetalGPU) { msg(self.encoder, sel_registerName("setScissorRect:".ptr), rect); } -metal_draw_triangles_ios :: (self: *MetalGPU, vertex_offset: s32, vertex_count: s32) { +metal_draw_triangles_ios :: (self: *MetalGPU, vertex_offset: i32, vertex_count: i32) { inline if OS != .ios { return; } if self.encoder == null { return; } if vertex_count <= 0 { return; } diff --git a/library/modules/platform/android.sx b/library/modules/platform/android.sx index f12f466..f2c4a28 100644 --- a/library/modules/platform/android.sx +++ b/library/modules/platform/android.sx @@ -56,7 +56,7 @@ SurfaceView :: #foreign #jni_class("android/view/SurfaceView") { SurfaceHolderCallback :: #foreign #jni_class("android/view/SurfaceHolder$Callback") { } MotionEvent :: #foreign #jni_class("android/view/MotionEvent") { - getAction :: (self: *Self) -> s32; + getAction :: (self: *Self) -> i32; getX :: (self: *Self) -> f32; getY :: (self: *Self) -> f32; } @@ -72,23 +72,23 @@ ActivityClass :: #foreign #jni_class("android/app/Activity") { // can route through `AAssetManager_open` when running on Android. sx_android_set_asset_manager :: (mgr: *void) #foreign; -__android_log_print :: (prio: s32, tag: *u8, fmt: *u8) -> s32 #foreign; -usleep :: (us: u32) -> s32 #foreign; +__android_log_print :: (prio: i32, tag: *u8, fmt: *u8) -> i32 #foreign; +usleep :: (us: u32) -> i32 #foreign; // libandroid ANativeWindow_fromSurface :: (env: *void, surface: *void) -> *void #foreign; ANativeWindow_release :: (window: *void) #foreign; -ANativeWindow_getWidth :: (window: *void) -> s32 #foreign; -ANativeWindow_getHeight :: (window: *void) -> s32 #foreign; -ANativeWindow_setBuffersGeometry :: (w: *void, width: s32, height: s32, fmt: s32) -> s32 #foreign; +ANativeWindow_getWidth :: (window: *void) -> i32 #foreign; +ANativeWindow_getHeight :: (window: *void) -> i32 #foreign; +ANativeWindow_setBuffersGeometry :: (w: *void, width: i32, height: i32, fmt: i32) -> i32 #foreign; AAssetManager_fromJava :: (env: *void, mgr: *void) -> *void #foreign; // pthread (link libpthread is built into bionic). -pthread_create :: (thread: *u64, attr: *void, start: (*void) -> *void callconv(.c), arg: *void) -> s32 #foreign; -pthread_mutex_init :: (m: *void, attr: *void) -> s32 #foreign; -pthread_mutex_lock :: (m: *void) -> s32 #foreign; -pthread_mutex_unlock :: (m: *void) -> s32 #foreign; +pthread_create :: (thread: *u64, attr: *void, start: (*void) -> *void callconv(.c), arg: *void) -> i32 #foreign; +pthread_mutex_init :: (m: *void, attr: *void) -> i32 #foreign; +pthread_mutex_lock :: (m: *void) -> i32 #foreign; +pthread_mutex_unlock :: (m: *void) -> i32 #foreign; // EGL. Constants from . We bring up an ES3 context with a // 24-bit RGB framebuffer + 24-bit depth (same shape chess used under @@ -99,25 +99,25 @@ EGL_NO_CONTEXT :*void: null; EGL_NO_SURFACE :*void: null; EGL_TRUE :u32: 1; EGL_FALSE :u32: 0; -EGL_NONE :s32: 0x3038; -EGL_RED_SIZE :s32: 0x3024; -EGL_GREEN_SIZE :s32: 0x3023; -EGL_BLUE_SIZE :s32: 0x3022; -EGL_ALPHA_SIZE :s32: 0x3021; -EGL_DEPTH_SIZE :s32: 0x3025; -EGL_RENDERABLE_TYPE :s32: 0x3040; -EGL_SURFACE_TYPE :s32: 0x3033; -EGL_OPENGL_ES3_BIT :s32: 0x00000040; -EGL_WINDOW_BIT :s32: 0x0004; -EGL_NATIVE_VISUAL_ID :s32: 0x302E; -EGL_CONTEXT_CLIENT_VERSION :s32: 0x3098; +EGL_NONE :i32: 0x3038; +EGL_RED_SIZE :i32: 0x3024; +EGL_GREEN_SIZE :i32: 0x3023; +EGL_BLUE_SIZE :i32: 0x3022; +EGL_ALPHA_SIZE :i32: 0x3021; +EGL_DEPTH_SIZE :i32: 0x3025; +EGL_RENDERABLE_TYPE :i32: 0x3040; +EGL_SURFACE_TYPE :i32: 0x3033; +EGL_OPENGL_ES3_BIT :i32: 0x00000040; +EGL_WINDOW_BIT :i32: 0x0004; +EGL_NATIVE_VISUAL_ID :i32: 0x302E; +EGL_CONTEXT_CLIENT_VERSION :i32: 0x3098; eglGetDisplay :: (id: u64) -> *void #foreign; -eglInitialize :: (d: *void, major: *s32, minor: *s32) -> u32 #foreign; -eglChooseConfig :: (d: *void, attrs: *s32, configs: **void, sz: s32, num: *s32) -> u32 #foreign; -eglGetConfigAttrib :: (d: *void, cfg: *void, attr: s32, value: *s32) -> u32 #foreign; -eglCreateContext :: (d: *void, cfg: *void, share: *void, attrs: *s32) -> *void #foreign; -eglCreateWindowSurface :: (d: *void, cfg: *void, window: *void, attrs: *s32) -> *void #foreign; +eglInitialize :: (d: *void, major: *i32, minor: *i32) -> u32 #foreign; +eglChooseConfig :: (d: *void, attrs: *i32, configs: **void, sz: i32, num: *i32) -> u32 #foreign; +eglGetConfigAttrib :: (d: *void, cfg: *void, attr: i32, value: *i32) -> u32 #foreign; +eglCreateContext :: (d: *void, cfg: *void, share: *void, attrs: *i32) -> *void #foreign; +eglCreateWindowSurface :: (d: *void, cfg: *void, window: *void, attrs: *i32) -> *void #foreign; eglMakeCurrent :: (d: *void, draw: *void, read: *void, ctx: *void) -> u32 #foreign; eglSwapBuffers :: (d: *void, surface: *void) -> u32 #foreign; eglDestroyContext :: (d: *void, ctx: *void) -> u32 #foreign; @@ -127,7 +127,7 @@ eglTerminate :: (d: *void) -> u32 #foreign; // ── Touch ring ────────────────────────────────────────────────────────── TouchEvent :: struct { - action: s32; + action: i32; x: f32; y: f32; } @@ -136,10 +136,10 @@ TouchEvent :: struct { // // Every per-instance piece of state — EGL handles, ANativeWindow, render // thread, touch ring + mutex, frame closure, user main fn — lives here. -// No module-level globals: a previous shape had `g_viewport_w : s32` at +// No module-level globals: a previous shape had `g_viewport_w : i32` at // module scope, which silently shadowed chess's own // `g_viewport_w : f32` on `#import` and caused the renderer to receive -// a logical width cast to s32 instead of the physical pixel width. +// a logical width cast to i32 instead of the physical pixel width. // // `logical_w` is the consumer's design width in points (e.g. chess sets // 414 to match an iPhone 12 layout). `begin_frame` derives `dpi_scale` @@ -149,8 +149,8 @@ TouchEvent :: struct { AndroidPlatform :: struct { title: [:0]u8 = ""; - width: s32 = 0; - height: s32 = 0; + width: i32 = 0; + height: i32 = 0; // Set by consumer code BEFORE `init` if a fixed design width is // wanted (chess uses 414). When 0, the platform reports @@ -168,8 +168,8 @@ AndroidPlatform :: struct { // Pixel-size from ANativeWindow_get{Width,Height}; derived dpi_scale // (pixel_w / logical_w when logical_w > 0, else 1.0). - pixel_w: s32 = 0; - pixel_h: s32 = 0; + pixel_w: i32 = 0; + pixel_h: i32 = 0; dpi_scale: f32 = 1.0; // Render thread lifecycle. `user_main_fn` is the consumer's `main` @@ -238,7 +238,7 @@ sx_android_detach_window :: (plat: *AndroidPlatform) { } } -sx_android_set_viewport :: (plat: *AndroidPlatform, w: s32, h: s32) { +sx_android_set_viewport :: (plat: *AndroidPlatform, w: i32, h: i32) { plat.pixel_w = w; plat.pixel_h = h; sx_android_recompute_scale(plat); @@ -280,11 +280,11 @@ sx_android_egl_init :: (plat: *AndroidPlatform) -> bool { plat.egl_display = eglGetDisplay(EGL_DEFAULT_DISPLAY); if plat.egl_display == EGL_NO_DISPLAY { return false; } - major : s32 = 0; - minor : s32 = 0; + major : i32 = 0; + minor : i32 = 0; if eglInitialize(plat.egl_display, @major, @minor) == EGL_FALSE { return false; } - cfg_attrs : [13]s32 = .{ + cfg_attrs : [13]i32 = .{ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT, EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_RED_SIZE, 8, @@ -293,15 +293,15 @@ sx_android_egl_init :: (plat: *AndroidPlatform) -> bool { EGL_DEPTH_SIZE, 24, EGL_NONE, }; - num_cfg : s32 = 0; + num_cfg : i32 = 0; if eglChooseConfig(plat.egl_display, @cfg_attrs[0], @plat.egl_config, 1, @num_cfg) == EGL_FALSE { return false; } if num_cfg < 1 { return false; } - visual_id : s32 = 0; + visual_id : i32 = 0; eglGetConfigAttrib(plat.egl_display, plat.egl_config, EGL_NATIVE_VISUAL_ID, @visual_id); ANativeWindow_setBuffersGeometry(plat.app_window, 0, 0, visual_id); - ctx_attrs : [3]s32 = .{ EGL_CONTEXT_CLIENT_VERSION, 3, EGL_NONE }; + ctx_attrs : [3]i32 = .{ EGL_CONTEXT_CLIENT_VERSION, 3, EGL_NONE }; plat.egl_context = eglCreateContext(plat.egl_display, plat.egl_config, EGL_NO_CONTEXT, @ctx_attrs[0]); if plat.egl_context == EGL_NO_CONTEXT { return false; } @@ -329,7 +329,7 @@ sx_android_recompute_scale :: (plat: *AndroidPlatform) { // ── Touch event queue ─────────────────────────────────────────────────── -sx_android_push_touch :: (plat: *AndroidPlatform, action: s32, x: f32, y: f32) { +sx_android_push_touch :: (plat: *AndroidPlatform, action: i32, x: f32, y: f32) { sx_android_ensure_touch_mutex(plat); pthread_mutex_lock(xx @plat.touch_mutex_storage[0]); next := (plat.touch_tail + 1) % 64; @@ -373,7 +373,7 @@ sx_android_ensure_touch_mutex :: (plat: *AndroidPlatform) { // ── Platform impl ─────────────────────────────────────────────────────── impl Platform for AndroidPlatform { - init :: (self: *AndroidPlatform, title: [:0]u8, w: s32, h: s32) -> bool { + init :: (self: *AndroidPlatform, title: [:0]u8, w: i32, h: i32) -> bool { self.title = title; self.width = w; self.height = h; diff --git a/library/modules/platform/android_jni.sx b/library/modules/platform/android_jni.sx index 22e27b3..2e9a26b 100644 --- a/library/modules/platform/android_jni.sx +++ b/library/modules/platform/android_jni.sx @@ -12,10 +12,10 @@ // against the bare name within the namespace. WindowInsets :: #foreign #jni_class("android/view/WindowInsets") { - getSystemWindowInsetTop :: (self: *Self) -> s32; - getSystemWindowInsetLeft :: (self: *Self) -> s32; - getSystemWindowInsetBottom :: (self: *Self) -> s32; - getSystemWindowInsetRight :: (self: *Self) -> s32; + getSystemWindowInsetTop :: (self: *Self) -> i32; + getSystemWindowInsetLeft :: (self: *Self) -> i32; + getSystemWindowInsetBottom :: (self: *Self) -> i32; + getSystemWindowInsetRight :: (self: *Self) -> i32; } View :: #foreign #jni_class("android/view/View") { diff --git a/library/modules/platform/api.sx b/library/modules/platform/api.sx index 16747cf..7edf0dd 100644 --- a/library/modules/platform/api.sx +++ b/library/modules/platform/api.sx @@ -4,7 +4,7 @@ #import "modules/platform/types.sx"; Platform :: protocol { - init :: (title: [:0]u8, w: s32, h: s32) -> bool; + init :: (title: [:0]u8, w: i32, h: i32) -> bool; run_frame_loop :: (frame_fn: Closure()); diff --git a/library/modules/platform/bundle.sx b/library/modules/platform/bundle.sx index 1ba610d..9216125 100644 --- a/library/modules/platform/bundle.sx +++ b/library/modules/platform/bundle.sx @@ -130,7 +130,7 @@ bundle_main :: () -> bool { // Android (Week 7) will zip them into the APK at the same relative path. // Recursive copy shells out to `cp -R` until fs.sx grows `list_dir`. asset_count := opts.asset_dir_count(); - j : s64 = 0; + j : i64 = 0; while j < asset_count { src := opts.asset_dir_src_at(j); dest := opts.asset_dir_dest_at(j); @@ -156,7 +156,7 @@ bundle_main :: () -> bool { out("error: bundle: cannot create Frameworks dir\n"); return false; } - i : s64 = 0; + i : i64 = 0; while i < fw_count { fw_name := opts.framework_at(i); if !embed_framework(opts, fw_name, fw_dir) { @@ -369,7 +369,7 @@ copy_asset_dir :: (src: string, dest: string, bundle: string) -> bool { embed_framework :: (opts: BuildOptions, name: string, dest_dir: string) -> bool { subdir := concat(name, ".framework"); path_count := opts.framework_path_count(); - i : s64 = 0; + i : i64 = 0; while i < path_count { base := opts.framework_path_at(i); candidate := concat(base, "/"); @@ -701,7 +701,7 @@ android_bundle_main :: (opts: BuildOptions, binary: string, apk_path: string, bu // path used a hardcoded `assets/` walk; the sx form respects every // `add_asset_dir(src, dest)` pair the user registered. asset_count := opts.asset_dir_count(); - j : s64 = 0; + j : i64 = 0; while j < asset_count { src := opts.asset_dir_src_at(j); dest := opts.asset_dir_dest_at(j); @@ -988,7 +988,7 @@ compile_jni_main_sources :: (opts: BuildOptions, stage: string, android_jar: str javac_files := ""; d8_files := ""; count := opts.jni_main_count(); - i : s64 = 0; + i : i64 = 0; while i < count { foreign := opts.jni_main_foreign_path_at(i); java_source := opts.jni_main_java_source_at(i); diff --git a/library/modules/platform/sdl3.sx b/library/modules/platform/sdl3.sx index 4fbf1ac..35258c8 100644 --- a/library/modules/platform/sdl3.sx +++ b/library/modules/platform/sdl3.sx @@ -11,7 +11,7 @@ g_sdl_plat : *SdlPlatform = null; -chdir :: (path: [*]u8) -> s32 #foreign; +chdir :: (path: [*]u8) -> i32 #foreign; SDL_GetBasePath :: () -> [*]u8 #foreign; // A macOS `.app` launched via Finder / `open` starts with CWD=`/`, so a @@ -26,7 +26,7 @@ sdl_chdir_to_bundle :: () { bp := SDL_GetBasePath(); if bp == null { return; } // Reorient only when the base path lives inside a `.app` bundle. - i : s64 = 0; + i : i64 = 0; found := false; while bp[i] != 0 { if bp[i] == 46 and bp[i + 1] == 97 and bp[i + 2] == 112 and bp[i + 3] == 112 { @@ -43,10 +43,10 @@ SdlPlatform :: struct { gl_ctx: *void = null; running: bool = true; - width: s32 = 0; - height: s32 = 0; - pixel_w: s32 = 0; - pixel_h: s32 = 0; + width: i32 = 0; + height: i32 = 0; + pixel_w: i32 = 0; + pixel_h: i32 = 0; dpi_scale: f32 = 1.0; delta_time: f32 = 0.008; @@ -59,7 +59,7 @@ SdlPlatform :: struct { } impl Platform for SdlPlatform { - init :: (self: *SdlPlatform, title: [:0]u8, w: s32, h: s32) -> bool { + init :: (self: *SdlPlatform, title: [:0]u8, w: i32, h: i32) -> bool { self.running = true; self.has_frame_closure = false; self.delta_time = 0.008; @@ -178,8 +178,8 @@ impl Platform for SdlPlatform { self.last_perf = current; inline if OS == .wasm { - new_w : s32 = 0; - new_h : s32 = 0; + new_w : i32 = 0; + new_h : i32 = 0; SDL_GetWindowSize(self.window, @new_w, @new_h); if new_w != self.width or new_h != self.height { self.width = new_w; diff --git a/library/modules/platform/types.sx b/library/modules/platform/types.sx index e005eea..722ff6b 100644 --- a/library/modules/platform/types.sx +++ b/library/modules/platform/types.sx @@ -5,8 +5,8 @@ FrameContext :: struct { viewport_w: f32; viewport_h: f32; - pixel_w: s32; - pixel_h: s32; + pixel_w: i32; + pixel_h: i32; dpi_scale: f32; delta_time: f32; // The host clock time at which the next vsync will present the frame diff --git a/library/modules/platform/uikit.sx b/library/modules/platform/uikit.sx index c4d7cfd..bdbac23 100644 --- a/library/modules/platform/uikit.sx +++ b/library/modules/platform/uikit.sx @@ -15,9 +15,9 @@ #import "modules/platform/types.sx"; #import "modules/platform/api.sx"; -UIApplicationMain :: (argc: s32, argv: *void, principal_class: *NSString, delegate_class: *NSString) -> s32 #foreign; +UIApplicationMain :: (argc: i32, argv: *void, principal_class: *NSString, delegate_class: *NSString) -> i32 #foreign; dlsym :: (handle: *void, name: [*]u8) -> *void #foreign; -chdir :: (path: [*]u8) -> s32 #foreign; +chdir :: (path: [*]u8) -> i32 #foreign; // QuartzCore's wall-clock helper used by CoreAnimation. Seconds since boot, // monotonic. We use it as the timebase for keyboard-inset lockstep so the @@ -67,7 +67,7 @@ NSValue :: #foreign #objc_class("NSValue") { NSNumber :: #foreign #objc_class("NSNumber") { #extends NSObject; // Class method (no `self: *Self` first param → static dispatch). - numberWithBool :: (b: s8) -> *NSNumber; + numberWithBool :: (b: i8) -> *NSNumber; // Instance value extractors. doubleValue :: (self: *Self) -> f64; unsignedLongValue :: (self: *Self) -> u64; @@ -128,7 +128,7 @@ CADisplayLink :: #foreign #objc_class("CADisplayLink") { CALayer :: #foreign #objc_class("CALayer") { #extends NSObject; - setOpaque :: (self: *Self, opaque: s8); + setOpaque :: (self: *Self, opaque: i8); } CAEAGLLayer :: #foreign #objc_class("CAEAGLLayer") { @@ -145,10 +145,10 @@ CAMetalLayer :: #foreign #objc_class("CAMetalLayer") { EAGLContext :: #foreign #objc_class("EAGLContext") { #extends NSObject; alloc :: () -> *EAGLContext; - initWithAPI :: (self: *Self, api: s32) -> *EAGLContext; + initWithAPI :: (self: *Self, api: i32) -> *EAGLContext; setCurrentContext :: (ctx: *EAGLContext); - renderbufferStorage_fromDrawable :: (self: *Self, target: u32, drawable: *void) -> s8; - presentRenderbuffer :: (self: *Self, target: u32) -> s8; + renderbufferStorage_fromDrawable :: (self: *Self, target: u32, drawable: *void) -> i8; + presentRenderbuffer :: (self: *Self, target: u32) -> i8; } // ── UIKit chrome (Phase 3.2 C4) ──────────────────────────────────────── @@ -166,8 +166,8 @@ UIScreen :: #foreign #objc_class("UIScreen") { // extend it so the runtime picks up the responder-chain behavior. UIResponder :: #foreign #objc_class("UIResponder") { #extends NSObject; - becomeFirstResponder :: (self: *Self) -> s8; - resignFirstResponder :: (self: *Self) -> s8; + becomeFirstResponder :: (self: *Self) -> i8; + resignFirstResponder :: (self: *Self) -> i8; } UIView :: #foreign #objc_class("UIView") { @@ -292,8 +292,8 @@ UIKitPlatform :: struct { viewport_w: f32 = 0.0; viewport_h: f32 = 0.0; - pixel_w: s32 = 0; - pixel_h: s32 = 0; + pixel_w: i32 = 0; + pixel_h: i32 = 0; dpi_scale: f32 = 1.0; delta_time: f32 = 0.016; @@ -334,7 +334,7 @@ UIKitPlatform :: struct { } impl Platform for UIKitPlatform { - init :: (self: *UIKitPlatform, title: [:0]u8, w: s32, h: s32) -> bool { + init :: (self: *UIKitPlatform, title: [:0]u8, w: i32, h: i32) -> bool { self.dpi_scale = 1.0; self.delta_time = 0.016; self.has_frame_closure = false; @@ -501,8 +501,8 @@ impl Platform for UIKitPlatform { glBindFramebuffer(GL_FRAMEBUFFER, self.framebuffer); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, self.color_renderbuffer); - pw : s32 = 0; - ph : s32 = 0; + pw : i32 = 0; + ph : i32 = 0; GL_RENDERBUFFER_WIDTH :u32: 0x8D42; GL_RENDERBUFFER_HEIGHT :u32: 0x8D43; glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, @pw); diff --git a/library/modules/std/cli.sx b/library/modules/std/cli.sx index 916945d..e33451b 100644 --- a/library/modules/std/cli.sx +++ b/library/modules/std/cli.sx @@ -38,11 +38,11 @@ libc :: #library "c"; // macOS C-runtime argv/argc accessors (crt_externs.h): // extern char ***_NSGetArgv(void); extern int *_NSGetArgc(void); // Each returns a pointer to the runtime's slot; dereference once for the -// `char**` / `int` the process was launched with. Declared as `*s64` / -// `*s32` since on 64-bit a `char***` is just a pointer to a pointer-sized +// `char**` / `int` the process was launched with. Declared as `*i64` / +// `*i32` since on 64-bit a `char***` is just a pointer to a pointer-sized // slot. -ns_get_argv :: () -> *s64 #foreign libc "_NSGetArgv"; -ns_get_argc :: () -> *s32 #foreign libc "_NSGetArgc"; +ns_get_argv :: () -> *i64 #foreign libc "_NSGetArgv"; +ns_get_argc :: () -> *i32 #foreign libc "_NSGetArgc"; // ===================================================================== // EXIT-CODE & `--json` CONTRACT (F3.3) — the minimal surface `dist` (and @@ -80,9 +80,9 @@ exit_usage :: () -> noreturn { proc.exit(EX_USAGE); } // Number of process arguments (argc). >= 1 for any normally-launched // process, since argv[0] is the executable path. -os_argc :: () -> s64 { +os_argc :: () -> i64 { inline if OS == { - case .macos: { return cast(s64) ns_get_argc().*; } + case .macos: { return cast(i64) ns_get_argc().*; } else: { out("std.cli: unsupported platform — only macOS is implemented (needs _NSGetArgv/_NSGetArgc).\n"); proc.exit(EX_UNAVAILABLE); @@ -102,8 +102,8 @@ os_argc :: () -> s64 { os_args :: (buf: []string) -> []string { inline if OS == { case .macos: { - argc := cast(s64) ns_get_argc().*; - argv : [*]s64 = xx ns_get_argv().*; + argc := cast(i64) ns_get_argc().*; + argv : [*]i64 = xx ns_get_argv().*; n := if argc > buf.len then buf.len else argc; i := 0; while i < n { @@ -216,7 +216,7 @@ FlagValue :: struct { // the failure names a flag rather than an input token (a missing required // flag sets `token` to the flag name). Diag :: struct { - index: s64 = -1; + index: i64 = -1; token: string = ""; } @@ -225,7 +225,7 @@ Diag :: struct { Parsed :: struct { group: string; command: string; - cmd_index: s64; + cmd_index: i64; json: bool; // `--json` mode: true iff `--json` is in argv rest: []string; spec: []FlagSpec; // view of the matched command's flag specs diff --git a/library/modules/std/core.sx b/library/modules/std/core.sx index 371c20f..4f1b4cb 100644 --- a/library/modules/std/core.sx +++ b/library/modules/std/core.sx @@ -8,27 +8,27 @@ out :: (str: string) -> void #builtin; // sqrt :: (x: $T) -> T #builtin; // sin :: (x: $T) -> T #builtin; // cos :: (x: $T) -> T #builtin; -size_of :: ($T: Type) -> s64 #builtin; -align_of :: ($T: Type) -> s64 #builtin; +size_of :: ($T: Type) -> i64 #builtin; +align_of :: ($T: Type) -> i64 #builtin; // Low-level libc bindings, used by allocator implementations to avoid // recursing through `context.allocator`. The bare `malloc`/`free` // spellings are NOT declared: the Allocator protocol + the std/mem.sx // helpers are the allocation surface (`free` is the typed slice helper // there). Raw libc escape hatch: `libc_malloc` / `libc_free`. -libc_malloc :: (size: s64) -> *void #foreign libc "malloc"; +libc_malloc :: (size: i64) -> *void #foreign libc "malloc"; libc_free :: (ptr: *void) -> void #foreign libc "free"; -memcpy :: (dst: *void, src: *void, size: s64) -> *void #foreign libc "memcpy"; -memset :: (dst: *void, val: s64, size: s64) -> void #foreign libc "memset"; +memcpy :: (dst: *void, src: *void, size: i64) -> *void #foreign libc "memcpy"; +memset :: (dst: *void, val: i64, size: i64) -> void #foreign libc "memset"; type_of :: (val: $T) -> Type #builtin; type_name :: ($T: Type) -> string #builtin; -field_count :: ($T: Type) -> s64 #builtin; -field_name :: ($T: Type, idx: s64) -> string #builtin; -field_value :: (s: $T, idx: s64) -> Any #builtin; +field_count :: ($T: Type) -> i64 #builtin; +field_name :: ($T: Type, idx: i64) -> string #builtin; +field_value :: (s: $T, idx: i64) -> Any #builtin; is_flags :: ($T: Type) -> bool #builtin; type_is_unsigned :: ($T: Type) -> bool #builtin; -field_value_int :: ($T: Type, idx: s64) -> s64 #builtin; -field_index :: ($T: Type, val: T) -> s64 #builtin; +field_value_int :: ($T: Type, idx: i64) -> i64 #builtin; +field_index :: ($T: Type, val: T) -> i64 #builtin; error_tag_name :: (e: $T) -> string #builtin; // Call-site location, synthesized by the `#caller_location` directive when it @@ -36,8 +36,8 @@ error_tag_name :: (e: $T) -> string #builtin; // to report where they were invoked. Source_Location :: struct { file: string; - line: s32; - col: s32; + line: i32; + col: i32; func: string; } string :: []u8 #builtin; @@ -47,7 +47,7 @@ string :: []u8 #builtin; // Bytes-level primitives carry the `_bytes` suffix so the typed // helpers in std/mem.sx own the bare names (`alloc(T, n)`, `free(s)`). Allocator :: protocol #inline { - alloc_bytes :: (size: s64) -> *void; + alloc_bytes :: (size: i64) -> *void; dealloc_bytes :: (ptr: *void); } diff --git a/library/modules/std/fmt.sx b/library/modules/std/fmt.sx index bb5a9ef..21c3874 100644 --- a/library/modules/std/fmt.sx +++ b/library/modules/std/fmt.sx @@ -6,7 +6,7 @@ // --- Slice & string allocation --- -cstring :: (size: s64) -> string { +cstring :: (size: i64) -> string { raw := context.allocator.alloc_bytes(size + 1); memset(raw, 0, size + 1); s : string = ---; @@ -15,7 +15,7 @@ cstring :: (size: s64) -> string { s } -alloc_slice :: ($T: Type, count: s64) -> []T { +alloc_slice :: ($T: Type, count: i64) -> []T { raw := context.allocator.alloc_bytes(count * size_of(T)); memset(raw, 0, count * size_of(T)); s : []T = ---; @@ -24,12 +24,12 @@ alloc_slice :: ($T: Type, count: s64) -> []T { s } -int_to_string :: (n: s64) -> string { +int_to_string :: (n: i64) -> string { if n == 0 { return "0"; } neg := n < 0; // Extract digits straight from `n` without ever negating it: `0 - n` - // overflows for s64::MIN (its magnitude is unrepresentable as a - // positive s64). sx `%` truncates toward zero, so `n % 10` keeps n's + // overflows for i64::MIN (its magnitude is unrepresentable as a + // positive i64). sx `%` truncates toward zero, so `n % 10` keeps n's // sign; take each remainder's absolute value for the digit. tmp := cstring(20); i := 19; @@ -47,13 +47,13 @@ int_to_string :: (n: s64) -> string { // Unsigned decimal of `n`'s 64 bits — renders the full u64 range // (0 .. 18446744073709551615). Used by `any_to_string` for unsigned -// integer values, which an s64-based formatter would misread (e.g. a +// integer values, which an i64-based formatter would misread (e.g. a // u64 all-ones value as -1). -uint_to_string :: (n: s64) -> string { +uint_to_string :: (n: i64) -> string { if n == 0 { return "0"; } // Long division by 10 across the four unsigned 16-bit limbs, most // significant first. Each step folds the running remainder into the - // next limb; the per-step accumulator stays well within s64 + // next limb; the per-step accumulator stays well within i64 // (max 9*65536 + 65535), so signed `/` and `%` are exact. g := decompose_u16x4(n); tmp := cstring(20); @@ -80,8 +80,8 @@ bool_to_string :: (b: bool) -> string { float_to_string :: (f: f64) -> string { neg := f < 0.0; v := if neg then 0.0 - f else f; - int_part := cast(s64) v; - frac := cast(s64) ((v - cast(f64) int_part) * 1000000.0); + int_part := cast(i64) v; + frac := cast(i64) ((v - cast(f64) int_part) * 1000000.0); if frac < 0 { frac = 0 - frac; } istr := int_to_string(int_part); fstr := int_to_string(frac); @@ -103,7 +103,7 @@ float_to_string :: (f: f64) -> string { buf } -hex_group :: (buf: string, offset: s64, val: s64) { +hex_group :: (buf: string, offset: i64, val: i64) { i := offset + 3; v := val; while i >= offset { @@ -120,7 +120,7 @@ hex_group :: (buf: string, offset: s64, val: s64) { // back into 0..65535 — so callers get correct unsigned arithmetic out // of a signed-only integer type. Shared by the hex and unsigned-decimal // formatters. -decompose_u16x4 :: (n: s64) -> [4]s64 { +decompose_u16x4 :: (n: i64) -> [4]i64 { g0 := n % 65536; if g0 < 0 { g0 = g0 + 65536; } r1 := (n - g0) / 65536; @@ -132,7 +132,7 @@ decompose_u16x4 :: (n: s64) -> [4]s64 { r3 := (r2 - g2) / 65536; g3 := r3 % 65536; if g3 < 0 { g3 = g3 + 65536; } - limbs : [4]s64 = ---; + limbs : [4]i64 = ---; limbs[0] = g3; limbs[1] = g2; limbs[2] = g1; @@ -140,7 +140,7 @@ decompose_u16x4 :: (n: s64) -> [4]s64 { limbs } -int_to_hex_string :: (n: s64) -> string { +int_to_hex_string :: (n: i64) -> string { if n == 0 { return "0"; } g := decompose_u16x4(n); @@ -168,7 +168,7 @@ concat :: (a: string, b: string) -> string { buf } -substr :: (s: string, start: s64, len: s64) -> string { +substr :: (s: string, start: i64, len: i64) -> string { buf := cstring(len); memcpy(buf.ptr, @s[start], len); buf @@ -251,14 +251,14 @@ slice_to_string :: (items: []$T) -> string { } pointer_to_string :: (p: $T) -> string { - addr : s64 = xx p; + addr : i64 = xx p; if addr == 0 { "null" } else { concat(type_name(T), concat("@0x", int_to_hex_string(addr))) } } flags_to_string :: (val: $T) -> string { - v := cast(s64) val; + v := cast(i64) val; result := ""; i := 0; while i < field_count(T) { diff --git a/library/modules/std/fs.sx b/library/modules/std/fs.sx index 572eef5..33d020c 100644 --- a/library/modules/std/fs.sx +++ b/library/modules/std/fs.sx @@ -24,36 +24,36 @@ libc :: #library "c"; // API below wraps them. Users should not call these directly. // // macOS `open` is variadic in C (`int open(const char*, int, ...)`); -// declared with `..args: []s32` so the mode is passed via the C +// declared with `..args: []i32` so the mode is passed via the C // variadic tail. Without that, the mode arg goes to the wrong // register on arm64 and the file ends up with mode 0. -open :: (path: [:0]u8, flags: s32, ..args: []s32) -> s32 #foreign libc; -close :: (fd: s32) -> s32 #foreign libc; -read :: (fd: s32, buf: [*]u8, count: usize) -> isize #foreign libc; -write :: (fd: s32, buf: [*]u8, count: usize) -> isize #foreign libc; -lseek :: (fd: s32, offset: s64, whence: s32) -> s64 #foreign libc; -unlink :: (path: [:0]u8) -> s32 #foreign libc; -rmdir :: (path: [:0]u8) -> s32 #foreign libc; -mkdir :: (path: [:0]u8, mode: u32) -> s32 #foreign libc; -access :: (path: [:0]u8, mode: s32) -> s32 #foreign libc; -chmod :: (path: [:0]u8, mode: u32) -> s32 #foreign libc; -rename :: (oldp: [:0]u8, newp: [:0]u8) -> s32 #foreign libc; +open :: (path: [:0]u8, flags: i32, ..args: []i32) -> i32 #foreign libc; +close :: (fd: i32) -> i32 #foreign libc; +read :: (fd: i32, buf: [*]u8, count: usize) -> isize #foreign libc; +write :: (fd: i32, buf: [*]u8, count: usize) -> isize #foreign libc; +lseek :: (fd: i32, offset: i64, whence: i32) -> i64 #foreign libc; +unlink :: (path: [:0]u8) -> i32 #foreign libc; +rmdir :: (path: [:0]u8) -> i32 #foreign libc; +mkdir :: (path: [:0]u8, mode: u32) -> i32 #foreign libc; +access :: (path: [:0]u8, mode: i32) -> i32 #foreign libc; +chmod :: (path: [:0]u8, mode: u32) -> i32 #foreign libc; +rename :: (oldp: [:0]u8, newp: [:0]u8) -> i32 #foreign libc; // macOS POSIX constants. Linux values differ; split into platform- // conditional includes when we gain a Linux host. -O_RDONLY :s32: 0x0000; -O_WRONLY :s32: 0x0001; -O_RDWR :s32: 0x0002; -O_APPEND :s32: 0x0008; -O_CREAT :s32: 0x0200; -O_TRUNC :s32: 0x0400; +O_RDONLY :i32: 0x0000; +O_WRONLY :i32: 0x0001; +O_RDWR :i32: 0x0002; +O_APPEND :i32: 0x0008; +O_CREAT :i32: 0x0200; +O_TRUNC :i32: 0x0400; -SEEK_SET :s32: 0; -SEEK_CUR :s32: 1; -SEEK_END :s32: 2; +SEEK_SET :i32: 0; +SEEK_CUR :i32: 1; +SEEK_END :i32: 2; -F_OK :s32: 0; +F_OK :i32: 0; // ── Public types ───────────────────────────────────────────────────── @@ -67,7 +67,7 @@ OpenMode :: enum { SeekFrom :: enum { set; current; end; } File :: struct { - fd: s32 = -1; + fd: i32 = -1; is_valid :: (self: *File) -> bool { self.fd >= 0 } @@ -78,19 +78,19 @@ File :: struct { rc == 0 } - read :: (self: *File, buf: string) -> s64 { + read :: (self: *File, buf: string) -> i64 { if self.fd < 0 { return -1; } n := read(self.fd, buf.ptr, xx buf.len); - cast(s64) n + cast(i64) n } - write :: (self: *File, data: string) -> s64 { + write :: (self: *File, data: string) -> i64 { if self.fd < 0 { return -1; } n := write(self.fd, data.ptr, xx data.len); - cast(s64) n + cast(i64) n } - seek :: (self: *File, offset: s64, whence: SeekFrom) -> s64 { + seek :: (self: *File, offset: i64, whence: SeekFrom) -> i64 { if self.fd < 0 { return -1; } w := SEEK_SET; if whence == .current { w = SEEK_CUR; } @@ -105,7 +105,7 @@ File :: struct { // idea for `delete_file`/`delete_dir` vs libc's `unlink`/`rmdir`, // `set_mode` vs libc's `chmod`, etc. -mode_to_flags :: (m: OpenMode) -> s32 { +mode_to_flags :: (m: OpenMode) -> i32 { if m == .read { return O_RDONLY; } if m == .write { return O_WRONLY | O_CREAT | O_TRUNC; } if m == .append { return O_WRONLY | O_CREAT | O_APPEND; } @@ -133,7 +133,7 @@ read_file :: (path: [:0]u8) -> ?string { buf := cstring(size); n := read(fd, buf.ptr, xx size); close(fd); - if cast(s64) n != size { return null; } + if cast(i64) n != size { return null; } buf } @@ -143,7 +143,7 @@ write_file :: (path: [:0]u8, data: string) -> bool { if fd < 0 { return false; } n := write(fd, data.ptr, xx data.len); close(fd); - cast(s64) n == cast(s64) data.len + cast(i64) n == cast(i64) data.len } append_file :: (path: [:0]u8, data: string) -> bool { @@ -151,7 +151,7 @@ append_file :: (path: [:0]u8, data: string) -> bool { if fd < 0 { return false; } n := write(fd, data.ptr, xx data.len); close(fd); - cast(s64) n == cast(s64) data.len + cast(i64) n == cast(i64) data.len } // ── Single-syscall ops ─────────────────────────────────────────────── diff --git a/library/modules/std/hash.sx b/library/modules/std/hash.sx index 01d560d..71faaf7 100644 --- a/library/modules/std/hash.sx +++ b/library/modules/std/hash.sx @@ -3,7 +3,7 @@ // // Content addressing is security-critical, so the digest is computed // in-process: no shelling out, no platform crypto library. All 32-bit -// word arithmetic is done in s64 and masked back to 32 bits with +// word arithmetic is done in i64 and masked back to 32 bits with // `& MASK32`, so the result is identical regardless of the host's // native integer width or overflow behaviour. // @@ -39,7 +39,7 @@ MASK32 :: 0xFFFFFFFF; // Round constants K[0..63] — the first 32 bits of the fractional parts // of the cube roots of the first 64 primes (FIPS 180-4 §4.2.2). -K : [64]s64 = .[ +K : [64]i64 = .[ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, @@ -51,31 +51,31 @@ K : [64]s64 = .[ ]; // 32-bit right rotate. `word` must already be masked to 32 bits. -rotr :: (word: s64, n: s64) -> s64 { +rotr :: (word: i64, n: i64) -> i64 { ((word >> n) | (word << (32 - n))) & MASK32 } -big_sigma0 :: (x: s64) -> s64 { rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22) } -big_sigma1 :: (x: s64) -> s64 { rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25) } -small_sigma0 :: (x: s64) -> s64 { rotr(x, 7) ^ rotr(x, 18) ^ (x >> 3) } -small_sigma1 :: (x: s64) -> s64 { rotr(x, 17) ^ rotr(x, 19) ^ (x >> 10) } +big_sigma0 :: (x: i64) -> i64 { rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22) } +big_sigma1 :: (x: i64) -> i64 { rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25) } +small_sigma0 :: (x: i64) -> i64 { rotr(x, 7) ^ rotr(x, 18) ^ (x >> 3) } +small_sigma1 :: (x: i64) -> i64 { rotr(x, 17) ^ rotr(x, 19) ^ (x >> 10) } Sha256 :: struct { - h: [8]s64; // running hash state (each entry masked to 32 bits) + h: [8]i64; // running hash state (each entry masked to 32 bits) buf: [64]u8; // partial-block buffer - buf_len: s64; // bytes currently in `buf` (0..63) - total_len: s64; // total bytes absorbed so far + buf_len: i64; // bytes currently in `buf` (0..63) + total_len: i64; // total bytes absorbed so far // Crunch the 64-byte block currently in `buf` into the state. process_block :: (self: *Sha256) { - w : [64]s64 = ---; + w : [64]i64 = ---; t := 0; while t < 16 { base := t * 4; - w[t] = ((cast(s64) self.buf[base]) << 24) - | ((cast(s64) self.buf[base + 1]) << 16) - | ((cast(s64) self.buf[base + 2]) << 8) - | (cast(s64) self.buf[base + 3]); + w[t] = ((cast(i64) self.buf[base]) << 24) + | ((cast(i64) self.buf[base + 1]) << 16) + | ((cast(i64) self.buf[base + 2]) << 8) + | (cast(i64) self.buf[base + 3]); t += 1; } t = 16; @@ -186,7 +186,7 @@ Sha256 :: struct { } // Lowercase-hex ASCII byte for a 0..15 nibble. 48='0', 97='a'. -nibble_hex :: (n: s64) -> u8 { +nibble_hex :: (n: i64) -> u8 { if n < 10 then xx (n + 48) else xx (n - 10 + 97) } diff --git a/library/modules/std/json.sx b/library/modules/std/json.sx index 989b84a..a67635c 100644 --- a/library/modules/std/json.sx +++ b/library/modules/std/json.sx @@ -4,7 +4,7 @@ // This module delivers the JSON VALUE MODEL, the WRITER, and the READER // (parser). The model is built once and shared by both directions. // -// NUMBERS ARE INTEGERS ONLY (s64) for this milestone — there is no +// NUMBERS ARE INTEGERS ONLY (i64) for this milestone — there is no // fraction or exponent. A JSON value is one of: null, bool, integer, // string, array, object. The reader REJECTS a fraction or exponent // (`error.BadNumber`) rather than silently truncating it. @@ -82,7 +82,7 @@ JsonError :: error { Overflow, Io } Value :: enum { null_; bool_: bool; - int_: s64; + int_: i64; str: string; // view into caller-owned bytes; not copied array: Array; object: Object; @@ -100,8 +100,8 @@ Member :: struct { // allocator explicitly. Array :: struct { items: [*]Value = null; - len: s64 = 0; - cap: s64 = 0; + len: i64 = 0; + cap: i64 = 0; // Append `v`, preserving order. Grows the backing store through the // explicit `alloc` when full (doubling), freeing the old buffer. @@ -133,8 +133,8 @@ Array :: struct { // explicit `alloc`. Object :: struct { items: [*]Member = null; - len: s64 = 0; - cap: s64 = 0; + len: i64 = 0; + cap: i64 = 0; // Append a (key, val) pair at the end. Does not check for or merge a // duplicate key — insertion order is the contract; a repeated key is @@ -177,7 +177,7 @@ Object :: struct { Sink :: struct { dst: []u8; // caller-owned destination (buffer mode) or staging (file mode) - pos: s64 = 0; // bytes currently in `dst` + pos: i64 = 0; // bytes currently in `dst` file: *File = null; // null => buffer mode put_byte :: (self: *Sink, b: u8) -> !JsonError { @@ -213,7 +213,7 @@ Sink :: struct { // ── Writer ─────────────────────────────────────────────────────────── // Lowercase-hex ASCII byte for a 0..15 nibble. 48='0', 97='a'. -hex_digit :: (n: s64) -> u8 { +hex_digit :: (n: i64) -> u8 { if n < 10 then xx (n + 48) else xx (n - 10 + 97) } @@ -224,8 +224,8 @@ write_u_escape :: (c: u8, sink: *Sink) -> !JsonError { try sink.put_byte(117); // 'u' try sink.put_byte(48); // '0' try sink.put_byte(48); // '0' - try sink.put_byte(hex_digit((cast(s64) c >> 4) & 0xF)); - try sink.put_byte(hex_digit(cast(s64) c & 0xF)); + try sink.put_byte(hex_digit((cast(i64) c >> 4) & 0xF)); + try sink.put_byte(hex_digit(cast(i64) c & 0xF)); return; } @@ -254,12 +254,12 @@ write_string :: (s: string, sink: *Sink) -> !JsonError { } // Emit a signed integer in decimal, no allocation. Digits are formed in a -// stack buffer working in NEGATIVE space so s64 MIN +// stack buffer working in NEGATIVE space so i64 MIN // (-9223372036854775808) — whose magnitude is not representable as a -// positive s64 — serializes correctly. -write_int :: (n: s64, sink: *Sink) -> !JsonError { +// positive i64 — serializes correctly. +write_int :: (n: i64, sink: *Sink) -> !JsonError { if n == 0 { try sink.put_byte(48); return; } - tmp : [20]u8 = ---; // 19 digits + sign is the s64 worst case + tmp : [20]u8 = ---; // 19 digits + sign is the i64 worst case neg := n < 0; v := n; if !neg { v = 0 - n; } // fold positives into negative space @@ -321,7 +321,7 @@ write_object :: (obj: Object, sink: *Sink) -> !JsonError { // bytes written. Raises `error.Overflow` if `dst` is too small (the // partial contents of `dst` are then undefined — nothing is truncated // silently). No allocation. -write_to_buffer :: (v: Value, dst: []u8) -> (s64, !JsonError) { +write_to_buffer :: (v: Value, dst: []u8) -> (i64, !JsonError) { sink := Sink.{ dst = dst }; try write_value(v, @sink); return sink.pos; @@ -343,7 +343,7 @@ write_to_file :: (v: Value, file: *File, staging: []u8) -> !JsonError { // `parse(src, alloc)` turns a JSON document in `src` into the value model // above. It is the inverse of the writer for the v0 scope: objects (in // INSERTION ORDER), arrays, strings (with full unescaping incl. \uXXXX -// and surrogate pairs), s64 integers, bool, null. +// and surrogate pairs), i64 integers, bool, null. // // FAILURE SURFACING (hard contract): every malformed input raises on the // error channel (`!JsonParseError`) — never a bogus or default value. @@ -351,7 +351,7 @@ write_to_file :: (v: Value, file: *File, staging: []u8) -> !JsonError { // `pos` (the parser cursor) marks where the failure was detected. // // NOT SUPPORTED (rejected, not silently accepted): a fraction or exponent -// in a number (`1.5`, `1e9`) → `BadNumber`; a number outside s64 → +// in a number (`1.5`, `1e9`) → `BadNumber`; a number outside i64 → // `BadNumber`; a leading-zero integer (`01`) → `BadNumber`. An UNESCAPED // raw control byte (U+0000..U+001F) inside a string → `BadControlChar` // (RFC 8259 §7 requires those bytes to be escaped); the escaped forms @@ -386,17 +386,17 @@ JsonParseError :: error { UnexpectedToken, UnexpectedEnd, BadEscape, BadNumber, // Lowercase/uppercase hex nibble value (0..15) of an ASCII byte; a non-hex // byte in a `\uXXXX` escape is a `BadEscape`. -hex_value :: (c: u8) -> (s64, !JsonParseError) { - if c >= 48 and c <= 57 { return (cast(s64) c) - 48; } // '0'..'9' - if c >= 97 and c <= 102 { return (cast(s64) c) - 97 + 10; } // 'a'..'f' - if c >= 65 and c <= 70 { return (cast(s64) c) - 65 + 10; } // 'A'..'F' +hex_value :: (c: u8) -> (i64, !JsonParseError) { + if c >= 48 and c <= 57 { return (cast(i64) c) - 48; } // '0'..'9' + if c >= 97 and c <= 102 { return (cast(i64) c) - 97 + 10; } // 'a'..'f' + if c >= 65 and c <= 70 { return (cast(i64) c) - 65 + 10; } // 'A'..'F' raise error.BadEscape; } // Encode code point `cp` (already validated 0..0x10FFFF, non-surrogate) as // UTF-8 into `out`, returning the byte count (1..4). No bounds check: the // decode buffer is sized to the raw escaped span, which always dominates. -encode_utf8 :: (cp: s64, out: [*]u8) -> s64 { +encode_utf8 :: (cp: i64, out: [*]u8) -> i64 { if cp < 0x80 { out[0] = xx cp; return 1; @@ -424,7 +424,7 @@ encode_utf8 :: (cp: s64, out: [*]u8) -> s64 { // EXPLICIT allocator for composites + decoded strings. Parser :: struct { src: string; - pos: s64 = 0; + pos: i64 = 0; alloc: Allocator; // Advance past JSON whitespace (space / tab / LF / CR). @@ -450,7 +450,7 @@ Parser :: struct { // Read 4 hex digits at `i` (which must lie within [.., end)); returns // the 16-bit value. Fewer than 4 digits before `end` is a BadEscape. - read_hex4 :: (self: *Parser, i: s64, end: s64) -> (s64, !JsonParseError) { + read_hex4 :: (self: *Parser, i: i64, end: i64) -> (i64, !JsonParseError) { if i + 4 > end { raise error.BadEscape; } v := 0; k := 0; @@ -464,7 +464,7 @@ Parser :: struct { // Decode the escaped string body in [start, end) into `out`, returning // the decoded byte length. Pass 1 (in parse_string) guarantees there is // no dangling backslash, so the byte after every `\` is in range. - decode_into :: (self: *Parser, start: s64, end: s64, out: [*]u8) -> (s64, !JsonParseError) { + decode_into :: (self: *Parser, start: i64, end: i64, out: [*]u8) -> (i64, !JsonParseError) { di := 0; i := start; while i < end { @@ -544,15 +544,15 @@ Parser :: struct { return string.{ ptr = out, len = dlen }; } - // Parse an s64 integer (optional '-', then digits). Rejects leading - // zeros, a fraction/exponent tail, and any value outside s64 — all - // `BadNumber`. Accumulates in NEGATIVE space so s64 MIN parses exactly. - parse_number :: (self: *Parser) -> (s64, !JsonParseError) { - // s64 bounds, built positionally because |MIN| is not a - // representable positive s64 literal. `min_div10` is `MIN / 10` + // Parse an i64 integer (optional '-', then digits). Rejects leading + // zeros, a fraction/exponent tail, and any value outside i64 — all + // `BadNumber`. Accumulates in NEGATIVE space so i64 MIN parses exactly. + parse_number :: (self: *Parser) -> (i64, !JsonParseError) { + // i64 bounds, built positionally because |MIN| is not a + // representable positive i64 literal. `min_div10` is `MIN / 10` // truncated toward zero (remainder -8) — the digit loop's overflow // threshold. Accumulation runs in NEGATIVE space so MIN is exact. - s64_min := 0 - 9223372036854775807 - 1; + i64_min := 0 - 9223372036854775807 - 1; min_div10 := 0 - 922337203685477580; neg := false; if self.src[self.pos] == 45 { neg = true; self.pos += 1; } // '-' @@ -560,12 +560,12 @@ Parser :: struct { dstart := self.pos; c0 := self.src[self.pos]; if c0 < 48 or c0 > 57 { raise error.BadNumber; } - val : s64 = 0; + val : i64 = 0; digits := 0; while self.pos < self.src.len { c := self.src[self.pos]; if c < 48 or c > 57 { break; } - d := (cast(s64) c) - 48; + d := (cast(i64) c) - 48; if val < min_div10 { raise error.BadNumber; } if val == min_div10 and d > 8 { raise error.BadNumber; } val = val * 10 - d; @@ -578,7 +578,7 @@ Parser :: struct { if nc == 46 or nc == 101 or nc == 69 { raise error.BadNumber; } // '.' / 'e' / 'E' — ints only } if !neg { - if val == s64_min { raise error.BadNumber; } // |MIN| not representable as +s64 + if val == i64_min { raise error.BadNumber; } // |MIN| not representable as +i64 val = 0 - val; } return val; diff --git a/library/modules/std/list.sx b/library/modules/std/list.sx index 36a8374..e19af4e 100644 --- a/library/modules/std/list.sx +++ b/library/modules/std/list.sx @@ -4,8 +4,8 @@ List :: struct ($T: Type) { items: [*]T = null; - len: s64 = 0; - cap: s64 = 0; + len: i64 = 0; + cap: i64 = 0; append :: (list: *List(T), item: T, alloc: Allocator = context.allocator) { if list.len >= list.cap { @@ -22,7 +22,7 @@ List :: struct ($T: Type) { list.len += 1; } - ensure_capacity :: (list: *List(T), n: s64, alloc: Allocator = context.allocator) { + ensure_capacity :: (list: *List(T), n: i64, alloc: Allocator = context.allocator) { if list.cap >= n { return; } new_cap := if list.cap == 0 then 4 else list.cap; while new_cap < n { new_cap = new_cap * 2; } diff --git a/library/modules/std/log.sx b/library/modules/std/log.sx index 99b8d7f..279fa46 100644 --- a/library/modules/std/log.sx +++ b/library/modules/std/log.sx @@ -15,7 +15,7 @@ libc :: #library "c"; -write :: (fd: s32, buf: [*]u8, count: usize) -> isize #foreign libc; +write :: (fd: i32, buf: [*]u8, count: usize) -> isize #foreign libc; // Prefix the level, append a newline, write the whole line to stderr. log_emit :: (level: string, msg: string) { diff --git a/library/modules/std/mem.sx b/library/modules/std/mem.sx index f3ef89a..4db394d 100644 --- a/library/modules/std/mem.sx +++ b/library/modules/std/mem.sx @@ -31,7 +31,7 @@ destroy :: ufcs (a: Allocator, ptr: *$T) { } // Allocate a []T of `count` elements. Contents are UNINITIALISED. -alloc :: ufcs (a: Allocator, $T: Type, count: s64) -> []T { +alloc :: ufcs (a: Allocator, $T: Type, count: i64) -> []T { raw := a.alloc_bytes(count * size_of(T)); s : []T = ---; s.ptr = xx raw; @@ -57,7 +57,7 @@ clone :: ufcs (src: []$T, a: Allocator) -> []T { // Reallocate a slice to `new_count` elements: fresh storage, contents // copied up to min(len, new_count), old backing freed. The returned // slice replaces the operand — the old slice is dangling after this. -resize :: ufcs (slice: []$T, a: Allocator, new_count: s64) -> []T { +resize :: ufcs (slice: []$T, a: Allocator, new_count: i64) -> []T { raw := a.alloc_bytes(new_count * size_of(T)); n := if slice.len < new_count then slice.len else new_count; memcpy(raw, xx slice.ptr, n * size_of(T)); @@ -72,7 +72,7 @@ resize :: ufcs (slice: []$T, a: Allocator, new_count: s64) -> []T { // dealloc — there is no in-place grow primitive to try yet, and // `align` beyond the heap's natural 8 is not honored until the // protocol carries alignment. -mem_realloc :: ufcs (a: Allocator, ptr: *void, old: s64, new: s64, align: s64) -> *void { +mem_realloc :: ufcs (a: Allocator, ptr: *void, old: i64, new: i64, align: i64) -> *void { raw := a.alloc_bytes(new); n := if old < new then old else new; memcpy(raw, ptr, n); @@ -91,7 +91,7 @@ mem_realloc :: ufcs (a: Allocator, ptr: *void, old: s64, new: s64, align: s64) - CAllocator :: struct {} impl Allocator for CAllocator { - alloc_bytes :: (self: *CAllocator, size: s64) -> *void { + alloc_bytes :: (self: *CAllocator, size: i64) -> *void { return libc_malloc(size); } dealloc_bytes :: (self: *CAllocator, ptr: *void) { @@ -112,7 +112,7 @@ impl Allocator for CAllocator { // print("alloc count: {}\n", gpa.alloc_count); GPA :: struct { - alloc_count: s64; + alloc_count: i64; init :: () -> GPA { GPA.{ alloc_count = 0 } @@ -120,7 +120,7 @@ GPA :: struct { } impl Allocator for GPA { - alloc_bytes :: (self: *GPA, size: s64) -> *void { + alloc_bytes :: (self: *GPA, size: i64) -> *void { self.alloc_count += 1; return libc_malloc(size); } @@ -146,15 +146,15 @@ impl Allocator for GPA { ArenaChunk :: struct { next: *ArenaChunk; - cap: s64; + cap: i64; } Arena :: struct { first: *ArenaChunk; - end_index: s64; + end_index: i64; parent: Allocator; - add_chunk :: (a: *Arena, min_size: s64) { + add_chunk :: (a: *Arena, min_size: i64) { prev_cap := if a.first != null then a.first.cap else 0; needed := min_size + 16 + 16; len := (prev_cap + needed) * 3 / 2; @@ -166,7 +166,7 @@ Arena :: struct { a.end_index = 0; } - init :: (parent_alloc: Allocator, size: s64) -> Arena { + init :: (parent_alloc: Allocator, size: i64) -> Arena { self : Arena = .{ first = null, end_index = 0, parent = parent_alloc }; self.add_chunk(size); self @@ -198,7 +198,7 @@ Arena :: struct { } impl Allocator for Arena { - alloc_bytes :: (self: *Arena, size: s64) -> *void { + alloc_bytes :: (self: *Arena, size: i64) -> *void { aligned := (size + 7) & (0 - 8); if self.first != null { usable := self.first.cap - 16; @@ -232,10 +232,10 @@ impl Allocator for Arena { BufAlloc :: struct { buf: [*]u8; - len: s64; - pos: s64; + len: i64; + pos: i64; - init :: (buf: [*]u8, len: s64) -> BufAlloc { + init :: (buf: [*]u8, len: i64) -> BufAlloc { BufAlloc.{ buf = buf, len = len, pos = 0 } } @@ -245,7 +245,7 @@ BufAlloc :: struct { } impl Allocator for BufAlloc { - alloc_bytes :: (self: *BufAlloc, size: s64) -> *void { + alloc_bytes :: (self: *BufAlloc, size: i64) -> *void { aligned := (size + 7) & (0 - 8); if self.pos + aligned > self.len { return null; @@ -282,9 +282,9 @@ impl Allocator for BufAlloc { TrackingAllocator :: struct { parent: Allocator; - alloc_count: s64; - dealloc_count: s64; - total_alloc_bytes: s64; + alloc_count: i64; + dealloc_count: i64; + total_alloc_bytes: i64; init :: (parent_alloc: Allocator) -> TrackingAllocator { TrackingAllocator.{ @@ -295,7 +295,7 @@ TrackingAllocator :: struct { } } - leak_count :: (t: *TrackingAllocator) -> s64 { + leak_count :: (t: *TrackingAllocator) -> i64 { t.alloc_count - t.dealloc_count } @@ -306,7 +306,7 @@ TrackingAllocator :: struct { } impl Allocator for TrackingAllocator { - alloc_bytes :: (self: *TrackingAllocator, size: s64) -> *void { + alloc_bytes :: (self: *TrackingAllocator, size: i64) -> *void { ptr := self.parent.alloc_bytes(size); if ptr != null { self.alloc_count += 1; diff --git a/library/modules/std/process.sx b/library/modules/std/process.sx index 130a560..a7db94b 100644 --- a/library/modules/std/process.sx +++ b/library/modules/std/process.sx @@ -21,12 +21,12 @@ libc :: #library "c"; // ── Low-level libc bindings ───────────────────────────────────────── popen :: (cmd: [:0]u8, mode: [:0]u8) -> *void #foreign libc; -pclose :: (stream: *void) -> s32 #foreign libc; +pclose :: (stream: *void) -> i32 #foreign libc; fread :: (ptr: [*]u8, size: usize, nmemb: usize, stream: *void) -> usize #foreign libc; -feof :: (stream: *void) -> s32 #foreign libc; +feof :: (stream: *void) -> i32 #foreign libc; getenv :: (name: [:0]u8) -> *u8 #foreign libc; strlen :: (s: *u8) -> usize #foreign libc; -system :: (cmd: [:0]u8) -> s32 #foreign libc; +system :: (cmd: [:0]u8) -> i32 #foreign libc; // ── Public types ───────────────────────────────────────────────────── @@ -34,7 +34,7 @@ ProcessResult :: struct { /// Exit code as reported by `WEXITSTATUS(status)`. 0 = success. /// Note: doesn't distinguish "killed by signal" from "exited /// non-zero"; phase 1B will return a tagged union. - exit_code: s32; + exit_code: i32; stdout: string; } @@ -50,7 +50,7 @@ ProcessResult :: struct { // with stdout, append " 2>&1" to the command. run :: (cmd: [:0]u8) -> ?ProcessResult { f := popen(cmd, "r"); - if cast(s64) f == 0 { return null; } + if cast(i64) f == 0 { return null; } out := ""; buf := cstring(4096); @@ -61,7 +61,7 @@ run :: (cmd: [:0]u8) -> ?ProcessResult { if n > 0 { chunk : string = ---; chunk.ptr = buf.ptr; - chunk.len = cast(s64) n; + chunk.len = cast(i64) n; out = concat(out, chunk); } } @@ -85,12 +85,12 @@ run :: (cmd: [:0]u8) -> ?ProcessResult { // string if set to "". env :: (name: [:0]u8) -> ?string { p := getenv(name); - addr : s64 = xx p; + addr : i64 = xx p; if addr == 0 { return null; } n := strlen(p); if n == 0 { return ""; } - buf := cstring(cast(s64) n); - memcpy(buf.ptr, xx p, cast(s64) n); + buf := cstring(cast(i64) n); + memcpy(buf.ptr, xx p, cast(i64) n); buf } @@ -126,7 +126,7 @@ find_executable :: (name: [:0]u8) -> ?string { // via `write(2)`, so skipping the stdio flush loses nothing. Binding the // symbol `"exit"` would also collide with this module's own `exit` function // at the link level. -clib_exit :: (code: s32) -> noreturn #foreign libc "_exit"; +clib_exit :: (code: i32) -> noreturn #foreign libc "_exit"; // Stop the process immediately with exit code `code`. Does NOT unwind: // no `defer` / `onfail` cleanup runs, no error-trace frames are pushed — diff --git a/library/modules/std/socket.sx b/library/modules/std/socket.sx index 9094f8d..eea4b41 100644 --- a/library/modules/std/socket.sx +++ b/library/modules/std/socket.sx @@ -4,20 +4,20 @@ libc :: #library "c"; // POSIX socket API -socket :: (domain: s32, kind: s32, protocol: s32) -> s32 #foreign libc; -setsockopt :: (fd: s32, level: s32, optname: s32, optval: *s32, optlen: u32) -> s32 #foreign libc; -bind :: (fd: s32, addr: *SockAddr, addrlen: u32) -> s32 #foreign libc; -listen :: (fd: s32, backlog: s32) -> s32 #foreign libc; -accept :: (fd: s32, addr: *SockAddr, addrlen: *u32) -> s32 #foreign libc; -read :: (fd: s32, buf: [*]u8, count: usize) -> isize #foreign libc; -write :: (fd: s32, buf: [*]u8, count: usize) -> isize #foreign libc; -close :: (fd: s32) -> s32 #foreign libc; +socket :: (domain: i32, kind: i32, protocol: i32) -> i32 #foreign libc; +setsockopt :: (fd: i32, level: i32, optname: i32, optval: *i32, optlen: u32) -> i32 #foreign libc; +bind :: (fd: i32, addr: *SockAddr, addrlen: u32) -> i32 #foreign libc; +listen :: (fd: i32, backlog: i32) -> i32 #foreign libc; +accept :: (fd: i32, addr: *SockAddr, addrlen: *u32) -> i32 #foreign libc; +read :: (fd: i32, buf: [*]u8, count: usize) -> isize #foreign libc; +write :: (fd: i32, buf: [*]u8, count: usize) -> isize #foreign libc; +close :: (fd: i32) -> i32 #foreign libc; // Constants (macOS) -AF_INET :s32: 2; -SOCK_STREAM :s32: 1; -SOL_SOCKET :s32: 0xFFFF; -SO_REUSEADDR :s32: 0x4; +AF_INET :i32: 2; +SOCK_STREAM :i32: 1; +SOL_SOCKET :i32: 0xFFFF; +SO_REUSEADDR :i32: 0x4; // macOS sockaddr_in (16 bytes, has sin_len field) SockAddr :: struct { @@ -28,6 +28,6 @@ SockAddr :: struct { sin_zero: u64 = 0; } -htons :: (port: s64) -> u16 { +htons :: (port: i64) -> u16 { cast(u16) (((port & 0xFF) << 8) | ((port >> 8) & 0xFF)) } diff --git a/library/modules/std/trace.sx b/library/modules/std/trace.sx index d1b37b5..e92e213 100644 --- a/library/modules/std/trace.sx +++ b/library/modules/std/trace.sx @@ -28,16 +28,16 @@ libc :: #library "c"; // library/vendors/sx_trace_runtime/sx_trace.c. TraceFrame :: struct { file: string; - line: s32; - col: s32; + line: i32; + col: i32; func: string; line_text: string; // the source line, for the snippet + caret } // `n` spaces — used to position the `^` caret under a column. -spaces :: (n: s32) -> string { +spaces :: (n: i32) -> string { s := ""; - i : s32 = 0; + i : i32 = 0; while i < n { s = concat(s, " "); i = i + 1; @@ -54,7 +54,7 @@ sx_trace_len :: () -> u32 #foreign; sx_trace_truncated :: () -> u32 #foreign; sx_trace_frame_at :: (i: u32) -> u64 #foreign; -write :: (fd: s32, buf: [*]u8, count: usize) -> isize #foreign libc; +write :: (fd: i32, buf: [*]u8, count: usize) -> isize #foreign libc; // Render the current trace buffer to a string (allocated from // context.allocator). Empty buffer → "" so callers can cheaply skip output. diff --git a/library/modules/ui/dock.sx b/library/modules/ui/dock.sx index 1a91aae..10bc73e 100755 --- a/library/modules/ui/dock.sx +++ b/library/modules/ui/dock.sx @@ -93,12 +93,12 @@ DOCK_ANIM_DURATION :f32: 0.19; // 190ms DockInteraction :: struct { // Drag state - dragging_child: s64; // -1 = none + dragging_child: i64; // -1 = none drag_start_pos: Point; drag_offset: Point; click_fraction_x: f32; click_fraction_y: f32; - hovered_zone: s64; // -1 = none, else DockZone ordinal + hovered_zone: i64; // -1 = none, else DockZone ordinal // Per-child state natural_sizes: List(Size); @@ -111,7 +111,7 @@ DockInteraction :: struct { anim_sizes: List(Animated(Size)); header_pressed: List(bool); - child_count: s64; + child_count: i64; parent_allocator: Allocator; // GPA — used for persistent list growth init :: (self: *DockInteraction) { @@ -135,7 +135,7 @@ DockInteraction :: struct { self.header_pressed = List(bool).{}; } - ensure_capacity :: (self: *DockInteraction, count: s64) { + ensure_capacity :: (self: *DockInteraction, count: i64) { if self.child_count >= count { return; } while self.child_count < count { self.natural_sizes.append(Size.zero(), self.parent_allocator); @@ -151,7 +151,7 @@ DockInteraction :: struct { } } - set_target_size :: (self: *DockInteraction, index: s64, target: Size) { + set_target_size :: (self: *DockInteraction, index: i64, target: Size) { if index >= self.child_count { return; } anim := @self.anim_sizes.items[index]; cur := anim.to; @@ -168,7 +168,7 @@ DockInteraction :: struct { } } - get_animated_size :: (self: *DockInteraction, index: s64) -> Size { + get_animated_size :: (self: *DockInteraction, index: i64) -> Size { if index >= self.child_count { return Size.zero(); } (@self.anim_sizes.items[index]).current } @@ -197,7 +197,7 @@ DockInteraction :: struct { } } -start_dragging :: (interaction: *DockInteraction, child_index: s64, pos: Point, panel_frame: Frame) { +start_dragging :: (interaction: *DockInteraction, child_index: i64, pos: Point, panel_frame: Frame) { interaction.dragging_child = child_index; interaction.drag_start_pos = pos; interaction.drag_offset = Point.zero(); @@ -218,7 +218,7 @@ start_dragging :: (interaction: *DockInteraction, child_index: s64, pos: Point, // Helper functions // ============================================================================= -zone_by_index :: (i: s64) -> DockZone { +zone_by_index :: (i: i64) -> DockZone { if i == { case 0: .fill; case 1: .center; @@ -234,8 +234,8 @@ zone_by_index :: (i: s64) -> DockZone { } find_hovered_zone :: (bounds: Frame, pos: Point, hint_size: f32, enable_corners: bool) -> ?DockZone { - count : s64 = if enable_corners then 10 else 6; - i : s64 = 0; + count : i64 = if enable_corners then 10 else 6; + i : i64 = 0; while i < count { zone := zone_by_index(i); hint := dock_zone_get_hint_frame(zone, bounds, hint_size); @@ -365,7 +365,7 @@ DockPanel :: struct { corner_radius: f32; header_height: f32; dock_interaction: *DockInteraction; - panel_index: s64; + panel_index: i64; DEFAULT_BG :Color: Color.rgba(26, 26, 31, 242); DEFAULT_HEADER_BG :Color: Color.rgba(38, 38, 46, 255); @@ -469,7 +469,7 @@ Dock :: struct { hint_active_color: Color; preview_color: Color; enable_corners: bool; - on_dock: ?Closure(s64, DockZone); + on_dock: ?Closure(i64, DockZone); make :: (interaction: *DockInteraction, delta_time: *f32) -> Dock { d : Dock = ---; @@ -519,7 +519,7 @@ impl View for Dock { dt : f32 = self.delta_time.*; interaction.tick_animations(dt); - i : s64 = 0; + i : i64 = 0; while i < self.children.len { child := @self.children.items[i]; @@ -603,7 +603,7 @@ impl View for Dock { } // Draw children - i : s64 = 0; + i : i64 = 0; while i < self.children.len { child := @self.children.items[i]; child.view.render(ctx, child.computed_frame); @@ -619,8 +619,8 @@ impl View for Dock { } // Zone hint indicators - count : s64 = if self.enable_corners then 10 else 6; - j : s64 = 0; + count : i64 = if self.enable_corners then 10 else 6; + j : i64 = 0; while j < count { zone := zone_by_index(j); hint_frame := dock_zone_get_hint_frame(zone, frame, self.hint_size); diff --git a/library/modules/ui/gesture.sx b/library/modules/ui/gesture.sx index dcd554a..23cf520 100755 --- a/library/modules/ui/gesture.sx +++ b/library/modules/ui/gesture.sx @@ -16,14 +16,14 @@ GesturePhase :: enum { TapValue :: struct { location: Point; - count: s32; + count: i32; } TapGesture :: struct { - count: s32; + count: i32; on_tap: ?Closure(); phase: GesturePhase; - tap_count: s32; + tap_count: i32; start_position: Point; TAP_THRESHOLD :f32: 10.0; diff --git a/library/modules/ui/glyph_cache.sx b/library/modules/ui/glyph_cache.sx index c3775e4..7195555 100755 --- a/library/modules/ui/glyph_cache.sx +++ b/library/modules/ui/glyph_cache.sx @@ -50,7 +50,7 @@ ShapedGlyph :: struct { } is_ascii :: (text: string) -> bool { - i : s64 = 0; + i : i64 = 0; while i < text.len { if text[i] >= 128 { return false; } i += 1; @@ -69,9 +69,9 @@ KBTS_USER_ID_GENERATION_MODE_CODEPOINT_INDEX :u32: 0; KbtsGlyphIterator :: struct { glyph_storage: *void; current_glyph: *void; - last_advance_x: s32; - x: s32; - y: s32; + last_advance_x: i32; + x: i32; + y: i32; } KbtsRun :: struct { @@ -89,15 +89,15 @@ KbtsGlyph :: struct { codepoint: u32; id: u16; uid: u16; - user_id_or_codepoint_index: s32; - offset_x: s32; - offset_y: s32; - advance_x: s32; - advance_y: s32; + user_id_or_codepoint_index: i32; + offset_x: i32; + offset_y: i32; + advance_x: i32; + advance_y: i32; } // kbts_font_info2 base (simplified — we only need the Size field for dispatch) -KBTS_FONT_INFO_STRING_ID_COUNT :s32: 7; +KBTS_FONT_INFO_STRING_ID_COUNT :i32: 7; KbtsFontInfo2 :: struct { size: u32; @@ -111,21 +111,21 @@ KbtsFontInfo2 :: struct { KbtsFontInfo2_1 :: struct { base: KbtsFontInfo2; units_per_em: u16; - x_min: s16; - y_min: s16; - x_max: s16; - y_max: s16; - ascent: s16; - descent: s16; - line_gap: s16; + x_min: i16; + y_min: i16; + x_max: i16; + y_max: i16; + ascent: i16; + descent: i16; + line_gap: i16; } -GLYPH_ATLAS_W :s32: 1024; -GLYPH_ATLAS_H :s32: 1024; -FONTINFO_SIZE :s64: 256; +GLYPH_ATLAS_W :i32: 1024; +GLYPH_ATLAS_H :i32: 1024; +FONTINFO_SIZE :i64: 256; PackResult :: struct { - x, y: s32; + x, y: i32; } // Dynamic glyph cache with on-demand rasterization and texture atlas packing. @@ -136,25 +136,25 @@ GlyphCache :: struct { // Atlas texture (GPU) texture_id: u32; - atlas_width: s32; - atlas_height: s32; + atlas_width: i32; + atlas_height: i32; // Atlas bitmap (CPU-side for updates) bitmap: [*]u8; // Shelf packer state - shelf_y: s32; - shelf_height: s32; - cursor_x: s32; - padding: s32; + shelf_y: i32; + shelf_height: i32; + cursor_x: i32; + padding: i32; // Glyph lookup cache entries: List(GlyphEntry); // Hash table for O(1) glyph lookup (open addressing, linear probing) hash_keys: [*]u32; // key per slot (0 = empty sentinel) - hash_vals: [*]s32; // index into entries list - hash_cap: s64; // table capacity (power of 2) + hash_vals: [*]i32; // index into entries list + hash_cap: i64; // table capacity (power of 2) // Dirty tracking for texture upload dirty: bool; @@ -172,12 +172,12 @@ GlyphCache :: struct { shape_ctx: *void; shape_font: *void; units_per_em: u16; - font_data_size: s32; + font_data_size: i32; shaped_buf: List(ShapedGlyph); // Shape cache: skip reshaping if same text + size as last call last_shape_ptr: [*]u8; - last_shape_len: s64; + last_shape_len: i64; last_shape_size_q: u16; // Allocator that owns every dynamically-grown buffer on this cache — @@ -199,7 +199,7 @@ GlyphCache :: struct { self.parent_allocator = context.allocator; // Load font file - file_size : s32 = 0; + file_size : i32 = 0; font_data := read_file_bytes(path, @file_size); if font_data == null { out("Failed to load font: "); @@ -216,9 +216,9 @@ GlyphCache :: struct { stbtt_InitFont(self.font_info, font_data, 0); // Get font vertical metrics (in unscaled font units) - ascent_i : s32 = 0; - descent_i : s32 = 0; - linegap_i : s32 = 0; + ascent_i : i32 = 0; + descent_i : i32 = 0; + linegap_i : i32 = 0; stbtt_GetFontVMetrics(self.font_info, @ascent_i, @descent_i, @linegap_i); // Store unscaled metrics — we'll scale per font_size in measure_text @@ -241,7 +241,7 @@ GlyphCache :: struct { // Allocate atlas bitmap self.atlas_width = GLYPH_ATLAS_W; self.atlas_height = GLYPH_ATLAS_H; - bitmap_size : s64 = xx self.atlas_width * xx self.atlas_height; + bitmap_size : i64 = xx self.atlas_width * xx self.atlas_height; self.bitmap = xx self.parent_allocator.alloc_bytes(bitmap_size); memset(self.bitmap, 0, bitmap_size); @@ -257,10 +257,10 @@ GlyphCache :: struct { // Init hash table (256 slots) self.hash_cap = 256; - hash_bytes : s64 = self.hash_cap * 4; // u32 per slot + hash_bytes : i64 = self.hash_cap * 4; // u32 per slot self.hash_keys = xx self.parent_allocator.alloc_bytes(hash_bytes); memset(self.hash_keys, 0, hash_bytes); - val_bytes : s64 = self.hash_cap * 8; // s64 per slot (s32 would suffice but alignment) + val_bytes : i64 = self.hash_cap * 8; // i64 per slot (i32 would suffice but alignment) self.hash_vals = xx self.parent_allocator.alloc_bytes(val_bytes); // Create the atlas texture. In GPU-protocol mode we create empty and @@ -296,7 +296,7 @@ GlyphCache :: struct { // Hash table lookup (open addressing, linear probing) mask := self.hash_cap - 1; - slot : s64 = xx ((key * 2654435761) >> 24) & xx mask; + slot : i64 = xx ((key * 2654435761) >> 24) & xx mask; while self.hash_keys[slot] != 0 { if self.hash_keys[slot] == key { return @self.entries.items[self.hash_vals[slot]].glyph; @@ -309,18 +309,18 @@ GlyphCache :: struct { scale := stbtt_ScaleForPixelHeight(self.font_info, actual_size); // Get glyph bounding box - x0 : s32 = 0; - y0 : s32 = 0; - x1 : s32 = 0; - y1 : s32 = 0; + x0 : i32 = 0; + y0 : i32 = 0; + x1 : i32 = 0; + y1 : i32 = 0; stbtt_GetGlyphBitmapBox(self.font_info, xx glyph_index, scale, scale, @x0, @y0, @x1, @y1); glyph_w := if x1 > x0 then x1 - x0 else 0; glyph_h := if y1 > y0 then y1 - y0 else 0; // Get horizontal metrics - advance_i : s32 = 0; - lsb_i : s32 = 0; + advance_i : i32 = 0; + lsb_i : i32 = 0; stbtt_GetGlyphHMetrics(self.font_info, xx glyph_index, @advance_i, @lsb_i); advance : f32 = xx advance_i * scale; @@ -349,7 +349,7 @@ GlyphCache :: struct { } // Rasterize directly into atlas bitmap - dest_offset : s64 = xx pack.y * xx self.atlas_width + xx pack.x; + dest_offset : i64 = xx pack.y * xx self.atlas_width + xx pack.x; stbtt_MakeGlyphBitmap( self.font_info, @self.bitmap[dest_offset], @@ -384,13 +384,13 @@ GlyphCache :: struct { } // Insert a key→index mapping into the hash table, growing if needed - hash_insert :: (self: *GlyphCache, key: u32, index: s64) { + hash_insert :: (self: *GlyphCache, key: u32, index: i64) { // Grow if load factor > 70% if self.entries.len * 10 > self.hash_cap * 7 { self.hash_grow(); } mask := self.hash_cap - 1; - slot : s64 = xx ((key * 2654435761) >> 24) & xx mask; + slot : i64 = xx ((key * 2654435761) >> 24) & xx mask; while self.hash_keys[slot] != 0 { slot = (slot + 1) & mask; } @@ -405,19 +405,19 @@ GlyphCache :: struct { old_vals := self.hash_vals; self.hash_cap = old_cap * 2; - hash_bytes : s64 = self.hash_cap * 4; + hash_bytes : i64 = self.hash_cap * 4; self.hash_keys = xx self.parent_allocator.alloc_bytes(hash_bytes); memset(self.hash_keys, 0, hash_bytes); - val_bytes : s64 = self.hash_cap * 8; + val_bytes : i64 = self.hash_cap * 8; self.hash_vals = xx self.parent_allocator.alloc_bytes(val_bytes); // Rehash mask := self.hash_cap - 1; - i : s64 = 0; + i : i64 = 0; while i < old_cap { k := old_keys[i]; if k != 0 { - slot : s64 = xx ((k * 2654435761) >> 24) & xx mask; + slot : i64 = xx ((k * 2654435761) >> 24) & xx mask; while self.hash_keys[slot] != 0 { slot = (slot + 1) & mask; } @@ -456,7 +456,7 @@ GlyphCache :: struct { // Shelf-based rectangle packer. // Returns PackResult with x >= 0 on success, x = -1 if no space. - try_pack :: (self: *GlyphCache, w: s32, h: s32) -> PackResult { + try_pack :: (self: *GlyphCache, w: i32, h: i32) -> PackResult { padded_w := w + self.padding; padded_h := h + self.padding; @@ -488,15 +488,15 @@ GlyphCache :: struct { grow :: (self: *GlyphCache) { new_w := self.atlas_width * 2; new_h := self.atlas_height * 2; - new_size : s64 = xx new_w * xx new_h; + new_size : i64 = xx new_w * xx new_h; new_bitmap : [*]u8 = xx self.parent_allocator.alloc_bytes(new_size); memset(new_bitmap, 0, new_size); // Copy old rows into new bitmap - y : s32 = 0; + y : i32 = 0; while y < self.atlas_height { - old_off : s64 = xx y * xx self.atlas_width; - new_off : s64 = xx y * xx new_w; + old_off : i64 = xx y * xx self.atlas_width; + new_off : i64 = xx y * xx new_w; memcpy(@new_bitmap[new_off], @self.bitmap[old_off], xx self.atlas_width); y += 1; } @@ -525,7 +525,7 @@ GlyphCache :: struct { // Recompute UV coordinates for all cached glyphs atlas_wf : f32 = xx new_w; atlas_hf : f32 = xx new_h; - i : s64 = 0; + i : i64 = 0; while i < self.entries.len { g := @self.entries.items[i].glyph; if g.width > 0.0 { @@ -591,13 +591,13 @@ GlyphCache :: struct { shape_ascii :: (self: *GlyphCache, text: string, font_size: f32) { scale := stbtt_ScaleForPixelHeight(self.font_info, font_size); total : f32 = 0.0; - i : s64 = 0; + i : i64 = 0; while i < text.len { - ch : s32 = xx text[i]; + ch : i32 = xx text[i]; glyph_index : u16 = xx stbtt_FindGlyphIndex(self.font_info, ch); - advance_i : s32 = 0; - lsb_i : s32 = 0; + advance_i : i32 = 0; + lsb_i : i32 = 0; stbtt_GetGlyphHMetrics(self.font_info, xx glyph_index, @advance_i, @lsb_i); adv : f32 = xx advance_i * scale; @@ -650,7 +650,7 @@ GlyphCache :: struct { measure_text :: (self: *GlyphCache, text: string, font_size: f32) -> Size { self.shape_text(text, font_size); width : f32 = 0.0; - i : s64 = 0; + i : i64 = 0; while i < self.shaped_buf.len { width += self.shaped_buf.items[i].advance; i += 1; diff --git a/library/modules/ui/pipeline.sx b/library/modules/ui/pipeline.sx index f62d5f0..3bb6a04 100755 --- a/library/modules/ui/pipeline.sx +++ b/library/modules/ui/pipeline.sx @@ -27,7 +27,7 @@ UIPipeline :: struct { // `push Context` site. arena_a: Arena; arena_b: Arena; - frame_index: s64; + frame_index: i64; body: Closure() -> View; has_body: bool; parent_allocator: Allocator; diff --git a/library/modules/ui/render.sx b/library/modules/ui/render.sx index 140cb44..2d156b9 100755 --- a/library/modules/ui/render.sx +++ b/library/modules/ui/render.sx @@ -35,12 +35,12 @@ RenderNode :: struct { // Opacity opacity: f32; - depth: s64; + depth: i64; } RenderTree :: struct { nodes: List(RenderNode); - generation: s64; + generation: i64; init :: () -> RenderTree { RenderTree.{ generation = 0 } @@ -51,7 +51,7 @@ RenderTree :: struct { self.generation += 1; } - add :: (self: *RenderTree, node: RenderNode) -> s64 { + add :: (self: *RenderTree, node: RenderNode) -> i64 { idx := self.nodes.len; self.nodes.append(node); idx @@ -62,9 +62,9 @@ RenderTree :: struct { RenderContext :: struct { tree: *RenderTree; - clip_depth: s64; + clip_depth: i64; opacity: f32; - depth: s64; + depth: i64; init :: (tree: *RenderTree) -> RenderContext { RenderContext.{ diff --git a/library/modules/ui/renderer.sx b/library/modules/ui/renderer.sx index c0ee0c7..9f081fc 100755 --- a/library/modules/ui/renderer.sx +++ b/library/modules/ui/renderer.sx @@ -10,27 +10,27 @@ #import "modules/ui/font.sx"; // Vertex: pos(2) + uv(2) + color(4) + params(4) = 12 floats -UI_VERTEX_FLOATS :s64: 12; -UI_VERTEX_BYTES :s64: 48; -MAX_UI_VERTICES :s64: 16384; +UI_VERTEX_FLOATS :i64: 12; +UI_VERTEX_BYTES :i64: 48; +MAX_UI_VERTICES :i64: 16384; UIRenderer :: struct { // GL-side handles. Used when `gpu == null` (every non-iOS target today). vao: u32; vbo: u32; shader: u32; - proj_loc: s32; - tex_loc: s32; + proj_loc: i32; + tex_loc: i32; // CPU-side vertex scratch buffer — same for both backends. vertices: [*]f32; - vertex_count: s64; + vertex_count: i64; screen_width: f32; screen_height: f32; dpi_scale: f32; white_texture: u32; // GL name OR TextureHandle (both are u32-shaped) current_texture: u32; - draw_calls: s64; + draw_calls: i64; // GPU protocol backend. When set, the renderer routes shader / buffer / // texture / draw calls through `gpu` instead of raw GL. The chess game @@ -44,8 +44,8 @@ UIRenderer :: struct { // time, not at draw-call submission, so re-using offset 0 across flushes // would let the last writer win and earlier batches would render as // whatever was uploaded last. Reset to 0 in `begin()`. - mtl_buf_offset: s64 = 0; - mtl_buf_capacity: s64 = 0; + mtl_buf_offset: i64 = 0; + mtl_buf_capacity: i64 = 0; init :: (self: *UIRenderer) { // Allocate vertex scratch (CPU side) — same for both backends. @@ -295,7 +295,7 @@ UIRenderer :: struct { flush :: (self: *UIRenderer) { if self.vertex_count == 0 { return; } - upload_size : s64 = self.vertex_count * UI_VERTEX_BYTES; + upload_size : i64 = self.vertex_count * UI_VERTEX_BYTES; if self.gpu != null { // Mirror the GL path: bind current texture before drawing. @@ -315,7 +315,7 @@ UIRenderer :: struct { } byte_off := self.mtl_buf_offset; self.gpu.update_buffer_at(self.mtl_vbuf, xx self.vertices, upload_size, byte_off); - vertex_off : s32 = xx (byte_off / UI_VERTEX_BYTES); + vertex_off : i32 = xx (byte_off / UI_VERTEX_BYTES); self.gpu.draw_triangles(vertex_off, xx self.vertex_count); // Each batch starts on a vertex boundary so `vertex_off = // byte_off / UI_VERTEX_BYTES` lands on a whole vertex (otherwise @@ -364,7 +364,7 @@ UIRenderer :: struct { raster_size := node.font_size * font.dpi_scale; inv_dpi := font.inv_dpi; - i : s64 = 0; + i : i64 = 0; while i < font.shaped_buf.len { shaped := font.shaped_buf.items[i]; cached := font.get_or_rasterize(shaped.glyph_index, raster_size); diff --git a/library/modules/ui/state.sx b/library/modules/ui/state.sx index 7d936a1..3e4340c 100755 --- a/library/modules/ui/state.sx +++ b/library/modules/ui/state.sx @@ -14,17 +14,17 @@ State :: struct ($T: Type) { // --- StateEntry — type-erased storage --- StateEntry :: struct { - id: s64; + id: i64; data: [*]u8; - size: s64; - generation: s64; + size: i64; + generation: i64; } // --- StateStore — manages persistent state --- StateStore :: struct { entries: List(StateEntry); - current_generation: s64; + current_generation: i64; parent_allocator: Allocator; init :: (self: *StateStore) { @@ -33,9 +33,9 @@ StateStore :: struct { self.parent_allocator = context.allocator; } - get_or_create :: (self: *StateStore, id: s64, $T: Type, default: T) -> State(T) { + get_or_create :: (self: *StateStore, id: i64, $T: Type, default: T) -> State(T) { // Search for existing entry - i : s64 = 0; + i : i64 = 0; while i < self.entries.len { if self.entries.items[i].id == id { self.entries.items[i].generation = self.current_generation; diff --git a/library/modules/ui/stats_panel.sx b/library/modules/ui/stats_panel.sx index 96d7f0e..6e36843 100755 --- a/library/modules/ui/stats_panel.sx +++ b/library/modules/ui/stats_panel.sx @@ -45,7 +45,7 @@ impl View for StatsPanel { // FPS value dt := self.delta_time.*; - fps : s64 = if dt > 0.0 then xx (1.0 / dt) else 0; + fps : i64 = if dt > 0.0 then xx (1.0 / dt) else 0; fps_text := format("FPS: {}", fps); fps_size := measure_text(fps_text, StatsPanel.VALUE_SIZE); fps_frame := Frame.make( diff --git a/readme.md b/readme.md index 416326d..66e185b 100644 --- a/readme.md +++ b/readme.md @@ -10,7 +10,7 @@ An experimental systems programming language with Jai-inspired syntax, compile-t #import "modules/std.sx"; Point :: struct { - x, y: s32; + x, y: i32; magnitude :: (self: *Point) -> f32 { sqrt(self.x * self.x + self.y * self.y); } } @@ -75,7 +75,7 @@ Options: | Type | Description | |------|-------------| -| `s8`..`s64`, `u8`..`u64` | Signed/unsigned integers (default: `s64`) | +| `i8`..`i64`, `u8`..`u64` | Signed/unsigned integers (default: `i64`) | | `f32`, `f64` | Floating point (default: `f32`) | | `bool` | `true` / `false` | | `string` | UTF-8 fat pointer `{ptr, len}` | @@ -87,15 +87,15 @@ Options: | `Closure(args) -> ret` | Closure type | **Numeric limits.** A field-like access on a builtin integer type name folds to -a compile-time constant of that type: `s64.max` → `9223372036854775807`, -`u8.min` → `0`, `s3.max` → `3`. It works for every width `s1`..`s64` / `u1`..`u64` +a compile-time constant of that type: `i64.max` → `9223372036854775807`, +`u8.min` → `0`, `i3.max` → `3`. It works for every width `i1`..`i64` / `u1`..`u64` plus `usize`/`isize`, and is usable anywhere a constant of that type is — including array dimensions (`[u8.max]T` is a 255-element array). The float types `f32`/`f64` expose `.min` / `.max` too (with `.min` = most-negative finite = `-max`, **not** C's `DBL_MIN`) plus the float-only `.epsilon` (ULP of 1.0, not C#'s denormal `Epsilon`), `.min_positive` (smallest normal = C `DBL_MIN`), `.true_min` (smallest subnormal — beware flush-to-zero CPU modes), `.inf`, and `.nan`. A float-only -accessor on an integer (`s32.epsilon`), or any accessor on a non-numeric type, is +accessor on an integer (`i32.epsilon`), or any accessor on a non-numeric type, is a clean compile error. The fold applies only to a bare type-name receiver: a raw identifier that binds a value shadowing a type name (`` `f64 := … `` then `` `f64.epsilon ``) reads the value's field, not the limit — for a local, global, @@ -109,12 +109,12 @@ even when it flows into an integer binding or an array dimension, so it truncate ```sx // Constants (compile-time when possible) PI :: 3.14159; -MAX : s32 : 100; +MAX : i32 : 100; // Variables (mutable) x := 42; // inferred type -y : s32 = 0; // explicit type -z : s32 = ---; // uninitialized +y : i32 = 0; // explicit type +z : i32 = ---; // uninitialized ``` A typed constant's initializer must be compatible with its annotation — an @@ -123,7 +123,7 @@ integer fits any integer or float, a float a float type, a string `string`, constant expression alike: both `N : string : 4` and `N : string : M + 2` are a compile-time `type mismatch` error, not a silently-accepted constant. Mixed int+float arithmetic promotes to the float in either operand order (`n + 0.5` and -`0.5 + n` are both `f64`), so `C : s64 : M + 0.5` is rejected regardless of order +`0.5 + n` are both `f64`), so `C : i64 : M + 0.5` is rejected regardless of order while `F : f64 : M + 0.5` folds to `2.5`. **Aggregate constants.** Array- and struct-typed `::` constants are immutable @@ -132,8 +132,8 @@ value, and unused tables are dropped from the binary. `::` is the one and only const spelling (`const` is not a keyword): ```sx -K : [4]s64 : .[11, 22, 33, 44]; // typed array const -A :: .[1, 2, 3]; // untyped — infers [3]s64 +K : [4]i64 : .[11, 22, 33, 44]; // typed array const +A :: .[1, 2, 3]; // untyped — infers [3]i64 M :: .[1, 2.2, 3]; // numeric mix promotes — [3]f64 LIT :: Color.{ r = 255, g = 0, b = 0 }; // struct const — also one global @@ -152,7 +152,7 @@ integer-typed binding *without* a cast follows the same integral-fold rule an array dimension uses: an **integral** compile-time float folds to its integer, a **non-integral** one is a compile error. It holds whether the value is a literal or *any* compile-time-constant float expression — including one that references a -float-typed const (`F : f64 : 2.5; y : s64 = F + 1.5` → `4`), a builtin float +float-typed const (`F : f64 : 2.5; y : i64 = F + 1.5` → `4`), a builtin float numeric-limit accessor (`f64.max - f64.max` → `0`, while `f64.true_min + 0.5` errors), a float `%` (`6.0 % 4.0` → `2`, while `5.5 % 2.0` = `1.5` errors), or a float `/` (`6.0 / 2.0` → `3`, while `5.0 / 2.0` = `2.5` errors — a float `/` is @@ -161,30 +161,30 @@ the compile-time float evaluator recognises every leaf shape the integer one doe no constant float form escapes the rule at one site while folding at another — and is uniform across a typed local, a parameter default, a struct field default, a call -argument, a typed constant, **and an array dimension / count** — `y : s64 = 4.0`, -`K : s64 : 4.0`, `y : s64 = M + 2.0`, and `[F + 1.5]s64` (≡ `[4]s64`, whether +argument, a typed constant, **and an array dimension / count** — `y : i64 = 4.0`, +`K : i64 : 4.0`, `y : i64 = M + 2.0`, and `[F + 1.5]i64` (≡ `[4]i64`, whether written directly, through a const, or via a type alias) all give `4`, while -`y : s64 = 1.5`, `N : s64 : 1.5`, `y : s64 = M + 0.5`, `y : s64 = F + 0.25` -(= `2.75`), and `[F + 0.25]s64` all error (one wording at the binding sites: +`y : i64 = 1.5`, `N : i64 : 1.5`, `y : i64 = M + 0.5`, `y : i64 = F + 0.25` +(= `2.75`), and `[F + 0.25]i64` all error (one wording at the binding sites: `cannot implicitly narrow non-integral float …`; a dimension instead reports `array dimension must be an integer, but '…' is a non-integral float`, since the -cast escape does not apply in a count position). An explicit `xx` / `cast(s64)` -is the escape hatch and always truncates (`y : s64 = xx 1.5` → `1`, -`y : s64 = xx (M + 0.5)` → `2`); a genuine runtime float is likewise unaffected. +cast escape does not apply in a count position). An explicit `xx` / `cast(i64)` +is the escape hatch and always truncates (`y : i64 = xx 1.5` → `1`, +`y : i64 = xx (M + 0.5)` → `2`); a genuine runtime float is likewise unaffected. -Builtin type names (`s2`, `u8`, `bool`, `string`, …) are reserved and a *bare* +Builtin type names (`i2`, `u8`, `bool`, `string`, …) are reserved and a *bare* spelling can't be used as an identifier at a **value-binding or declaration-name** site — a value binding (`:=` / typed local / parameter), a `::` constant or function declaration, an `impl` method definition, or a `::` type declaration (`struct` / `enum` / `union` / alias / `protocol` / …) — each is an error -(`s2 :: 5` and `s2 :: (n) { … }` are rejected just like `s2 := 5`). **Member-name +(`i2 :: 5` and `i2 :: (n) { … }` are rejected just like `i2 := 5`). **Member-name positions are exempt**: a struct *field*, a union *tag*, and a protocol -*method-signature* may be a bare reserved spelling (`struct { s2: s64 }`, -`union { u8: … }`, `protocol { s2 :: () -> s64 }`) — they are reached via `obj.name`, +*method-signature* may be a bare reserved spelling (`struct { i2: i64 }`, +`union { u8: … }`, `protocol { i2 :: () -> i64 }`) — they are reached via `obj.name`, so they never mis-lower. The bare exemption covers only the identifier-classified -reserved names (`s1`..`s64`, `u1`..`u64`, `bool`, `string`, `void`, `usize`, +reserved names (`i1`..`i64`, `u1`..`u64`, `bool`, `string`, `void`, `usize`, `isize`, `Any`); `f32` and `f64` are lexer keywords, so even in a member slot they -need the backtick (`` struct { `f32: s64 } ``). A leading backtick escapes one into +need the backtick (`` struct { `f32: i64 } ``). A leading backtick escapes one into a **raw identifier**: `` `name `` is the literal identifier `name` (the backtick drops out of the text), usable in **every** position — value, declaration, and type, and optional in the @@ -192,24 +192,24 @@ exempt member positions. It is the only way handwritten sx can spell a reserved name in a binding or declaration site. ```sx -`s2 := 2.5; // identifier "s2", distinct from the s2 type -print("{}\n", `s2); // 2.5 (or bare `s2` in value position) +`i2 := 2.5; // identifier "i2", distinct from the i2 type +print("{}\n", `i2); // 2.5 (or bare `i2` in value position) -`s2 :: struct { x: s64; } // declare a type named with a reserved spelling -v : `s2 = ---; // and reference it as a type — resolves to the struct -x : s2 = 3; // bare `s2` in type position is still the int type +`i2 :: struct { x: i64; } // declare a type named with a reserved spelling +v : `i2 = ---; // and reference it as a type — resolves to the struct +x : i2 = 3; // bare `i2` in type position is still the int type ``` It works in every identifier position — local, global, parameter, struct field, union tag, function name, type/alias/import name, a top-level or struct-body constant, and the control-flow / capture / binding forms (destructure, `if`/`while` binding, `for` capture, match capture, `catch`/`onfail` tag) — and a reserved-spelled -function is bare-callable (`s2(10)`). A backtick name used as a type resolves to a -`` `name ``-declared type — including a parameterized template (`` `s2(s64) ``) and +function is bare-callable (`i2(10)`). A backtick name used as a type resolves to a +`` `name ``-declared type — including a parameterized template (`` `i2(i64) ``) and under pointer/optional wrappers — else a normal `unknown type` error. Foreign declarations from `#import c { … }` are exempt automatically: C names that -collide with reserved type names (e.g. `s1`, `s2`) import unedited, and a foreign +collide with reserved type names (e.g. `i1`, `i2`) import unedited, and a foreign reserved-name function is bare-callable by its C name. ### Structs @@ -257,8 +257,8 @@ rw := Perms.read | Perms.write; ### Optionals ```sx -x: ?s32 = 42; -y: ?s32 = null; +x: ?i32 = 42; +y: ?i32 = null; val := x ?? 0; // null coalescing forced := x!; // force unwrap (traps on null) @@ -281,7 +281,7 @@ max :: (a: $T, b: T) -> T { List :: struct ($T: Type) { items: [*]T; - len: s64; + len: i64; append :: (self: *List(T), item: T) { ... } } @@ -295,8 +295,8 @@ are_equal :: ($T: Type/Eq, a: T, b: T) -> bool { a.eq(b); } ### Closures ```sx -make_adder :: (n: s64) -> Closure(s64) -> s64 { - closure((x: s64) -> s64 => x + n); +make_adder :: (n: i64) -> Closure(i64) -> i64 { + closure((x: i64) -> i64 => x + n); } add5 := make_adder(5); @@ -309,11 +309,11 @@ Closures capture by value. Bare functions auto-promote to closures when needed. ```sx Drawable :: protocol { - draw :: (x: s32, y: s32); + draw :: (x: i32, y: i32); } impl Drawable for Circle { - draw :: (self: *Circle, x: s32, y: s32) { ... } + draw :: (self: *Circle, x: i32, y: i32) { ... } } shape : Drawable = xx my_circle; // type erasure via xx @@ -323,7 +323,7 @@ shape.draw(10, 20); // dynamic dispatch `#inline` protocols store function pointers directly (no vtable indirection): ```sx Allocator :: protocol #inline { - alloc :: (size: s64) -> *void; + alloc :: (size: i64) -> *void; dealloc :: (ptr: *void); } ``` @@ -400,8 +400,8 @@ FIBONACCI_10 :: #run fib(10); Foreign functions: ```sx libc :: #library "c"; -printf :: (fmt: [:0]u8, args: ..Any) -> s32 #foreign libc; -write_fd :: (fd: s32, buf: [*]u8, count: u64) -> s64 #foreign libc "write"; +printf :: (fmt: [:0]u8, args: ..Any) -> i32 #foreign libc; +write_fd :: (fd: i32, buf: [*]u8, count: u64) -> i64 #foreign libc "write"; ``` Direct C header import: @@ -436,7 +436,7 @@ functions, constants, AND types alike**: a flat import of a flat import is NOT bare-visible (when `A` imports `B` and `B` imports `C`, `A` does not see `C`'s top-level names — including its types — so qualify them, or `#import "C"` directly if you reference them). This holds for a *parameterized* type head too: a generic -struct / parameterized protocol / type-returning function used as `Box(s64)` is +struct / parameterized protocol / type-returning function used as `Box(i64)` is gated exactly like a bare leaf type — the constructor head must be reachable over your own or a direct flat import, not two hops away. A bare reference to a namespaced-only import's member — function, module constant, or **type** (leaf or @@ -444,7 +444,7 @@ generic head) — is likewise not visible and is rejected (`type 'X' is not visi #import the module that declares it`); qualify it as `m.name`. The type gate holds wherever a bare type name is named — a value/field annotation, a reflection / type-arg slot (`size_of(T)`, `size_of(*T)`), a typed array-literal head (`T.[…]`), -a parameterized head (`Box(s64)`), or a type-as-value / type-match arm — not just +a parameterized head (`Box(i64)`), or a type-as-value / type-match arm — not just plain annotations. **Own-wins** holds at every one of those sites too, exactly like a bare call: when the querying module declares its OWN same-name type, that bare reference resolves to ITS author — never a same-name flat import. Ambiguity is @@ -455,8 +455,8 @@ multiple flat-imported modules; qualify the reference or remove the duplicate import`) — never a silent pick of one author. Qualifying the reference is a real escape hatch for a **generic head** too: `ns.Box(args)` selects the template AUTHORED by `ns`'s module, so two namespaces each declaring a same-name -`Box($T)` with different layouts stay distinct types (`a.Box(s64)` and -`b.Box(s64)` instantiate their own author's fields), never the global last-wins +`Box($T)` with different layouts stay distinct types (`a.Box(i64)` and +`b.Box(i64)` instantiate their own author's fields), never the global last-wins template. (A library's own *internal* type references still resolve: a generic struct / pack fn / protocol body is instantiated in the module that defines it, so e.g. `List(T).append`'s `alloc: Allocator` is visible there regardless of the call @@ -503,7 +503,7 @@ Box :: r.Box; // generic head re-export — same template // consumer.sx #import "facade.sx"; -b := Box(s64).{ item = 3 }; // rich.sx's Box, via the facade +b := Box(i64).{ item = 3 }; // rich.sx's Box, via the facade ``` ### Implicit Context @@ -513,7 +513,7 @@ Every program gets an implicit `context` with a default allocator: ```sx // No boilerplate needed — context is auto-initialized main :: () { - list := List(s64).create(); // uses context.allocator + list := List(i64).create(); // uses context.allocator list.append(42); } @@ -529,7 +529,7 @@ push Context.{ allocator = my_arena } { #import "modules/std.sx"; quick_sort :: (items: []$T) { - partition :: (items: []T, lo: s64, hi: s64) -> s64 { + partition :: (items: []T, lo: i64, hi: i64) -> i64 { pivot := items[hi]; i := lo - 1; j := lo; @@ -545,7 +545,7 @@ quick_sort :: (items: []$T) { i; } - sort :: (items: []T, lo: s64, hi: s64) { + sort :: (items: []T, lo: i64, hi: i64) { if lo < hi { pi := partition(items, lo, hi); sort(items, lo, pi - 1); @@ -557,7 +557,7 @@ quick_sort :: (items: []$T) { } main :: () { - arr : []s64 = .[333, 2, 3, 5, 2, 2, 3, 4, 5, 6, 6, 1]; + arr : []i64 = .[333, 2, 3, 5, 2, 2, 3, 4, 5, 6, 6, 1]; quick_sort(arr); print("{}\n", arr); // [1, 2, 2, 2, 3, 3, 4, 5, 5, 6, 6, 333] diff --git a/specs.md b/specs.md index 3c6ab32..c9fc0ac 100644 --- a/specs.md +++ b/specs.md @@ -15,7 +15,7 @@ Line comments start with `//` and extend to end of line. #### Reserved type names -A spelling that names a builtin type — the arbitrary-width integers `s1`..`s64` / +A spelling that names a builtin type — the arbitrary-width integers `i1`..`i64` / `u1`..`u64`, plus `bool`, `string`, `void`, `f32`, `f64`, `usize`, `isize`, `Any` — is reserved. A bare reserved spelling is rejected at **value-binding and declaration-name sites**: a value binding (`:=` / typed local / parameter), a @@ -32,26 +32,26 @@ a builtin would shadow the builtin. The exemptions are the backtick escape name, and a protocol **method-signature** name may be a bare reserved spelling. These sit in a member slot (`name: T` / `name :: (…)`) and are reached only via `obj.name` (or dispatched by string), so they are never type-classified and never -mis-lower. The backtick form is optional there and names the same member — `obj.s2` -and `` obj.`s2 `` both resolve. The exemption covers member *signatures* only: an +mis-lower. The backtick form is optional there and names the same member — `obj.i2` +and `` obj.`i2 `` both resolve. The exemption covers member *signatures* only: an `impl` method **definition** is a real function (a declaration site, not a member slot), so a reserved-spelled impl method still needs the backtick -(`` `s2 :: (self) ``), exactly like a free function. See `examples/0158`. +(`` `i2 :: (self) ``), exactly like a free function. See `examples/0158`. The bare member-name exemption applies only to the **identifier-classified** -reserved spellings — `s1`..`s64`, `u1`..`u64`, `bool`, `string`, `void`, `usize`, +reserved spellings — `i1`..`i64`, `u1`..`u64`, `bool`, `string`, `void`, `usize`, `isize`, `Any` — which all lex as ordinary identifiers. The two **keyword-classified** reserved spellings, `f32` and `f64`, are lexer keywords, and member-name slots require an identifier token; a bare `f32` / `f64` is therefore rejected at parse (`expected field name in struct`) even in a member position. Use -the backtick there too — `` struct { `f32: s64; } `` / `` union { `f64: … } `` / -`` protocol { `f32 :: () -> s64; } `` work as field / tag / method names. +the backtick there too — `` struct { `f32: i64; } `` / `` union { `f64: … } `` / +`` protocol { `f32 :: () -> i64; } `` work as field / tag / method names. ```sx -s2 := 2.5; // ERROR: 's2' is a reserved type name and cannot be used as an identifier -s2 :: 5; // ERROR — a `::` constant name is a binding site too -s2 :: (n: s64) -> s64 { n } // ERROR — so is a function name -s2 :: struct { x: s64; } // ERROR — and a type-declaration name +i2 := 2.5; // ERROR: 'i2' is a reserved type name and cannot be used as an identifier +i2 :: 5; // ERROR — a `::` constant name is a binding site too +i2 :: (n: i64) -> i64 { n } // ERROR — so is a function name +i2 :: struct { x: i64; } // ERROR — and a type-declaration name ``` (The stdlib's own builtin definitions — e.g. `string :: []u8 #builtin;` — are the @@ -66,26 +66,26 @@ is `name`), and the escape is usable in **every position**: value, declaration, **and type**. It is the only way handwritten sx can spell a reserved name. ```sx -`s2 := 2.5; // OK — identifier "s2", distinct from the s2 type -print("{}\n", `s2); // 2.5 (backtick reference) -print("{}\n", s2); // 2.5 (bare reference in value position → the binding) -x : s2 = 3; // bare `s2` in TYPE position is still the s2 int type +`i2 := 2.5; // OK — identifier "i2", distinct from the i2 type +print("{}\n", `i2); // 2.5 (backtick reference) +print("{}\n", i2); // 2.5 (bare reference in value position → the binding) +x : i2 = 3; // bare `i2` in TYPE position is still the i2 int type ``` **Type position.** A backtick in type position is the literal name used as a type -reference: it resolves to a `` `s2 ``-declared type (struct / enum / union / type -alias / …), and never the builtin. A bare `s2` in type position stays the builtin -int; a backtick name with no matching declaration is a normal `unknown type 's2'` +reference: it resolves to a `` `i2 ``-declared type (struct / enum / union / type +alias / …), and never the builtin. A bare `i2` in type position stays the builtin +int; a backtick name with no matching declaration is a normal `unknown type 'i2'` error. A raw type reference flows through the **same continuations** as a bare type -name, so it parameterizes a reserved-spelled generic template (`` `s2(s64) ``) and -composes under the pointer / optional / slice wrappers (`` *`s2 ``, `` ?`s2 ``). +name, so it parameterizes a reserved-spelled generic template (`` `i2(i64) ``) and +composes under the pointer / optional / slice wrappers (`` *`i2 ``, `` ?`i2 ``). ```sx -`s2 :: struct($T: Type) { x: $T; } // generic template with a reserved-spelled name -v : `s2(s64) = ---; // parameterized raw type reference +`i2 :: struct($T: Type) { x: $T; } // generic template with a reserved-spelled name +v : `i2(i64) = ---; // parameterized raw type reference v.x = 7; -p : *`s2(s64) = @v; // wrappers compose over a raw type -x : s2 = 3; // bare `s2` is still the 2-bit signed int +p : *`i2(i64) = @v; // wrappers compose over a raw type +x : i2 = 3; // bare `i2` is still the 2-bit signed int ``` **Declaration position.** A *bare* reserved-name declaration of every kind still @@ -99,17 +99,17 @@ reference, and every control-flow / capture / binding form (destructure name, ```sx `u8 := 100; // global -`s2 :: 2.5; // constant declaration -`s2 : s64 : 5; // typed constant declaration -`u8 :: (`s1: s64) -> s64 { `s1 } // function name + parameter -P :: struct { `s2: f64; } // struct field -H :: struct { `s2 :: 5; } // struct-body constant (untyped + `: T :` typed) -M :: union { `s1: s32; } // union tag +`i2 :: 2.5; // constant declaration +`i2 : i64 : 5; // typed constant declaration +`u8 :: (`i1: i64) -> i64 { `i1 } // function name + parameter +P :: struct { `i2: f64; } // struct field +H :: struct { `i2 :: 5; } // struct-body constant (untyped + `: T :` typed) +M :: union { `i1: i32; } // union tag `u16 :: enum { A; B; } // type-declaration name `u8, rest := pair(); // destructure name -if `s16 := maybe() { } // optional binding +if `i16 := maybe() { } // optional binding for xs, 0.. (`bool, `u16) { } // for captures -x catch (`s2) { } // catch tag binding +x catch (`i2) { } // catch tag binding ``` In the **member-name positions** among these — struct field, union tag, and @@ -118,8 +118,8 @@ spelling is already legal there (see "Member-name positions are exempt" above). Everywhere else (value bindings and declaration names, including an `impl` method definition) the backtick is *required* to spell a reserved name. -A reserved-spelled **function** is bare-callable: `` `s2 :: (n: s64) -> s64 { … } `` -can be invoked as `s2(10)` (the bare callee spelling parses as a type but resolves +A reserved-spelled **function** is bare-callable: `` `i2 :: (n: i64) -> i64 { … } `` +can be invoked as `i2(10)` (the bare callee spelling parses as a type but resolves to the function when one of that name is in scope; `TypeName(val)` is not a cast). A backtick may also escape a keyword spelling (`` `for ``, `` `struct ``), yielding @@ -127,17 +127,17 @@ an identifier with that text. **`#import c` exemption.** Foreign declarations synthesized by an `#import c { … }` block are treated as raw automatically: a generated C parameter or function name -that collides with a reserved type name (e.g. `s1`, `s2`) imports unedited, with no +that collides with a reserved type name (e.g. `i1`, `i2`) imports unedited, with no backticks and no reserved-name error, and a foreign reserved-name function is bare-callable by its C name. The exemption is scoped to the foreign decls — it does -not make a foreign `s2` usable as the sx `s2` type, nor relax the rule for +not make a foreign `i2` usable as the sx `i2` type, nor relax the rule for hand-written sx code. ### Literals | Kind | Examples | Type | |-----------|---------------------|---------| -| Integer | `0`, `42`, `0xFF`, `0b1010` | `s64` | +| Integer | `0`, `42`, `0xFF`, `0b1010` | `i64` | | Float | `0.3`, `0.9` | `f32` | | String | `"Hello"`, `"z: {z}"` | `string` (may span multiple lines) | | Heredoc String | `#string END`...`END` | `string` | @@ -237,7 +237,7 @@ ordinary comparisons. Native codegen and the comptime interpreter agree on this. ## 2. Type System ### Primitive Types -- `s1`..`s64` — signed integers (1 to 64 bits). `s64` is the default for integer literals. +- `i1`..`i64` — signed integers (1 to 64 bits). `i64` is the default for integer literals. - `u1`..`u64` — unsigned integers (1 to 64 bits). - `f32` — 32-bit floating point - `f64` — 64-bit floating point @@ -252,36 +252,36 @@ A field-like access on a builtin **integer** type name folds, at compile time, t that type's smallest/largest representable value: ```sx -maxS64 := s64.max; // 9223372036854775807 -minS32 := s32.min; // -2147483648 +maxS64 := i64.max; // 9223372036854775807 +minS32 := i32.min; // -2147483648 maxU8 := u8.max; // 255 minU8 := u8.min; // 0 -m3 := s3.max; // 3 (arbitrary width) +m3 := i3.max; // 3 (arbitrary width) n := u64.max; // 18446744073709551615 (all-ones) ``` -- **Receiver.** Any builtin integer type: every signed width `s1`..`s64`, every +- **Receiver.** Any builtin integer type: every signed width `i1`..`i64`, every unsigned width `u1`..`u64` (arbitrary 1–64 bit widths, not only the - power-of-two ones), plus `usize`/`isize` (target-width — `u64`/`s64` on a + power-of-two ones), plus `usize`/`isize` (target-width — `u64`/`i64` on a 64-bit host). - **Value.** Pure `(width, signedness)` arithmetic — never a per-name table: - `sN`: `min = -(2^(N-1))`, `max = 2^(N-1) - 1` - `uN`: `min = 0`, `max = 2^N - 1` -- **Result type.** The constant has the **queried** type: `s3.max` is an `s3`, +- **Result type.** The constant has the **queried** type: `i3.max` is an `i3`, `u64.max` is a `u64`. So it is usable anywhere a constant of that type is legal — initializers, `::` / `:=` bindings, and larger expressions — and in array-dimension / count position via the compile-time integer path - (`[u8.max]T` is a 255-element array; `[s16.max]T` a 32767-element one). A + (`[u8.max]T` is a 255-element array; `[i16.max]T` a 32767-element one). A count that does not fit (`[u64.max]T`) is rejected as an oversized dimension. - **Representation note.** `u64.max` / `usize.max` is the all-ones 64-bit value (`18446744073709551615`), which exceeds the signed `i64` range used for integer constants; it is stored as that exact bit pattern carrying the `u64` - type (it reinterprets to `-1` as an `s64`). It cannot be written as a decimal + type (it reinterprets to `-1` as an `i64`). It cannot be written as a decimal literal. The default integer formatter is signedness-aware: `print("{}", u64.max)` renders the full unsigned decimal `18446744073709551615` (and any unsigned value across all 64 bits), while a - signed value — including `s64.min` — prints with all its digits. A bit - reinterpret (`union { u: u64; s: s64 }`) is still a valid way to inspect the + signed value — including `i64.min` — prints with all its digits. A bit + reinterpret (`union { u: u64; s: i64 }`) is still a valid way to inspect the raw bits, but is no longer needed merely to print the value. - **Non-numeric receivers.** `.min` / `.max` on a non-numeric type (`bool`, `string`, a pointer, a `struct`, `void`, an `enum`) is a compile error, never @@ -332,8 +332,8 @@ qn := f64.nan; // a quiet NaN guaranteed property is that it is unequal to everything, itself included (`nan != nan` is `true` — native float `!=` lowers unordered, issue 0091). - **Float-only on an integer is an error.** `.epsilon` / `.min_positive` / - `.true_min` / `.inf` / `.nan` applied to an integer type (`s32.epsilon`, - `u8.inf`, `s64.true_min`) is a clean compile error — integer types expose only + `.true_min` / `.inf` / `.nan` applied to an integer type (`i32.epsilon`, + `u8.inf`, `i64.true_min`) is a clean compile error — integer types expose only `.min` / `.max`. - **Pinning the values.** The lexer has no exponent notation and the default float formatter is crude (issue 0090), so float limits can be asserted neither @@ -346,7 +346,7 @@ qn := f64.nan; // a quiet NaN `0x7F800000`. - **Type receiver vs. a shadowing value binding.** A numeric-limit access folds only when the receiver is a builtin numeric **type name** (`f64.epsilon`, - `s32.max`, `u8.max`). A backtick raw identifier that binds a *value* whose + `i32.max`, `u8.max`). A backtick raw identifier that binds a *value* whose spelling shadows a type name (F0.6) is an ordinary value: `` `f64.epsilon `` reads that value's `epsilon` field — it does **not** fold to the limit. This holds for **every** value-binding kind — a `` `f64 := … `` local, a module-scope @@ -357,7 +357,7 @@ qn := f64.nan; // a quiet NaN and count** contexts: a raw value-shadow field read is an ordinary *runtime* read there too — never a compile-time numeric-limit leaf — so `` `f64.epsilon `` narrowing into an integer binding truncates like any runtime float (its field - value, not the limit), and `` `s8.max `` used as an array dimension is rejected + value, not the limit), and `` `i8.max `` used as an array dimension is rejected as a non-constant count rather than folding to the builtin `127`. ### Enum Types @@ -375,7 +375,7 @@ Color :: enum { // Enum with payloads (tagged union) Shape :: enum { circle: f32; // typed variant - rect: s32; // typed variant + rect: i32; // typed variant none; // void variant } ``` @@ -428,7 +428,7 @@ C-style untagged unions for zero-cost memory overlays (type punning). All fields ```sx Overlay :: union { f: f32; - i: s32; + i: i32; } ``` All fields must have types (unlike enums, which may have void variants). @@ -448,7 +448,7 @@ Unions must be initialized with `---` (undefined) and then assigned per-field: ```sx o :Overlay = ---; o.f = 3.14; -print("{}\n", o.i); // reinterpret bits as s32 +print("{}\n", o.i); // reinterpret bits as i32 ``` #### Restrictions @@ -509,17 +509,17 @@ v1.x = 3.0; // assign to field x of struct v1 `#using StructName;` inside a struct declaration embeds all fields from `StructName` at that position. The embedded fields are accessed directly, as if declared inline. ```sx -UBase :: struct { x: s32; y: s32; } -UExt :: struct { #using UBase; z: s32; } +UBase :: struct { x: i32; y: i32; } +UExt :: struct { #using UBase; z: i32; } e := UExt.{ x = 1, y = 2, z = 3 }; print("{}\n", e.x); // 1 ``` `#using` may appear at any field position (beginning, middle, end) and multiple `#using` entries are allowed: ```sx -UPos :: struct { px: s32; py: s32; } -UCol :: struct { r: s32; g: s32; } -USprite :: struct { #using UPos; #using UCol; scale: s32; } +UPos :: struct { px: i32; py: i32; } +UCol :: struct { r: i32; g: i32; } +USprite :: struct { #using UPos; #using UCol; scale: i32; } s := USprite.{ px = 10, py = 20, r = 255, g = 128, scale = 1 }; ``` @@ -535,9 +535,9 @@ print("{}", v1); // Vec4{x:1.0, y:2.0, z:3.0, w:0.0} Functions declared inside a struct body become methods, registered as `StructName.method`: ```sx Point :: struct { - x, y: s32; + x, y: i32; - sum :: (self: *Point) -> s32 { self.x + self.y; } + sum :: (self: *Point) -> i32 { self.x + self.y; } } p := Point.{ x = 3, y = 4 }; @@ -555,7 +555,7 @@ Protocols define a set of method signatures that types can implement. They enabl #### Declaration ```sx Allocator :: protocol #inline { - alloc :: (size: s64) -> *void; + alloc :: (size: i64) -> *void; dealloc :: (ptr: *void); } ``` @@ -574,7 +574,7 @@ Use `#inline` for protocols with few methods where call overhead matters (e.g., #### `impl` Blocks ```sx impl Allocator for GPA { - alloc :: (self: *GPA, size: s64) -> *void { + alloc :: (self: *GPA, size: i64) -> *void { self.alloc_count += 1; malloc(size); } @@ -667,8 +667,8 @@ s : Sizable = xx @w; // identical to `xx w` — borrows w Protocol methods can have bodies. `self` dispatches through the vtable (dynamic dispatch): ```sx Writer :: protocol { - write :: (data: string) -> s64; // required - write_line :: (data: string) -> s64 { // default + write :: (data: string) -> i64; // required + write_line :: (data: string) -> i64 { // default n := self.write(data); n + self.write("\n"); } @@ -707,7 +707,7 @@ are_equal :: (a: $T/Eq, b: T) -> bool { a.eq(b); } eq_and_hash :: (a: $T/Eq/Hashable, b: T) -> bool { ... } ``` -Constraints produce clear errors at monomorphization: `"s64 does not implement Hashable"`. Dispatch is static — same as unconstrained generics but with compile-time validation. +Constraints produce clear errors at monomorphization: `"i64 does not implement Hashable"`. Dispatch is static — same as unconstrained generics but with compile-time validation. Constraints also work on struct type parameters: ```sx @@ -722,7 +722,7 @@ SortedPair :: struct ($T: Type/Comparable) { Pair :: struct ($T: Type) { a: T; b: T; } impl Summable for Pair($T) { - sum :: (self: *Pair(T)) -> s32 { xx self.a + xx self.b; } + sum :: (self: *Pair(T)) -> i32 { xx self.a + xx self.b; } } ``` @@ -754,13 +754,13 @@ Into :: protocol(Target: Type) { A user can then add conversions for any `(Source, Target)` pair: ```sx -MyString :: struct { tag: s64 = 0; } +MyString :: struct { tag: i64 = 0; } -impl Into(MyString) for s64 { - convert :: (self: s64) -> MyString { .{ tag = self }; } +impl Into(MyString) for i64 { + convert :: (self: i64) -> MyString { .{ tag = self }; } } -main :: () -> s32 { +main :: () -> i32 { x : MyString = xx 42; // direct call to monomorphised convert 0; } @@ -788,7 +788,7 @@ impl Into(MyBuf) for []u8 { ... } - **Only at explicit `xx`.** Implicit conversions (assignment, parameter passing) never trigger user-space coercions. - **Explicit target required.** `xx val` with no surrounding type - context still defaults to `s64` for legacy reasons; the user-space + context still defaults to `i64` for legacy reasons; the user-space fallback only fires when the target was named explicitly. - **Import-scoped visibility.** An `impl` is visible from a file only if the file transitively imports the impl's defining module. An impl @@ -809,10 +809,10 @@ Anonymous product types with optional field names. Tuples are first-class values #### Construction ```sx -pair := (40, 2); // positional tuple: (s64, s64) -named := (x: 10, y: 20); // named tuple: (x: s64, y: s64) +pair := (40, 2); // positional tuple: (i64, i64) +named := (x: 10, y: 20); // named tuple: (x: i64, y: i64) single := (42,); // 1-tuple (trailing comma in value position) -zeroed : (s32, s32) = ---; // zero-initialized tuple +zeroed : (i32, i32) = ---; // zero-initialized tuple ``` Note: In value position, `(expr)` without a comma is a grouping expression, not a tuple. Use `(expr,)` for a 1-tuple value. @@ -820,10 +820,10 @@ Note: In value position, `(expr)` without a comma is a grouping expression, not #### Type Syntax In type position, `(T)` is always a tuple type — no trailing comma needed. The `->` arrow disambiguates function types from tuple types: ```sx -(s64) // tuple type with one field -(s64, s64) // tuple type with two fields -(s64) -> s64 // function type: takes s64, returns s64 -(s64, s64) -> s64 // function type: takes two s64, returns s64 +(i64) // tuple type with one field +(i64, i64) // tuple type with two fields +(i64) -> i64 // function type: takes i64, returns i64 +(i64, i64) -> i64 // function type: takes two i64, returns i64 ``` #### Field Access @@ -836,15 +836,15 @@ named.0; // 10 — numeric index also works on named tuples #### As Return Type ```sx -swap :: (a: s64, b: s64) -> (s64, s64) { (b, a); } -wrap :: (x: s64) -> (s64) { (x,); } +swap :: (a: i64, b: i64) -> (i64, i64) { (b, a); } +wrap :: (x: i64) -> (i64) { (x,); } s := swap(1, 2); // s.0 = 2, s.1 = 1 t := wrap(42); // t.0 = 42 ``` #### Representation -Tuples are represented as anonymous LLVM struct types (same layout as named structs). A tuple `(s64, s64)` has LLVM type `{ i64, i64 }`. +Tuples are represented as anonymous LLVM struct types (same layout as named structs). A tuple `(i64, i64)` has LLVM type `{ i64, i64 }`. #### Tuple Operators @@ -856,14 +856,14 @@ Tuples are represented as anonymous LLVM struct types (same layout as named stru **Concatenation** (`+`) — creates a new tuple with fields from both sides: ```sx -c := (1, 2) + (3, 4); // c : (s64, s64, s64, s64) +c := (1, 2) + (3, 4); // c : (i64, i64, i64, i64) c.0; // 1 c.3; // 4 ``` **Repetition** (`*`) — repeats a tuple N times (N must be a compile-time integer literal): ```sx -r := (1, 2) * 3; // r : (s64, s64, s64, s64, s64, s64) +r := (1, 2) * 3; // r : (i64, i64, i64, i64, i64, i64) r.0; // 1 r.5; // 2 ``` @@ -886,26 +886,26 @@ Fixed-size arrays with element type and length. ```sx buffer : [5]f32 = .[0, 2, 3.5, 4, 0]; val := buffer[2]; // 3.5 -buffer.len // 5 (compile-time constant, s64) +buffer.len // 5 (compile-time constant, i64) ``` Arrays can also be constructed programmatically with the `Array` builtin: ```sx -MyArr :: Array(5, s32); // equivalent to [5]s32 +MyArr :: Array(5, i32); // equivalent to [5]i32 ``` A **count** is a compile-time integer used as an array dimension, a `Vector` lane count, or a generic value-param count. Every count must be **integral**: an -integral compile-time float folds to its integer (`[4.0]s64` ≡ `[4]s64`), while a +integral compile-time float folds to its integer (`[4.0]i64` ≡ `[4]i64`), while a non-integral float is rejected (an array dimension reports "array dimension must be an integer, but '4.5' is a non-integral float"). This holds however the float is written — a literal (`4.0`), a float-typed const (`N : f64 : 4.0`), or a const **expression** whose value is integral, including one built from a -non-integral float-const leaf (`F : f64 : 2.5; [F + 1.5]s64` ≡ `[4]s64`, and -likewise through a const, `K : s64 : F + 1.5; [K]s64`), a builtin float -numeric-limit accessor (`[f64.max - f64.max]s64` → length 0), a float `%`, or a -float `/` whose quotient is integral (`[6.0 / 2.0]s64` ≡ `[3]s64`; a non-integral -quotient like `[5.0 / 2.0]s64` = 2.5 is rejected — a float `/` is always float +non-integral float-const leaf (`F : f64 : 2.5; [F + 1.5]i64` ≡ `[4]i64`, and +likewise through a const, `K : i64 : F + 1.5; [K]i64`), a builtin float +numeric-limit accessor (`[f64.max - f64.max]i64` → length 0), a float `%`, or a +float `/` whose quotient is integral (`[6.0 / 2.0]i64` ≡ `[3]i64`; a non-integral +quotient like `[5.0 / 2.0]i64` = 2.5 is rejected — a float `/` is always float division, never integer truncation, even when both operands are integral). A count and a typed binding's float→integer initializer share the *same* compile-time float @@ -939,13 +939,13 @@ rather than being an error. A slice `[]T` is a fat pointer `{ptr, i64}` referencing a contiguous sequence of `T` elements. Same runtime layout as `string`. ```sx // Arrays implicitly coerce to slices at call sites -arr : [5]s32 = .[3, 1, 4, 1, 5]; -sortSlice(arr); // [5]s32 → []s32 coercion +arr : [5]i32 = .[3, 1, 4, 1, 5]; +sortSlice(arr); // [5]i32 → []i32 coercion // Slice operations items[i] // read element at index items[i] = val; // write element at index -items.len // length (s64) +items.len // length (i64) items.ptr // raw pointer ``` @@ -954,10 +954,10 @@ Slices support generic type parameters: `[]$T` introduces type parameter `T` inf ### Subslicing Arrays, slices, and strings support subslice syntax to create zero-copy views: ```sx -arr : [5]s32 = .[3, 1, 4, 1, 5]; -sub := arr[1..4]; // []s32 → [1, 4, 1] -head := arr[..3]; // []s32 → [3, 1, 4] -tail := arr[2..]; // []s32 → [4, 1, 5] +arr : [5]i32 = .[3, 1, 4, 1, 5]; +sub := arr[1..4]; // []i32 → [1, 4, 1] +head := arr[..3]; // []i32 → [3, 1, 4] +tail := arr[2..]; // []i32 → [4, 1, 5] msg := "hello world"; word := msg[6..11]; // string → "world" @@ -1016,8 +1016,8 @@ np : *Vec2 = null; **Many-pointer**: `[*]T` supports indexing for buffers of unknown size. ```sx -arr : [5]s32 = .[10, 20, 30, 40, 50]; -mp : [*]s32 = @arr[0]; // *s32 → [*]s32 implicit +arr : [5]i32 = .[10, 20, 30, 40, 50]; +mp : [*]i32 = @arr[0]; // *i32 → [*]i32 implicit val := mp[2]; // 30 ``` @@ -1032,7 +1032,7 @@ val := mp[2]; // 30 **Unchecked writes (the pointer contract)**: pointers carry no read-only qualifier — there is no `const` pointer type in sx (`const` is not a keyword). Taking the address of constant storage yields a plain -pointer: `@K` on an array constant `K : [4]s64 : .[...]` is `*[4]s64`. +pointer: `@K` on an array constant `K : [4]i64 : .[...]` is `*[4]i64`. Reads through it are fine; **writes through any pointer are unchecked**, and writing into constant storage through a pointer is undefined behavior (the storage is marked constant in the emitted binary). The compile-time @@ -1049,37 +1049,37 @@ Optional types represent values that may or may not be present. #### Type Syntax ```sx -x: ?s32 = 42; // optional s32, has value -y: ?s32 = null; // optional s32, no value +x: ?i32 = 42; // optional i32, has value +y: ?i32 = null; // optional i32, no value ``` -Any type `T` can be made optional: `?s32`, `?string`, `?Point`, `?*T`, `?[]T`. +Any type `T` can be made optional: `?i32`, `?string`, `?Point`, `?*T`, `?[]T`. #### LLVM Representation -- Non-pointer optionals (`?s32`, `?Point`): `{ T, i1 }` struct — payload + has_value flag +- Non-pointer optionals (`?i32`, `?Point`): `{ T, i1 }` struct — payload + has_value flag - Pointer optionals (`?*T`): bare pointer — null represents absence #### Implicit Wrapping A value of type `T` implicitly converts to `?T`: ```sx -wrap :: (n: s32) -> ?s32 { - if n > 0 { return n; } // s32 → ?s32 (wraps) - return null; // null → ?s32 +wrap :: (n: i32) -> ?i32 { + if n > 0 { return n; } // i32 → ?i32 (wraps) + return null; // null → ?i32 } ``` #### Force Unwrap (`!`) Extracts the payload, traps at runtime if null: ```sx -x: ?s32 = 42; -val := x!; // val : s32 = 42 +x: ?i32 = 42; +val := x!; // val : i32 = 42 ``` #### Null Coalescing (`??`) Returns the payload if present, otherwise evaluates the right-hand side: ```sx -x: ?s32 = 42; -y: ?s32 = null; +x: ?i32 = 42; +y: ?i32 = null; a := x ?? 0; // 42 b := y ?? 99; // 99 ``` @@ -1087,9 +1087,9 @@ b := y ?? 99; // 99 #### Safe Unwrap (`if val := expr`) Binds the payload to a variable if present: ```sx -x: ?s32 = 42; +x: ?i32 = 42; if val := x { - print("{}\n", val); // val : s32 = 42 + print("{}\n", val); // val : i32 = 42 } else { print("none\n"); } @@ -1125,12 +1125,12 @@ Result type of `x?.field` is always `?FieldType`. #### Flow-Sensitive Narrowing The compiler narrows `?T` to `T` in control flow branches: ```sx -x: ?s32 = 42; +x: ?i32 = 42; if x != null { - print("{}\n", x); // x is s32 here (narrowed) + print("{}\n", x); // x is i32 here (narrowed) } if x == null { return; } -print("{}\n", x); // x is s32 here (guard narrowing) +print("{}\n", x); // x is i32 here (guard narrowing) ``` Compound conditions: @@ -1147,7 +1147,7 @@ Reassignment kills narrowing. #### Struct Field Defaults Optional fields in structs default to `null`: ```sx -Node :: struct { value: s32; next: ?s32; } +Node :: struct { value: i32; next: ?i32; } n := Node.{ value = 10 }; // n.next is null ``` @@ -1167,11 +1167,11 @@ libc :: #library "c"; sdl :: #library "SDL3"; // Bind foreign functions — library ref is required -socket :: (domain: s32, type: s32, protocol: s32) -> s32 #foreign libc; +socket :: (domain: i32, type: i32, protocol: i32) -> i32 #foreign libc; SDL_Init :: (flags: u32) -> bool #foreign sdl; // Symbol renaming — optional second argument gives the C symbol name -write_fd :: (fd: s32, buf: [*]u8, count: u64) -> s64 #foreign libc "write"; +write_fd :: (fd: i32, buf: [*]u8, count: u64) -> i64 #foreign libc "write"; ``` - `#library "name"` must be assigned to a named constant. The library is passed to the linker (`-lname` on Unix, `name.lib` on Windows). @@ -1185,7 +1185,7 @@ write_fd :: (fd: s32, buf: [*]u8, count: u64) -> s64 #foreign libc "write"; | `const char*` (input) | `[:0]u8` | compiler extracts `.ptr` at call site | | `char*` (output buffer) | `[*]u8` | raw buffer, no length | | `const char**` | `*[:0]u8` | address of `[:0]u8` — `.ptr` at offset 0 | -| `int*` (single out) | `*s32` | | +| `int*` (single out) | `*i32` | | | `unsigned*` (single out) | `*u32` | | | `float*` (buffer) | `[*]f32` | | | `void*` (generic) | `*void` | only for truly opaque/generic data | @@ -1238,8 +1238,8 @@ s := sqrt(9.0); // 3.0 Expressed as `(param_types) -> return_type`. A function with no return type annotation returns void. ```sx -// type is (s32) -> s32 -compute :: (x: s32) -> s32 { x * x; } +// type is (i32) -> i32 +compute :: (x: i32) -> i32 { x * x; } // type is () -> void main :: () { } @@ -1258,7 +1258,7 @@ through it: ```sx Box :: struct ($T: Type) { item: T; } BoxAlias :: Box; // same template -b := BoxAlias(s64).{ item = 3 }; +b := BoxAlias(i64).{ item = 3 }; b2 : BoxAlias(string) = .{ item = "x" }; // annotation head too ``` @@ -1298,7 +1298,7 @@ sum :: (a: $T, b: T) -> T { - Bare `T` (without `$`) **references** the introduced type parameter - At call sites, type arguments are **inferred** from actual argument types: ```sx - sum(40, 2) // T = s32 + sum(40, 2) // T = i32 sum(1.5, 2.5) // T = f32 ``` - Each unique set of concrete types produces a **separate specialized function** (monomorphization) @@ -1313,7 +1313,7 @@ path_join :: (..parts: []string) -> string { ... } - The leading `..` marks the parameter as variadic; the declared type is the slice the body sees (so `..parts: []string` makes `parts` a `[]string` inside). - The variadic parameter must be the last positional parameter. -- For homogeneous element types (`[]s32`, `[]string`, ...), the call site packs the +- For homogeneous element types (`[]i32`, `[]string`, ...), the call site packs the trailing args into a stack-allocated `[N x T]` and passes a slice over it. - For `[]Any`, each trailing arg is boxed into `Any` (type tag + payload) before packing; `args[i]` reads back the boxed value. @@ -1482,23 +1482,23 @@ map :: (mapper: Closure(..sources.T) -> $R, ..sources: ValueListenable) isReady : ValueListenable(bool) = map( (va, vb, vc) => va and vb > 10 and vc == "cool", - a, b, c); // a,b,c : ValueListenable(bool/s32/string) + a, b, c); // a,b,c : ValueListenable(bool/i32/string) ``` ### Type Inference - `::` bindings infer type from the right-hand side - `:=` bindings infer type from the right-hand side - Explicit annotation overrides inference: `NAME : f64 : 0.9;` -- Integer literals default to `s64` +- Integer literals default to `i64` - Float literals default to `f64` - Enum literals (`.variant`) infer their enum type from context (expected type) ### Type Conversions **Implicit (widening)** — allowed without annotation: -- Integer to wider integer of same signedness (`u8` → `u16`, `s8` → `s32`) -- Unsigned to strictly wider signed (`u8` → `s16`) -- Any integer to any float (`u8` → `f32`, `s32` → `f64`) +- Integer to wider integer of same signedness (`u8` → `u16`, `i8` → `i32`) +- Unsigned to strictly wider signed (`u8` → `i16`) +- Any integer to any float (`u8` → `f32`, `i32` → `f64`) - Float to wider float (`f32` → `f64`) - Integer literals can convert to any numeric type implicitly @@ -1507,10 +1507,10 @@ an integer-typed binding without `xx`/`cast` is governed by the SAME rule an array dimension / lane count uses (see "Array dimensions are integral", §2): - An **integral** compile-time float **folds** to its integer, whether written - as a literal or a const expression: `y : s64 = 4.0` ≡ `y : s64 = 4`, - `n : s64 = -2.0` ≡ `-2`, `y : s64 = M + 2.0` → 4 (`M :: 2`). A const expression + as a literal or a const expression: `y : i64 = 4.0` ≡ `y : i64 = 4`, + `n : i64 = -2.0` ≡ `-2`, `y : i64 = M + 2.0` → 4 (`M :: 2`). A const expression here is *any* compile-time-constant float expression — an integer-const leaf - (`M + 2.0`), a float-typed const leaf (`F : f64 : 2.5; y : s64 = F + 1.5` → 4), + (`M + 2.0`), a float-typed const leaf (`F : f64 : 2.5; y : i64 = F + 1.5` → 4), a builtin float numeric-limit accessor (`f64.max - f64.max` → 0), a float `%` (`6.0 % 4.0` → 2), or a float `/` whose quotient is integral (`6.0 / 2.0` → 3), or any combination of them. The compile-time float evaluator recognises every @@ -1521,16 +1521,16 @@ array dimension / lane count uses (see "Array dimensions are integral", §2): but `5.0 / 2.0` is `2.5` (errors) — never integer truncating division. - A **non-integral** compile-time float — literal OR const expression — is a **compile error** with one uniform wording at every site: - `y : s64 = 1.5`, `y : s64 = M + 0.5`, `y : s64 = F + 0.25` (= 2.75), - `y : s64 = f64.true_min + 0.5` (= 0.5), `y : s64 = 5.5 % 2.0` (= 1.5), and - `y : s64 = 5.0 / 2.0` (= 2.5) all → - "cannot implicitly narrow non-integral float '…' to 's64'; use an explicit + `y : i64 = 1.5`, `y : i64 = M + 0.5`, `y : i64 = F + 0.25` (= 2.75), + `y : i64 = f64.true_min + 0.5` (= 0.5), `y : i64 = 5.5 % 2.0` (= 1.5), and + `y : i64 = 5.0 / 2.0` (= 2.5) all → + "cannot implicitly narrow non-integral float '…' to 'i64'; use an explicit cast (`xx`/`cast`)". - This applies uniformly to a typed **local**, a function **param default**, a struct **field default**, a call **argument**, a typed module **constant** - (`K : s64 : 4.0` → 4; `K : s64 : M + 2.0` → 4; `N : s64 : 1.5` and - `N : s64 : M + 0.5` → error), and an array **dimension** / count (`[F + 1.5]s64` - ≡ `[4]s64`; `[F + 0.25]s64` → error). All five sites fold the *same* set of + (`K : i64 : 4.0` → 4; `K : i64 : M + 2.0` → 4; `N : i64 : 1.5` and + `N : i64 : M + 0.5` → error), and an array **dimension** / count (`[F + 1.5]i64` + ≡ `[4]i64`; `[F + 0.25]i64` → error). All five sites fold the *same* set of compile-time float expressions through one evaluator — only the dimension/count site phrases its rejection as "array dimension must be an integer, but '…' is a non-integral float", since the `xx`/`cast` escape does not apply in a count @@ -1538,18 +1538,18 @@ array dimension / lane count uses (see "Array dimensions are integral", §2): narrow it explicitly with `xx`/`cast`. **Explicit (narrowing)** — requires `xx` prefix (or `cast(T)`): -- Integer to narrower integer (`s32` → `u8`) -- Signed to unsigned (`s32` → `u32`) +- Integer to narrower integer (`i32` → `u8`) +- Signed to unsigned (`i32` → `u32`) - Float to narrower float (`f64` → `f32`) - Float to any integer (`f64` → `u16`) — always **truncates**, integral or not - (`y : s64 = xx 1.5` → 1); this is the escape hatch from the implicit rule above -- Unsigned to signed of same or narrower width (`u8` → `s8`) + (`y : i64 = xx 1.5` → 1); this is the escape hatch from the implicit rule above +- Unsigned to signed of same or narrower width (`u8` → `i8`) The `xx` prefix operator marks an expression for auto-conversion to the expected type from context (assignment, declaration, argument, return): ```sx large: f64 = 5999.5; x : u16 = xx large; // f64 → u16 -d : u8 = #run xx resolve(5); // s32 → u8 at compile time +d : u8 = #run xx resolve(5); // i32 → u8 at compile time ``` Using `xx` outside a typed context (where the target type is known) is a compile error. @@ -1576,11 +1576,11 @@ and never will be — it is an ordinary identifier. Examples: ```sx -SOME_INT :: 0; // s64 +SOME_INT :: 0; // i64 SOME_STR :: "Hello"; // string SOME_FLOAT :: 0.3; // f64 SOME_DOUBLE : f64 : 0.9; // f64 (explicit) -SOME_FUNC :: () => 42; // () -> s64 +SOME_FUNC :: () => 42; // () -> i64 SOME_TYPE :: f64; // type alias ``` @@ -1593,7 +1593,7 @@ constant expression: both `N : string : 4` and `N : string : M + 2` (with `M :: 2`) are rejected at the declaration — neither registers a usable constant. A constant expression's type is its promoted result type (see [Arithmetic](#arithmetic)), so a mixed int+float initializer is a float in either -operand order: `C : s64 : M + 0.5` and `C : s64 : 0.5 + M` are both rejected, and +operand order: `C : i64 : M + 0.5` and `C : i64 : 0.5 + M` are both rejected, and `F : f64 : M + 0.5` is accepted and folds to `2.5`. #### Array Constants @@ -1604,18 +1604,18 @@ into that storage directly — no per-use copies. Unused array constants are dropped by dead-global elimination. ```sx -K : [4]s64 : .[11, 22, 33, 44]; // typed -A :: .[1, 2, 3]; // untyped — infers [3]s64 +K : [4]i64 : .[11, 22, 33, 44]; // typed +A :: .[1, 2, 3]; // untyped — infers [3]i64 M :: .[1, 2.2, 3]; // untyped — infers [3]f64 x := K[i]; // GEP into the global — no copy y := K; // by-value copy (normal array-value semantics); // mutating y does not touch K f(K); // by-value param — copy at the call -p := @K; // *[4]s64 — address of the const storage (reads) +p := @K; // *[4]i64 — address of the const storage (reads) ``` -Untyped inference unifies the element types: all ints → `s64`; any float +Untyped inference unifies the element types: all ints → `i64`; any float present promotes the whole element type to `f64` (int elements convert exactly, mirroring "an integer fits any integer or float"); all floats → `f64`; `bool` / `string` elements must be homogeneous. Element shapes may @@ -1641,7 +1641,7 @@ are independent. The same constant-expression forms are accepted as elements of array constants. ```sx -Color :: struct { r, g, b: s64; } +Color :: struct { r, g, b: i64; } LIT :: Color.{ r = 255, g = 0, b = 0 }; // one global; uses GEP it EXPR :: Color.{ r = K + 1, g = K * 2, b = 0 }; // folds, also one global W : Color : Color.{ r = 1, g = 2, b = 3 }; // typed form, same storage @@ -1654,8 +1654,8 @@ documented contract for this class — side effects run per use and the value may differ between reads: ```sx -counter : s64 = 0; -bump :: () -> s64 { counter += 1; counter } +counter : i64 = 0; +bump :: () -> i64 { counter += 1; counter } CALL :: Color.{ r = bump(), g = 0, b = 0 }; print("{} {}\n", CALL.r, CALL.r); // prints '1 2'; counter is now 2 @@ -1724,7 +1724,7 @@ The `:=` operator creates a mutable binding. The type is inferred unless explici Examples: ```sx -x := 42; // s32, mutable +x := 42; // i32, mutable x := if true then 1 else 2; z : Foo = .variant2; // Foo, mutable, explicit type a : Foo; // Foo, default-initialized (a=0, b=42, c=undef) @@ -1752,11 +1752,11 @@ return slot. See [§12 Error Handling](#12-error-handling). Examples: ```sx -compute :: (x: s32) -> s32 { +compute :: (x: i32) -> i32 { x * x // trailing expression, no `;` → the return value } -square :: (x: s32) -> s32 { +square :: (x: i32) -> i32 { return x * x; // explicit return is equivalent } @@ -1782,7 +1782,7 @@ A block in **value position** that produces no value is a compile error (rather than silently returning a zero default): ```sx -double :: (n: s32) -> s32 { +double :: (n: i32) -> i32 { n * 2; // error: value discarded by `;` — drop it, or use `return` } ``` @@ -1792,7 +1792,7 @@ a value-discard, so the arm still yields `expr`. Only an explicit inner braced block inside an arm follows the rule: ```sx -classify :: (n: s32) -> s32 { +classify :: (n: i32) -> i32 { if n == { case 0: 100; // arm value is 100 (the `;` is just the separator) case 1: { x := 5; x*2 } // braced block, no trailing `;` → value 10 @@ -1860,12 +1860,12 @@ An optional backing type can be specified after the `enum` keyword (Jai-style): ```sx Color :: enum u8 { red; green; blue; } -Status :: enum s16 { ok; error; timeout; } +Status :: enum i16 { ok; error; timeout; } ``` Syntax: `Name :: enum [flags] [type] { ... }` -The backing type must be an integer type (`u8`, `u16`, `u32`, `s8`, `s16`, `s32`, `s64`, etc.). When omitted, the default is `s64`. This is useful for C interop (matching C enum sizes) and memory efficiency. +The backing type must be an integer type (`u8`, `u16`, `u32`, `i8`, `i16`, `i32`, `i64`, etc.). When omitted, the default is `i64`. This is useful for C interop (matching C enum sizes) and memory efficiency. ### Enum Layout Struct @@ -1998,7 +1998,7 @@ a floating-point operand yields the **float**, regardless of operand order (`n + 0.5` and `0.5 + n` both produce an `f64`). This holds for the expression's static type as well as its value, so `print("{}", n + 0.5)` formats a float and a typed binding `x : f64 = n + 0.5` is exact (not truncated). A mixed-numeric -expression therefore does not satisfy an integer annotation — `C : s64 : n + 0.5` +expression therefore does not satisfy an integer annotation — `C : i64 : n + 0.5` is a `type mismatch` in either operand order. ### Chained Comparisons @@ -2123,7 +2123,7 @@ optional **capture group** and the body. Each iterable is a collection ```sx for xs (x) { } // collection, element capture -for 0..n (i) { } // range, `end` exclusive; cursor i (s64) +for 0..n (i) { } // range, `end` exclusive; cursor i (i64) for 1..=5 (a) { } // `..=` — end inclusive: 1 2 3 4 5 for 0..5 { } // no captures — body runs 5 times for xs { } // no captures — body runs xs.len times @@ -2166,7 +2166,7 @@ its own cursor; consequences: on mismatch — the first iterable is the authoritative one. **Captures are positional**: the group binds one name per iterable, in -order — range positions bind the cursor value (s64), collection positions +order — range positions bind the cursor value (i64), collection positions bind the element. An empty group is omitted entirely (no parens). Capture names shadow outer bindings, like any inner declaration. Use `_` to discard a position. The old single-iterable index form `for xs: (x, i)` is gone — @@ -2205,7 +2205,7 @@ compile-time constant (so it can index a pack: `break;` exits the loop. `continue;` skips to the next iteration. Both run the iteration's pending `defer`s first (see Defer). ```sx -arr : [5]s32 = .[1, 2, 3, 4, 5]; +arr : [5]i32 = .[1, 2, 3, 4, 5]; for arr, 0.. (val, ix) { if ix == 2 { continue; } print("{}\n", val); @@ -2219,7 +2219,7 @@ for arr, 0.. (val, ix) { ``` Anonymous function. Produces a function value. Supports the same parameter features as named functions: `$` generic type params, `..` variadic params, and optional return type annotation. ```sx -SOME_FUNC :: () => 42; // () -> s32 +SOME_FUNC :: () => 42; // () -> i32 double :: (x: $T) -> T => x + x; // generic lambda with return type ``` @@ -2229,17 +2229,17 @@ A **closure** is a function bundled with captured state. It is represented as a #### Closure Type ```sx -Closure(param_types) -> R // e.g. Closure(s32, s32) -> s32 -Closure(param_types) // void return: Closure(s64) -> void -?Closure(s32) -> s32 // optional closure (null = none) +Closure(param_types) -> R // e.g. Closure(i32, i32) -> i32 +Closure(param_types) // void return: Closure(i64) -> void +?Closure(i32) -> i32 // optional closure (null = none) Closure(..Ts) -> R // pack-expanded params (see Variadic Heterogeneous Type Packs) ``` #### Creating Closures — `closure()` intrinsic ```sx offset := 50; -f := closure((x: s32) -> s32 => x + offset); // expression body -g := closure((x: s32) -> s32 { // block body +f := closure((x: i32) -> i32 => x + offset); // expression body +g := closure((x: i32) -> i32 { // block body if x < 0 { return 0; } return x + offset; }); @@ -2254,7 +2254,7 @@ The `closure()` intrinsic: **Capture semantics**: capture by value (snapshot at creation time). Mutating the original variable after creating the closure does not affect the captured value. ```sx n := 10; -f := closure((x: s64) -> s64 => x + n); +f := closure((x: i64) -> i64 => x + n); n = 999; print("{}\n", f(5)); // 15, not 1004 ``` @@ -2269,16 +2269,16 @@ The compiler prepends the env pointer to the argument list and does an indirect #### Auto-Promotion A bare function can be implicitly promoted to a `Closure` where one is expected. The compiler generates a static thunk that ignores the env parameter, with a null env pointer. ```sx -double :: (x: s32) -> s32 { return x * 2; } -apply :: (f: Closure(s32) -> s32, x: s32) -> s32 { return f(x); } +double :: (x: i32) -> i32 { return x * 2; } +apply :: (f: Closure(i32) -> i32, x: i32) -> i32 { return f(x); } apply(double, 10); // double auto-promoted to Closure ``` #### Factory Functions Functions can return closures, enabling the factory pattern: ```sx -make_adder :: (n: s32) -> Closure(s32) -> s32 { - return closure((x: s32) -> s32 => x + n); +make_adder :: (n: i32) -> Closure(i32) -> i32 { + return closure((x: i32) -> i32 => x + n); } add5 := make_adder(5); print("{}\n", add5(100)); // 105 @@ -2289,7 +2289,7 @@ print("{}\n", add5(100)); // 105 ```sx Button :: struct { label: string; - on_click: ?Closure(s64) -> void; + on_click: ?Closure(i64) -> void; } btn := Button.{ label = "OK", on_click = null }; if handler := btn.on_click { @@ -2300,7 +2300,7 @@ if handler := btn.on_click { #### Memory Closure env is allocated via `context.allocator`. The compiler auto-initializes `context` with a default GPA (malloc/free wrapper) at the start of `main()`. Use `push Context` to override with a custom allocator. Auto-promoted closures have a null env and require no allocation. ```sx -f := closure((x: s64) -> s64 => x + 10); // env allocated via default GPA +f := closure((x: i64) -> i64 => x + 10); // env allocated via default GPA print("{}\n", f(5)); ``` @@ -2322,11 +2322,11 @@ via dot. The `ufcs` keyword opts a function in, with two spellings — marking the function itself, or declaring a (renaming) alias: ```sx -create :: (x: s32) -> void {} // plain — NOT dot-callable -create2 :: ufcs (x: s32) -> void {} // ufcs-marked — dot-callable +create :: (x: i32) -> void {} // plain — NOT dot-callable +create2 :: ufcs (x: i32) -> void {} // ufcs-marked — dot-callable create3 :: ufcs create; // ufcs alias — dot-callable -f : s32 = 4; +f : i32 = 4; f.create(); // error: 'create' is not a ufcs function (help: call it // directly, pipe it, or declare it `create :: ufcs (...)`) f.create2(); // works — calls create2(f) @@ -2360,7 +2360,7 @@ xs |> first_of(); // pipe — desugars to first_of(xs) The alias form decouples the method name from the function name — useful when the bare name reads poorly in dot position: ```sx -arena_alloc :: (arena: *Arena, size: s64) -> *void { ... } +arena_alloc :: (arena: *Arena, size: i64) -> *void { ... } alloc :: ufcs arena_alloc; myArena.alloc(42); // calls arena_alloc(myArena, 42) @@ -2372,7 +2372,7 @@ This avoids the naming redundancy of `myArena.arena_alloc(42)`. #### Tuple UFCS Splatting When a tuple is used as the receiver of a UFCS call, its elements are unpacked as leading arguments: ```sx -num_add :: (a: s64, b: s64) -> s64 { a + b; } +num_add :: (a: i64, b: i64) -> i64 { a + b; } add :: ufcs num_add; (40, 2).add(); // splats to num_add(40, 2) → 42 @@ -2382,7 +2382,7 @@ add :: ufcs num_add; With more arguments: ```sx -compute :: (a: s64, b: s64, c: s64, d: s64) -> s64 { a + b * c - d; } +compute :: (a: i64, b: i64, c: i64, d: i64) -> i64 { a + b * c - d; } calc :: ufcs compute; (1, 2, 3, 4).calc(); // full splat → compute(1, 2, 3, 4) @@ -2470,7 +2470,7 @@ A block `{ ... }` contains zero or more statements. The last expression in a blo In function bodies, the last expression becomes the return value: ```sx -compute :: (x: s32) -> s32 { +compute :: (x: i32) -> i32 { x * x; // this is returned } ``` @@ -2528,31 +2528,31 @@ Built-in functions are declared in `std.sx` with the `#builtin` suffix, which te - `cos(x: $T) -> T` — cosine (maps to LLVM intrinsic) ### Memory -- `malloc(size: s64) -> *void` — allocate `size` bytes of heap memory +- `malloc(size: i64) -> *void` — allocate `size` bytes of heap memory - `free(ptr: *void) -> void` — free previously allocated memory -- `memcpy(dst: *void, src: *void, size: s64) -> *void` — copy `size` bytes from `src` to `dst` -- `memset(dst: *void, val: s64, size: s64) -> void` — fill `size` bytes at `dst` with `val` -- `size_of($T: Type) -> s64` — size of type `T` in bytes -- `align_of($T: Type) -> s64` — alignment of type `T` in bytes +- `memcpy(dst: *void, src: *void, size: i64) -> *void` — copy `size` bytes from `src` to `dst` +- `memset(dst: *void, val: i64, size: i64) -> void` — fill `size` bytes at `dst` with `val` +- `size_of($T: Type) -> i64` — size of type `T` in bytes +- `align_of($T: Type) -> i64` — alignment of type `T` in bytes ### Type Introspection - `type_of(val: $T) -> Type` — returns the runtime type tag of a value - `type_name($T: Type) -> string` — returns the name of type `T` as a string (e.g., `"Point"`) -- `field_count($T: Type) -> s64` — returns the number of fields (struct), variants (enum), or elements (vector) in type `T` -- `field_name($T: Type, idx: s64) -> string` — returns the name of the `idx`-th field (struct) or variant (enum) of type `T` -- `field_value(s: $T, idx: s64) -> Any` — returns the `idx`-th field (struct) or element (vector) of `s`, boxed as `Any` -- `field_value_int($T: Type, idx: s64) -> s64` — returns the integer value of the `idx`-th enum variant -- `field_index($T: Type, val: T) -> s64` — returns the sequential variant index for an explicit enum value (reverse of `field_value_int`). Returns `-1` if no variant matches. +- `field_count($T: Type) -> i64` — returns the number of fields (struct), variants (enum), or elements (vector) in type `T` +- `field_name($T: Type, idx: i64) -> string` — returns the name of the `idx`-th field (struct) or variant (enum) of type `T` +- `field_value(s: $T, idx: i64) -> Any` — returns the `idx`-th field (struct) or element (vector) of `s`, boxed as `Any` +- `field_value_int($T: Type, idx: i64) -> i64` — returns the integer value of the `idx`-th enum variant +- `field_index($T: Type, val: T) -> i64` — returns the sequential variant index for an explicit enum value (reverse of `field_value_int`). Returns `-1` if no variant matches. - `is_flags($T: Type) -> bool` — returns `true` if `T` is a flags enum (declared with `#flags`) -- `type_eq($A: Type, $B: Type) -> bool` — structural TypeId equality (`type_eq(s64, s64)` is `true`, distinct shapes are `false`); folds at compile time, so `inline if type_eq(...)` is comptime-decidable +- `type_eq($A: Type, $B: Type) -> bool` — structural TypeId equality (`type_eq(i64, i64)` is `true`, distinct shapes are `false`); folds at compile time, so `inline if type_eq(...)` is comptime-decidable - `type_is_unsigned($T: Type) -> bool` — `true` if `T` is an unsigned integer (`u8`/`u16`/`u32`/`u64`/`usize`); used by `{}` formatting to print unsigned integers as unsigned decimal -The seven type-only builtins — `size_of`, `align_of`, `field_count`, `type_name`, `type_eq`, `type_is_unsigned`, `is_flags` — strictly require a **type** argument. A spelled type (`s64`, `*u8`, `Point`) or a generic type parameter (`T`) is accepted by all seven. A runtime `Type` value (`type_of(x)`, a `[]Type` element, a `Type`-typed local) is currently supported by `type_name` and `type_is_unsigned` only; the other five (`size_of`, `align_of`, `field_count`, `type_eq`, `is_flags`) are compile-time-only — a runtime `Type` value is not yet supported there (runtime reflection is deferred to a future step). Passing a value (`size_of(6)`, `type_is_unsigned(true)`) is a compile-time error — ` expects a type, got ''` — not a silent reinterpretation of the value's bits as a type. +The seven type-only builtins — `size_of`, `align_of`, `field_count`, `type_name`, `type_eq`, `type_is_unsigned`, `is_flags` — strictly require a **type** argument. A spelled type (`i64`, `*u8`, `Point`) or a generic type parameter (`T`) is accepted by all seven. A runtime `Type` value (`type_of(x)`, a `[]Type` element, a `Type`-typed local) is currently supported by `type_name` and `type_is_unsigned` only; the other five (`size_of`, `align_of`, `field_count`, `type_eq`, `is_flags`) are compile-time-only — a runtime `Type` value is not yet supported there (runtime reflection is deferred to a future step). Passing a value (`size_of(6)`, `type_is_unsigned(true)`) is a compile-time error — ` expects a type, got ''` — not a silent reinterpretation of the value's bits as a type. -An `Any` is accepted because it can hold either a value or a `Type`. `type_name` and `type_is_unsigned` consult the `Any`'s runtime type-tag, not its payload: an `Any` holding a *value* reports the type **of that value** (`av : Any = 6` → `type_name(av)` is `"s64"`), while an `Any` holding a *`Type` value* (e.g. `type_of(x)` stored in an `Any`) names the **held type**. This is the same tag the `{}` formatter reads, so `print(av)` and `type_name(av)` agree on what `av` is. +An `Any` is accepted because it can hold either a value or a `Type`. `type_name` and `type_is_unsigned` consult the `Any`'s runtime type-tag, not its payload: an `Any` holding a *value* reports the type **of that value** (`av : Any = 6` → `type_name(av)` is `"i64"`), while an `Any` holding a *`Type` value* (e.g. `type_of(x)` stored in an `Any`) names the **held type**. This is the same tag the `{}` formatter reads, so `print(av)` and `type_name(av)` agree on what `av` is. ### Type Conversion -- `cast(Type) expr` — prefix operator that converts `expr` to `Type`. Examples: `cast(s32) 3.14`, `cast(f64) n`. When `Type` is a runtime `Type` value inside a type-category match arm, the compiler generates a dispatch switch over all types in the category, monomorphizing the callee for each concrete type. +- `cast(Type) expr` — prefix operator that converts `expr` to `Type`. Examples: `cast(i32) 3.14`, `cast(f64) n`. When `Type` is a runtime `Type` value inside a type-category match arm, the compiler generates a dispatch switch over all types in the category, monomorphizing the callee for each concrete type. ### Vectors - `Vector($N: int, $T: Type) -> Type` — returns an LLVM vector type of `N` elements of type `T` @@ -2567,7 +2567,7 @@ An `Any` is accepted because it can hold either a value or a `Type`. `type_name` **Compile-time constants** — bind a compile-time value to a name: ```sx -compute :: (x: s32) -> s32 { x * x; } +compute :: (x: i32) -> i32 { x * x; } x :: #run compute(5); // x = 25, evaluated at compile time ``` @@ -2646,7 +2646,7 @@ The `modules/build.sx` module provides compile-time constants set by the compile |----------|------|-------------| | `OS` | `OperatingSystem` | Target OS: `.macos`, `.linux`, `.windows`, `.wasm`, `.unknown` | | `ARCH` | `Architecture` | Target arch: `.aarch64`, `.x86_64`, `.wasm32`, `.unknown` | -| `POINTER_SIZE` | `s64` | Pointer width in bytes (8 for 64-bit, 4 for wasm32) | +| `POINTER_SIZE` | `i64` | Pointer width in bytes (8 for 64-bit, 4 for wasm32) | These are used with `inline if` for compile-time conditional compilation: @@ -2712,7 +2712,7 @@ main :: () { x : r.Thing = t; // type annotation n := r.LIMIT; // module const c := r.Color.green; // enum variant - b := r.Box(s64).{ item = 3 }; // generic struct head + b := r.Box(i64).{ item = 3 }; // generic struct head } ``` @@ -2774,7 +2774,7 @@ parse :: (text: string) -> ?JsonValue { ... } std :: #import "modules/std.sx"; #import "modules/std/json.sx"; -main :: () -> s32 { +main :: () -> i32 { std.print("hello there\n"); v := parse("{}"); 0 @@ -2964,7 +2964,7 @@ locally-unwrapped optionals). | `env(name: [:0]u8) -> ?string` | `getenv` (null if unset) | | `find_executable(name) -> ?string` | `command -v ` via shell | -`ProcessResult` is `{ exit_code: s32, stdout: string }`. The post-link +`ProcessResult` is `{ exit_code: i32, stdout: string }`. The post-link bundler invokes `codesign`, `plutil`, `security`, `aapt2`, `javac`, `d8`, `keytool`, `apksigner`, etc. through `run`. @@ -3027,7 +3027,7 @@ See [§12 Error Handling](#12-error-handling). sx models recoverable errors as a **separate return channel**, not a wrapped result type. A trailing `!` in a function's return type adds one extra return slot — a `u32` error tag — alongside the normal value slots. This keeps sx's -native multi-return ergonomics: `-> (s32, s64, !)` is a function returning two +native multi-return ergonomics: `-> (i32, i64, !)` is a function returning two values *and* an error, with no tuple-in-a-wrapper. This section is the canonical surface reference. The design rationale, @@ -3036,10 +3036,10 @@ trade-offs, and implementation breakdown live in `current/PLAN-ERR.md`. ### Failable signatures ```sx -parse_digit :: (s: string) -> (s32, !) { ... } // one value + error -parse :: (s: string) -> (s32, s64, !) { ... } // multi-value + error +parse_digit :: (s: string) -> (i32, !) { ... } // one value + error +parse :: (s: string) -> (i32, i64, !) { ... } // multi-value + error must_init :: () -> ! { ... } // pure failable, no value -divide :: (a: s32, b: s32) -> (s32, !MathErr) { ... } // named set +divide :: (a: i32, b: i32) -> (i32, !MathErr) { ... } // named set ``` The `!` is always the **last** slot. `0` in the error slot means "no error"; @@ -3054,7 +3054,7 @@ Two forms of error set: ParseErr :: error { BadDigit, Overflow, Empty }; // Inferred set — bare `!` collects whatever tags the body raises. -quick :: () -> (s32, !) { +quick :: () -> (i32, !) { if cond raise error.SomeAdHocTag; // mints into the inferred set return 0; } @@ -3280,7 +3280,7 @@ function, or at top level, is rejected. - **Explicit annotation required.** A closure literal's value type is inferred as today, but if its body raises or `try`-escapes, the `!` channel is **not** - inferred — declare it (`closure((x: s32) -> (s32, !) { ... })`). This keeps + inferred — declare it (`closure((x: i32) -> (i32, !) { ... })`). This keeps adding a `raise` from silently changing a lambda's type. - **Program-wide union per shape.** All `Closure() -> (T, !)` occurrences with the same signature share one inferred-set node; the SCC pass unions @@ -3386,7 +3386,7 @@ else_arm = 'else' ':' stmt* pattern = '.' IDENT | INT | BOOL | IDENT lambda = '(' params? ')' ('->' type)? '=>' expr args = expr (',' expr)* ','? -type = '$' IDENT | 's32' | 'f32' | 'f64' | 'bool' | 'string' +type = '$' IDENT | 'i32' | 'f32' | 'f64' | 'bool' | 'string' | 'Any' | 'Type' | '..' type | '[' expr ']' type | IDENT | '(' type (',' type)* ',' '!' IDENT? ')' // value-carrying failable | '!' IDENT? // pure failable (`!` / `!Named`) diff --git a/src/ast.zig b/src/ast.zig index c767849..5c38dcb 100644 --- a/src/ast.zig +++ b/src/ast.zig @@ -136,7 +136,7 @@ pub const FnDecl = struct { /// functions, lowering-time objc/protocol method synthesis) leave it zero. name_span: Span = .{ .start = 0, .end = 0 }, /// True when the function NAME was written as a backtick raw identifier - /// (`` `s2 :: … ``) or synthesized by a `#import c` foreign decl. A raw + /// (`` `i2 :: … ``) or synthesized by a `#import c` foreign decl. A raw /// name is exempt from the reserved-type-name binding check. /// Every PARSER fn_decl is built through `parseFnDecl`, whose `name_is_raw` /// is a REQUIRED parameter, so a parser site cannot drop it; the default @@ -165,7 +165,7 @@ pub const Param = struct { /// parameter, lowering substitutes this expression in its place. default_expr: ?*Node = null, /// True when the param name was written as a backtick raw identifier - /// (`` `s2 ``) or synthesized by a `#import c` foreign decl. A raw name is + /// (`` `i2 ``) or synthesized by a `#import c` foreign decl. A raw name is /// exempt from the reserved-type-name binding check. is_raw: bool = false, }; @@ -204,8 +204,8 @@ pub const StringLiteral = struct { pub const Identifier = struct { name: []const u8, - /// True when written as a backtick raw identifier (`` `s2 ``). Carried so a - /// destructure target (`` `s2, b := … ``) can be recognised as raw and + /// True when written as a backtick raw identifier (`` `i2 ``). Carried so a + /// destructure target (`` `i2, b := … ``) can be recognised as raw and /// exempted from the reserved-type-name binding check. is_raw: bool = false, }; @@ -298,7 +298,7 @@ pub const IfExpr = struct { binding_name: ?[]const u8 = null, // for `if val := expr { ... }` optional binding binding_span: ?Span = null, // span of `binding_name` (set iff `binding_name` is) /// True when the optional binding was a backtick raw identifier - /// (`` if `s2 := … ``) — exempt from the reserved-type-name check. + /// (`` if `i2 := … ``) — exempt from the reserved-type-name check. binding_is_raw: bool = false, }; @@ -315,7 +315,7 @@ pub const MatchArm = struct { capture: ?[]const u8 = null, // payload binding name: case .variant: (name) { ... } capture_span: ?Span = null, // span of `capture` (set iff `capture` is) /// True when the capture was a backtick raw identifier - /// (`` case .v: (`s2) ``) — exempt from the reserved-type-name check. + /// (`` case .v: (`i2) ``) — exempt from the reserved-type-name check. capture_is_raw: bool = false, }; @@ -329,7 +329,7 @@ pub const ConstDecl = struct { /// 1:1 caret (the finding-1 bug). name_span: Span, /// True when the constant NAME was written as a backtick raw identifier - /// (`` `s2 :: … ``). NO default: required at every site so the reserved- + /// (`` `i2 :: … ``). NO default: required at every site so the reserved- /// name exemption can't be dropped — mirrors `checkBindingName`'s required /// `is_raw` argument so the parser and the check can't desync. is_raw: bool, @@ -344,7 +344,7 @@ pub const VarDecl = struct { foreign_lib: ?[]const u8 = null, foreign_name: ?[]const u8 = null, /// True when the binding name was written as a backtick raw identifier - /// (`` `s2 := … ``). A raw name is exempt from the reserved-type-name + /// (`` `i2 := … ``). A raw name is exempt from the reserved-type-name /// binding check. is_raw: bool = false, }; @@ -378,7 +378,7 @@ pub const DestructureDecl = struct { names: []const []const u8, name_spans: []const Span, // one per entry in `names`, same order /// One per entry in `names`, same order: true when that target was a - /// backtick raw identifier (`` `s2, b := … ``) — exempt from the + /// backtick raw identifier (`` `i2, b := … ``) — exempt from the /// reserved-type-name binding check. name_is_raw: []const bool, value: *Node, @@ -392,7 +392,7 @@ pub const EnumDecl = struct { variant_values: []const ?*Node = &.{}, // explicit value per variant (null = auto), empty = all auto backing_type: ?*Node = null, // optional backing type: enum u8 { ... } /// True when the declared NAME was a backtick raw identifier - /// (`` `s2 :: enum { … } ``) — exempt from the reserved-type-name decl + /// (`` `i2 :: enum { … } ``) — exempt from the reserved-type-name decl /// check. A bare reserved-name decl still errors. is_raw: bool = false, }; @@ -440,7 +440,7 @@ pub const StructDecl = struct { methods: []const *Node = &.{}, // fn_decl nodes for struct methods constants: []const *Node = &.{}, // const_decl nodes for struct-level constants /// True when the declared NAME was a backtick raw identifier - /// (`` `s2 :: struct { … } ``) — exempt from the reserved-type-name decl + /// (`` `i2 :: struct { … } ``) — exempt from the reserved-type-name decl /// check. A bare reserved-name decl still errors. is_raw: bool = false, }; @@ -470,10 +470,10 @@ pub const TypeExpr = struct { is_generic: bool = false, protocol_constraints: []const []const u8 = &.{}, // e.g. ["Eq", "Hashable"] for $T/Eq/Hashable /// True when written as a backtick raw identifier in type position - /// (`` `s2 ``). Such a reference is the LITERAL name `s2` used as a type — + /// (`` `i2 ``). Such a reference is the LITERAL name `i2` used as a type — /// resolution skips the builtin/reserved classifier and looks up a - /// `` `s2 ``-declared type (struct/enum/union/alias), else "unknown - /// type". A bare `s2` keeps `is_raw = false` and is the int type. + /// `` `i2 ``-declared type (struct/enum/union/alias), else "unknown + /// type". A bare `i2` keeps `is_raw = false` and is the int type. is_raw: bool = false, }; @@ -523,7 +523,7 @@ pub const CatchExpr = struct { binding: ?[]const u8 = null, binding_span: ?Span = null, // span of `binding` (set iff `binding` is) /// True when the binding was a backtick raw identifier - /// (`` x catch `s2 { … } ``) — exempt from the reserved-type-name check. + /// (`` x catch `i2 { … } ``) — exempt from the reserved-type-name check. binding_is_raw: bool = false, body: *Node, is_match_body: bool = false, @@ -536,7 +536,7 @@ pub const OnFailStmt = struct { binding: ?[]const u8 = null, binding_span: ?Span = null, // span of `binding` (set iff `binding` is) /// True when the binding was a backtick raw identifier - /// (`` onfail `s2 { … } ``) — exempt from the reserved-type-name check. + /// (`` onfail `i2 { … } ``) — exempt from the reserved-type-name check. binding_is_raw: bool = false, body: *Node, }; @@ -562,7 +562,7 @@ pub const ImportDecl = struct { path: []const u8, name: ?[]const u8, /// True when the namespace NAME was a backtick raw identifier - /// (`` `s2 :: #import "…" ``) — exempt from the reserved-type-name decl + /// (`` `i2 :: #import "…" ``) — exempt from the reserved-type-name decl /// check. A flat `#import` (name == null) binds nothing. is_raw: bool = false, }; @@ -585,10 +585,10 @@ pub const ParameterizedTypeExpr = struct { name: []const u8, // e.g. "Vector", or later generic struct names args: []const *Node, // e.g. [int_literal(3), type_expr("f32")] /// True when the base name was a backtick raw identifier in type position - /// (`` `s2(s64) ``). Such a reference is the LITERAL name `s2` used as a + /// (`` `i2(i64) ``). Such a reference is the LITERAL name `i2` used as a /// parameterized type — resolution skips the builtin parameterized /// classifier (e.g. the `Vector` intrinsic) and instantiates a - /// `` `s2 ``-declared generic template. + /// `` `i2 ``-declared generic template. is_raw: bool = false, }; @@ -647,7 +647,7 @@ pub const WhileExpr = struct { binding_name: ?[]const u8 = null, // for `while val := expr { ... }` optional binding binding_span: ?Span = null, // span of `binding_name` (set iff `binding_name` is) /// True when the optional binding was a backtick raw identifier - /// (`` while `s2 := … ``) — exempt from the reserved-type-name check. + /// (`` while `i2 := … ``) — exempt from the reserved-type-name check. binding_is_raw: bool = false, }; @@ -674,7 +674,7 @@ pub const ForIterable = struct { pub const ForCapture = struct { name: []const u8, span: ?Span = null, - /// True when the name was a backtick raw identifier (`` for xs (`s2) ``) + /// True when the name was a backtick raw identifier (`` for xs (`i2) ``) /// — exempt from the reserved-type-name check. is_raw: bool = false, /// `(*x)` — bind a pointer into the collection (no per-element copy). diff --git a/src/backend/llvm/abi.zig b/src/backend/llvm/abi.zig index 7247917..8e8c6f7 100644 --- a/src/backend/llvm/abi.zig +++ b/src/backend/llvm/abi.zig @@ -47,7 +47,7 @@ pub const AbiLowering = struct { } // WASM32: usize/isize are pointer-sized (i32 on wasm32). - // Other integer types (s64, u64) keep their declared size — they represent + // Other integer types (i64, u64) keep their declared size — they represent // genuinely 64-bit values (SDL_WindowFlags, timestamps, etc.). if (self.e.target_config.isWasm32()) { if (ir_ty == .usize or ir_ty == .isize) return self.e.cached_i32; diff --git a/src/backend/llvm/ops.zig b/src/backend/llvm/ops.zig index a22b8b6..58c4d40 100644 --- a/src/backend/llvm/ops.zig +++ b/src/backend/llvm/ops.zig @@ -338,7 +338,7 @@ pub const Ops = struct { const result = c.LLVMBuildLoad2(self.e.builder, llvm_ty, ptr, "load"); self.e.mapRef(result); } else { - self.e.mapRef(c.LLVMGetUndef(self.e.toLLVMType(if (instruction.ty == .void) .s64 else instruction.ty))); + self.e.mapRef(c.LLVMGetUndef(self.e.toLLVMType(if (instruction.ty == .void) .i64 else instruction.ty))); } } @@ -574,8 +574,8 @@ pub const Ops = struct { if (is_pointer_ret) break :blk emit.Jni.CallStaticObjectMethod; break :blk switch (ret_ty_id) { .void => emit.Jni.CallStaticVoidMethod, - .s32 => emit.Jni.CallStaticIntMethod, - .s64 => emit.Jni.CallStaticLongMethod, + .i32 => emit.Jni.CallStaticIntMethod, + .i64 => emit.Jni.CallStaticLongMethod, .f32 => emit.Jni.CallStaticFloatMethod, .f64 => emit.Jni.CallStaticDoubleMethod, .bool => emit.Jni.CallStaticBooleanMethod, @@ -588,8 +588,8 @@ pub const Ops = struct { if (is_pointer_ret) break :blk emit.Jni.CallNonvirtualObjectMethod; break :blk switch (ret_ty_id) { .void => emit.Jni.CallNonvirtualVoidMethod, - .s32 => emit.Jni.CallNonvirtualIntMethod, - .s64 => emit.Jni.CallNonvirtualLongMethod, + .i32 => emit.Jni.CallNonvirtualIntMethod, + .i64 => emit.Jni.CallNonvirtualLongMethod, .f32 => emit.Jni.CallNonvirtualFloatMethod, .f64 => emit.Jni.CallNonvirtualDoubleMethod, .bool => emit.Jni.CallNonvirtualBooleanMethod, @@ -602,8 +602,8 @@ pub const Ops = struct { if (is_pointer_ret) break :blk emit.Jni.CallObjectMethod; break :blk switch (ret_ty_id) { .void => emit.Jni.CallVoidMethod, - .s32 => emit.Jni.CallIntMethod, - .s64 => emit.Jni.CallLongMethod, + .i32 => emit.Jni.CallIntMethod, + .i64 => emit.Jni.CallLongMethod, .f32 => emit.Jni.CallFloatMethod, .f64 => emit.Jni.CallDoubleMethod, .bool => emit.Jni.CallBooleanMethod, @@ -983,7 +983,7 @@ pub const Ops = struct { /// `const_type` / `type_of` produce) → the TypeId is the payload. /// Otherwise the box carries a *runtime value* whose type IS the tag /// → use the tag as the TypeId. This is what makes `type_name(av)` - /// for `av : Any = 6` report `s64` (the held value's type), while + /// for `av : Any = 6` report `i64` (the held value's type), while /// `type_name(type_of(x))` still names the held type. /// `.unresolved` is a hard tripwire: a type-resolution failure reached /// emission without a diagnostic. @@ -1059,7 +1059,7 @@ pub const Ops = struct { .type_eq => { // Dynamic `type_eq(a, b)` — both args are // Type values. Extract TypeId from each Any - // box (or use directly if `.s64`-typed), + // box (or use directly if `.i64`-typed), // icmp eq. const a = blk: { const v = self.e.resolveRef(bi.args[0]); diff --git a/src/backend/llvm/types.zig b/src/backend/llvm/types.zig index aa7c54c..47ff16f 100644 --- a/src/backend/llvm/types.zig +++ b/src/backend/llvm/types.zig @@ -21,10 +21,10 @@ pub const TypeLowering = struct { return switch (ty) { .void => self.e.cached_void, .bool => self.e.cached_i1, - .s8 => self.e.cached_i8, - .s16 => self.e.cached_i16, - .s32 => self.e.cached_i32, - .s64 => self.e.cached_i64, + .i8 => self.e.cached_i8, + .i16 => self.e.cached_i16, + .i32 => self.e.cached_i32, + .i64 => self.e.cached_i64, .u8 => self.e.cached_i8, .u16 => self.e.cached_i16, .u32 => self.e.cached_i32, diff --git a/src/c_import.zig b/src/c_import.zig index 5439084..82cf1d7 100644 --- a/src/c_import.zig +++ b/src/c_import.zig @@ -127,7 +127,7 @@ pub fn processCImport( .name = pname, .name_span = .{ .start = 0, .end = 0 }, .type_expr = ptype_node, - // Foreign C param names (`s1`, `s2`, …) are RAW — exempt from + // Foreign C param names (`i1`, `i2`, …) are RAW — exempt from // the reserved-type-name binding check; generated bindings // must import without hand-edits. .is_raw = true, @@ -157,7 +157,7 @@ pub fn processCImport( .return_type = ret_node, .body = foreign_body, // A foreign C function whose own NAME collides with a reserved - // type spelling (`int s2(int);`) is RAW — exempt from the + // type spelling (`int i2(int);`) is RAW — exempt from the // reserved-type-name decl check so generated bindings import // without hand-edits. .is_raw = true, @@ -505,9 +505,9 @@ fn mapCTypeToSxNode( if (std.mem.eql(u8, base, "void") or std.mem.eql(u8, base, "const void")) { return makePointerTypeNode(allocator, "void"); } - // int * → *s32 + // int * → *i32 if (std.mem.eql(u8, base, "int") or std.mem.eql(u8, base, "const int")) { - return makePointerTypeNode(allocator, "s32"); + return makePointerTypeNode(allocator, "i32"); } // unsigned int * / unsigned * → *u32 if (std.mem.eql(u8, base, "unsigned int") or std.mem.eql(u8, base, "unsigned") or std.mem.eql(u8, base, "const unsigned int")) { @@ -521,9 +521,9 @@ fn mapCTypeToSxNode( if (std.mem.eql(u8, base, "double") or std.mem.eql(u8, base, "const double")) { return makePointerTypeNode(allocator, "f64"); } - // short * → *s16 + // short * → *i16 if (std.mem.eql(u8, base, "short") or std.mem.eql(u8, base, "const short")) { - return makePointerTypeNode(allocator, "s16"); + return makePointerTypeNode(allocator, "i16"); } // Pointer to pointer → *void if (std.mem.endsWith(u8, base, "*")) { @@ -539,13 +539,13 @@ fn mapCTypeToSxNode( } // Direct types - if (std.mem.eql(u8, trimmed, "int") or std.mem.eql(u8, trimmed, "signed int")) return makeTypeExprNode(allocator, "s32"); + if (std.mem.eql(u8, trimmed, "int") or std.mem.eql(u8, trimmed, "signed int")) return makeTypeExprNode(allocator, "i32"); if (std.mem.eql(u8, trimmed, "unsigned int") or std.mem.eql(u8, trimmed, "unsigned")) return makeTypeExprNode(allocator, "u32"); - if (std.mem.eql(u8, trimmed, "long") or std.mem.eql(u8, trimmed, "long int") or std.mem.eql(u8, trimmed, "signed long")) return makeTypeExprNode(allocator, "s64"); + if (std.mem.eql(u8, trimmed, "long") or std.mem.eql(u8, trimmed, "long int") or std.mem.eql(u8, trimmed, "signed long")) return makeTypeExprNode(allocator, "i64"); if (std.mem.eql(u8, trimmed, "unsigned long") or std.mem.eql(u8, trimmed, "unsigned long int")) return makeTypeExprNode(allocator, "u64"); - if (std.mem.eql(u8, trimmed, "long long") or std.mem.eql(u8, trimmed, "long long int")) return makeTypeExprNode(allocator, "s64"); + if (std.mem.eql(u8, trimmed, "long long") or std.mem.eql(u8, trimmed, "long long int")) return makeTypeExprNode(allocator, "i64"); if (std.mem.eql(u8, trimmed, "unsigned long long") or std.mem.eql(u8, trimmed, "unsigned long long int")) return makeTypeExprNode(allocator, "u64"); - if (std.mem.eql(u8, trimmed, "short") or std.mem.eql(u8, trimmed, "short int") or std.mem.eql(u8, trimmed, "signed short")) return makeTypeExprNode(allocator, "s16"); + if (std.mem.eql(u8, trimmed, "short") or std.mem.eql(u8, trimmed, "short int") or std.mem.eql(u8, trimmed, "signed short")) return makeTypeExprNode(allocator, "i16"); if (std.mem.eql(u8, trimmed, "unsigned short") or std.mem.eql(u8, trimmed, "unsigned short int")) return makeTypeExprNode(allocator, "u16"); if (std.mem.eql(u8, trimmed, "char") or std.mem.eql(u8, trimmed, "signed char")) return makeTypeExprNode(allocator, "u8"); if (std.mem.eql(u8, trimmed, "unsigned char")) return makeTypeExprNode(allocator, "u8"); @@ -554,8 +554,8 @@ fn mapCTypeToSxNode( if (std.mem.eql(u8, trimmed, "size_t")) return makeTypeExprNode(allocator, "u64"); if (std.mem.eql(u8, trimmed, "_Bool") or std.mem.eql(u8, trimmed, "bool")) return makeTypeExprNode(allocator, "u8"); - // Default: unknown type → s64 (treat as opaque integer-sized value) - return makeTypeExprNode(allocator, "s64"); + // Default: unknown type → i64 (treat as opaque integer-sized value) + return makeTypeExprNode(allocator, "i64"); } // --------------------------------------------------------------------------- diff --git a/src/imports.test.zig b/src/imports.test.zig index 702a659..4000d1f 100644 --- a/src/imports.test.zig +++ b/src/imports.test.zig @@ -83,14 +83,14 @@ test "imports: module_decls retains same-name cross-module fns; flat_import_grap var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); - try tmp.dir.writeFile(io, .{ .sub_path = "a.sx", .data = "greet :: () -> s64 { 1 }\n" }); - try tmp.dir.writeFile(io, .{ .sub_path = "b.sx", .data = "greet :: () -> s64 { 2 }\n" }); - try tmp.dir.writeFile(io, .{ .sub_path = "nsmod.sx", .data = "helper :: () -> s64 { 3 }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "a.sx", .data = "greet :: () -> i64 { 1 }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "b.sx", .data = "greet :: () -> i64 { 2 }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "nsmod.sx", .data = "helper :: () -> i64 { 3 }\n" }); const main_src = \\#import "a.sx"; \\#import "b.sx"; \\ns :: #import "nsmod.sx"; - \\main :: () -> s32 { 0 } + \\main :: () -> i32 { 0 } \\ ; try tmp.dir.writeFile(io, .{ .sub_path = "main.sx", .data = main_src }); @@ -192,12 +192,12 @@ test "imports: mixed non-fn/fn same-name collision stays first-wins in merged sc var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); - try tmp.dir.writeFile(io, .{ .sub_path = "a.sx", .data = "Widget :: struct { x: s64 }\n" }); - try tmp.dir.writeFile(io, .{ .sub_path = "b.sx", .data = "Widget :: () -> s64 { 7 }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "a.sx", .data = "Widget :: struct { x: i64 }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "b.sx", .data = "Widget :: () -> i64 { 7 }\n" }); const main_src = \\#import "a.sx"; \\#import "b.sx"; - \\main :: () -> s32 { 0 } + \\main :: () -> i32 { 0 } \\ ; try tmp.dir.writeFile(io, .{ .sub_path = "main.sx", .data = main_src }); @@ -263,10 +263,10 @@ test "buildImportFacts: flat imports keep same-name fn/struct + value-vs-type pe defer tmp.cleanup(); // a.sx: dup() fn, Box struct, Shape as a VALUE const. - try tmp.dir.writeFile(io, .{ .sub_path = "a.sx", .data = "dup :: () -> s64 { 1 }\nBox :: struct { x: s64 }\nShape :: 7;\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "a.sx", .data = "dup :: () -> i64 { 1 }\nBox :: struct { x: i64 }\nShape :: 7;\n" }); // b.sx: dup() fn, Box struct, Shape as a TYPE (same spelling as a.sx's value). - try tmp.dir.writeFile(io, .{ .sub_path = "b.sx", .data = "dup :: () -> s64 { 2 }\nBox :: struct { y: s64 }\nShape :: struct { z: s64 }\n" }); - try tmp.dir.writeFile(io, .{ .sub_path = "main.sx", .data = "#import \"a.sx\";\n#import \"b.sx\";\nmain :: () -> s32 { 0 }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "b.sx", .data = "dup :: () -> i64 { 2 }\nBox :: struct { y: i64 }\nShape :: struct { z: i64 }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "main.sx", .data = "#import \"a.sx\";\n#import \"b.sx\";\nmain :: () -> i32 { 0 }\n" }); var dirbuf: [4096]u8 = undefined; const absdir = dirbuf[0..try tmp.dir.realPath(io, &dirbuf)]; @@ -321,9 +321,9 @@ test "buildImportFacts: directory import unions member-file decls under the dir defer tmp.cleanup(); try tmp.dir.createDirPath(io, "lib"); - try tmp.dir.writeFile(io, .{ .sub_path = "lib/one.sx", .data = "from_one :: () -> s64 { 1 }\n" }); - try tmp.dir.writeFile(io, .{ .sub_path = "lib/two.sx", .data = "Two :: struct { v: s64 }\n" }); - try tmp.dir.writeFile(io, .{ .sub_path = "main.sx", .data = "#import \"lib\";\nmain :: () -> s32 { 0 }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "lib/one.sx", .data = "from_one :: () -> i64 { 1 }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "lib/two.sx", .data = "Two :: struct { v: i64 }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "main.sx", .data = "#import \"lib\";\nmain :: () -> i32 { 0 }\n" }); var dirbuf: [4096]u8 = undefined; const absdir = dirbuf[0..try tmp.dir.realPath(io, &dirbuf)]; @@ -349,8 +349,8 @@ test "buildImportFacts: namespaced file import captures target_module_path" { var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); - try tmp.dir.writeFile(io, .{ .sub_path = "point.sx", .data = "Point :: struct { x: s64 }\n" }); - try tmp.dir.writeFile(io, .{ .sub_path = "main.sx", .data = "g :: #import \"point.sx\";\nmain :: () -> s32 { 0 }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "point.sx", .data = "Point :: struct { x: i64 }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "main.sx", .data = "g :: #import \"point.sx\";\nmain :: () -> i32 { 0 }\n" }); var dirbuf: [4096]u8 = undefined; const absdir = dirbuf[0..try tmp.dir.realPath(io, &dirbuf)]; @@ -382,8 +382,8 @@ test "buildImportFacts: namespaced directory import captures dir path as target" defer tmp.cleanup(); try tmp.dir.createDirPath(io, "pkg"); - try tmp.dir.writeFile(io, .{ .sub_path = "pkg/m.sx", .data = "helper :: () -> s64 { 9 }\n" }); - try tmp.dir.writeFile(io, .{ .sub_path = "main.sx", .data = "pkg :: #import \"pkg\";\nmain :: () -> s32 { 0 }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "pkg/m.sx", .data = "helper :: () -> i64 { 9 }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "main.sx", .data = "pkg :: #import \"pkg\";\nmain :: () -> i32 { 0 }\n" }); var dirbuf: [4096]u8 = undefined; const absdir = dirbuf[0..try tmp.dir.realPath(io, &dirbuf)]; @@ -409,7 +409,7 @@ test "buildImportFacts: c-import namespace recorded as an edge" { defer tmp.cleanup(); try tmp.dir.writeFile(io, .{ .sub_path = "ch.h", .data = "int cm_add(int a, int b);\n" }); - try tmp.dir.writeFile(io, .{ .sub_path = "main.sx", .data = "cmod :: #import c {\n #include \"ch.h\";\n};\nmain :: () -> s32 { 0 }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "main.sx", .data = "cmod :: #import c {\n #include \"ch.h\";\n};\nmain :: () -> i32 { 0 }\n" }); var dirbuf: [4096]u8 = undefined; const absdir = dirbuf[0..try tmp.dir.realPath(io, &dirbuf)]; @@ -440,7 +440,7 @@ test "buildImportFacts: same-module duplicate top-level name is diagnosed" { var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); - try tmp.dir.writeFile(io, .{ .sub_path = "main.sx", .data = "foo :: () -> s64 { 1 }\nfoo :: () -> s64 { 2 }\nmain :: () -> s32 { 0 }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "main.sx", .data = "foo :: () -> i64 { 1 }\nfoo :: () -> i64 { 2 }\nmain :: () -> i32 { 0 }\n" }); var dirbuf: [4096]u8 = undefined; const absdir = dirbuf[0..try tmp.dir.realPath(io, &dirbuf)]; @@ -469,8 +469,8 @@ test "buildImportFacts: fn-then-namespace-alias same-module collision is diagnos var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); - try tmp.dir.writeFile(io, .{ .sub_path = "lib.sx", .data = "helper :: () -> s64 { 9 }\n" }); - try tmp.dir.writeFile(io, .{ .sub_path = "main.sx", .data = "dup :: () -> s64 { 1 }\ndup :: #import \"lib.sx\";\nmain :: () -> s32 { 0 }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "lib.sx", .data = "helper :: () -> i64 { 9 }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "main.sx", .data = "dup :: () -> i64 { 1 }\ndup :: #import \"lib.sx\";\nmain :: () -> i32 { 0 }\n" }); var dirbuf: [4096]u8 = undefined; const absdir = dirbuf[0..try tmp.dir.realPath(io, &dirbuf)]; @@ -493,8 +493,8 @@ test "buildImportFacts: namespace-alias-then-fn same-module collision is diagnos var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); - try tmp.dir.writeFile(io, .{ .sub_path = "lib.sx", .data = "helper :: () -> s64 { 9 }\n" }); - try tmp.dir.writeFile(io, .{ .sub_path = "main.sx", .data = "dup :: #import \"lib.sx\";\ndup :: () -> s64 { 1 }\nmain :: () -> s32 { 0 }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "lib.sx", .data = "helper :: () -> i64 { 9 }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "main.sx", .data = "dup :: #import \"lib.sx\";\ndup :: () -> i64 { 1 }\nmain :: () -> i32 { 0 }\n" }); var dirbuf: [4096]u8 = undefined; const absdir = dirbuf[0..try tmp.dir.realPath(io, &dirbuf)]; @@ -523,9 +523,9 @@ test "buildDeclTable: stable DeclId per decl, round-trip, struct keying, namespa var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); - try tmp.dir.writeFile(io, .{ .sub_path = "lib.sx", .data = "helper :: () -> s64 { 9 }\nBox :: struct($T: Type) { v: T; }\n" }); - try tmp.dir.writeFile(io, .{ .sub_path = "geom.sx", .data = "Point :: struct { x: s64 }\n" }); - try tmp.dir.writeFile(io, .{ .sub_path = "main.sx", .data = "#import \"lib.sx\";\ng :: #import \"geom.sx\";\nmain :: () -> s32 { 0 }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "lib.sx", .data = "helper :: () -> i64 { 9 }\nBox :: struct($T: Type) { v: T; }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "geom.sx", .data = "Point :: struct { x: i64 }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "main.sx", .data = "#import \"lib.sx\";\ng :: #import \"geom.sx\";\nmain :: () -> i32 { 0 }\n" }); var dirbuf: [4096]u8 = undefined; const absdir = dirbuf[0..try tmp.dir.realPath(io, &dirbuf)]; diff --git a/src/ir/calls.test.zig b/src/ir/calls.test.zig index bb3a914..0ef9856 100644 --- a/src/ir/calls.test.zig +++ b/src/ir/calls.test.zig @@ -72,16 +72,16 @@ test "calls: builtin and reflection result types, unknown fallthrough" { var args = [_]*Node{&arg}; const cases = [_]struct { name: []const u8, want: TypeId }{ - .{ .name = "size_of", .want = .s64 }, - .{ .name = "align_of", .want = .s64 }, + .{ .name = "size_of", .want = .i64 }, + .{ .name = "align_of", .want = .i64 }, // Reflection builtins (resolved by callee name, outside the // `resolveBuiltin` table) — each must keep its own result tag so a // pack-fn caller boxes the value with the right type. .{ .name = "type_name", .want = .string }, .{ .name = "type_eq", .want = .bool }, .{ .name = "has_impl", .want = .bool }, - .{ .name = "field_count", .want = .s64 }, - .{ .name = "field_index", .want = .s64 }, + .{ .name = "field_count", .want = .i64 }, + .{ .name = "field_index", .want = .i64 }, .{ .name = "field_name", .want = .string }, .{ .name = "error_tag_name", .want = .string }, .{ .name = "is_comptime", .want = .bool }, @@ -110,15 +110,15 @@ test "calls: cast result type is its resolved type argument" { defer module.deinit(); var l = Lowering.init(&module); - // `cast(s64) x` types as the resolved target type — the first arg is the + // `cast(i64) x` types as the resolved target type — the first arg is the // type expression, resolved via `resolveTypeArg` (a primitive needs no // scope / registration). - var target = node(.{ .type_expr = .{ .name = "s64" } }); + var target = node(.{ .type_expr = .{ .name = "i64" } }); var value = node(.{ .int_literal = .{ .value = 1 } }); var cast_args = [_]*Node{ &target, &value }; var cast_callee = node(.{ .identifier = .{ .name = "cast" } }); var cast_call = node(.{ .call = .{ .callee = &cast_callee, .args = &cast_args } }); - try std.testing.expectEqual(TypeId.s64, l.inferExprType(&cast_call)); + try std.testing.expectEqual(TypeId.i64, l.inferExprType(&cast_call)); } test "calls: dot-shorthand enum construction types as the target type" { @@ -136,8 +136,8 @@ test "calls: dot-shorthand enum construction types as the target type" { try std.testing.expectEqual(TypeId.unresolved, l.inferExprType(&enum_call)); - l.target_type = .s32; - try std.testing.expectEqual(TypeId.s32, l.inferExprType(&enum_call)); + l.target_type = .i32; + try std.testing.expectEqual(TypeId.i32, l.inferExprType(&enum_call)); } // ── Layer 2: the CallPlan object (kind / target / variant / properties) ───── @@ -157,7 +157,7 @@ test "plan: builtin and reflection carry kind + target" { const so = cr.plan(&so_call.data.call); try std.testing.expectEqual(CallPlan.Kind.builtin, so.kind); try std.testing.expectEqual(BuiltinId.size_of, so.target.builtin); - try std.testing.expectEqual(TypeId.s64, so.return_type); + try std.testing.expectEqual(TypeId.i64, so.return_type); var tn_callee = node(.{ .identifier = .{ .name = "type_name" } }); var tn_call = node(.{ .call = .{ .callee = &tn_callee, .args = &args } }); @@ -190,13 +190,13 @@ test "plan: lazy free fn classifies as direct_fn and flags default-arg expansion var l = Lowering.init(&module); const cr = CallResolver{ .l = &l }; - // greet :: (a: s64, b: s64 = 0) -> s64 — registered but NOT lowered, so + // greet :: (a: i64, b: i64 = 0) -> i64 — registered but NOT lowered, so // it resolves through the AST (lazy) arm and `b`'s default is splice-able. const params = [_]ast.Param{ - .{ .name = "a", .name_span = .{ .start = 0, .end = 0 }, .type_expr = typeExpr(alloc, "s64") }, - .{ .name = "b", .name_span = .{ .start = 0, .end = 0 }, .type_expr = typeExpr(alloc, "s64"), .default_expr = intLit(alloc, 0) }, + .{ .name = "a", .name_span = .{ .start = 0, .end = 0 }, .type_expr = typeExpr(alloc, "i64") }, + .{ .name = "b", .name_span = .{ .start = 0, .end = 0 }, .type_expr = typeExpr(alloc, "i64"), .default_expr = intLit(alloc, 0) }, }; - const fd = ast.FnDecl{ .name = "greet", .params = ¶ms, .return_type = typeExpr(alloc, "s64"), .body = emptyBody(alloc) }; + const fd = ast.FnDecl{ .name = "greet", .params = ¶ms, .return_type = typeExpr(alloc, "i64"), .body = emptyBody(alloc) }; l.program_index.fn_ast_map.put("greet", &fd) catch unreachable; // greet(1) — omits `b`, so its default is spliced in. @@ -206,7 +206,7 @@ test "plan: lazy free fn classifies as direct_fn and flags default-arg expansion const p = cr.plan(&call.data.call); try std.testing.expectEqual(CallPlan.Kind.direct_fn, p.kind); try std.testing.expectEqualStrings("greet", p.target.named); - try std.testing.expectEqual(TypeId.s64, p.return_type); + try std.testing.expectEqual(TypeId.i64, p.return_type); try std.testing.expect(p.expands_defaults); try std.testing.expect(!p.prepends_receiver); } @@ -271,19 +271,19 @@ test "plan: closure and fn-pointer callees, __sx_ctx by calling convention" { try std.testing.expect(p.prepends_ctx); } - // fp : () -> s32 (default conv) — sx fn-pointer, carries ctx. - const fp_ty = module.types.functionType(&.{}, .s32); + // fp : () -> i32 (default conv) — sx fn-pointer, carries ctx. + const fp_ty = module.types.functionType(&.{}, .i32); scope.put("fp", .{ .ref = Ref.none, .ty = fp_ty, .is_alloca = false }); { const call = callNode(alloc, ident(alloc, "fp"), &.{}); const p = cr.plan(&call.data.call); try std.testing.expectEqual(CallPlan.Kind.fn_pointer, p.kind); - try std.testing.expectEqual(TypeId.s32, p.return_type); + try std.testing.expectEqual(TypeId.i32, p.return_type); try std.testing.expect(p.prepends_ctx); } - // cfp : () -> s32 (C conv) — C fn-pointer, NO implicit ctx. - const cfp_ty = module.types.functionTypeCC(&.{}, .s32, .c); + // cfp : () -> i32 (C conv) — C fn-pointer, NO implicit ctx. + const cfp_ty = module.types.functionTypeCC(&.{}, .i32, .c); scope.put("cfp", .{ .ref = Ref.none, .ty = cfp_ty, .is_alloca = false }); { const call = callNode(alloc, ident(alloc, "cfp"), &.{}); @@ -302,9 +302,9 @@ test "plan: protocol dispatch selects method index + prepends receiver" { var l = Lowering.init(&module); const cr = CallResolver{ .l = &l }; - // Drawable :: protocol { measure :: () -> s64; draw :: () -> bool; } + // Drawable :: protocol { measure :: () -> i64; draw :: () -> bool; } const methods = [_]ast.ProtocolMethodDecl{ - .{ .name = "measure", .params = &.{}, .param_names = &.{}, .return_type = typeExpr(alloc, "s64"), .default_body = null }, + .{ .name = "measure", .params = &.{}, .param_names = &.{}, .return_type = typeExpr(alloc, "i64"), .default_body = null }, .{ .name = "draw", .params = &.{}, .param_names = &.{}, .return_type = typeExpr(alloc, "bool"), .default_body = null }, }; const pd = ast.ProtocolDecl{ .name = "Drawable", .methods = &methods }; @@ -329,12 +329,12 @@ test "plan: struct (UFCS) method via #compiler dispatch + prepends receiver" { var l = Lowering.init(&module); const cr = CallResolver{ .l = &l }; - // struct Point, with a `#compiler` method Point.scale(self) -> s64. + // struct Point, with a `#compiler` method Point.scale(self) -> i64. _ = module.types.intern(.{ .@"struct" = .{ .name = module.types.internString("Point"), .fields = &.{} } }); const self_param = ast.Param{ .name = "self", .name_span = .{ .start = 0, .end = 0 }, .type_expr = typeExpr(alloc, "Point") }; const params = [_]ast.Param{self_param}; const compiler_body = mk(alloc, .{ .compiler_expr = {} }); - const method_fd = ast.FnDecl{ .name = "Point.scale", .params = ¶ms, .return_type = typeExpr(alloc, "s64"), .body = compiler_body }; + const method_fd = ast.FnDecl{ .name = "Point.scale", .params = ¶ms, .return_type = typeExpr(alloc, "i64"), .body = compiler_body }; l.program_index.fn_ast_map.put("Point.scale", &method_fd) catch unreachable; const recv = callNode(alloc, ident(alloc, "cast"), &[_]*Node{ typeExpr(alloc, "Point"), intLit(alloc, 0) }); @@ -342,7 +342,7 @@ test "plan: struct (UFCS) method via #compiler dispatch + prepends receiver" { const p = cr.plan(&call.data.call); try std.testing.expectEqual(CallPlan.Kind.struct_method, p.kind); try std.testing.expectEqualStrings("Point.scale", p.target.named); - try std.testing.expectEqual(TypeId.s64, p.return_type); + try std.testing.expectEqual(TypeId.i64, p.return_type); try std.testing.expect(p.prepends_receiver); } @@ -356,8 +356,8 @@ test "plan: foreign-class instance vs static dispatch" { const cr = CallResolver{ .l = &l }; const members = [_]ast.ForeignClassMember{ - .{ .method = .{ .name = "length", .params = &.{}, .param_names = &.{}, .return_type = typeExpr(alloc, "s64"), .is_static = false } }, - .{ .method = .{ .name = "stringWithUTF8String", .params = &.{}, .param_names = &.{}, .return_type = typeExpr(alloc, "s64"), .is_static = true } }, + .{ .method = .{ .name = "length", .params = &.{}, .param_names = &.{}, .return_type = typeExpr(alloc, "i64"), .is_static = false } }, + .{ .method = .{ .name = "stringWithUTF8String", .params = &.{}, .param_names = &.{}, .return_type = typeExpr(alloc, "i64"), .is_static = true } }, }; var fcd = ast.ForeignClassDecl{ .name = "NSString", .foreign_path = "NSString", .runtime = .objc_class, .members = &members }; l.program_index.foreign_class_map.put("NSString", &fcd) catch unreachable; @@ -371,7 +371,7 @@ test "plan: foreign-class instance vs static dispatch" { try std.testing.expectEqual(CallPlan.Kind.foreign_instance, p.kind); try std.testing.expectEqualStrings("length", p.target.foreign_method.name); try std.testing.expect(!p.target.foreign_method.is_static); - try std.testing.expectEqual(TypeId.s64, p.return_type); + try std.testing.expectEqual(TypeId.i64, p.return_type); try std.testing.expect(p.prepends_receiver); } // Static: `NSString.stringWithUTF8String(...)` — no receiver. @@ -430,7 +430,7 @@ test "plan: free-function UFCS prepends receiver, distinct from namespace_fn" { const cr = CallResolver{ .l = &l }; // struct Counter, and a FREE ufcs function `bump :: ufcs (c: Counter) -> - // s32` — NOT registered as `Counter.bump`, so it can only be reached via + // i32` — NOT registered as `Counter.bump`, so it can only be reached via // UFCS. Dot-dispatch is OPT-IN: the fn carries `is_ufcs` and is // registered in `fn_ast_map`, where the plan's opt-in gate reads it. const counter = module.types.intern(.{ .@"struct" = .{ .name = module.types.internString("Counter"), .fields = &.{} } }); @@ -438,7 +438,7 @@ test "plan: free-function UFCS prepends receiver, distinct from namespace_fn" { const params = [_]ast.Param{c_param}; const ret_stmt = mk(alloc, .{ .return_stmt = .{ .value = intLit(alloc, 7) } }); const body = mk(alloc, .{ .block = .{ .stmts = &[_]*Node{ret_stmt} } }); - const fd = ast.FnDecl{ .name = "bump", .params = ¶ms, .return_type = typeExpr(alloc, "s32"), .body = body, .is_ufcs = true }; + const fd = ast.FnDecl{ .name = "bump", .params = ¶ms, .return_type = typeExpr(alloc, "i32"), .body = body, .is_ufcs = true }; l.program_index.fn_ast_map.put("bump", &fd) catch unreachable; l.lowerFunction(&fd, "bump", false); const fid = l.resolveFuncByName("bump").?; @@ -457,7 +457,7 @@ test "plan: free-function UFCS prepends receiver, distinct from namespace_fn" { try std.testing.expectEqual(fid, p.target.func); try std.testing.expect(p.prepends_receiver); try std.testing.expect(p.prepends_ctx); - try std.testing.expectEqual(TypeId.s32, p.return_type); + try std.testing.expectEqual(TypeId.i32, p.return_type); } test "plan: qualified namespace function" { @@ -469,13 +469,13 @@ test "plan: qualified namespace function" { var l = Lowering.init(&module); const cr = CallResolver{ .l = &l }; - // mathlib.square :: () -> s64 — registered under its qualified name, lazy. - const fd = ast.FnDecl{ .name = "mathlib.square", .params = &.{}, .return_type = typeExpr(alloc, "s64"), .body = emptyBody(alloc) }; + // mathlib.square :: () -> i64 — registered under its qualified name, lazy. + const fd = ast.FnDecl{ .name = "mathlib.square", .params = &.{}, .return_type = typeExpr(alloc, "i64"), .body = emptyBody(alloc) }; l.program_index.fn_ast_map.put("mathlib.square", &fd) catch unreachable; const call = callNode(alloc, fieldAccess(alloc, ident(alloc, "mathlib"), "square"), &.{}); const p = cr.plan(&call.data.call); try std.testing.expectEqual(CallPlan.Kind.namespace_fn, p.kind); try std.testing.expectEqualStrings("mathlib.square", p.target.named); - try std.testing.expectEqual(TypeId.s64, p.return_type); + try std.testing.expectEqual(TypeId.i64, p.return_type); } diff --git a/src/ir/calls.zig b/src/ir/calls.zig index 3f02a3b..adf139d 100644 --- a/src/ir/calls.zig +++ b/src/ir/calls.zig @@ -131,7 +131,7 @@ pub const CallResolver = struct { } break :blk TypeId.f64; }, - .size_of, .align_of => .s64, + .size_of, .align_of => .i64, .cast => if (c.args.len > 0) self.l.resolveTypeArg(c.args[0]) else .unresolved, else => .unresolved, }; @@ -144,8 +144,8 @@ pub const CallResolver = struct { if (std.mem.eql(u8, bare_name, "type_name")) return refl(bare_name, .string); if (std.mem.eql(u8, bare_name, "type_eq")) return refl(bare_name, .bool); if (std.mem.eql(u8, bare_name, "has_impl")) return refl(bare_name, .bool); - if (std.mem.eql(u8, bare_name, "field_count")) return refl(bare_name, .s64); - if (std.mem.eql(u8, bare_name, "field_index")) return refl(bare_name, .s64); + if (std.mem.eql(u8, bare_name, "field_count")) return refl(bare_name, .i64); + if (std.mem.eql(u8, bare_name, "field_index")) return refl(bare_name, .i64); if (std.mem.eql(u8, bare_name, "field_name")) return refl(bare_name, .string); if (std.mem.eql(u8, bare_name, "error_tag_name")) return refl(bare_name, .string); if (std.mem.eql(u8, bare_name, "is_comptime")) return refl(bare_name, .bool); @@ -351,7 +351,7 @@ pub const CallResolver = struct { // lowering dispatches — they can't disagree under a flat same-name // collision (R5 §C). Without this, plan typed the // first-wins winner while lowering bound the selected shadow, - // mis-tagging the call's result (a string-typed winner over an s64 + // mis-tagging the call's result (a string-typed winner over an i64 // shadow boxes a raw int as a string pointer → segfault). // `.ambiguous` / `.none` fall through to the first-wins path below, // unchanged. diff --git a/src/ir/conversions.test.zig b/src/ir/conversions.test.zig index 8873bd1..1e0f7bf 100644 --- a/src/ir/conversions.test.zig +++ b/src/ir/conversions.test.zig @@ -29,28 +29,28 @@ test "conversions: classify covers the built-in coercion ladder" { const tt = &module.types; // no-op + Any box/unbox. - try std.testing.expectEqual(Plan.no_op, cr.classify(.s64, .s64)); - try std.testing.expectEqual(Plan.unbox_any, cr.classify(.any, .s64)); - try std.testing.expectEqual(Plan.box_any, cr.classify(.s64, .any)); + try std.testing.expectEqual(Plan.no_op, cr.classify(.i64, .i64)); + try std.testing.expectEqual(Plan.unbox_any, cr.classify(.any, .i64)); + try std.testing.expectEqual(Plan.box_any, cr.classify(.i64, .any)); // Numeric / pointer ladder. - try std.testing.expectEqual(Plan.widen, cr.classify(.s32, .s64)); - try std.testing.expectEqual(Plan.narrow, cr.classify(.s64, .s32)); - try std.testing.expectEqual(Plan.int_to_float, cr.classify(.s32, .f64)); - try std.testing.expectEqual(Plan.float_to_int, cr.classify(.f64, .s32)); - const ptr_s64 = tt.ptrTo(.s64); - try std.testing.expectEqual(Plan.ptr_int_bitcast, cr.classify(ptr_s64, .s64)); - try std.testing.expectEqual(Plan.ptr_int_bitcast, cr.classify(.s64, ptr_s64)); + try std.testing.expectEqual(Plan.widen, cr.classify(.i32, .i64)); + try std.testing.expectEqual(Plan.narrow, cr.classify(.i64, .i32)); + try std.testing.expectEqual(Plan.int_to_float, cr.classify(.i32, .f64)); + try std.testing.expectEqual(Plan.float_to_int, cr.classify(.f64, .i32)); + const ptr_i64 = tt.ptrTo(.i64); + try std.testing.expectEqual(Plan.ptr_int_bitcast, cr.classify(ptr_i64, .i64)); + try std.testing.expectEqual(Plan.ptr_int_bitcast, cr.classify(.i64, ptr_i64)); // Optional wrap / unwrap, and void → optional. - const opt_s64 = tt.optionalOf(.s64); - try std.testing.expectEqual(Plan.optional_wrap, cr.classify(.s64, opt_s64)); - try std.testing.expectEqual(Plan.optional_unwrap, cr.classify(opt_s64, .s64)); - try std.testing.expectEqual(Plan.void_to_optional, cr.classify(.void, opt_s64)); + const opt_i64 = tt.optionalOf(.i64); + try std.testing.expectEqual(Plan.optional_wrap, cr.classify(.i64, opt_i64)); + try std.testing.expectEqual(Plan.optional_unwrap, cr.classify(opt_i64, .i64)); + try std.testing.expectEqual(Plan.void_to_optional, cr.classify(.void, opt_i64)); // Tuple → tuple, same arity. - const t_ss = tt.intern(.{ .tuple = .{ .fields = &[_]TypeId{ .s64, .s64 }, .names = null } }); - const t_ii = tt.intern(.{ .tuple = .{ .fields = &[_]TypeId{ .s32, .s32 }, .names = null } }); + const t_ss = tt.intern(.{ .tuple = .{ .fields = &[_]TypeId{ .i64, .i64 }, .names = null } }); + const t_ii = tt.intern(.{ .tuple = .{ .fields = &[_]TypeId{ .i32, .i32 }, .names = null } }); try std.testing.expectEqual(Plan.tuple_elementwise, cr.classify(t_ss, t_ii)); // Closure value → bare fn-ptr: rejected. @@ -100,17 +100,17 @@ test "conversions: classifyXX picks the xx-operator head decision" { const drawable = tt.findByName(tt.internString("Drawable")).?; // Any source unboxes regardless of dst. - try std.testing.expectEqual(XXPlan.unbox_any, cr.classifyXX(.any, .s64)); + try std.testing.expectEqual(XXPlan.unbox_any, cr.classifyXX(.any, .i64)); // Same type → no-op. - try std.testing.expectEqual(XXPlan.no_op, cr.classifyXX(.s64, .s64)); + try std.testing.expectEqual(XXPlan.no_op, cr.classifyXX(.i64, .i64)); // dst is a protocol → erasure (checked before the src-protocol case). - try std.testing.expectEqual(XXPlan.erase_protocol, cr.classifyXX(.s64, drawable)); + try std.testing.expectEqual(XXPlan.erase_protocol, cr.classifyXX(.i64, drawable)); // src is a protocol, dst is a pointer → recover the ctx pointer. - try std.testing.expectEqual(XXPlan.protocol_to_pointer, cr.classifyXX(drawable, tt.ptrTo(.s64))); + try std.testing.expectEqual(XXPlan.protocol_to_pointer, cr.classifyXX(drawable, tt.ptrTo(.i64))); // src is a protocol but dst is NOT a pointer → fall to the ladder. - try std.testing.expectEqual(XXPlan.coerce, cr.classifyXX(drawable, .s64)); + try std.testing.expectEqual(XXPlan.coerce, cr.classifyXX(drawable, .i64)); // Pointer materialization (`xx value` into a `*T` slot, no built-in) defers // to the ladder + the user-`Into` pointer fallback in lowerXX. const a = tt.intern(.{ .@"struct" = .{ .name = tt.internString("A"), .fields = &.{} } }); - try std.testing.expectEqual(XXPlan.coerce, cr.classifyXX(a, tt.ptrTo(.s32))); + try std.testing.expectEqual(XXPlan.coerce, cr.classifyXX(a, tt.ptrTo(.i32))); } diff --git a/src/ir/emit_llvm.test.zig b/src/ir/emit_llvm.test.zig index db9fe09..b3ca92b 100644 --- a/src/ir/emit_llvm.test.zig +++ b/src/ir/emit_llvm.test.zig @@ -29,12 +29,12 @@ test "emit: main() returns 42" { var b = Builder.init(&module); - // func main() -> s64 { return 42; } - _ = b.beginFunction(str(&module, "main"), &.{}, .s64); + // func main() -> i64 { return 42; } + _ = b.beginFunction(str(&module, "main"), &.{}, .i64); const entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry); - const c42 = b.constInt(42, .s64); - b.ret(c42, .s64); + const c42 = b.constInt(42, .i64); + b.ret(c42, .i64); b.finalize(); // Emit to LLVM @@ -49,7 +49,7 @@ test "emit: main() returns 42" { const ir_str = emitter.dumpToString(); try std.testing.expect(std.mem.indexOf(u8, ir_str, "define") != null); // `main` is emitted with the C entry-point convention: it returns i32, so - // the s64 const 42 is truncated to `ret i32 42`. + // the i64 const 42 is truncated to `ret i32 42`. try std.testing.expect(std.mem.indexOf(u8, ir_str, "ret i32 42") != null); } @@ -60,12 +60,12 @@ test "emit: add(a, b) returns a + b" { var b = Builder.init(&module); - // func add(a: s64, b: s64) -> s64 { return a + b; } + // func add(a: i64, b: i64) -> i64 { return a + b; } const params = &[_]Function.Param{ - .{ .name = str(&module, "a"), .ty = .s64 }, - .{ .name = str(&module, "b"), .ty = .s64 }, + .{ .name = str(&module, "a"), .ty = .i64 }, + .{ .name = str(&module, "b"), .ty = .i64 }, }; - _ = b.beginFunction(str(&module, "add"), params, .s64); + _ = b.beginFunction(str(&module, "add"), params, .i64); const entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry); @@ -78,10 +78,10 @@ test "emit: add(a, b) returns a + b" { // at 0, and params are accessed differently. The lowering pass emits // alloca+store for params. For this test, we use const_int to test // the add instruction directly. - const a = b.constInt(10, .s64); - const a_b = b.constInt(32, .s64); - const sum = b.add(a, a_b, .s64); - b.ret(sum, .s64); + const a = b.constInt(10, .i64); + const a_b = b.constInt(32, .i64); + const sum = b.add(a, a_b, .i64); + b.ret(sum, .i64); b.finalize(); var emitter = LLVMEmitter.init(alloc, &module, "test_add", .{}); @@ -138,14 +138,14 @@ test "emit: negation" { // Negating a constant folds; negate a param so `sub 0, %x` is emitted. _ = b.beginFunction(str(&module, "negate"), &[_]Function.Param{ - .{ .name = str(&module, "x"), .ty = .s64 }, - }, .s64); + .{ .name = str(&module, "x"), .ty = .i64 }, + }, .i64); const entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry); const val = Ref.fromIndex(0); - const neg = b.emit(.{ .neg = .{ .operand = val } }, .s64); - b.ret(neg, .s64); + const neg = b.emit(.{ .neg = .{ .operand = val } }, .i64); + b.ret(neg, .i64); b.finalize(); var emitter = LLVMEmitter.init(alloc, &module, "test_neg", .{}); @@ -189,16 +189,16 @@ test "emit: alloca, store, load" { var b = Builder.init(&module); - // func f() -> s64 { var x: s64 = 10; return x; } - _ = b.beginFunction(str(&module, "f"), &.{}, .s64); + // func f() -> i64 { var x: i64 = 10; return x; } + _ = b.beginFunction(str(&module, "f"), &.{}, .i64); const entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry); - const x_ptr = b.alloca(.s64); // alloca s64 → *s64 - const ten = b.constInt(10, .s64); + const x_ptr = b.alloca(.i64); // alloca i64 → *i64 + const ten = b.constInt(10, .i64); b.store(x_ptr, ten); // store 10 → *x - const loaded = b.load(x_ptr, .s64); // load *x → s64 - b.ret(loaded, .s64); + const loaded = b.load(x_ptr, .i64); // load *x → i64 + b.ret(loaded, .i64); b.finalize(); var emitter = LLVMEmitter.init(alloc, &module, "test_mem", .{}); @@ -221,12 +221,12 @@ test "emit: comparison and branch" { var b = Builder.init(&module); - // func f(a, b) -> s64 { if (a < b) return 1; else return 0; } + // func f(a, b) -> i64 { if (a < b) return 1; else return 0; } // Params (not constants) so the icmp isn't folded. _ = b.beginFunction(str(&module, "cmpfn"), &[_]Function.Param{ - .{ .name = str(&module, "a"), .ty = .s64 }, - .{ .name = str(&module, "b"), .ty = .s64 }, - }, .s64); + .{ .name = str(&module, "a"), .ty = .i64 }, + .{ .name = str(&module, "b"), .ty = .i64 }, + }, .i64); const entry = b.appendBlock(str(&module, "entry"), &.{}); const then_bb = b.appendBlock(str(&module, "then"), &.{}); const else_bb = b.appendBlock(str(&module, "else"), &.{}); @@ -238,12 +238,12 @@ test "emit: comparison and branch" { b.condBr(cond, then_bb, &.{}, else_bb, &.{}); b.switchToBlock(then_bb); - const one = b.constInt(1, .s64); - b.ret(one, .s64); + const one = b.constInt(1, .i64); + b.ret(one, .i64); b.switchToBlock(else_bb); - const zero = b.constInt(0, .s64); - b.ret(zero, .s64); + const zero = b.constInt(0, .i64); + b.ret(zero, .i64); b.finalize(); var emitter = LLVMEmitter.init(alloc, &module, "test_cmp", .{}); @@ -264,27 +264,27 @@ test "emit: function call" { var b = Builder.init(&module); - // func add(a: s64, b: s64) -> s64 { return a + b; } (using constants) + // func add(a: i64, b: i64) -> i64 { return a + b; } (using constants) const add_id = b.beginFunction(str(&module, "addfn"), &[_]Function.Param{ - .{ .name = str(&module, "a"), .ty = .s64 }, - .{ .name = str(&module, "b"), .ty = .s64 }, - }, .s64); + .{ .name = str(&module, "a"), .ty = .i64 }, + .{ .name = str(&module, "b"), .ty = .i64 }, + }, .i64); const add_entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(add_entry); - const p0 = b.constInt(0, .s64); // placeholder - const p1 = b.constInt(0, .s64); - const sum = b.add(p0, p1, .s64); - b.ret(sum, .s64); + const p0 = b.constInt(0, .i64); // placeholder + const p1 = b.constInt(0, .i64); + const sum = b.add(p0, p1, .i64); + b.ret(sum, .i64); b.finalize(); - // func main() -> s64 { return addfn(3, 4); } - _ = b.beginFunction(str(&module, "main"), &.{}, .s64); + // func main() -> i64 { return addfn(3, 4); } + _ = b.beginFunction(str(&module, "main"), &.{}, .i64); const main_entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(main_entry); - const three = b.constInt(3, .s64); - const four = b.constInt(4, .s64); - const result = b.call(add_id, &.{ three, four }, .s64); - b.ret(result, .s64); + const three = b.constInt(3, .i64); + const four = b.constInt(4, .i64); + const result = b.call(add_id, &.{ three, four }, .i64); + b.ret(result, .i64); b.finalize(); var emitter = LLVMEmitter.init(alloc, &module, "test_call", .{}); @@ -298,7 +298,7 @@ test "emit: function call" { try std.testing.expect(std.mem.indexOf(u8, ir_str, "addfn") != null); } -test "emit: widen conversion s32 to s64" { +test "emit: widen conversion i32 to i64" { const alloc = std.testing.allocator; var module = Module.init(alloc); defer module.deinit(); @@ -307,14 +307,14 @@ test "emit: widen conversion s32 to s64" { // sext of a constant folds; widen a param so `sext` is emitted. _ = b.beginFunction(str(&module, "wfn"), &[_]Function.Param{ - .{ .name = str(&module, "x"), .ty = .s32 }, - }, .s64); + .{ .name = str(&module, "x"), .ty = .i32 }, + }, .i64); const entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry); const val = Ref.fromIndex(0); - const wide = b.widen(val, .s32, .s64); - b.ret(wide, .s64); + const wide = b.widen(val, .i32, .i64); + b.ret(wide, .i64); b.finalize(); var emitter = LLVMEmitter.init(alloc, &module, "test_widen", .{}); @@ -338,10 +338,10 @@ test "emit: type conversion toLLVMType" { // Just verify toLLVMType doesn't crash for all builtin types _ = emitter.toLLVMType(.void); _ = emitter.toLLVMType(.bool); - _ = emitter.toLLVMType(.s8); - _ = emitter.toLLVMType(.s16); - _ = emitter.toLLVMType(.s32); - _ = emitter.toLLVMType(.s64); + _ = emitter.toLLVMType(.i8); + _ = emitter.toLLVMType(.i16); + _ = emitter.toLLVMType(.i32); + _ = emitter.toLLVMType(.i64); _ = emitter.toLLVMType(.u8); _ = emitter.toLLVMType(.u16); _ = emitter.toLLVMType(.u32); @@ -381,12 +381,12 @@ test "emit: abiCoerceParamType coerces C-ABI structs by size bucket" { defer module.deinit(); // Intern the shapes before building the emitter (toLLVMType reads live). - const small = internStruct(&module, "Small", &.{ .s32, .s32 }); // 8 bytes - const mid = internStruct(&module, "Mid", &.{ .s64, .s64 }); // 16 bytes - const big = internStruct(&module, "Big", &.{ .s64, .s64, .s64 }); // 24 bytes + const small = internStruct(&module, "Small", &.{ .i32, .i32 }); // 8 bytes + const mid = internStruct(&module, "Mid", &.{ .i64, .i64 }); // 16 bytes + const big = internStruct(&module, "Big", &.{ .i64, .i64, .i64 }); // 24 bytes const hfa_f = internStruct(&module, "HfaF", &.{ .f32, .f32, .f32, .f32 }); // 16, all-float const hfa_d = internStruct(&module, "HfaD", &.{ .f64, .f64 }); // 16, all-double - const sl = module.types.sliceOf(.s32); + const sl = module.types.sliceOf(.i32); var emitter = LLVMEmitter.init(alloc, &module, "test_abi", .{}); defer emitter.deinit(); @@ -404,7 +404,7 @@ test "emit: abiCoerceParamType coerces C-ABI structs by size bucket" { try std.testing.expect(emitter.abiCoerceParamType(.string, emitter.toLLVMType(.string)) == emitter.cached_ptr); try std.testing.expect(emitter.abiCoerceParamType(sl, emitter.toLLVMType(sl)) == emitter.cached_ptr); // Scalars pass through unchanged. - try std.testing.expect(emitter.abiCoerceParamType(.s32, emitter.toLLVMType(.s32)) == emitter.toLLVMType(.s32)); + try std.testing.expect(emitter.abiCoerceParamType(.i32, emitter.toLLVMType(.i32)) == emitter.toLLVMType(.i32)); } test "emit: needsByval only for > 16-byte non-HFA structs" { @@ -412,11 +412,11 @@ test "emit: needsByval only for > 16-byte non-HFA structs" { var module = Module.init(alloc); defer module.deinit(); - const small = internStruct(&module, "Small", &.{ .s32, .s32 }); - const mid = internStruct(&module, "Mid", &.{ .s64, .s64 }); - const big = internStruct(&module, "Big", &.{ .s64, .s64, .s64 }); + const small = internStruct(&module, "Small", &.{ .i32, .i32 }); + const mid = internStruct(&module, "Mid", &.{ .i64, .i64 }); + const big = internStruct(&module, "Big", &.{ .i64, .i64, .i64 }); const hfa_d = internStruct(&module, "HfaD", &.{ .f64, .f64 }); - const sl = module.types.sliceOf(.s32); + const sl = module.types.sliceOf(.i32); var emitter = LLVMEmitter.init(alloc, &module, "test_byval", .{}); defer emitter.deinit(); @@ -427,7 +427,7 @@ test "emit: needsByval only for > 16-byte non-HFA structs" { try std.testing.expect(!emitter.needsByval(hfa_d, emitter.toLLVMType(hfa_d))); // HFA try std.testing.expect(!emitter.needsByval(.string, emitter.toLLVMType(.string))); try std.testing.expect(!emitter.needsByval(sl, emitter.toLLVMType(sl))); - try std.testing.expect(!emitter.needsByval(.s32, emitter.toLLVMType(.s32))); // non-struct + try std.testing.expect(!emitter.needsByval(.i32, emitter.toLLVMType(.i32))); // non-struct } // ── Struct/Enum/Union tests ───────────────────────────────────────── @@ -437,10 +437,10 @@ test "emit: struct_init and struct_get" { var module = Module.init(alloc); defer module.deinit(); - // Create a struct type: Point { x: s64, y: s64 } + // Create a struct type: Point { x: i64, y: i64 } const fields = &[_]types.TypeInfo.StructInfo.Field{ - .{ .name = str(&module, "x"), .ty = .s64 }, - .{ .name = str(&module, "y"), .ty = .s64 }, + .{ .name = str(&module, "x"), .ty = .i64 }, + .{ .name = str(&module, "y"), .ty = .i64 }, }; const owned_fields = alloc.dupe(types.TypeInfo.StructInfo.Field, fields) catch unreachable; defer alloc.free(owned_fields); @@ -451,20 +451,20 @@ test "emit: struct_init and struct_get" { var b = Builder.init(&module); - // func f(v) -> s64 { p = Point{v, 20}; return p.y; } + // func f(v) -> i64 { p = Point{v, 20}; return p.y; } // A param operand keeps the aggregate non-constant so insertvalue / // extractvalue survive (a fully-constant struct would be folded). _ = b.beginFunction(str(&module, "f"), &[_]Function.Param{ - .{ .name = str(&module, "v"), .ty = .s64 }, - }, .s64); + .{ .name = str(&module, "v"), .ty = .i64 }, + }, .i64); const entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry); const x = Ref.fromIndex(0); - const y = b.constInt(20, .s64); + const y = b.constInt(20, .i64); const p = b.structInit(&.{ x, y }, point_ty); - const py = b.structGet(p, 1, .s64); - b.ret(py, .s64); + const py = b.structGet(p, 1, .i64); + b.ret(py, .i64); b.finalize(); var emitter = LLVMEmitter.init(alloc, &module, "test_struct", .{}); @@ -486,8 +486,8 @@ test "emit: struct_gep (pointer to field)" { // Create struct type const fields = &[_]types.TypeInfo.StructInfo.Field{ - .{ .name = str(&module, "x"), .ty = .s64 }, - .{ .name = str(&module, "y"), .ty = .s64 }, + .{ .name = str(&module, "x"), .ty = .i64 }, + .{ .name = str(&module, "y"), .ty = .i64 }, }; const owned_fields = alloc.dupe(types.TypeInfo.StructInfo.Field, fields) catch unreachable; defer alloc.free(owned_fields); @@ -495,21 +495,21 @@ test "emit: struct_gep (pointer to field)" { .name = str(&module, "Point"), .fields = owned_fields, } }); - const ptr_s64 = module.types.ptrTo(.s64); + const ptr_i64 = module.types.ptrTo(.i64); var b = Builder.init(&module); - // func f() -> s64 { var p: Point; p.y = 42; return p.y; } - _ = b.beginFunction(str(&module, "gepfn"), &.{}, .s64); + // func f() -> i64 { var p: Point; p.y = 42; return p.y; } + _ = b.beginFunction(str(&module, "gepfn"), &.{}, .i64); const entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry); const p_ptr = b.alloca(point_ty); - const y_ptr = b.structGepTyped(p_ptr, 1, ptr_s64, point_ty); - const c42 = b.constInt(42, .s64); + const y_ptr = b.structGepTyped(p_ptr, 1, ptr_i64, point_ty); + const c42 = b.constInt(42, .i64); b.store(y_ptr, c42); - const loaded = b.load(y_ptr, .s64); - b.ret(loaded, .s64); + const loaded = b.load(y_ptr, .i64); + b.ret(loaded, .i64); b.finalize(); var emitter = LLVMEmitter.init(alloc, &module, "test_gep", .{}); @@ -544,16 +544,16 @@ test "emit: enum_init and enum_tag (plain enum)" { var b = Builder.init(&module); - // func f() -> s64 { c = Color.Green; return tag(c); } - _ = b.beginFunction(str(&module, "enumfn"), &.{}, .s64); + // func f() -> i64 { c = Color.Green; return tag(c); } + _ = b.beginFunction(str(&module, "enumfn"), &.{}, .i64); const entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry); const green = b.enumInit(1, Ref.none, color_ty); // Green = tag 1 - const tag = b.enumTag(green, .s32); - // Widen tag from s32 to s64 for the return - const wide = b.widen(tag, .s32, .s64); - b.ret(wide, .s64); + const tag = b.enumTag(green, .i32); + // Widen tag from i32 to i64 for the return + const wide = b.widen(tag, .i32, .i64); + b.ret(wide, .i64); b.finalize(); var emitter = LLVMEmitter.init(alloc, &module, "test_enum", .{}); @@ -572,17 +572,17 @@ test "emit: tagged union (enum_init with payload, enum_tag, enum_payload)" { var module = Module.init(alloc); defer module.deinit(); - // Create a tagged union: Shape { Circle: f64, Rect: s64 } + // Create a tagged union: Shape { Circle: f64, Rect: i64 } const ufields = &[_]types.TypeInfo.StructInfo.Field{ .{ .name = str(&module, "Circle"), .ty = .f64 }, - .{ .name = str(&module, "Rect"), .ty = .s64 }, + .{ .name = str(&module, "Rect"), .ty = .i64 }, }; const owned_ufields = alloc.dupe(types.TypeInfo.StructInfo.Field, ufields) catch unreachable; defer alloc.free(owned_ufields); const shape_ty = module.types.intern(.{ .tagged_union = .{ .name = str(&module, "Shape"), .fields = owned_ufields, - .tag_type = .s64, + .tag_type = .i64, } }); var b = Builder.init(&module); @@ -597,7 +597,7 @@ test "emit: tagged union (enum_init with payload, enum_tag, enum_payload)" { const radius = Ref.fromIndex(0); const shape = b.enumInit(0, radius, shape_ty); // Circle = tag 0 - const tag = b.emit(.{ .enum_tag = .{ .operand = shape } }, .s64); + const tag = b.emit(.{ .enum_tag = .{ .operand = shape } }, .i64); _ = tag; // tag is used but we just check it doesn't crash const payload = b.emit(.{ .enum_payload = .{ .base = shape, .field_index = 0 } }, .f64); b.ret(payload, .f64); @@ -623,9 +623,9 @@ test "emit: union_get (reinterpret union field)" { var module = Module.init(alloc); defer module.deinit(); - // Untagged union: Data { as_int: s64, as_float: f64 } + // Untagged union: Data { as_int: i64, as_float: f64 } const ufields = &[_]types.TypeInfo.StructInfo.Field{ - .{ .name = str(&module, "as_int"), .ty = .s64 }, + .{ .name = str(&module, "as_int"), .ty = .i64 }, .{ .name = str(&module, "as_float"), .ty = .f64 }, }; const owned_ufields = alloc.dupe(types.TypeInfo.StructInfo.Field, ufields) catch unreachable; @@ -637,15 +637,15 @@ test "emit: union_get (reinterpret union field)" { var b = Builder.init(&module); - // func f() -> s64 { d = Data.as_int(42); return union_get(d, 0) as s64; } - _ = b.beginFunction(str(&module, "ugfn"), &.{}, .s64); + // func f() -> i64 { d = Data.as_int(42); return union_get(d, 0) as i64; } + _ = b.beginFunction(str(&module, "ugfn"), &.{}, .i64); const entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry); - const val = b.constInt(42, .s64); + const val = b.constInt(42, .i64); const d = b.enumInit(0, val, data_ty); - const got = b.emit(.{ .union_get = .{ .base = d, .field_index = 0 } }, .s64); - b.ret(got, .s64); + const got = b.emit(.{ .union_get = .{ .base = d, .field_index = 0 } }, .i64); + b.ret(got, .i64); b.finalize(); var emitter = LLVMEmitter.init(alloc, &module, "test_union_get", .{}); @@ -667,19 +667,19 @@ test "emit: array index_get" { var module = Module.init(alloc); defer module.deinit(); - const arr_ty = module.types.arrayOf(.s64, 3); + const arr_ty = module.types.arrayOf(.i64, 3); var b = Builder.init(&module); - // func f() -> s64 { arr: [3]s64 = ---; return arr[1]; } - _ = b.beginFunction(str(&module, "arr_idx"), &.{}, .s64); + // func f() -> i64 { arr: [3]i64 = ---; return arr[1]; } + _ = b.beginFunction(str(&module, "arr_idx"), &.{}, .i64); const entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry); const undef_arr = b.emit(.{ .const_undef = {} }, arr_ty); - const idx = b.constInt(1, .s64); - const elem = b.emit(.{ .index_get = .{ .lhs = undef_arr, .rhs = idx } }, .s64); - b.ret(elem, .s64); + const idx = b.constInt(1, .i64); + const elem = b.emit(.{ .index_get = .{ .lhs = undef_arr, .rhs = idx } }, .i64); + b.ret(elem, .i64); b.finalize(); var emitter = LLVMEmitter.init(alloc, &module, "test_arr_idx", .{}); @@ -700,17 +700,17 @@ test "emit: length on slice" { var b = Builder.init(&module); - // func f(s: string) -> s64 { return s.len; } + // func f(s: string) -> i64 { return s.len; } // A string param keeps the value non-constant so extractvalue survives. _ = b.beginFunction(str(&module, "strlen"), &[_]Function.Param{ .{ .name = str(&module, "s"), .ty = .string }, - }, .s64); + }, .i64); const entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry); const s = Ref.fromIndex(0); - const len = b.emit(.{ .length = .{ .operand = s } }, .s64); - b.ret(len, .s64); + const len = b.emit(.{ .length = .{ .operand = s } }, .i64); + b.ret(len, .i64); b.finalize(); var emitter = LLVMEmitter.init(alloc, &module, "test_len", .{}); @@ -762,12 +762,12 @@ test "emit: array_to_slice" { var module = Module.init(alloc); defer module.deinit(); - const arr_ty = module.types.arrayOf(.s64, 4); - const slice_ty = module.types.sliceOf(.s64); + const arr_ty = module.types.arrayOf(.i64, 4); + const slice_ty = module.types.sliceOf(.i64); var b = Builder.init(&module); - // func f() -> []s64 { var arr: [4]s64 = ---; return arr[:]; } + // func f() -> []i64 { var arr: [4]i64 = ---; return arr[:]; } _ = b.beginFunction(str(&module, "a2s"), &.{}, slice_ty); const entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry); @@ -798,13 +798,13 @@ test "emit: subslice" { var b = Builder.init(&module); - // func f(s: []u8, lo: s64, hi: s64) -> []u8 { return s[lo..hi]; } + // func f(s: []u8, lo: i64, hi: i64) -> []u8 { return s[lo..hi]; } // All operands are params: a constant base folds the GEP, and constant // lo/hi fold the `hi - lo` subtraction. _ = b.beginFunction(str(&module, "ssfn"), &[_]Function.Param{ .{ .name = str(&module, "s"), .ty = slice_ty }, - .{ .name = str(&module, "lo"), .ty = .s64 }, - .{ .name = str(&module, "hi"), .ty = .s64 }, + .{ .name = str(&module, "lo"), .ty = .i64 }, + .{ .name = str(&module, "hi"), .ty = .i64 }, }, slice_ty); const entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry); @@ -836,22 +836,22 @@ test "emit: optional_wrap and optional_unwrap (value type)" { var module = Module.init(alloc); defer module.deinit(); - const opt_ty = module.types.optionalOf(.s64); + const opt_ty = module.types.optionalOf(.i64); var b = Builder.init(&module); - // func f(v) -> s64 { opt = wrap(v); return unwrap(opt); } + // func f(v) -> i64 { opt = wrap(v); return unwrap(opt); } // Param value keeps the optional non-constant (else insertvalue folds). _ = b.beginFunction(str(&module, "optfn"), &[_]Function.Param{ - .{ .name = str(&module, "v"), .ty = .s64 }, - }, .s64); + .{ .name = str(&module, "v"), .ty = .i64 }, + }, .i64); const entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry); const val = Ref.fromIndex(0); const wrapped = b.optionalWrap(val, opt_ty); - const unwrapped = b.optionalUnwrap(wrapped, .s64); - b.ret(unwrapped, .s64); + const unwrapped = b.optionalUnwrap(wrapped, .i64); + b.ret(unwrapped, .i64); b.finalize(); var emitter = LLVMEmitter.init(alloc, &module, "test_opt", .{}); @@ -872,13 +872,13 @@ test "emit: optional_has_value" { var module = Module.init(alloc); defer module.deinit(); - const opt_ty = module.types.optionalOf(.s64); + const opt_ty = module.types.optionalOf(.i64); var b = Builder.init(&module); // Param value keeps the optional non-constant (else extractvalue folds). _ = b.beginFunction(str(&module, "hasfn"), &[_]Function.Param{ - .{ .name = str(&module, "v"), .ty = .s64 }, + .{ .name = str(&module, "v"), .ty = .i64 }, }, .bool); const entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry); @@ -909,15 +909,15 @@ test "emit: switch_br" { var b = Builder.init(&module); - // func f(x: s64) -> s64 { match x { 0 => 10, 1 => 20, _ => 30 } } - _ = b.beginFunction(str(&module, "swfn"), &.{}, .s64); + // func f(x: i64) -> i64 { match x { 0 => 10, 1 => 20, _ => 30 } } + _ = b.beginFunction(str(&module, "swfn"), &.{}, .i64); const entry = b.appendBlock(str(&module, "entry"), &.{}); const case0 = b.appendBlock(str(&module, "case0"), &.{}); const case1 = b.appendBlock(str(&module, "case1"), &.{}); const default_bb = b.appendBlock(str(&module, "default"), &.{}); b.switchToBlock(entry); - const x = b.constInt(1, .s64); + const x = b.constInt(1, .i64); const cases = alloc.dupe(inst_mod.SwitchBranch.Case, &.{ .{ .value = 0, .target = case0, .args = &.{} }, .{ .value = 1, .target = case1, .args = &.{} }, @@ -931,13 +931,13 @@ test "emit: switch_br" { } }, .void); b.switchToBlock(case0); - b.ret(b.constInt(10, .s64), .s64); + b.ret(b.constInt(10, .i64), .i64); b.switchToBlock(case1); - b.ret(b.constInt(20, .s64), .s64); + b.ret(b.constInt(20, .i64), .i64); b.switchToBlock(default_bb); - b.ret(b.constInt(30, .s64), .s64); + b.ret(b.constInt(30, .i64), .i64); b.finalize(); var emitter = LLVMEmitter.init(alloc, &module, "test_switch", .{}); @@ -957,18 +957,18 @@ test "emit: closure_create" { var module = Module.init(alloc); defer module.deinit(); - const closure_ty = module.types.closureType(&.{.s64}, .s64); + const closure_ty = module.types.closureType(&.{.i64}, .i64); var b = Builder.init(&module); // Create a dummy trampoline function const tramp_id = b.beginFunction(str(&module, "tramp"), &[_]inst_mod.Function.Param{ - .{ .name = str(&module, "env"), .ty = .s64 }, - .{ .name = str(&module, "x"), .ty = .s64 }, - }, .s64); + .{ .name = str(&module, "env"), .ty = .i64 }, + .{ .name = str(&module, "x"), .ty = .i64 }, + }, .i64); const tramp_entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(tramp_entry); - b.ret(b.constInt(0, .s64), .s64); + b.ret(b.constInt(0, .i64), .i64); b.finalize(); // func f(e: *void) -> closure { return closure_create(tramp, e); } @@ -1004,18 +1004,18 @@ test "emit: box_any and unbox_any" { var b = Builder.init(&module); - // func f(v) -> s64 { a = box(v); return unbox(a); } + // func f(v) -> i64 { a = box(v); return unbox(a); } // Param value keeps the boxed Any non-constant (else insertvalue folds). _ = b.beginFunction(str(&module, "anyfn"), &[_]Function.Param{ - .{ .name = str(&module, "v"), .ty = .s64 }, - }, .s64); + .{ .name = str(&module, "v"), .ty = .i64 }, + }, .i64); const entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry); const val = Ref.fromIndex(0); - const boxed = b.emit(.{ .box_any = .{ .operand = val, .source_type = .s64 } }, .any); - const unboxed = b.emit(.{ .unbox_any = .{ .operand = boxed } }, .s64); - b.ret(unboxed, .s64); + const boxed = b.emit(.{ .box_any = .{ .operand = val, .source_type = .i64 } }, .any); + const unboxed = b.emit(.{ .unbox_any = .{ .operand = boxed } }, .i64); + b.ret(unboxed, .i64); b.finalize(); var emitter = LLVMEmitter.init(alloc, &module, "test_any", .{}); @@ -1036,15 +1036,15 @@ test "emit: ERR E3.0 — DWARF debug info (compile unit + subprogram + per-inst var b = Builder.init(&module); - // func main() -> s64 { return 42; } — with the `return` instruction + // func main() -> i64 { return 42; } — with the `return` instruction // carrying a span that lands on line 3 of the source map below. - _ = b.beginFunction(str(&module, "main"), &.{}, .s64); + _ = b.beginFunction(str(&module, "main"), &.{}, .i64); const entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry); // "a\nb\nXYZ" — byte offset 4 ('X') is line 3, col 1. b.current_span = .{ .start = 4, .end = 5 }; - const c42 = b.constInt(42, .s64); - b.ret(c42, .s64); + const c42 = b.constInt(42, .i64); + b.ret(c42, .i64); b.finalize(); // Source map keyed on the main file. setDebugContext + opt none @@ -1080,10 +1080,10 @@ test "emit: ERR E3.0 — no DWARF without a debug context (unit-test default)" { defer module.deinit(); var b = Builder.init(&module); - _ = b.beginFunction(str(&module, "main"), &.{}, .s64); + _ = b.beginFunction(str(&module, "main"), &.{}, .i64); const entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry); - b.ret(b.constInt(42, .s64), .s64); + b.ret(b.constInt(42, .i64), .i64); b.finalize(); // No setDebugContext call → no source map → debug info off even at @@ -1111,9 +1111,9 @@ test "emit: argIRTypeOrFail surfaces .unresolved for an unresolvable FFI arg ref var b = Builder.init(&module); - // func ffifn(a: s64, b: f64) -> void { } + // func ffifn(a: i64, b: f64) -> void { } const fid = b.beginFunction(str(&module, "ffifn"), &[_]Function.Param{ - .{ .name = str(&module, "a"), .ty = .s64 }, + .{ .name = str(&module, "a"), .ty = .i64 }, .{ .name = str(&module, "b"), .ty = .f64 }, }, .void); const entry = b.appendBlock(str(&module, "entry"), &.{}); @@ -1127,7 +1127,7 @@ test "emit: argIRTypeOrFail surfaces .unresolved for an unresolvable FFI arg ref // Happy path: a real arg ref (param 0 / param 1) resolves byte-identically // to its declared IR type — the FFI fast path is unchanged. - try std.testing.expectEqual(TypeId.s64, emitter.argIRTypeOrFail(Ref.fromIndex(0))); + try std.testing.expectEqual(TypeId.i64, emitter.argIRTypeOrFail(Ref.fromIndex(0))); try std.testing.expectEqual(TypeId.f64, emitter.argIRTypeOrFail(Ref.fromIndex(1))); // A ref past every param and instruction is unresolvable. @@ -1145,12 +1145,12 @@ test "emit: argIRTypeOrFail surfaces .unresolved for an unresolvable FFI arg ref try std.testing.expect(emitter.argIRTypeOrFail(bogus) != .void); } -// ── reflection-builtin arg-type lookup must fail loudly, never `.s64` ── +// ── reflection-builtin arg-type lookup must fail loudly, never `.i64` ── // `reflectArgRepr` backs the `type_name` / `type_eq` reflection builtins, which read // their `Type` arg as a boxed `Any` aggregate (`.any` → extract value field) or a bare // i64 TypeId index. A ref it cannot resolve is a codegen invariant violation; it must // surface `.unresolved` (which the emit site hard-panics on) instead of the old silent -// `getRefIRType(arg) orelse .s64` default that would mis-classify a boxed arg as bare +// `getRefIRType(arg) orelse .i64` default that would mis-classify a boxed arg as bare // and read the wrong value with no diagnostic. test "emit: reflectArgRepr surfaces .unresolved for an unresolvable reflection arg ref (issue 0075)" { const alloc = std.testing.allocator; @@ -1159,10 +1159,10 @@ test "emit: reflectArgRepr surfaces .unresolved for an unresolvable reflection a var b = Builder.init(&module); - // func reflfn(boxed: any, bare: s64) -> void { } + // func reflfn(boxed: any, bare: i64) -> void { } const fid = b.beginFunction(str(&module, "reflfn"), &[_]Function.Param{ .{ .name = str(&module, "boxed"), .ty = .any }, - .{ .name = str(&module, "bare"), .ty = .s64 }, + .{ .name = str(&module, "bare"), .ty = .i64 }, }, .void); const entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry); @@ -1174,7 +1174,7 @@ test "emit: reflectArgRepr surfaces .unresolved for an unresolvable reflection a emitter.current_func_idx = fid.index(); // Happy path: a boxed `.any` Type arg classifies as `.boxed` (extract value - // field); a bare `.s64` TypeId arg classifies as `.bare` (use directly). + // field); a bare `.i64` TypeId arg classifies as `.bare` (use directly). // These decisions are byte-identical to the pre-fix `== .any` gate. try std.testing.expectEqual(LLVMEmitter.ReflectArgRepr.boxed, emitter.reflectArgRepr(Ref.fromIndex(0))); try std.testing.expectEqual(LLVMEmitter.ReflectArgRepr.bare, emitter.reflectArgRepr(Ref.fromIndex(1))); @@ -1183,11 +1183,11 @@ test "emit: reflectArgRepr surfaces .unresolved for an unresolvable reflection a const bogus = Ref.fromIndex(100_000); try std.testing.expectEqual(@as(?TypeId, null), emitter.getRefIRType(bogus)); - // Fail-before: the old `getRefIRType(arg) orelse .s64` would silently yield - // `.s64` here — which `!= .any`, so the reflection arm would treat a failed + // Fail-before: the old `getRefIRType(arg) orelse .i64` would silently yield + // `.i64` here — which `!= .any`, so the reflection arm would treat a failed // lookup as a bare i64 and read the wrong value with no diagnostic. - try std.testing.expectEqual(TypeId.s64, emitter.getRefIRType(bogus) orelse TypeId.s64); - try std.testing.expect((emitter.getRefIRType(bogus) orelse TypeId.s64) != .any); + try std.testing.expectEqual(TypeId.i64, emitter.getRefIRType(bogus) orelse TypeId.i64); + try std.testing.expect((emitter.getRefIRType(bogus) orelse TypeId.i64) != .any); // Pass-after: the classifier returns the dedicated `.unresolved` variant, // never `.bare`, so the emit site trips its hard panic instead of silently diff --git a/src/ir/emit_llvm.zig b/src/ir/emit_llvm.zig index 193c99f..91969ba 100644 --- a/src/ir/emit_llvm.zig +++ b/src/ir/emit_llvm.zig @@ -948,7 +948,7 @@ pub const LLVMEmitter = struct { .string => |sid| self.emitConstStringGlobal(self.ir_mod.types.getString(sid)), .aggregate => |agg| self.emitConstAggregate(agg, llvm_ty, false), .vtable => c.LLVMConstNull(llvm_ty), // placeholder — initialized in initVtableGlobals after function declarations - // A top-level null-pointer global (`p : *s64 = null;`) and a + // A top-level null-pointer global (`p : *i64 = null;`) and a // zero-initialized global both emit as the all-zero constant // of the global's type. .null_val, .zeroinit => c.LLVMConstNull(llvm_ty), @@ -2164,7 +2164,7 @@ pub const LLVMEmitter = struct { if (kind == c.LLVMIntegerTypeKind) { const width = c.LLVMGetIntTypeWidth(ty); if (width < 64) { - return c.LLVMBuildSExt(self.builder, val, self.cached_i64, "s64"); + return c.LLVMBuildSExt(self.builder, val, self.cached_i64, "i64"); } return val; } @@ -2198,11 +2198,11 @@ pub const LLVMEmitter = struct { const info = self.ir_mod.types.get(ty); return switch (info) { .signed => |w| switch (w) { - 8 => TypeId.s8.index(), - 16 => TypeId.s16.index(), - 32 => TypeId.s32.index(), - 64 => TypeId.s64.index(), - else => if (w <= 32) TypeId.s32.index() else TypeId.s64.index(), + 8 => TypeId.i8.index(), + 16 => TypeId.i16.index(), + 32 => TypeId.i32.index(), + 64 => TypeId.i64.index(), + else => if (w <= 32) TypeId.i32.index() else TypeId.i64.index(), }, .unsigned => |w| switch (w) { 8 => TypeId.u8.index(), @@ -2278,7 +2278,7 @@ pub const LLVMEmitter = struct { if (val_w == 1) { return c.LLVMBuildUIToFP(self.builder, val, param_ty, "ca.uitofp"); } - // Default to SIToFP since most sx integers are signed (s64). + // Default to SIToFP since most sx integers are signed (i64). // Explicit unsigned conversions go through the IR widen/narrow path. return c.LLVMBuildSIToFP(self.builder, val, param_ty, "ca.sitofp"); } @@ -2386,7 +2386,7 @@ pub const LLVMEmitter = struct { /// Resolve the IR type of a foreign-call argument ref. Every FFI arg ref is /// a real function param or block instruction result, so a `null` here is a /// codegen invariant violation, not a recoverable case: return the dedicated - /// `.unresolved` sentinel — never `.void`/`.s64` — so the failure cannot be + /// `.unresolved` sentinel — never `.void`/`.i64` — so the failure cannot be /// mistaken for a real type and trips `toLLVMType`'s hard tripwire at the call /// site instead of silently emitting a void-typed foreign argument. pub fn argIRTypeOrFail(self: *LLVMEmitter, arg_ref: Ref) TypeId { @@ -2397,7 +2397,7 @@ pub const LLVMEmitter = struct { /// argument: boxed inside an `Any` aggregate (extract the value field) vs a /// bare i64 `TypeId` index. The IR-type lookup is must-succeed, so it routes /// through `argIRTypeOrFail`; a failed lookup surfaces as `.unresolved` — - /// never a silent `.s64` that would mis-classify a boxed arg as bare and read + /// never a silent `.i64` that would mis-classify a boxed arg as bare and read /// the wrong value. The caller turns `.unresolved` into a hard tripwire. pub const ReflectArgRepr = enum { boxed, bare, unresolved }; @@ -2938,7 +2938,7 @@ pub fn isFloatOrVecFloat(ty: TypeId, types: *const TypeTable) bool { pub fn isSignedType(ty: TypeId) bool { return switch (ty) { - .s8, .s16, .s32, .s64, .isize => true, + .i8, .i16, .i32, .i64, .isize => true, else => false, }; } @@ -2953,10 +2953,10 @@ fn floatBits(ty: TypeId) u32 { fn intBits(ty: TypeId) u32 { return switch (ty) { - .s8, .u8 => 8, - .s16, .u16 => 16, - .s32, .u32 => 32, - .s64, .u64 => 64, + .i8, .u8 => 8, + .i16, .u16 => 16, + .i32, .u32 => 32, + .i64, .u64 => 64, .bool => 1, .usize, .isize => 0, // target-dependent — caller must query pointer_size else => 64, diff --git a/src/ir/expr_typer.test.zig b/src/ir/expr_typer.test.zig index af4a586..022b639 100644 --- a/src/ir/expr_typer.test.zig +++ b/src/ir/expr_typer.test.zig @@ -28,7 +28,7 @@ test "expr_typer: literal shapes" { var bool_n = node(.{ .bool_literal = .{ .value = true } }); var str_n = node(.{ .string_literal = .{ .raw = "hi" } }); - try std.testing.expectEqual(TypeId.s64, l.inferExprType(&int_n)); + try std.testing.expectEqual(TypeId.i64, l.inferExprType(&int_n)); try std.testing.expectEqual(TypeId.f64, l.inferExprType(&float_n)); try std.testing.expectEqual(TypeId.bool, l.inferExprType(&bool_n)); try std.testing.expectEqual(TypeId.string, l.inferExprType(&str_n)); @@ -47,14 +47,14 @@ test "expr_typer: binary comparison is bool, int arithmetic stays int" { try std.testing.expectEqual(TypeId.bool, l.inferExprType(&cmp)); var add = node(.{ .binary_op = .{ .op = .add, .lhs = &lhs, .rhs = &rhs } }); - try std.testing.expectEqual(TypeId.s64, l.inferExprType(&add)); + try std.testing.expectEqual(TypeId.i64, l.inferExprType(&add)); } // A non-comparison binary op infers the PROMOTED result // of (lhs, rhs), not the LHS alone — so a mixed int+float op types as the float -// in EITHER operand order (was LHS-biased: `int + float` → s64 while +// in EITHER operand order (was LHS-biased: `int + float` → i64 while // `float + int` → f64). This is what feeds the typed-const validation that -// rejected `s64 : 0.5 + M` but not `s64 : M + 0.5`. +// rejected `i64 : 0.5 + M` but not `i64 : M + 0.5`. test "expr_typer: mixed int+float arithmetic promotes to float, order-independent" { const alloc = std.testing.allocator; var module = ir_mod.Module.init(alloc); @@ -64,7 +64,7 @@ test "expr_typer: mixed int+float arithmetic promotes to float, order-independen var int_n = node(.{ .int_literal = .{ .value = 2 } }); var float_n = node(.{ .float_literal = .{ .value = 0.5 } }); - // int LHS, float RHS → f64 (was s64 before the fix). + // int LHS, float RHS → f64 (was i64 before the fix). var add_if = node(.{ .binary_op = .{ .op = .add, .lhs = &int_n, .rhs = &float_n } }); try std.testing.expectEqual(TypeId.f64, l.inferExprType(&add_if)); @@ -81,12 +81,12 @@ test "expr_typer: mixed int+float arithmetic promotes to float, order-independen // `lowerBinaryOp`'s value type and `inferExprType`): an integer LHS with a // floating-point RHS promotes to the float; every other pairing keeps the LHS. test "arithResultType: int×float promotes to float, else takes lhs" { - try std.testing.expectEqual(TypeId.f64, Lowering.arithResultType(.s64, .f64)); + try std.testing.expectEqual(TypeId.f64, Lowering.arithResultType(.i64, .f64)); try std.testing.expectEqual(TypeId.f32, Lowering.arithResultType(.u32, .f32)); - try std.testing.expectEqual(TypeId.f32, Lowering.arithResultType(.s64, .f32)); + try std.testing.expectEqual(TypeId.f32, Lowering.arithResultType(.i64, .f32)); // Non-promoting pairings keep the LHS type. - try std.testing.expectEqual(TypeId.s64, Lowering.arithResultType(.s64, .s64)); - try std.testing.expectEqual(TypeId.f64, Lowering.arithResultType(.f64, .s64)); + try std.testing.expectEqual(TypeId.i64, Lowering.arithResultType(.i64, .i64)); + try std.testing.expectEqual(TypeId.f64, Lowering.arithResultType(.f64, .i64)); try std.testing.expectEqual(TypeId.f32, Lowering.arithResultType(.f32, .f64)); } @@ -133,9 +133,9 @@ test "expr_typer: raw value binding shadows numeric-limit, bare type still folds defer module.deinit(); var l = Lowering.init(&module); - // A struct `Box { epsilon: s64 }` bound to the raw name `` `f64 ``. + // A struct `Box { epsilon: i64 }` bound to the raw name `` `f64 ``. const box_fields = [_]ir_mod.types.TypeInfo.StructInfo.Field{ - .{ .name = module.types.internString("epsilon"), .ty = .s64 }, + .{ .name = module.types.internString("epsilon"), .ty = .i64 }, }; const box_ty = module.types.intern(.{ .@"struct" = .{ .name = module.types.internString("Box"), @@ -148,10 +148,10 @@ test "expr_typer: raw value binding shadows numeric-limit, bare type still folds scope.put("f64", .{ .ref = Ref.none, .ty = box_ty, .is_alloca = false }); // `` `f64.epsilon `` — identifier receiver resolving to the value binding → - // ordinary field read, types as s64 (the field), not f64. + // ordinary field read, types as i64 (the field), not f64. var raw_recv = node(.{ .identifier = .{ .name = "f64", .is_raw = true } }); var raw_fa = node(.{ .field_access = .{ .object = &raw_recv, .field = "epsilon" } }); - try std.testing.expectEqual(TypeId.s64, l.inferExprType(&raw_fa)); + try std.testing.expectEqual(TypeId.i64, l.inferExprType(&raw_fa)); // bare `f64.epsilon` — type_expr receiver, never shadowed → folds to f64. var type_recv = node(.{ .type_expr = .{ .name = "f64" } }); @@ -162,9 +162,9 @@ test "expr_typer: raw value binding shadows numeric-limit, bare type still folds // a raw value binding can shadow a builtin numeric type name through // any of three sources — lexical scope, program globals, or module // value constants. The shared `identifierBindsValue` guard consults all three, -// so a global `` `f32 := Box.{…} `` and a module-const `` `s16 :: Box.{…} `` each +// so a global `` `f32 := Box.{…} `` and a module-const `` `i16 :: Box.{…} `` each // read the value's field (NOT the numeric-limit fold), while a bare `f32.max` / -// `s16.max` (a `.type_expr` receiver) still folds. Pins the guard across the two +// `i16.max` (a `.type_expr` receiver) still folds. Pins the guard across the two // non-lexical sources the attempt-3 scope-only fix missed. test "expr_typer: global and module-const raw bindings shadow numeric-limit" { var arena = std.heap.ArenaAllocator.init(std.testing.allocator); @@ -174,9 +174,9 @@ test "expr_typer: global and module-const raw bindings shadow numeric-limit" { defer module.deinit(); var l = Lowering.init(&module); - // `Box { max: s64 }` — the struct both raw bindings resolve to. + // `Box { max: i64 }` — the struct both raw bindings resolve to. const box_fields = [_]ir_mod.types.TypeInfo.StructInfo.Field{ - .{ .name = module.types.internString("max"), .ty = .s64 }, + .{ .name = module.types.internString("max"), .ty = .i64 }, }; const box_ty = module.types.intern(.{ .@"struct" = .{ .name = module.types.internString("Box"), @@ -185,25 +185,25 @@ test "expr_typer: global and module-const raw bindings shadow numeric-limit" { // GLOBAL raw binding `` `f32 := Box.{…} `` — registered in global_names. try l.program_index.global_names.put("f32", .{ .id = @enumFromInt(0), .ty = box_ty }); - // MODULE-CONST raw binding `` `s16 :: Box.{…} `` — registered in module_const_map. + // MODULE-CONST raw binding `` `i16 :: Box.{…} `` — registered in module_const_map. var const_val = node(.{ .int_literal = .{ .value = 0 } }); - try l.program_index.module_const_map.put("s16", .{ .value = &const_val, .ty = box_ty }); + try l.program_index.module_const_map.put("i16", .{ .value = &const_val, .ty = box_ty }); // The shared guard sees both non-lexical bindings, but not an unbound spelling. try std.testing.expect(l.identifierBindsValue("f32")); - try std.testing.expect(l.identifierBindsValue("s16")); + try std.testing.expect(l.identifierBindsValue("i16")); try std.testing.expect(!l.identifierBindsValue("u8")); - // `` `f32.max `` — global raw receiver → ordinary field read, types as s64 + // `` `f32.max `` — global raw receiver → ordinary field read, types as i64 // (the field), not f32 (the fold). var g_recv = node(.{ .identifier = .{ .name = "f32", .is_raw = true } }); var g_fa = node(.{ .field_access = .{ .object = &g_recv, .field = "max" } }); - try std.testing.expectEqual(TypeId.s64, l.inferExprType(&g_fa)); + try std.testing.expectEqual(TypeId.i64, l.inferExprType(&g_fa)); - // `` `s16.max `` — module-const raw receiver → ordinary field read, types as s64. - var c_recv = node(.{ .identifier = .{ .name = "s16", .is_raw = true } }); + // `` `i16.max `` — module-const raw receiver → ordinary field read, types as i64. + var c_recv = node(.{ .identifier = .{ .name = "i16", .is_raw = true } }); var c_fa = node(.{ .field_access = .{ .object = &c_recv, .field = "max" } }); - try std.testing.expectEqual(TypeId.s64, l.inferExprType(&c_fa)); + try std.testing.expectEqual(TypeId.i64, l.inferExprType(&c_fa)); // bare `f32.max` — type_expr receiver, never shadowed → folds to f32, even // though a global `` `f32 `` value is bound. @@ -211,9 +211,9 @@ test "expr_typer: global and module-const raw bindings shadow numeric-limit" { var bare_f32_fa = node(.{ .field_access = .{ .object = &bare_f32, .field = "max" } }); try std.testing.expectEqual(TypeId.f32, l.inferExprType(&bare_f32_fa)); - // bare `s16.max` — type_expr receiver, never shadowed → folds to the s16 - // type, even though a module-const `` `s16 `` value is bound. - var bare_s16 = node(.{ .type_expr = .{ .name = "s16" } }); - var bare_s16_fa = node(.{ .field_access = .{ .object = &bare_s16, .field = "max" } }); - try std.testing.expectEqual(TypeId.s16, l.inferExprType(&bare_s16_fa)); + // bare `i16.max` — type_expr receiver, never shadowed → folds to the i16 + // type, even though a module-const `` `i16 `` value is bound. + var bare_i16 = node(.{ .type_expr = .{ .name = "i16" } }); + var bare_i16_fa = node(.{ .field_access = .{ .object = &bare_i16, .field = "max" } }); + try std.testing.expectEqual(TypeId.i16, l.inferExprType(&bare_i16_fa)); } diff --git a/src/ir/expr_typer.zig b/src/ir/expr_typer.zig index c1c2451..d8ede4c 100644 --- a/src/ir/expr_typer.zig +++ b/src/ir/expr_typer.zig @@ -34,7 +34,7 @@ pub const ExprTyper = struct { // here is typed by that single owner, not mistyped as `.unresolved`. .call => self.l.inferExprType(node), .string_literal => .string, - .int_literal => .s64, + .int_literal => .i64, .float_literal => .f64, .bool_literal => .bool, .null_literal => .void, @@ -53,7 +53,7 @@ pub const ExprTyper = struct { // of (lhs, rhs), not the LHS alone — `Lowering.arithResultType` // is the same rule `lowerBinaryOp` applies, so `M + 0.5` types // as `f64` regardless of operand order (was LHS-biased: `M + 0.5` - // → s64 while `0.5 + M` → f64). + // → i64 while `0.5 + M` → f64). else => Lowering.arithResultType(self.l.inferExprType(bop.lhs), self.l.inferExprType(bop.rhs)), }, .unary_op => |uop| switch (uop.op) { @@ -125,17 +125,17 @@ pub const ExprTyper = struct { return .void; }, .field_access => |fa| { - // Pack-arity intercept: `.len` is s64. Mirrors + // Pack-arity intercept: `.len` is i64. Mirrors // the lowerFieldAccess intercept so AST-level type // inference picks the same shape. if (self.l.pack_param_count) |ppc| { if (fa.object.data == .identifier and std.mem.eql(u8, fa.field, "len")) { - if (ppc.contains(fa.object.data.identifier.name)) return .s64; + if (ppc.contains(fa.object.data.identifier.name)) return .i64; } } // Struct constant access: `Struct.CONST` — mirrors the // lowerFieldAccess intercept (line 3851). Without this, - // `Phys.GRAVITY` (f64) inferred as s64 and pack-fn + // `Phys.GRAVITY` (f64) inferred as i64 and pack-fn // callers boxed the float into the int slot. if (fa.object.data == .identifier) { const obj_name = fa.object.data.identifier.name; @@ -205,7 +205,7 @@ pub const ExprTyper = struct { obj_ty = opt_info.optional.child; } } - if (std.mem.eql(u8, fa.field, "len")) return if (is_opt_chain) self.l.module.types.optionalOf(.s64) else .s64; + if (std.mem.eql(u8, fa.field, "len")) return if (is_opt_chain) self.l.module.types.optionalOf(.i64) else .i64; if (std.mem.eql(u8, fa.field, "ptr")) { // .ptr on slice/string → [*]element_type const elem_ty = self.l.getElementType(obj_ty); @@ -311,13 +311,13 @@ pub const ExprTyper = struct { return .unresolved; }, .type_expr => |te| { - // type_expr can also be a variable reference (e.g., "s1" matches builtin s1 type) + // type_expr can also be a variable reference (e.g., "i1" matches builtin i1 type) if (self.l.scope) |scope| { if (scope.lookup(te.name)) |binding| { return binding.ty; } } - // A bare type name in expression position (e.g. `s64`, + // A bare type name in expression position (e.g. `i64`, // `Point`, `*u8`) is a Type value — IR type `.any`. if (self.l.isKnownTypeName(te.name)) return .any; return .unresolved; @@ -388,7 +388,7 @@ pub const ExprTyper = struct { // `opt ?? default` — result is the inner type when lhs is // optional (the unwrap path's value), else falls back to // the rhs's type. Without this arm pack-fn callers - // misinferred float-optional coalesces as s64 and the + // misinferred float-optional coalesces as i64 and the // pack mono mangled the arg as int — the actual f64 value // got truncated through Any boxing. const lhs_ty = self.l.inferExprType(nc.lhs); diff --git a/src/ir/ffi_objc.zig b/src/ir/ffi_objc.zig index 808a00a..9912ce6 100644 --- a/src/ir/ffi_objc.zig +++ b/src/ir/ffi_objc.zig @@ -101,7 +101,7 @@ pub const ObjcLowering = struct { /// AFTER stripping `self`. /// /// Single-character encodings (the common case): - /// v=void B=bool c=s8/BOOL s=s16 i=s32 q=s64 + /// v=void B=bool c=i8/BOOL s=i16 i=i32 q=i64 /// C=u8 S=u16 I=u32 Q=u64 f=f32 d=f64 /// @=id #=Class :=SEL *=C string ^v=void* / generic ptr /// @@ -168,7 +168,7 @@ pub const ObjcLowering = struct { }, .f32 => try out.append(self.l.alloc, 'f'), .f64 => try out.append(self.l.alloc, 'd'), - // sx-target arm64 — pointer-sized aliases match s64/u64. + // sx-target arm64 — pointer-sized aliases match i64/u64. .isize => try out.append(self.l.alloc, 'q'), .usize => try out.append(self.l.alloc, 'Q'), .pointer => |p| { @@ -387,7 +387,7 @@ pub const ObjcLowering = struct { break :blk fcd.runtime == .objc_class or fcd.runtime == .objc_protocol; }; - // `weak` requires an object pointer — `weak s32` is meaningless and + // `weak` requires an object pointer — `weak i32` is meaningless and // would invoke objc_storeWeak on a non-object slot. if (has_weak and !is_object_ptr) { if (self.l.diagnostics) |d| { @@ -396,7 +396,7 @@ pub const ObjcLowering = struct { } } - // `copy` requires an object pointer — `copy s32` makes no sense. + // `copy` requires an object pointer — `copy i32` makes no sense. if (has_copy and !is_object_ptr) { if (self.l.diagnostics) |d| { const span = ast.Span{ .start = 0, .end = 0 }; diff --git a/src/ir/generics.test.zig b/src/ir/generics.test.zig index f780ac3..72d869c 100644 --- a/src/ir/generics.test.zig +++ b/src/ir/generics.test.zig @@ -34,7 +34,7 @@ test "generics: mangleTypeName encodes the mono-key fragment per type shape" { // Builtins — the leaf fragments `mangleGenericName` concatenates per // bound type param (`base__...`). - try std.testing.expectEqualStrings("s64", gr.mangleTypeName(.s64)); + try std.testing.expectEqualStrings("i64", gr.mangleTypeName(.i64)); try std.testing.expectEqualStrings("u8", gr.mangleTypeName(.u8)); try std.testing.expectEqualStrings("f32", gr.mangleTypeName(.f32)); try std.testing.expectEqualStrings("bool", gr.mangleTypeName(.bool)); @@ -42,12 +42,12 @@ test "generics: mangleTypeName encodes the mono-key fragment per type shape" { try std.testing.expectEqualStrings("string", gr.mangleTypeName(.string)); // Compound shapes — prefix + recursive inner fragment. - try std.testing.expectEqualStrings("ptr_s64", gr.mangleTypeName(tt.ptrTo(.s64))); - try std.testing.expectEqualStrings("opt_s64", gr.mangleTypeName(tt.optionalOf(.s64))); + try std.testing.expectEqualStrings("ptr_i64", gr.mangleTypeName(tt.ptrTo(.i64))); + try std.testing.expectEqualStrings("opt_i64", gr.mangleTypeName(tt.optionalOf(.i64))); try std.testing.expectEqualStrings("ptr_opt_u8", gr.mangleTypeName(tt.ptrTo(tt.optionalOf(.u8)))); try std.testing.expectEqualStrings("SL_f64", gr.mangleTypeName(tt.intern(.{ .slice = .{ .element = .f64 } }))); try std.testing.expectEqualStrings("mptr_u8", gr.mangleTypeName(tt.intern(.{ .many_pointer = .{ .element = .u8 } }))); - try std.testing.expectEqualStrings("AR_4_s32", gr.mangleTypeName(tt.intern(.{ .array = .{ .element = .s32, .length = 4 } }))); + try std.testing.expectEqualStrings("AR_4_i32", gr.mangleTypeName(tt.intern(.{ .array = .{ .element = .i32, .length = 4 } }))); try std.testing.expectEqualStrings("vec_3_f32", gr.mangleTypeName(tt.intern(.{ .vector = .{ .element = .f32, .length = 3 } }))); // Named aggregate → its declared name. @@ -55,11 +55,11 @@ test "generics: mangleTypeName encodes the mono-key fragment per type shape" { try std.testing.expectEqualStrings("Point", gr.mangleTypeName(pt)); // Tuple: "tu" + "_" per field. - const tup = tt.intern(.{ .tuple = .{ .fields = &[_]TypeId{ .s64, .bool }, .names = null } }); - try std.testing.expectEqualStrings("tu_s64_bool", gr.mangleTypeName(tup)); + const tup = tt.intern(.{ .tuple = .{ .fields = &[_]TypeId{ .i64, .bool }, .names = null } }); + try std.testing.expectEqualStrings("tu_i64_bool", gr.mangleTypeName(tup)); // The `Lowering` wrapper delegates here — same result. - try std.testing.expectEqualStrings("ptr_s64", l.mangleTypeName(tt.ptrTo(.s64))); + try std.testing.expectEqualStrings("ptr_i64", l.mangleTypeName(tt.ptrTo(.i64))); } test "generics: inferGenericReturnType binds explicit type args, resolves return, restores bindings" { @@ -100,8 +100,8 @@ test "generics: inferGenericReturnType binds explicit type args, resolves return } }.f; - const c_s64 = mkCall(alloc, "s64"); - try std.testing.expectEqual(TypeId.s64, gr.inferGenericReturnType(&fd, &c_s64)); + const c_i64 = mkCall(alloc, "i64"); + try std.testing.expectEqual(TypeId.i64, gr.inferGenericReturnType(&fd, &c_i64)); const c_f64 = mkCall(alloc, "f64"); try std.testing.expectEqual(TypeId.f64, gr.inferGenericReturnType(&fd, &c_f64)); @@ -145,14 +145,14 @@ test "generics: buildTypeBindings infers a type param from value args, widest wi } }.f; - // add(1, 2) — both args s64 → T = s64. + // add(1, 2) — both args i64 → T = i64. { const args = [_]*const Node{ intLit(alloc, 1), intLit(alloc, 2) }; var bindings = gr.buildTypeBindings(&fd, &args); defer bindings.deinit(); - try std.testing.expectEqual(TypeId.s64, bindings.get("T").?); + try std.testing.expectEqual(TypeId.i64, bindings.get("T").?); } - // add(1.0, 2) — mixed f64/s64 → widest f64 wins regardless of order. + // add(1.0, 2) — mixed f64/i64 → widest f64 wins regardless of order. { const args = [_]*const Node{ floatLit(alloc, 1.0), intLit(alloc, 2) }; var bindings = gr.buildTypeBindings(&fd, &args); diff --git a/src/ir/generics.zig b/src/ir/generics.zig index 14db86f..d10c47c 100644 --- a/src/ir/generics.zig +++ b/src/ir/generics.zig @@ -28,14 +28,14 @@ pub const GenericResolver = struct { // ── Mono-key construction ─────────────────────────────────────────── - /// Mangle a TypeId into its mono-key fragment ("s64", "ptr_T", "SL_T", + /// Mangle a TypeId into its mono-key fragment ("i64", "ptr_T", "SL_T", /// "AR_n_T", struct name, "tu_X_Y", …). Recursive for compound shapes. pub fn mangleTypeName(self: GenericResolver, ty: TypeId) []const u8 { // Builtin types - if (ty == .s8) return "s8"; - if (ty == .s16) return "s16"; - if (ty == .s32) return "s32"; - if (ty == .s64) return "s64"; + if (ty == .i8) return "i8"; + if (ty == .i16) return "i16"; + if (ty == .i32) return "i32"; + if (ty == .i64) return "i64"; if (ty == .u8) return "u8"; if (ty == .u16) return "u16"; if (ty == .u32) return "u32"; @@ -77,7 +77,7 @@ pub const GenericResolver = struct { const inner = self.mangleTypeName(a.element); break :blk std.fmt.allocPrint(self.l.alloc, "AR_{d}_{s}", .{ a.length, inner }) catch "array"; }, - .signed => |w| std.fmt.allocPrint(self.l.alloc, "s{d}", .{w}) catch "signed", + .signed => |w| std.fmt.allocPrint(self.l.alloc, "i{d}", .{w}) catch "signed", .unsigned => |w| std.fmt.allocPrint(self.l.alloc, "u{d}", .{w}) catch "unsigned", .optional => |o| blk: { const inner = self.mangleTypeName(o.child); @@ -277,10 +277,10 @@ pub const GenericResolver = struct { // empty `tmp_bindings` is a valid input — non-generic literal // return types (e.g. `walk(..$args) -> string`) still need to // resolve through `resolveTypeWithBindings`, not fall through - // to the historical `.s64` default. The default silently + // to the historical `.i64` default. The default silently // misclassified pack-fn calls whose return type was a fixed // literal — every consumer (e.g. print's pack-shape mangling) - // inferred `s64` and routed the value through the wrong Any + // inferred `i64` and routed the value through the wrong Any // tag. var scope = TypeBindingScope.enter(self.l, tmp_bindings); defer scope.exit(); diff --git a/src/ir/inst.test.zig b/src/ir/inst.test.zig index a954312..b25ce82 100644 --- a/src/ir/inst.test.zig +++ b/src/ir/inst.test.zig @@ -19,9 +19,9 @@ test "Ref none sentinel" { test "basic instruction creation" { const inst = Inst{ .op = .{ .add = .{ .lhs = Ref.fromIndex(0), .rhs = Ref.fromIndex(1) } }, - .ty = .s32, + .ty = .i32, }; - try std.testing.expectEqual(types.TypeId.s32, inst.ty); + try std.testing.expectEqual(types.TypeId.i32, inst.ty); switch (inst.op) { .add => |bin| { try std.testing.expectEqual(Ref.fromIndex(0), bin.lhs); @@ -38,11 +38,11 @@ test "block creation" { block.insts.append(alloc, .{ .op = .{ .const_int = 42 }, - .ty = .s64, + .ty = .i64, }) catch unreachable; block.insts.append(alloc, .{ .op = .{ .ret = .{ .operand = Ref.fromIndex(0) } }, - .ty = .s64, + .ty = .i64, }) catch unreachable; try std.testing.expectEqual(@as(usize, 2), block.insts.items.len); @@ -51,12 +51,12 @@ test "block creation" { test "function creation" { const alloc = std.testing.allocator; const params = &[_]Function.Param{ - .{ .name = @enumFromInt(1), .ty = .s32 }, - .{ .name = @enumFromInt(2), .ty = .s32 }, + .{ .name = @enumFromInt(1), .ty = .i32 }, + .{ .name = @enumFromInt(2), .ty = .i32 }, }; - var func = Function.init(@enumFromInt(3), params, .s64); + var func = Function.init(@enumFromInt(3), params, .i64); defer func.deinit(alloc); - try std.testing.expectEqual(types.TypeId.s64, func.ret); + try std.testing.expectEqual(types.TypeId.i64, func.ret); try std.testing.expectEqual(@as(usize, 2), func.params.len); } diff --git a/src/ir/inst.zig b/src/ir/inst.zig index f3e85d8..4f96291 100644 --- a/src/ir/inst.zig +++ b/src/ir/inst.zig @@ -150,8 +150,8 @@ pub const Op = union(enum) { bool_not: UnaryOp, // ── Conversions ───────────────────────────────────────────────── - widen: Conversion, // safe widening (s32 → s64) - narrow: Conversion, // truncation via `xx` (s64 → s32) + widen: Conversion, // safe widening (i32 → i64) + narrow: Conversion, // truncation via `xx` (i64 → i32) bitcast: Conversion, // reinterpret bits int_to_float: Conversion, float_to_int: Conversion, @@ -282,7 +282,7 @@ pub const Store = struct { val: Ref, /// Declared type of the value being stored. Threaded through so the /// interp's raw-pointer store knows the destination byte width — a - /// `.int` Value alone is ambiguous (s8/s16/s32/s64/u*/usize/pointer + /// `.int` Value alone is ambiguous (i8/i16/i32/i64/u*/usize/pointer /// all flatten to `.int`). The LLVM emitter ignores this (LLVM knows /// the width from the SSA value's type already). val_ty: TypeId = .void, @@ -502,8 +502,8 @@ pub const Function = struct { /// IR with this set — sx-side `..T` params are slice-packed before /// lowering, so anything that survives is the C calling convention's /// `...`. emit_llvm passes `is_var_arg=1` to `LLVMFunctionType`; call - /// sites apply the standard default argument promotions (s8/s16/bool → - /// s32, f32 → f64) to extras past the fixed param count. + /// sites apply the standard default argument promotions (i8/i16/bool → + /// i32, f32 → f64) to extras past the fixed param count. is_variadic: bool = false, /// True if `params[0]` is the synthetic `__sx_ctx: *Context` /// parameter that every default-conv sx function receives. Callers diff --git a/src/ir/interp.test.zig b/src/ir/interp.test.zig index f27bfe6..3623a9a 100644 --- a/src/ir/interp.test.zig +++ b/src/ir/interp.test.zig @@ -34,15 +34,15 @@ test "interpret: compute(5) = 25" { var b = Builder.init(&module); - // func compute(x: s64) -> s64 { return x * x; } - const params = &[_]Function.Param{.{ .name = str(&module, "compute"), .ty = .s64 }}; - _ = b.beginFunction(str(&module, "compute"), params, .s64); + // func compute(x: i64) -> i64 { return x * x; } + const params = &[_]Function.Param{.{ .name = str(&module, "compute"), .ty = .i64 }}; + _ = b.beginFunction(str(&module, "compute"), params, .i64); const entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry); const x_ref = Ref.fromIndex(0); - const result = b.mul(x_ref, x_ref, .s64); - b.ret(result, .s64); + const result = b.mul(x_ref, x_ref, .i64); + b.ret(result, .i64); b.finalize(); var interp = Interpreter.init(&module, alloc); @@ -61,8 +61,8 @@ test "interpret: if/else branching" { var b = Builder.init(&module); - const params = &[_]Function.Param{.{ .name = str(&module, "x"), .ty = .s64 }}; - _ = b.beginFunction(str(&module, "abs"), params, .s64); + const params = &[_]Function.Param{.{ .name = str(&module, "x"), .ty = .i64 }}; + _ = b.beginFunction(str(&module, "abs"), params, .i64); const entry = b.appendBlock(str(&module, "entry"), &.{}); const then_bb = b.appendBlock(str(&module, "then"), &.{}); @@ -70,16 +70,16 @@ test "interpret: if/else branching" { b.switchToBlock(entry); const x = Ref.fromIndex(0); - const zero = b.constInt(0, .s64); + const zero = b.constInt(0, .i64); const is_neg = b.cmpLt(x, zero); b.condBr(is_neg, then_bb, &.{}, else_bb, &.{}); b.switchToBlock(then_bb); - const neg_x = b.emit(.{ .neg = .{ .operand = x } }, .s64); - b.ret(neg_x, .s64); + const neg_x = b.emit(.{ .neg = .{ .operand = x } }, .i64); + b.ret(neg_x, .i64); b.switchToBlock(else_bb); - b.ret(x, .s64); + b.ret(x, .i64); b.finalize(); var interp = Interpreter.init(&module, alloc); @@ -101,30 +101,30 @@ test "interpret: function calling another function" { var b = Builder.init(&module); - // func square(x: s64) -> s64 { return x * x; } - const params_sq = &[_]Function.Param{.{ .name = str(&module, "x"), .ty = .s64 }}; - _ = b.beginFunction(str(&module, "square"), params_sq, .s64); + // func square(x: i64) -> i64 { return x * x; } + const params_sq = &[_]Function.Param{.{ .name = str(&module, "x"), .ty = .i64 }}; + _ = b.beginFunction(str(&module, "square"), params_sq, .i64); const entry1 = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry1); const x = Ref.fromIndex(0); - const sq = b.mul(x, x, .s64); - b.ret(sq, .s64); + const sq = b.mul(x, x, .i64); + b.ret(sq, .i64); b.finalize(); - // func sum_of_squares(a, b) -> s64 { return square(a) + square(b); } + // func sum_of_squares(a, b) -> i64 { return square(a) + square(b); } const params_ss = &[_]Function.Param{ - .{ .name = str(&module, "a"), .ty = .s64 }, - .{ .name = str(&module, "b"), .ty = .s64 }, + .{ .name = str(&module, "a"), .ty = .i64 }, + .{ .name = str(&module, "b"), .ty = .i64 }, }; - _ = b.beginFunction(str(&module, "sum_of_squares"), params_ss, .s64); + _ = b.beginFunction(str(&module, "sum_of_squares"), params_ss, .i64); const entry2 = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry2); const a = Ref.fromIndex(0); const b_param = Ref.fromIndex(1); - const sq_a = b.call(FuncId.fromIndex(0), &.{a}, .s64); - const sq_b = b.call(FuncId.fromIndex(0), &.{b_param}, .s64); - const sum = b.add(sq_a, sq_b, .s64); - b.ret(sum, .s64); + const sq_a = b.call(FuncId.fromIndex(0), &.{a}, .i64); + const sq_b = b.call(FuncId.fromIndex(0), &.{b_param}, .i64); + const sum = b.add(sq_a, sq_b, .i64); + b.ret(sum, .i64); b.finalize(); var interp = Interpreter.init(&module, alloc); @@ -143,19 +143,19 @@ test "interpret: alloca/store/load" { var b = Builder.init(&module); - _ = b.beginFunction(str(&module, "test"), &.{}, .s64); + _ = b.beginFunction(str(&module, "test"), &.{}, .i64); const entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry); - const slot = b.alloca(.s64); - const ten = b.constInt(10, .s64); + const slot = b.alloca(.i64); + const ten = b.constInt(10, .i64); b.store(slot, ten); - const loaded = b.load(slot, .s64); - const five = b.constInt(5, .s64); - const sum = b.add(loaded, five, .s64); + const loaded = b.load(slot, .i64); + const five = b.constInt(5, .i64); + const sum = b.add(loaded, five, .i64); b.store(slot, sum); - const result = b.load(slot, .s64); - b.ret(result, .s64); + const result = b.load(slot, .i64); + b.ret(result, .i64); b.finalize(); var interp = Interpreter.init(&module, alloc); @@ -168,7 +168,7 @@ test "interpret: alloca/store/load" { // ── Comptime parity tests ─────────────────────────────────────────────── // ── Test: while loop (sumOf10 from 15-while.sx) ───────────────────────── -// sumOf10 :: () -> s32 { i:=1; s:=0; while i<=10 { s+=i; i+=1; } s; } +// sumOf10 :: () -> i32 { i:=1; s:=0; while i<=10 { s+=i; i+=1; } s; } // Expected: 55 test "comptime: while loop — sumOf10 = 55" { @@ -179,7 +179,7 @@ test "comptime: while loop — sumOf10 = 55" { defer module.deinit(); var b = Builder.init(&module); - _ = b.beginFunction(str(&module, "sumOf10"), &.{}, .s64); + _ = b.beginFunction(str(&module, "sumOf10"), &.{}, .i64); const entry = b.appendBlock(str(&module, "entry"), &.{}); const hdr = b.appendBlock(str(&module, "while.hdr"), &.{}); @@ -188,37 +188,37 @@ test "comptime: while loop — sumOf10 = 55" { // entry: i=1, s=0, br while.hdr b.switchToBlock(entry); - const i_slot = b.alloca(.s64); - const one = b.constInt(1, .s64); + const i_slot = b.alloca(.i64); + const one = b.constInt(1, .i64); b.store(i_slot, one); - const s_slot = b.alloca(.s64); - const zero = b.constInt(0, .s64); + const s_slot = b.alloca(.i64); + const zero = b.constInt(0, .i64); b.store(s_slot, zero); b.br(hdr, &.{}); // while.hdr: if i <= 10 → body, else → exit b.switchToBlock(hdr); - const i_load = b.load(i_slot, .s64); - const ten = b.constInt(10, .s64); + const i_load = b.load(i_slot, .i64); + const ten = b.constInt(10, .i64); const cond = b.emit(.{ .cmp_le = .{ .lhs = i_load, .rhs = ten } }, .bool); b.condBr(cond, body, &.{}, exit, &.{}); // while.body: s += i; i += 1; br while.hdr b.switchToBlock(body); - const s_load = b.load(s_slot, .s64); - const i_load2 = b.load(i_slot, .s64); - const s_new = b.add(s_load, i_load2, .s64); + const s_load = b.load(s_slot, .i64); + const i_load2 = b.load(i_slot, .i64); + const s_new = b.add(s_load, i_load2, .i64); b.store(s_slot, s_new); - const i_load3 = b.load(i_slot, .s64); - const one2 = b.constInt(1, .s64); - const i_new = b.add(i_load3, one2, .s64); + const i_load3 = b.load(i_slot, .i64); + const one2 = b.constInt(1, .i64); + const i_new = b.add(i_load3, one2, .i64); b.store(i_slot, i_new); b.br(hdr, &.{}); // while.exit: return s b.switchToBlock(exit); - const s_final = b.load(s_slot, .s64); - b.ret(s_final, .s64); + const s_final = b.load(s_slot, .i64); + b.ret(s_final, .i64); b.finalize(); var interp = Interpreter.init(&module, alloc); @@ -228,7 +228,7 @@ test "comptime: while loop — sumOf10 = 55" { } // ── Test: optional coalesce (ct_sum from 32-optionals.sx) ──────────────── -// ct_sum :: () -> s32 { x:?s32=42; y:?s32=null; return (x??0)+(y??99); } +// ct_sum :: () -> i32 { x:?i32=42; y:?i32=null; return (x??0)+(y??99); } // Expected: 42 + 99 = 141 test "comptime: optional coalesce — ct_sum = 141" { @@ -239,33 +239,33 @@ test "comptime: optional coalesce — ct_sum = 141" { defer module.deinit(); var b = Builder.init(&module); - _ = b.beginFunction(str(&module, "ct_sum"), &.{}, .s64); + _ = b.beginFunction(str(&module, "ct_sum"), &.{}, .i64); const entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry); - // x: ?s32 = 42 → alloca, store 42 - const x_slot = b.alloca(.s64); - const forty_two = b.constInt(42, .s64); + // x: ?i32 = 42 → alloca, store 42 + const x_slot = b.alloca(.i64); + const forty_two = b.constInt(42, .i64); b.store(x_slot, forty_two); - // y: ?s32 = null → alloca, store null - const y_slot = b.alloca(.s64); - const null_val = b.constNull(.s64); + // y: ?i32 = null → alloca, store null + const y_slot = b.alloca(.i64); + const null_val = b.constNull(.i64); b.store(y_slot, null_val); // (x ?? 0) - const x_load = b.load(x_slot, .s64); - const zero = b.constInt(0, .s64); - const x_coalesced = b.emit(.{ .optional_coalesce = .{ .lhs = x_load, .rhs = zero } }, .s64); + const x_load = b.load(x_slot, .i64); + const zero = b.constInt(0, .i64); + const x_coalesced = b.emit(.{ .optional_coalesce = .{ .lhs = x_load, .rhs = zero } }, .i64); // (y ?? 99) - const y_load = b.load(y_slot, .s64); - const ninety_nine = b.constInt(99, .s64); - const y_coalesced = b.emit(.{ .optional_coalesce = .{ .lhs = y_load, .rhs = ninety_nine } }, .s64); + const y_load = b.load(y_slot, .i64); + const ninety_nine = b.constInt(99, .i64); + const y_coalesced = b.emit(.{ .optional_coalesce = .{ .lhs = y_load, .rhs = ninety_nine } }, .i64); // return x_coalesced + y_coalesced - const sum = b.add(x_coalesced, y_coalesced, .s64); - b.ret(sum, .s64); + const sum = b.add(x_coalesced, y_coalesced, .i64); + b.ret(sum, .i64); b.finalize(); var interp = Interpreter.init(&module, alloc); @@ -275,7 +275,7 @@ test "comptime: optional coalesce — ct_sum = 141" { } // ── Test: optional unwrap (ct_opt_unwrap from 50-smoke.sx) ─────────────── -// ct_opt_unwrap :: () -> s32 { x:?s32 = 77; return x!; } +// ct_opt_unwrap :: () -> i32 { x:?i32 = 77; return x!; } // Expected: 77 test "comptime: optional unwrap — 77" { @@ -286,17 +286,17 @@ test "comptime: optional unwrap — 77" { defer module.deinit(); var b = Builder.init(&module); - _ = b.beginFunction(str(&module, "ct_opt_unwrap"), &.{}, .s64); + _ = b.beginFunction(str(&module, "ct_opt_unwrap"), &.{}, .i64); const entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry); - const slot = b.alloca(.s64); - const val77 = b.constInt(77, .s64); + const slot = b.alloca(.i64); + const val77 = b.constInt(77, .i64); b.store(slot, val77); - const loaded = b.load(slot, .s64); - const unwrapped = b.optionalUnwrap(loaded, .s64); - b.ret(unwrapped, .s64); + const loaded = b.load(slot, .i64); + const unwrapped = b.optionalUnwrap(loaded, .i64); + b.ret(unwrapped, .i64); b.finalize(); var interp = Interpreter.init(&module, alloc); @@ -306,7 +306,7 @@ test "comptime: optional unwrap — 77" { } // ── Test: recursive fibonacci ──────────────────────────────────────────── -// fib :: (n: s64) -> s64 { if n <= 1 return n; return fib(n-1) + fib(n-2); } +// fib :: (n: i64) -> i64 { if n <= 1 return n; return fib(n-1) + fib(n-2); } // Expected: fib(10) = 55 test "comptime: recursive fibonacci — fib(10) = 55" { @@ -317,8 +317,8 @@ test "comptime: recursive fibonacci — fib(10) = 55" { defer module.deinit(); var b = Builder.init(&module); - const params = &[_]Function.Param{.{ .name = str(&module, "n"), .ty = .s64 }}; - _ = b.beginFunction(str(&module, "fib"), params, .s64); + const params = &[_]Function.Param{.{ .name = str(&module, "n"), .ty = .i64 }}; + _ = b.beginFunction(str(&module, "fib"), params, .i64); const entry = b.appendBlock(str(&module, "entry"), &.{}); const base_bb = b.appendBlock(str(&module, "base"), &.{}); @@ -327,23 +327,23 @@ test "comptime: recursive fibonacci — fib(10) = 55" { // entry: if n <= 1 → base, else → recurse b.switchToBlock(entry); const n = Ref.fromIndex(0); - const one = b.constInt(1, .s64); + const one = b.constInt(1, .i64); const is_base = b.emit(.{ .cmp_le = .{ .lhs = n, .rhs = one } }, .bool); b.condBr(is_base, base_bb, &.{}, rec_bb, &.{}); // base: return n b.switchToBlock(base_bb); - b.ret(n, .s64); + b.ret(n, .i64); // recurse: return fib(n-1) + fib(n-2) b.switchToBlock(rec_bb); - const n_minus_1 = b.sub(n, one, .s64); - const two = b.constInt(2, .s64); - const n_minus_2 = b.sub(n, two, .s64); - const fib1 = b.call(FuncId.fromIndex(0), &.{n_minus_1}, .s64); - const fib2 = b.call(FuncId.fromIndex(0), &.{n_minus_2}, .s64); - const sum = b.add(fib1, fib2, .s64); - b.ret(sum, .s64); + const n_minus_1 = b.sub(n, one, .i64); + const two = b.constInt(2, .i64); + const n_minus_2 = b.sub(n, two, .i64); + const fib1 = b.call(FuncId.fromIndex(0), &.{n_minus_1}, .i64); + const fib2 = b.call(FuncId.fromIndex(0), &.{n_minus_2}, .i64); + const sum = b.add(fib1, fib2, .i64); + b.ret(sum, .i64); b.finalize(); var interp = Interpreter.init(&module, alloc); @@ -353,7 +353,7 @@ test "comptime: recursive fibonacci — fib(10) = 55" { } // ── Test: compute(5) = 7 (from 05-run.sx) ────────────────────────────── -// compute :: (v: s32) -> s32 => v + 2; +// compute :: (v: i32) -> i32 => v + 2; // Expected: compute(5) = 7 test "comptime: compute(5) = 7" { @@ -364,15 +364,15 @@ test "comptime: compute(5) = 7" { defer module.deinit(); var b = Builder.init(&module); - const params = &[_]Function.Param{.{ .name = str(&module, "v"), .ty = .s64 }}; - _ = b.beginFunction(str(&module, "compute"), params, .s64); + const params = &[_]Function.Param{.{ .name = str(&module, "v"), .ty = .i64 }}; + _ = b.beginFunction(str(&module, "compute"), params, .i64); const entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry); const v = Ref.fromIndex(0); - const two = b.constInt(2, .s64); - const result = b.add(v, two, .s64); - b.ret(result, .s64); + const two = b.constInt(2, .i64); + const result = b.add(v, two, .i64); + b.ret(result, .i64); b.finalize(); var interp = Interpreter.init(&module, alloc); @@ -382,7 +382,7 @@ test "comptime: compute(5) = 7" { } // ── Test: chained comptime (CT_CHAIN from 50-smoke.sx) ─────────────────── -// add :: (a: s32, b: s32) -> s32 => a + b; +// add :: (a: i32, b: i32) -> i32 => a + b; // CT_VAL :: #run add(10, 15); → 25 // CT_CHAIN :: #run add(CT_VAL, 5); → 30 // Simulates calling add(25, 5) to verify chaining works. @@ -395,18 +395,18 @@ test "comptime: chained — add(add(10,15), 5) = 30" { defer module.deinit(); var b = Builder.init(&module); - // func add(a, b) -> s64 { return a + b; } + // func add(a, b) -> i64 { return a + b; } const params = &[_]Function.Param{ - .{ .name = str(&module, "a"), .ty = .s64 }, - .{ .name = str(&module, "b"), .ty = .s64 }, + .{ .name = str(&module, "a"), .ty = .i64 }, + .{ .name = str(&module, "b"), .ty = .i64 }, }; - _ = b.beginFunction(str(&module, "add"), params, .s64); + _ = b.beginFunction(str(&module, "add"), params, .i64); const entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry); const a = Ref.fromIndex(0); const b_ref = Ref.fromIndex(1); - const sum = b.add(a, b_ref, .s64); - b.ret(sum, .s64); + const sum = b.add(a, b_ref, .i64); + b.ret(sum, .i64); b.finalize(); var interp = Interpreter.init(&module, alloc); @@ -433,20 +433,20 @@ test "comptime: struct init and field access — 7" { defer module.deinit(); var b = Builder.init(&module); - _ = b.beginFunction(str(&module, "test_struct"), &.{}, .s64); + _ = b.beginFunction(str(&module, "test_struct"), &.{}, .i64); const entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry); // Point{x: 3, y: 4} - const three = b.constInt(3, .s64); - const four = b.constInt(4, .s64); - const point = b.structInit(&.{ three, four }, .s64); + const three = b.constInt(3, .i64); + const four = b.constInt(4, .i64); + const point = b.structInit(&.{ three, four }, .i64); // p.x + p.y - const px = b.structGet(point, 0, .s64); - const py = b.structGet(point, 1, .s64); - const sum = b.add(px, py, .s64); - b.ret(sum, .s64); + const px = b.structGet(point, 0, .i64); + const py = b.structGet(point, 1, .i64); + const sum = b.add(px, py, .i64); + b.ret(sum, .i64); b.finalize(); var interp = Interpreter.init(&module, alloc); @@ -538,14 +538,14 @@ test "comptime: negation — int and float" { defer module.deinit(); var b = Builder.init(&module); - // func neg_int(x: s64) -> s64 { return -x; } - const params = &[_]Function.Param{.{ .name = str(&module, "x"), .ty = .s64 }}; - _ = b.beginFunction(str(&module, "neg_int"), params, .s64); + // func neg_int(x: i64) -> i64 { return -x; } + const params = &[_]Function.Param{.{ .name = str(&module, "x"), .ty = .i64 }}; + _ = b.beginFunction(str(&module, "neg_int"), params, .i64); const entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry); const x = Ref.fromIndex(0); - const neg = b.emit(.{ .neg = .{ .operand = x } }, .s64); - b.ret(neg, .s64); + const neg = b.emit(.{ .neg = .{ .operand = x } }, .i64); + b.ret(neg, .i64); b.finalize(); var interp = Interpreter.init(&module, alloc); @@ -564,14 +564,14 @@ test "comptime: modulo — 17 mod 5 = 2" { defer module.deinit(); var b = Builder.init(&module); - _ = b.beginFunction(str(&module, "test_mod"), &.{}, .s64); + _ = b.beginFunction(str(&module, "test_mod"), &.{}, .i64); const entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry); - const seventeen = b.constInt(17, .s64); - const five = b.constInt(5, .s64); - const result = b.emit(.{ .mod = .{ .lhs = seventeen, .rhs = five } }, .s64); - b.ret(result, .s64); + const seventeen = b.constInt(17, .i64); + const five = b.constInt(5, .i64); + const result = b.emit(.{ .mod = .{ .lhs = seventeen, .rhs = five } }, .i64); + b.ret(result, .i64); b.finalize(); var interp = Interpreter.init(&module, alloc); @@ -591,8 +591,8 @@ test "comptime: switch_br dispatch" { defer module.deinit(); var b = Builder.init(&module); - const params = &[_]Function.Param{.{ .name = str(&module, "tag"), .ty = .s64 }}; - _ = b.beginFunction(str(&module, "dispatch"), params, .s64); + const params = &[_]Function.Param{.{ .name = str(&module, "tag"), .ty = .i64 }}; + _ = b.beginFunction(str(&module, "dispatch"), params, .i64); const entry = b.appendBlock(str(&module, "entry"), &.{}); const case0 = b.appendBlock(str(&module, "case0"), &.{}); @@ -607,16 +607,16 @@ test "comptime: switch_br dispatch" { }, default, &.{}); b.switchToBlock(case0); - const ten = b.constInt(10, .s64); - b.ret(ten, .s64); + const ten = b.constInt(10, .i64); + b.ret(ten, .i64); b.switchToBlock(case1); - const twenty = b.constInt(20, .s64); - b.ret(twenty, .s64); + const twenty = b.constInt(20, .i64); + b.ret(twenty, .i64); b.switchToBlock(default); - const thirty = b.constInt(30, .s64); - b.ret(thirty, .s64); + const thirty = b.constInt(30, .i64); + b.ret(thirty, .i64); b.finalize(); var interp = Interpreter.init(&module, alloc); @@ -642,14 +642,14 @@ test "comptime: enum init and tag" { defer module.deinit(); var b = Builder.init(&module); - _ = b.beginFunction(str(&module, "test_enum"), &.{}, .s64); + _ = b.beginFunction(str(&module, "test_enum"), &.{}, .i64); const entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry); // Create enum with tag=2, no payload - const e = b.enumInit(2, Ref.none, .s64); - const tag = b.emit(.{ .enum_tag = .{ .operand = e } }, .s64); - b.ret(tag, .s64); + const e = b.enumInit(2, Ref.none, .i64); + const tag = b.emit(.{ .enum_tag = .{ .operand = e } }, .i64); + b.ret(tag, .i64); b.finalize(); var interp = Interpreter.init(&module, alloc); @@ -668,14 +668,14 @@ test "comptime: widen/narrow passthrough" { defer module.deinit(); var b = Builder.init(&module); - _ = b.beginFunction(str(&module, "test_conv"), &.{}, .s64); + _ = b.beginFunction(str(&module, "test_conv"), &.{}, .i64); const entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry); - const val = b.constInt(42, .s32); - const widened = b.emit(.{ .widen = .{ .operand = val, .from = .s32, .to = .s64 } }, .s64); - const narrowed = b.emit(.{ .narrow = .{ .operand = widened, .from = .s64, .to = .s32 } }, .s32); - b.ret(narrowed, .s32); + const val = b.constInt(42, .i32); + const widened = b.emit(.{ .widen = .{ .operand = val, .from = .i32, .to = .i64 } }, .i64); + const narrowed = b.emit(.{ .narrow = .{ .operand = widened, .from = .i64, .to = .i32 } }, .i32); + b.ret(narrowed, .i32); b.finalize(); var interp = Interpreter.init(&module, alloc); @@ -694,13 +694,13 @@ test "comptime: const_type yields type_tag" { defer module.deinit(); var b = Builder.init(&module); - // Build a fn that returns `s64` as a Type-typed Any value (matches + // Build a fn that returns `i64` as a Type-typed Any value (matches // the .any IR type assigned by `constType`). The interp returns the // raw Value; we assert on the variant. _ = b.beginFunction(str(&module, "test_type_tag"), &.{}, .any); const entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry); - const t = b.constType(.s64); + const t = b.constType(.i64); b.ret(t, .any); b.finalize(); @@ -711,7 +711,7 @@ test "comptime: const_type yields type_tag" { // The Value MUST be a .type_tag, not an .int — proves the variant // is honestly distinguished. asTypeId returns the inner TypeId; // asInt MUST return null (no coercion). - try std.testing.expectEqual(@as(?TypeId, .s64), result.asTypeId()); + try std.testing.expectEqual(@as(?TypeId, .i64), result.asTypeId()); try std.testing.expectEqual(@as(?i64, null), result.asInt()); } @@ -725,23 +725,23 @@ test "comptime: type_tag comparison" { defer module.deinit(); var b = Builder.init(&module); - // Returns (s64 == s64) — should yield bool true via the new + // Returns (i64 == i64) — should yield bool true via the new // evalCmp arm for .type_tag operands. _ = b.beginFunction(str(&module, "test_type_eq_true"), &.{}, .bool); const entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry); - const a = b.constType(.s64); - const c = b.constType(.s64); + const a = b.constType(.i64); + const c = b.constType(.i64); const eq = b.cmpEq(a, c); b.ret(eq, .bool); b.finalize(); - // Different TypeIds: (s64 == s32) should be false. + // Different TypeIds: (i64 == i32) should be false. _ = b.beginFunction(str(&module, "test_type_eq_false"), &.{}, .bool); const entry2 = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry2); - const a2 = b.constType(.s64); - const c2 = b.constType(.s32); + const a2 = b.constType(.i64); + const c2 = b.constType(.i32); const eq2 = b.cmpEq(a2, c2); b.ret(eq2, .bool); b.finalize(); @@ -767,7 +767,7 @@ test "comptime: type_name builtin on type_tag" { _ = b.beginFunction(str(&module, "test_type_name"), &.{}, .string); const entry = b.appendBlock(str(&module, "entry"), &.{}); b.switchToBlock(entry); - const t = b.constType(.s64); + const t = b.constType(.i64); var args = [_]inst_mod.Ref{t}; const r = b.callBuiltin(.type_name, &args, .string); b.ret(r, .string); @@ -776,7 +776,7 @@ test "comptime: type_name builtin on type_tag" { var interp = Interpreter.init(&module, alloc); defer interp.deinit(); const result = try interp.call(FuncId.fromIndex(0), &.{}); - try std.testing.expectEqualStrings("s64", result.asString(&interp).?); + try std.testing.expectEqualStrings("i64", result.asString(&interp).?); } // ── Test: type_eq builtin on two .type_tag operands ──────────────────── @@ -809,7 +809,7 @@ test "comptime: type_eq builtin on type_tag values" { // A reflection builtin on an Any must report the type OF a held value (the // tag) and only read the payload when the Any holds a Type value (tag == // `.any`). Regression: a boxed value like -// `av : Any = 6` (`{ tag = s64, value = 6 }`) must resolve to `s64`, NOT +// `av : Any = 6` (`{ tag = i64, value = 6 }`) must resolve to `i64`, NOT // `types[6]` (`u8`). test "reflect: reflectTypeId branches on the Any tag" { const any_idx: i64 = @intCast(TypeId.any.index()); @@ -817,10 +817,10 @@ test "reflect: reflectTypeId branches on the Any tag" { // Native first-class Type value → the held TypeId directly. try std.testing.expectEqual(@as(?TypeId, .u64), (Value{ .type_tag = .u64 }).reflectTypeId()); - // Any holding a VALUE: `{ tag = s64, value = 6 }` → s64 (the tag), + // Any holding a VALUE: `{ tag = i64, value = 6 }` → i64 (the tag), // never `types[6]` (u8). This is the bug the fix closes. - var held_value = [_]Value{ .{ .int = @intCast(TypeId.s64.index()) }, .{ .int = 6 } }; - try std.testing.expectEqual(@as(?TypeId, .s64), (Value{ .aggregate = &held_value }).reflectTypeId()); + var held_value = [_]Value{ .{ .int = @intCast(TypeId.i64.index()) }, .{ .int = 6 } }; + try std.testing.expectEqual(@as(?TypeId, .i64), (Value{ .aggregate = &held_value }).reflectTypeId()); // Any holding a VALUE of an unsigned type: `{ tag = u32, value = 7 }` → u32. var held_u32 = [_]Value{ .{ .int = @intCast(TypeId.u32.index()) }, .{ .int = 7 } }; diff --git a/src/ir/interp.zig b/src/ir/interp.zig index 20325a1..bf060a7 100644 --- a/src/ir/interp.zig +++ b/src/ir/interp.zig @@ -98,7 +98,7 @@ pub const Value = union(enum) { /// box carries a *Type value* (the `box_any(.., .any)` / `const_type` /// shape) → the TypeId is the payload; otherwise the box carries a /// *runtime value* whose type IS the tag → the tag is the TypeId. This - /// makes `type_name(av)` for `av : Any = 6` report `s64` (the held + /// makes `type_name(av)` for `av : Any = 6` report `i64` (the held /// value's type) while `type_name(type_of(x))` still names the type. /// Returns null when `self` is neither shape (the caller bails loudly). pub fn reflectTypeId(self: Value) ?TypeId { @@ -266,7 +266,7 @@ pub const Interpreter = struct { const width = self.module.types.typeSizeBytes(val_ty); switch (val) { .int => |v| { - // Width is whatever the declared IR type says (s8..s64, + // Width is whatever the declared IR type says (i8..i64, // u8..u64, usize, pointer-as-int, bool-after-extension). // The Value tag itself is .int regardless. if (width == 0 or width > 8) return bailDetail("comptime store of int through raw pointer: unexpected declared width (expected 1..8 bytes)"); @@ -535,7 +535,7 @@ pub const Interpreter = struct { } return .void_val; } - if (ret == .s8 or ret == .s16 or ret == .s32 or ret == .s64 or + if (ret == .i8 or ret == .i16 or ret == .i32 or ret == .i64 or ret == .u8 or ret == .u16 or ret == .u32 or ret == .u64 or ret == .usize or ret == .isize) { @@ -1913,7 +1913,7 @@ pub const Interpreter = struct { // Any-boxed Type (`{ .any, tid }`), or an Any holding a // runtime value (`{ tag, value }`, where the tag IS the // value's type). `reflectTypeId` reads the runtime tag so - // `type_name(av)` for `av : Any = 6` names `s64`, not the + // `type_name(av)` for `av : Any = 6` names `i64`, not the // type whose index equals the payload. const tid = arg.reflectTypeId() orelse return bailDetail("comptime type_name: argument is not a Type value or boxed value (expected `.type_tag` or Any aggregate)"); @@ -1939,7 +1939,7 @@ pub const Interpreter = struct { // (`{ tag, value }`, where the tag IS the value's type). // `reflectTypeId` reads the runtime tag so // `type_is_unsigned(av)` for `av : Any = 6` answers about - // `s64`, not the type whose index equals the payload. + // `i64`, not the type whose index equals the payload. const tid = arg.reflectTypeId() orelse return bailDetail("comptime type_is_unsigned: argument is not a Type value or boxed value (expected `.type_tag` or Any aggregate)"); return .{ .value = .{ .boolean = self.module.types.isUnsignedInt(tid) } }; diff --git a/src/ir/jni_descriptor.test.zig b/src/ir/jni_descriptor.test.zig index 13c8551..b265764 100644 --- a/src/ir/jni_descriptor.test.zig +++ b/src/ir/jni_descriptor.test.zig @@ -51,12 +51,12 @@ fn expectType(name: []const u8, expected: []const u8) !void { test "primitive descriptors" { try expectType("void", "V"); try expectType("bool", "Z"); - try expectType("s8", "B"); + try expectType("i8", "B"); try expectType("u8", "B"); - try expectType("s16", "S"); + try expectType("i16", "S"); try expectType("u16", "C"); - try expectType("s32", "I"); - try expectType("s64", "J"); + try expectType("i32", "I"); + try expectType("i64", "J"); try expectType("f32", "F"); try expectType("f64", "D"); } @@ -105,8 +105,8 @@ test "slice of primitive is array descriptor" { defer arena.deinit(); const aa = arena.allocator(); - const s32 = try makeTypeExpr(aa, "s32"); - const slice = try makeSlice(aa, s32); + const i32_te = try makeTypeExpr(aa, "i32"); + const slice = try makeSlice(aa, i32_te); var buf: std.ArrayList(u8) = .empty; defer buf.deinit(a); @@ -181,11 +181,11 @@ test "deriveMethod respects #jni_method_descriptor override verbatim" { defer arena.deinit(); const aa = arena.allocator(); - // The actual sx signature `(self: *Self) -> s32` would derive to + // The actual sx signature `(self: *Self) -> i32` would derive to // `()I`. The override should win regardless. const self_te = try makeTypeExpr(aa, "Self"); const self_ptr = try makePointer(aa, self_te); - const ret = try makeTypeExpr(aa, "s32"); + const ret = try makeTypeExpr(aa, "i32"); const method: ast.ForeignMethodDecl = .{ .name = "weirdMethod", @@ -266,10 +266,10 @@ test "deriveMethod skips implicit self for instance methods" { defer arena.deinit(); const aa = arena.allocator(); - // method: getId :: (self: *Self) -> s32 → ()I + // method: getId :: (self: *Self) -> i32 → ()I const self_te = try makeTypeExpr(aa, "Self"); const self_ptr = try makePointer(aa, self_te); - const ret = try makeTypeExpr(aa, "s32"); + const ret = try makeTypeExpr(aa, "i32"); const method: ast.ForeignMethodDecl = .{ .name = "getId", @@ -289,9 +289,9 @@ test "deriveMethod for static method emits all params" { defer arena.deinit(); const aa = arena.allocator(); - // static abs :: (n: s32) -> s32 → (I)I - const n_ty = try makeTypeExpr(aa, "s32"); - const ret = try makeTypeExpr(aa, "s32"); + // static abs :: (n: i32) -> i32 → (I)I + const n_ty = try makeTypeExpr(aa, "i32"); + const ret = try makeTypeExpr(aa, "i32"); const method: ast.ForeignMethodDecl = .{ .name = "abs", @@ -311,10 +311,10 @@ test "deriveMethod with multiple primitive params and void return" { defer arena.deinit(); const aa = arena.allocator(); - // setBounds :: (self: *Self, x: s32, y: s32, w: s32, h: s32) -> void → (IIII)V + // setBounds :: (self: *Self, x: i32, y: i32, w: i32, h: i32) -> void → (IIII)V const self_te = try makeTypeExpr(aa, "Self"); const self_ptr = try makePointer(aa, self_te); - const s = try makeTypeExpr(aa, "s32"); + const s = try makeTypeExpr(aa, "i32"); const method: ast.ForeignMethodDecl = .{ .name = "setBounds", @@ -334,12 +334,12 @@ test "deriveMethod with slice param" { defer arena.deinit(); const aa = arena.allocator(); - // copy :: (self: *Self, src: []s8) -> s32 → ([B)I + // copy :: (self: *Self, src: []i8) -> i32 → ([B)I const self_te = try makeTypeExpr(aa, "Self"); const self_ptr = try makePointer(aa, self_te); - const s8 = try makeTypeExpr(aa, "s8"); - const src_slice = try makeSlice(aa, s8); - const ret = try makeTypeExpr(aa, "s32"); + const i8_te = try makeTypeExpr(aa, "i8"); + const src_slice = try makeSlice(aa, i8_te); + const ret = try makeTypeExpr(aa, "i32"); const method: ast.ForeignMethodDecl = .{ .name = "copy", @@ -380,13 +380,13 @@ test "isJniReturnTypeSupported accepts the dispatchable set + pointers only" { const t = &table; // The CallMethod-dispatchable primitives. - inline for (.{ types.TypeId.void, types.TypeId.bool, types.TypeId.s32, types.TypeId.s64, types.TypeId.f32, types.TypeId.f64 }) |ty| { + inline for (.{ types.TypeId.void, types.TypeId.bool, types.TypeId.i32, types.TypeId.i64, types.TypeId.f32, types.TypeId.f64 }) |ty| { try std.testing.expect(desc.isJniReturnTypeSupported(t, ty)); } // Other primitive widths are NOT dispatchable (would hit emit_llvm's // undef-producing `else` arm — the footgun this predicate guards). - inline for (.{ types.TypeId.s8, types.TypeId.s16, types.TypeId.u8, types.TypeId.u32, types.TypeId.u64 }) |ty| { + inline for (.{ types.TypeId.i8, types.TypeId.i16, types.TypeId.u8, types.TypeId.u32, types.TypeId.u64 }) |ty| { try std.testing.expect(!desc.isJniReturnTypeSupported(t, ty)); } diff --git a/src/ir/jni_descriptor.zig b/src/ir/jni_descriptor.zig index 4dd2a80..42e652f 100644 --- a/src/ir/jni_descriptor.zig +++ b/src/ir/jni_descriptor.zig @@ -6,10 +6,10 @@ // // void → V // bool → Z (jboolean) -// s8 → B (jbyte) -// s16 → S (jshort) -// s32 → I (jint) -// s64 → J (jlong) +// i8 → B (jbyte) +// i16 → S (jshort) +// i32 → I (jint) +// i64 → J (jlong) // u8 → B (jbyte — JNI bytes are signed; sx u8 still bridges via B) // u16 → C (jchar — unsigned 16-bit) // f32 → F (jfloat) @@ -137,12 +137,12 @@ fn primitiveChar(name: []const u8) ?u8 { const table = [_]struct { name: []const u8, ch: u8 }{ .{ .name = "void", .ch = 'V' }, .{ .name = "bool", .ch = 'Z' }, - .{ .name = "s8", .ch = 'B' }, + .{ .name = "i8", .ch = 'B' }, .{ .name = "u8", .ch = 'B' }, - .{ .name = "s16", .ch = 'S' }, + .{ .name = "i16", .ch = 'S' }, .{ .name = "u16", .ch = 'C' }, - .{ .name = "s32", .ch = 'I' }, - .{ .name = "s64", .ch = 'J' }, + .{ .name = "i32", .ch = 'I' }, + .{ .name = "i64", .ch = 'J' }, .{ .name = "f32", .ch = 'F' }, .{ .name = "f64", .ch = 'D' }, }; @@ -160,7 +160,7 @@ fn primitiveChar(name: []const u8) ?u8 { /// Pointer-typed returns route through `CallObjectMethod`. pub fn isJniReturnTypeSupported(table: *const types.TypeTable, ret_ty: TypeId) bool { return switch (ret_ty) { - .void, .bool, .s32, .s64, .f32, .f64 => true, + .void, .bool, .i32, .i64, .f32, .f64 => true, else => blk: { if (ret_ty.isBuiltin()) break :blk false; const info = table.get(ret_ty); diff --git a/src/ir/jni_java_emit.test.zig b/src/ir/jni_java_emit.test.zig index 86a1d80..f912f50 100644 --- a/src/ir/jni_java_emit.test.zig +++ b/src/ir/jni_java_emit.test.zig @@ -276,7 +276,7 @@ test "field declarations render as private Java fields" { const aa = arena.allocator(); const surface_view_ty = try makePointer(aa, try makeTypeExpr(aa, "SurfaceView")); - const int_ty = try makeTypeExpr(aa, "s32"); + const int_ty = try makeTypeExpr(aa, "i32"); const self_ty = try makePointer(aa, try makeTypeExpr(aa, "Self")); const body = try makeBodyMarker(aa); diff --git a/src/ir/jni_java_emit.zig b/src/ir/jni_java_emit.zig index e270878..487b198 100644 --- a/src/ir/jni_java_emit.zig +++ b/src/ir/jni_java_emit.zig @@ -20,7 +20,7 @@ // to bind the `sx_` symbols. // // Type matrix covered today: -// - void return + primitive returns (s8/s16/s32/s64, u8/u16, bool, +// - void return + primitive returns (i8/i16/i32/i64, u8/u16, bool, // f32/f64) // - `(self: *Self)` plus primitive params // - cross-class refs (`*Foo` where Foo is another declared @@ -341,12 +341,12 @@ fn emitJavaType( fn javaPrimitiveName(name: []const u8) ?[]const u8 { if (std.mem.eql(u8, name, "void")) return "void"; if (std.mem.eql(u8, name, "bool")) return "boolean"; - if (std.mem.eql(u8, name, "s8")) return "byte"; + if (std.mem.eql(u8, name, "i8")) return "byte"; if (std.mem.eql(u8, name, "u8")) return "byte"; - if (std.mem.eql(u8, name, "s16")) return "short"; + if (std.mem.eql(u8, name, "i16")) return "short"; if (std.mem.eql(u8, name, "u16")) return "char"; - if (std.mem.eql(u8, name, "s32")) return "int"; - if (std.mem.eql(u8, name, "s64")) return "long"; + if (std.mem.eql(u8, name, "i32")) return "int"; + if (std.mem.eql(u8, name, "i64")) return "long"; if (std.mem.eql(u8, name, "f32")) return "float"; if (std.mem.eql(u8, name, "f64")) return "double"; return null; diff --git a/src/ir/lower.test.zig b/src/ir/lower.test.zig index d387a57..3da44bc 100644 --- a/src/ir/lower.test.zig +++ b/src/ir/lower.test.zig @@ -18,13 +18,13 @@ test "lower: simple function with arithmetic" { var module = ir_mod.Module.init(alloc); defer module.deinit(); - // Build a minimal AST: add :: (a: s64, b: s64) -> s64 { return a + b; } + // Build a minimal AST: add :: (a: i64, b: i64) -> i64 { return a + b; } const a_type = alloc.create(Node) catch unreachable; - a_type.* = .{ .span = .{ .start = 0, .end = 0 }, .data = .{ .type_expr = .{ .name = "s64", .is_generic = false } } }; + a_type.* = .{ .span = .{ .start = 0, .end = 0 }, .data = .{ .type_expr = .{ .name = "i64", .is_generic = false } } }; const b_type = alloc.create(Node) catch unreachable; - b_type.* = .{ .span = .{ .start = 0, .end = 0 }, .data = .{ .type_expr = .{ .name = "s64", .is_generic = false } } }; + b_type.* = .{ .span = .{ .start = 0, .end = 0 }, .data = .{ .type_expr = .{ .name = "i64", .is_generic = false } } }; const ret_type = alloc.create(Node) catch unreachable; - ret_type.* = .{ .span = .{ .start = 0, .end = 0 }, .data = .{ .type_expr = .{ .name = "s64", .is_generic = false } } }; + ret_type.* = .{ .span = .{ .start = 0, .end = 0 }, .data = .{ .type_expr = .{ .name = "i64", .is_generic = false } } }; const a_ident = alloc.create(Node) catch unreachable; a_ident.* = .{ .span = .{ .start = 0, .end = 0 }, .data = .{ .identifier = .{ .name = "a" } } }; @@ -73,7 +73,7 @@ test "lower: simple function with arithmetic" { try std.testing.expectEqual(@as(usize, 1), module.functions.items.len); const func = module.getFunction(FuncId.fromIndex(0)); try std.testing.expectEqual(@as(usize, 2), func.params.len); - try std.testing.expectEqual(TypeId.s64, func.ret); + try std.testing.expectEqual(TypeId.i64, func.ret); try std.testing.expect(func.blocks.items.len > 0); // Print the IR to verify it looks reasonable @@ -94,15 +94,15 @@ test "lower: instructions carry their AST node's source span (ERR E3.0)" { var module = ir_mod.Module.init(alloc); defer module.deinit(); - // probe :: (a: s64, b: s64) -> s64 { return a + b; } — the `a + b` node + // probe :: (a: i64, b: i64) -> i64 { return a + b; } — the `a + b` node // gets a distinctive span so we can find the emitted `add` instruction and // assert it was stamped (not left at the empty {0,0} default). const a_type = alloc.create(Node) catch unreachable; - a_type.* = .{ .span = .{ .start = 0, .end = 0 }, .data = .{ .type_expr = .{ .name = "s64", .is_generic = false } } }; + a_type.* = .{ .span = .{ .start = 0, .end = 0 }, .data = .{ .type_expr = .{ .name = "i64", .is_generic = false } } }; const b_type = alloc.create(Node) catch unreachable; - b_type.* = .{ .span = .{ .start = 0, .end = 0 }, .data = .{ .type_expr = .{ .name = "s64", .is_generic = false } } }; + b_type.* = .{ .span = .{ .start = 0, .end = 0 }, .data = .{ .type_expr = .{ .name = "i64", .is_generic = false } } }; const ret_type = alloc.create(Node) catch unreachable; - ret_type.* = .{ .span = .{ .start = 0, .end = 0 }, .data = .{ .type_expr = .{ .name = "s64", .is_generic = false } } }; + ret_type.* = .{ .span = .{ .start = 0, .end = 0 }, .data = .{ .type_expr = .{ .name = "i64", .is_generic = false } } }; const a_ident = alloc.create(Node) catch unreachable; a_ident.* = .{ .span = .{ .start = 0, .end = 0 }, .data = .{ .identifier = .{ .name = "a" } } }; const b_ident = alloc.create(Node) catch unreachable; @@ -154,7 +154,7 @@ test "lower: if/else generates basic blocks" { var module = ir_mod.Module.init(alloc); defer module.deinit(); - // Build AST: test :: (c: bool) -> s64 { if c { return 1; } else { return 2; } } + // Build AST: test :: (c: bool) -> i64 { if c { return 1; } else { return 2; } } // The condition must be a runtime value (a param) — a constant `if true` // is folded by lowering to a single block, defeating the branch test. const cond_node = alloc.create(Node) catch unreachable; @@ -204,7 +204,7 @@ test "lower: if/else generates basic blocks" { const ret_type = alloc.create(Node) catch unreachable; defer alloc.destroy(ret_type); - ret_type.* = .{ .span = .{ .start = 0, .end = 0 }, .data = .{ .type_expr = .{ .name = "s64", .is_generic = false } } }; + ret_type.* = .{ .span = .{ .start = 0, .end = 0 }, .data = .{ .type_expr = .{ .name = "i64", .is_generic = false } } }; const fn_decl = ast.FnDecl{ .name = "test_if", @@ -303,18 +303,18 @@ test "lower: objcTypeEncodingFromSignature emits primitive shapes" { defer alloc.free(e1); try std.testing.expectEqualStrings("v@:", e1); - // Returns s32, takes s32: -(int)add:(int)x → "i@:i" - const e2 = try lowering.objc().objcTypeEncodingFromSignature(.s32, &.{.s32}, null); + // Returns i32, takes i32: -(int)add:(int)x → "i@:i" + const e2 = try lowering.objc().objcTypeEncodingFromSignature(.i32, &.{.i32}, null); defer alloc.free(e2); try std.testing.expectEqualStrings("i@:i", e2); - // s64 return, two s64 args: "q@:qq" - const e3 = try lowering.objc().objcTypeEncodingFromSignature(.s64, &.{ .s64, .s64 }, null); + // i64 return, two i64 args: "q@:qq" + const e3 = try lowering.objc().objcTypeEncodingFromSignature(.i64, &.{ .i64, .i64 }, null); defer alloc.free(e3); try std.testing.expectEqualStrings("q@:qq", e3); - // BOOL return (s8): "c@:" - const e4 = try lowering.objc().objcTypeEncodingFromSignature(.s8, &.{}, null); + // BOOL return (i8): "c@:" + const e4 = try lowering.objc().objcTypeEncodingFromSignature(.i8, &.{}, null); defer alloc.free(e4); try std.testing.expectEqualStrings("c@:", e4); @@ -357,9 +357,9 @@ test "lower: objcTypeEncodingFromSignature emits pointer shapes" { defer alloc.free(e2); try std.testing.expectEqualStrings("v@:*", e2); - // `[*]s32` (non-u8 many-pointer) → `^v`. - const s32_many = module.types.intern(.{ .many_pointer = .{ .element = .s32 } }); - const e3 = try lowering.objc().objcTypeEncodingFromSignature(.void, &.{s32_many}, null); + // `[*]i32` (non-u8 many-pointer) → `^v`. + const i32_many = module.types.intern(.{ .many_pointer = .{ .element = .i32 } }); + const e3 = try lowering.objc().objcTypeEncodingFromSignature(.void, &.{i32_many}, null); defer alloc.free(e3); try std.testing.expectEqualStrings("v@:^v", e3); } @@ -371,14 +371,14 @@ test "lower: objcDefinedStateStructType collects user-declared fields" { defer module.deinit(); var lowering = Lowering.init(&module); - // Synthesize a #objc_class("SxFoo") { counter: s32; ticks: s64; } AST. + // Synthesize a #objc_class("SxFoo") { counter: i32; ticks: i64; } AST. const span = ast.Span{ .start = 0, .end = 0 }; const counter_type = try alloc.create(Node); defer alloc.destroy(counter_type); - counter_type.* = .{ .span = span, .data = .{ .type_expr = .{ .name = "s32", .is_generic = false } } }; + counter_type.* = .{ .span = span, .data = .{ .type_expr = .{ .name = "i32", .is_generic = false } } }; const ticks_type = try alloc.create(Node); defer alloc.destroy(ticks_type); - ticks_type.* = .{ .span = span, .data = .{ .type_expr = .{ .name = "s64", .is_generic = false } } }; + ticks_type.* = .{ .span = span, .data = .{ .type_expr = .{ .name = "i64", .is_generic = false } } }; const members = [_]ast.ForeignClassMember{ .{ .field = .{ .name = "counter", .field_type = counter_type } }, @@ -401,9 +401,9 @@ test "lower: objcDefinedStateStructType collects user-declared fields" { try std.testing.expectEqualStrings("__SxFooState", module.types.getString(s.name)); try std.testing.expectEqual(@as(usize, 2), s.fields.len); try std.testing.expectEqualStrings("counter", module.types.getString(s.fields[0].name)); - try std.testing.expectEqual(TypeId.s32, s.fields[0].ty); + try std.testing.expectEqual(TypeId.i32, s.fields[0].ty); try std.testing.expectEqualStrings("ticks", module.types.getString(s.fields[1].name)); - try std.testing.expectEqual(TypeId.s64, s.fields[1].ty); + try std.testing.expectEqual(TypeId.i64, s.fields[1].ty); // Idempotency: a second call returns the same TypeId (cache hit on name). const state_ty2 = lowering.objc().objcDefinedStateStructType(&fcd); @@ -441,7 +441,7 @@ test "lower: objcDefinedStateStructType skips non-field members" { const span = ast.Span{ .start = 0, .end = 0 }; const counter_type = try alloc.create(Node); defer alloc.destroy(counter_type); - counter_type.* = .{ .span = span, .data = .{ .type_expr = .{ .name = "s32", .is_generic = false } } }; + counter_type.* = .{ .span = span, .data = .{ .type_expr = .{ .name = "i32", .is_generic = false } } }; const members = [_]ast.ForeignClassMember{ .{ .extends = "NSObject" }, @@ -519,10 +519,10 @@ test "lower: objcTypeEncodingFromSignature unwraps optional to wire type" { }; try lowering.program_index.foreign_class_map.put("NSString", &ns_fcd); - // `?s64 -> ?*NSString` collapses to `q -> @` at the Obj-C boundary. - const opt_s64 = module.types.optionalOf(.s64); + // `?i64 -> ?*NSString` collapses to `q -> @` at the Obj-C boundary. + const opt_i64 = module.types.optionalOf(.i64); const opt_ns = module.types.optionalOf(ns_ptr); - const e1 = try lowering.objc().objcTypeEncodingFromSignature(opt_ns, &.{opt_s64}, null); + const e1 = try lowering.objc().objcTypeEncodingFromSignature(opt_ns, &.{opt_i64}, null); defer alloc.free(e1); try std.testing.expectEqualStrings("@@:q", e1); @@ -571,7 +571,7 @@ test "lower: objcTypeEncodingFromSignature emits structs as {Name=fields...}" { .{ .name = len_name, .ty = .u64 }, }; const nsrange = module.types.intern(.{ .@"struct" = .{ .name = nsrange_name, .fields = &nsrange_fields } }); - const e3 = try lowering.objc().objcTypeEncodingFromSignature(nsrange, &.{ nsrange, .s64 }, null); + const e3 = try lowering.objc().objcTypeEncodingFromSignature(nsrange, &.{ nsrange, .i64 }, null); defer alloc.free(e3); try std.testing.expectEqualStrings("{_NSRange=QQ}@:{_NSRange=QQ}q", e3); } @@ -712,7 +712,7 @@ test "lower: isObjcClassPointer recognises pointer-to-foreign-Obj-C-class" { // *void and a builtin scalar → false (not object pointers). try std.testing.expect(!lowering.objc().isObjcClassPointer(module.types.ptrTo(.void))); - try std.testing.expect(!lowering.objc().isObjcClassPointer(.s32)); + try std.testing.expect(!lowering.objc().isObjcClassPointer(.i32)); } test "lower: objcPropertyKind defaults + explicit ARC modifiers" { @@ -737,7 +737,7 @@ test "lower: objcPropertyKind defaults + explicit ARC modifiers" { try lowering.program_index.foreign_class_map.put("NSString", &ns_fcd); // Primitive field, no modifiers → assign (the non-object default). - const prim = ast.ForeignFieldDecl{ .name = "count", .field_type = typeKeyword(alloc, "s32"), .is_property = true }; + const prim = ast.ForeignFieldDecl{ .name = "count", .field_type = typeKeyword(alloc, "i32"), .is_property = true }; defer alloc.destroy(prim.field_type); try std.testing.expect(lowering.objc().objcPropertyKind(prim) == .assign); @@ -982,11 +982,11 @@ test "E1.4c noreturn typing: divergence shapes + if-else unification + block pro defer alloc.destroy(lit); const then_div = mk.node(alloc, .{ .if_expr = .{ .condition = lit, .then_branch = ret, .else_branch = lit, .is_inline = false } }); defer alloc.destroy(then_div); - try std.testing.expectEqual(TypeId.s64, lowering.inferExprType(then_div)); // then diverges → else (s64) + try std.testing.expectEqual(TypeId.i64, lowering.inferExprType(then_div)); // then diverges → else (i64) const else_div = mk.node(alloc, .{ .if_expr = .{ .condition = lit, .then_branch = lit, .else_branch = ret, .is_inline = false } }); defer alloc.destroy(else_div); - try std.testing.expectEqual(TypeId.s64, lowering.inferExprType(else_div)); // then is s64 + try std.testing.expectEqual(TypeId.i64, lowering.inferExprType(else_div)); // then is i64 const both_div = mk.node(alloc, .{ .if_expr = .{ .condition = lit, .then_branch = ret, .else_branch = brk, .is_inline = false } }); defer alloc.destroy(both_div); @@ -1059,13 +1059,13 @@ test "conversions: optionalOfFlattened wraps once, flattening a nested optional" defer module.deinit(); var l = Lowering.init(&module); - const opt_s64 = module.types.optionalOf(.s64); + const opt_i64 = module.types.optionalOf(.i64); // Wrap a non-optional: T -> ?T. - try std.testing.expectEqual(opt_s64, l.optionalOfFlattened(.s64)); + try std.testing.expectEqual(opt_i64, l.optionalOfFlattened(.i64)); // Wrap an already-optional FLATTENS: ?T -> ?T (the coercion never builds ??T). - try std.testing.expectEqual(opt_s64, l.optionalOfFlattened(opt_s64)); + try std.testing.expectEqual(opt_i64, l.optionalOfFlattened(opt_i64)); // Contrast: the plain wrap does NOT flatten — ?T -> ??T (distinct type). - try std.testing.expect(module.types.optionalOf(opt_s64) != opt_s64); + try std.testing.expect(module.types.optionalOf(opt_i64) != opt_i64); } @@ -1100,9 +1100,9 @@ test "lower: assigning to a missing struct field emits field-not-found, no panic var diags = errors.DiagnosticList.init(alloc, "", "test.sx"); defer diags.deinit(); - // Register `Point :: struct { x: s64; }` so the struct literal resolves. + // Register `Point :: struct { x: i64; }` so the struct literal resolves. const fields = [_]ir_mod.types.TypeInfo.StructInfo.Field{ - .{ .name = module.types.internString("x"), .ty = .s64 }, + .{ .name = module.types.internString("x"), .ty = .i64 }, }; _ = module.types.intern(.{ .@"struct" = .{ .name = module.types.internString("Point"), .fields = &fields } }); @@ -1145,9 +1145,9 @@ test "lower: multi-assign to a missing struct field emits field-not-found, no co var diags = errors.DiagnosticList.init(alloc, "", "test.sx"); defer diags.deinit(); - // Register `Point :: struct { x: s64; }` so the struct literal resolves. + // Register `Point :: struct { x: i64; }` so the struct literal resolves. const fields = [_]ir_mod.types.TypeInfo.StructInfo.Field{ - .{ .name = module.types.internString("x"), .ty = .s64 }, + .{ .name = module.types.internString("x"), .ty = .i64 }, }; _ = module.types.intern(.{ .@"struct" = .{ .name = module.types.internString("Point"), .fields = &fields } }); @@ -1198,23 +1198,23 @@ test "lower: shared resolver types a pointer-typed field GEP as *field_ty, not f const span = ast.Span{ .start = 0, .end = 0 }; - // Register `S :: struct { p: *s64; }` — the field's own type is a pointer. - const ptr_s64 = module.types.ptrTo(.s64); + // Register `S :: struct { p: *i64; }` — the field's own type is a pointer. + const ptr_i64 = module.types.ptrTo(.i64); const fields = [_]ir_mod.types.TypeInfo.StructInfo.Field{ - .{ .name = module.types.internString("p"), .ty = ptr_s64 }, + .{ .name = module.types.internString("p"), .ty = ptr_i64 }, }; _ = module.types.intern(.{ .@"struct" = .{ .name = module.types.internString("S"), .fields = &fields } }); - // mutate :: (s: *S, q: *s64) { d := 0; s.p, d = q, 1; } + // mutate :: (s: *S, q: *i64) { d := 0; s.p, d = q, 1; } // The multi-assign target routes `s.p` through the shared fieldLvaluePtr // resolver. Pre-fix that resolver typed the field GEP with the bare field - // value type (`*s64`), so emitStore unwrapped one level to `s64` and + // value type (`*i64`), so emitStore unwrapped one level to `i64` and // coerceArg's closure auto-promotion stored a 16-byte struct over the // 8-byte field, clobbering the neighbour. The resolver now types the GEP - // `*(*s64)` so emitStore stops at the field's own pointer type. + // `*(*i64)` so emitStore stops at the field's own pointer type. var s_pointee = Node{ .span = span, .data = .{ .type_expr = .{ .name = "S", .is_generic = false } } }; var s_ty = Node{ .span = span, .data = .{ .pointer_type_expr = .{ .pointee_type = &s_pointee } } }; - var q_pointee = Node{ .span = span, .data = .{ .type_expr = .{ .name = "s64", .is_generic = false } } }; + var q_pointee = Node{ .span = span, .data = .{ .type_expr = .{ .name = "i64", .is_generic = false } } }; var q_ty = Node{ .span = span, .data = .{ .pointer_type_expr = .{ .pointee_type = &q_pointee } } }; var d_init = Node{ .span = span, .data = .{ .int_literal = .{ .value = 0 } } }; @@ -1240,8 +1240,8 @@ test "lower: shared resolver types a pointer-typed field GEP as *field_ty, not f var lowering = Lowering.init(&module); lowering.lowerFunction(&fd, "mutate", false); - // The field-store GEP must be typed `*(*s64)`: its pointee is the field's - // own type (`*s64`), not the field's pointee (`s64`). + // The field-store GEP must be typed `*(*i64)`: its pointee is the field's + // own type (`*i64`), not the field's pointee (`i64`). const func = module.getFunction(FuncId.fromIndex(0)); var found = false; for (func.blocks.items) |blk| { @@ -1249,7 +1249,7 @@ test "lower: shared resolver types a pointer-typed field GEP as *field_ty, not f if (inst.op == .struct_gep) { const info = module.types.get(inst.ty); try std.testing.expect(info == .pointer); - try std.testing.expectEqual(ptr_s64, info.pointer.pointee); + try std.testing.expectEqual(ptr_i64, info.pointer.pointee); found = true; } } @@ -1264,7 +1264,7 @@ test "lower: reflectionArgIsType accepts spelled types, rejects plain values (is var l = Lowering.init(&module); const span = ast.Span{ .start = 0, .end = 0 }; - const ty_node = Node{ .span = span, .data = .{ .type_expr = .{ .name = "s64", .is_generic = false } } }; + const ty_node = Node{ .span = span, .data = .{ .type_expr = .{ .name = "i64", .is_generic = false } } }; const int_node = Node{ .span = span, .data = .{ .int_literal = .{ .value = 6 } } }; const float_node = Node{ .span = span, .data = .{ .float_literal = .{ .value = 1.5 } } }; const bool_node = Node{ .span = span, .data = .{ .bool_literal = .{ .value = true } } }; @@ -1320,12 +1320,12 @@ test "lower: shadowed same-name author gets its own FuncId + real body (fix-0102 var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); - try tmp.dir.writeFile(io, .{ .sub_path = "a.sx", .data = "greet :: () -> s64 { 1 }\nuse_greet :: () -> s64 { greet() }\n" }); - try tmp.dir.writeFile(io, .{ .sub_path = "b.sx", .data = "greet :: () -> s64 { 2 }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "a.sx", .data = "greet :: () -> i64 { 1 }\nuse_greet :: () -> i64 { greet() }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "b.sx", .data = "greet :: () -> i64 { 2 }\n" }); const main_src = \\#import "a.sx"; \\#import "b.sx"; - \\main :: () -> s64 { use_greet() } + \\main :: () -> i64 { use_greet() } \\ ; try tmp.dir.writeFile(io, .{ .sub_path = "main.sx", .data = main_src }); @@ -1487,7 +1487,7 @@ test "lower: scan populates source-keyed caches per declaring source (E0)" { const main_src = \\na :: #import "a.sx"; \\nb :: #import "b.sx"; - \\main :: () -> s32 { 0 } + \\main :: () -> i32 { 0 } \\ ; try tmp.dir.writeFile(io, .{ .sub_path = "main.sx", .data = main_src }); diff --git a/src/ir/lower.zig b/src/ir/lower.zig index 492e7b0..fefa9aa 100644 --- a/src/ir/lower.zig +++ b/src/ir/lower.zig @@ -556,7 +556,7 @@ pub const Lowering = struct { return self.resolveTypeWithBindings(rt); } // No explicit annotation — the type is inferred from the body, which - // references the function's own parameters (`(x: s32) => x * 2`). Those + // references the function's own parameters (`(x: i32) => x * 2`). Those // params aren't pushed into `self.scope` until body lowering, so bind // them into a temporary scope here; otherwise `inferExprType` can't // resolve `x`, the inference yields `.unresolved`, and that reaches LLVM @@ -806,7 +806,7 @@ pub const Lowering = struct { // trampoline bodies (`(*void, $args[0]) -> $args[1]`) in stdlib's // generic Into(Block) impl. OOB indices / a missing binding emit a // diagnostic and return the `.unresolved` sentinel — never a plausible - // `.s64`, which would silently fabricate an 8-byte int. + // `.i64`, which would silently fabricate an 8-byte int. if (node.data == .pack_index_type_expr) { const pi = node.data.pack_index_type_expr; if (self.pack_arg_types) |pat| { @@ -933,7 +933,7 @@ pub const Lowering = struct { }, .identifier => |id| return self.resolveNominalLeaf(id.name, id.is_raw, node.span), // A non-spread tuple literal in a type position is a tuple-type - // literal (`(s32, s32)`); validate its elements are types and reject + // literal (`(i32, i32)`); validate its elements are types and reject // non-type elements loudly. .tuple_literal => return self.resolveTupleLiteralTypeArg(node), else => return type_bridge.resolveAstType(node, &self.module.types, &self.program_index.type_alias_map, &self.program_index.module_const_map), @@ -1117,7 +1117,7 @@ pub const Lowering = struct { /// Get the element type for a slice/array/string type. A non-collection /// type has no element type — return `.unresolved` (asking for it is a bug) - /// rather than a plausible `.s64`. + /// rather than a plausible `.i64`. pub fn getElementType(self: *Lowering, ty: TypeId) TypeId { if (ty == .string) return .u8; if (ty.isBuiltin()) return .unresolved; @@ -1154,7 +1154,7 @@ pub const Lowering = struct { /// value path (`lowerBinaryOp`) and AST-level inference /// (`ExprTyper.inferType`'s binary-op arm), so static typing reports /// exactly the type the lowered value carries. An integer LHS with a - /// floating-point RHS promotes to the float (`s64 + f64` → `f64`); every + /// floating-point RHS promotes to the float (`i64 + f64` → `f64`); every /// other pairing — including vectors / structs, whose `isInt` is false — /// takes the LHS type. Comparison / logical ops never reach here (they /// are `.bool` at both sites). @@ -1165,7 +1165,7 @@ pub const Lowering = struct { fn isInt(ty: TypeId) bool { return switch (ty) { - .s8, .s16, .s32, .s64, .u8, .u16, .u32, .u64, .usize, .isize => true, + .i8, .i16, .i32, .i64, .u8, .u16, .u32, .u64, .usize, .isize => true, else => false, }; } @@ -1293,15 +1293,15 @@ pub const Lowering = struct { var width: u8 = 0; var is_signed = false; switch (ty) { - .s8 => { + .i8 => { width = 8; is_signed = true; }, - .s16 => { + .i16 => { width = 16; is_signed = true; }, - .s32 => { + .i32 => { width = 32; is_signed = true; }, @@ -1309,7 +1309,7 @@ pub const Lowering = struct { .u16 => width = 16, .u32 => width = 32, else => { - if (ty.isBuiltin()) return null; // s64/u64/isize/usize/non-int + if (ty.isBuiltin()) return null; // i64/u64/isize/usize/non-int switch (self.module.types.get(ty)) { .signed => |w| { width = w; @@ -1343,7 +1343,7 @@ pub const Lowering = struct { const tn = blk: { if (ty.isBuiltin()) break :blk self.module.types.typeName(ty); break :blk switch (self.module.types.get(ty)) { - .signed => |w| std.fmt.bufPrint(&name_buf, "s{d}", .{w}) catch "integer", + .signed => |w| std.fmt.bufPrint(&name_buf, "i{d}", .{w}) catch "integer", .unsigned => |w| std.fmt.bufPrint(&name_buf, "u{d}", .{w}) catch "integer", else => self.module.types.typeName(ty), }; @@ -1449,10 +1449,10 @@ pub const Lowering = struct { fn typeBits(ty: TypeId) u32 { return switch (ty) { .bool => 1, - .s8, .u8 => 8, - .s16, .u16 => 16, - .s32, .u32 => 32, - .s64, .u64 => 64, + .i8, .u8 => 8, + .i16, .u16 => 16, + .i32, .u32 => 32, + .i64, .u64 => 64, .usize, .isize => 0, // target-dependent — use typeBitsEx .f32 => 32, .f64 => 64, diff --git a/src/ir/lower/call.zig b/src/ir/lower/call.zig index ea45666..5311d97 100644 --- a/src/ir/lower/call.zig +++ b/src/ir/lower/call.zig @@ -29,7 +29,7 @@ const hasComptimeParams = Lowering.hasComptimeParams; pub fn lowerCall(self: *Lowering, c_in: *const ast.Call) Ref { var c = c_in; // A bare reserved-type-name spelling in call position parses as a - // `.type_expr` (e.g. `s2(4)`), but if a function of that name is in + // `.type_expr` (e.g. `i2(4)`), but if a function of that name is in // scope — a backtick-declared sx fn or a `#import c` foreign fn whose C // name collides with a reserved type spelling — it is a CALL to that // function. `TypeName(val)` is not a cast (casts are `cast(T, val)`), so @@ -411,7 +411,7 @@ pub fn lowerCall(self: *Lowering, c_in: *const ast.Call) Ref { // Check builtins first (these are handled natively by interpreter and emitter) if (resolveBuiltin(id.name)) |bid| { const ret_ty: TypeId = switch (bid) { - .size_of, .align_of => .s64, + .size_of, .align_of => .i64, .sqrt, .sin, .cos, .floor => blk: { // Math builtins: return type matches argument type ($T -> T) if (c.args.len > 0) { @@ -530,8 +530,8 @@ pub fn lowerCall(self: *Lowering, c_in: *const ast.Call) Ref { const callee_ref = if (binding.is_alloca) self.builder.load(binding.ref, binding.ty) else binding.ref; const ret_ty = if (!binding.ty.isBuiltin()) blk: { const bti = self.module.types.get(binding.ty); - break :blk if (bti == .function) bti.function.ret else .s64; - } else .s64; + break :blk if (bti == .function) bti.function.ret else .i64; + } else .i64; var final_args = std.ArrayList(Ref).empty; defer final_args.deinit(self.alloc); if (self.fnPtrTypeWantsCtx(binding.ty)) { @@ -623,8 +623,8 @@ pub fn lowerCall(self: *Lowering, c_in: *const ast.Call) Ref { // Type constructor call: Sx(f32).user(0.5) — obj is a call that returns a type if (fa.object.data == .call) { const inner_call = &fa.object.data.call; - // Generic struct STATIC-METHOD head (`Box(s64).make(..)` or the - // qualified `a.Box(s64).make(..)`): the layout author is chosen + // Generic struct STATIC-METHOD head (`Box(i64).make(..)` or the + // qualified `a.Box(i64).make(..)`): the layout author is chosen // by the single head choke-point (CP-1) and the method body by // the instance's STAMPED author (CP-4), so layout-author ≡ // body-author for BOTH bare and qualified heads (E4 #1 / #2). @@ -1025,7 +1025,7 @@ pub fn lowerCall(self: *Lowering, c_in: *const ast.Call) Ref { // call PLAN selected for the receiver's source — the SAME author // plan typed the call's result as, so dispatch and typing can't // disagree (without this, a string-typed winner over - // an s64 shadow boxes a raw int as a string pointer → segfault). + // an i64 shadow boxes a raw int as a string pointer → segfault). // The plan is the single producer; lowering consumes its verdict // (`sel_author` / `cplan.ambiguous_collision`, computed once above) // rather than re-resolving the field name. `.ambiguous` → loud @@ -1189,7 +1189,7 @@ pub fn lowerCall(self: *Lowering, c_in: *const ast.Call) Ref { // Indirect call through expression const callee_ref = self.lowerExpr(c.callee); const owned = self.alloc.dupe(Ref, args.items) catch unreachable; - return self.builder.emit(.{ .call_indirect = .{ .callee = callee_ref, .args = owned } }, .s64); + return self.builder.emit(.{ .call_indirect = .{ .callee = callee_ref, .args = owned } }, .i64); }, } } @@ -1426,7 +1426,7 @@ pub fn lowerRuntimeDispatchCall( const type_tag_raw = self.lowerExpr(type_tag_node orelse return self.emitError("dispatch", call_node.callee.span)); const type_tag_node_ty = self.inferExprType(type_tag_node.?); const type_tag = if (type_tag_node_ty == .any) - self.builder.emit(.{ .unbox_any = .{ .operand = type_tag_raw } }, .s64) + self.builder.emit(.{ .unbox_any = .{ .operand = type_tag_raw } }, .i64) else type_tag_raw; const any_val = self.lowerExpr(any_val_node orelse return self.emitError("dispatch", call_node.callee.span)); @@ -1630,13 +1630,13 @@ pub fn lowerRuntimeDispatchCall( @memcpy(final_call_args[1..], call_args.items); } } - // Coerce non-cast args (source type unknown, use s64 default). + // Coerce non-cast args (source type unknown, use i64 default). // cast_arg_idx is in user-space (skips __sx_ctx); offset by ctx_slots. const ctx_slots: usize = if (callee_has_ctx) 1 else 0; for (0..@min(final_call_args.len, callee_params.len)) |ci| { if (ci < ctx_slots) continue; // skip __sx_ctx slot if ((ci - ctx_slots) != cast_arg_idx) { - final_call_args[ci] = self.coerceToType(final_call_args[ci], .s64, callee_params[ci].ty); + final_call_args[ci] = self.coerceToType(final_call_args[ci], .i64, callee_params[ci].ty); } } const result = self.builder.call(fid, final_call_args, callee_ret); @@ -1680,12 +1680,12 @@ pub fn tryLowerReflectionCall(self: *Lowering, name: []const u8, c: *const ast.C // size_of(T) → const_int(sizeof(T)) const ty = self.resolveTypeArg(c.args[0]); const size: i64 = @intCast(self.typeSizeBytes(ty)); - return self.builder.constInt(size, .s64); + return self.builder.constInt(size, .i64); } if (std.mem.eql(u8, name, "align_of")) { const ty = self.resolveTypeArg(c.args[0]); const a: i64 = @intCast(self.module.types.typeAlignBytes(ty)); - return self.builder.constInt(a, .s64); + return self.builder.constInt(a, .i64); } if (std.mem.eql(u8, name, "field_count")) { // field_count(T) → const_int(N) @@ -1700,7 +1700,7 @@ pub fn tryLowerReflectionCall(self: *Lowering, name: []const u8, c: *const ast.C .vector => |v| @intCast(v.length), else => 0, }; - return self.builder.constInt(count, .s64); + return self.builder.constInt(count, .i64); } if (std.mem.eql(u8, name, "type_name")) { // type_name(T): @@ -1712,8 +1712,8 @@ pub fn tryLowerReflectionCall(self: *Lowering, name: []const u8, c: *const ast.C // `callBuiltin(.type_name, [arg_ref])`. The interp's // arm (commit 9600ba5) reads the runtime `.type_tag` // and returns the per-position name. Without this - // split, the catch-all `else => .s64` in - // `resolveTypeArg` silently returns "s64" for every + // split, the catch-all `else => .i64` in + // `resolveTypeArg` silently returns "i64" for every // dynamic call — exactly the silent-arm pattern the // project's REJECTED PATTERNS forbid. if (self.isStaticTypeArg(c.args[0])) { @@ -1729,8 +1729,8 @@ pub fn tryLowerReflectionCall(self: *Lowering, name: []const u8, c: *const ast.C if (std.mem.eql(u8, name, "type_eq")) { // type_eq(T1, T2) → const_bool — comptime TypeId equality. // TypeIds are interned per structural shape so equality on - // them matches the user's intuition: `type_eq(s64, s64)` is - // true, `type_eq(*s64, *s64)` is true, distinct shapes are + // them matches the user's intuition: `type_eq(i64, i64)` is + // true, `type_eq(*i64, *i64)` is true, distinct shapes are // false. Pack-indexed types (`$args[0]`) resolve through // `resolveTypeArg` → `resolveTypeWithBindings`. if (c.args.len < 2) return self.builder.constBool(false); @@ -1745,7 +1745,7 @@ pub fn tryLowerReflectionCall(self: *Lowering, name: []const u8, c: *const ast.C // `any_to_string` — emits a `callBuiltin`: the interp reads // the boxed TypeId, LLVM GEPs a per-type signedness table. // Mirrors `type_name`'s static/dynamic split; the same split - // avoids `resolveTypeArg`'s silent `.s64` default lying about + // avoids `resolveTypeArg`'s silent `.i64` default lying about // a runtime Type value. if (c.args.len < 1) return self.builder.constBool(false); if (self.isStaticTypeArg(c.args[0])) { @@ -1873,7 +1873,7 @@ pub fn tryLowerReflectionCall(self: *Lowering, name: []const u8, c: *const ast.C // the returned value carries Type semantics (tag field // says ".any" → the value field holds the type id). const val = self.lowerExpr(c.args[0]); - const tag_val = self.builder.structGet(val, 0, .s64); + const tag_val = self.builder.structGet(val, 0, .i64); return self.builder.boxAny(tag_val, .any); } else { return self.builder.constType(arg_ty); @@ -1881,14 +1881,14 @@ pub fn tryLowerReflectionCall(self: *Lowering, name: []const u8, c: *const ast.C } if (std.mem.eql(u8, name, "field_index")) { // field_index(T, val) → extract tag from tagged union - if (c.args.len < 2) return self.builder.constInt(0, .s64); + if (c.args.len < 2) return self.builder.constInt(0, .i64); const val = self.lowerExpr(c.args[1]); // For tagged unions: extract field 0 (the tag) - return self.builder.emit(.{ .enum_tag = .{ .operand = val } }, .s64); + return self.builder.emit(.{ .enum_tag = .{ .operand = val } }, .i64); } if (std.mem.eql(u8, name, "field_value_int")) { // field_value_int(T, i) → lookup enum variant value by index - if (c.args.len < 2) return self.builder.constInt(0, .s64); + if (c.args.len < 2) return self.builder.constInt(0, .i64); const ty = self.resolveTypeArg(c.args[0]); const idx = self.lowerExpr(c.args[1]); // For enums with explicit values, build a global value array and index into it @@ -1901,11 +1901,11 @@ pub fn tryLowerReflectionCall(self: *Lowering, name: []const u8, c: *const ast.C var elems = std.ArrayList(Ref).empty; defer elems.deinit(self.alloc); for (vals) |v| { - elems.append(self.alloc, self.builder.constInt(v, .s64)) catch unreachable; + elems.append(self.alloc, self.builder.constInt(v, .i64)) catch unreachable; } - const arr_ty = self.module.types.arrayOf(.s64, @intCast(vals.len)); + const arr_ty = self.module.types.arrayOf(.i64, @intCast(vals.len)); const arr = self.builder.structInit(elems.items, arr_ty); - return self.builder.emit(.{ .index_get = .{ .lhs = arr, .rhs = idx } }, .s64); + return self.builder.emit(.{ .index_get = .{ .lhs = arr, .rhs = idx } }, .i64); } } } @@ -1921,7 +1921,7 @@ pub fn tryLowerReflectionCall(self: *Lowering, name: []const u8, c: *const ast.C /// shapes), or a runtime `Type` value — which is `.any`-typed at /// runtime (`type_of(x)`, a `[]Type` element `list[i]`, a `Type`-typed /// local / field / param). Any other expression — a value of type -/// s64 / f64 / bool / a struct — is NOT a type. +/// i64 / f64 / bool / a struct — is NOT a type. pub fn reflectionArgIsType(self: *Lowering, arg: *const Node) bool { if (self.isStaticTypeArg(arg)) return true; return self.inferExprType(arg) == .any; @@ -1986,7 +1986,7 @@ pub fn reflectionErrorSentinel(self: *Lowering, name: []const u8) Ref { std.mem.eql(u8, name, "type_is_unsigned") or std.mem.eql(u8, name, "is_flags")) return self.builder.constBool(false); - return self.builder.constInt(0, .s64); + return self.builder.constInt(0, .i64); } /// After args have been lowered, append the lowered values of any diff --git a/src/ir/lower/closure.zig b/src/ir/lower/closure.zig index c7fe42f..54ea15e 100644 --- a/src/ir/lower/closure.zig +++ b/src/ir/lower/closure.zig @@ -214,7 +214,7 @@ pub fn lowerLambda(self: *Lowering, lam: *const ast.Lambda) Ref { const env_local = self.builder.alloca(env_struct_ty); // Compute env size const env_byte_size_inner = self.computeEnvSize(capture_list); - const env_size_val = self.builder.constInt(@intCast(env_byte_size_inner), .s64); + const env_size_val = self.builder.constInt(@intCast(env_byte_size_inner), .i64); // memcpy(local_alloca, env_param, size) _ = self.callForeign("memcpy", &.{ env_local, env_param_ref, env_size_val }, self.module.types.ptrTo(.void)); @@ -247,7 +247,7 @@ pub fn lowerLambda(self: *Lowering, lam: *const ast.Lambda) Ref { // Bind params (user args start at user_param_base_lam, shifted past ctx + env). // Use the signature types computed above (`params`), which already // applied contextual typing from the target closure to untyped params — - // `resolveParamType` alone would drop it and default each to s64. + // `resolveParamType` alone would drop it and default each to i64. for (lam.params, 0..) |p, i| { const pty = params.items[user_param_base + i].ty; const slot = self.builder.alloca(pty); @@ -355,7 +355,7 @@ pub fn lowerLambda(self: *Lowering, lam: *const ast.Lambda) Ref { // `push Context.{ allocator = ... }` and a tracker / arena // counts the env allocation alongside everything else. const env_byte_size = self.computeEnvSize(capture_list); - const env_size = self.builder.constInt(@intCast(env_byte_size), .s64); + const env_size = self.builder.constInt(@intCast(env_byte_size), .i64); const ptr_void = self.module.types.ptrTo(.void); const env_heap = self.allocViaContext(env_size, ptr_void); // memcpy(heap, stack_alloca, size) diff --git a/src/ir/lower/coerce.zig b/src/ir/lower/coerce.zig index f77cb45..1c178b6 100644 --- a/src/ir/lower/coerce.zig +++ b/src/ir/lower/coerce.zig @@ -24,7 +24,7 @@ pub fn lowerXX(self: *Lowering, operand: Ref, operand_node: *const Node) Ref { // Use the operand's *actual* lowered Ref type rather than reaching // back through inferExprType — the latter doesn't cover every // expression shape (notably lambdas), and a wrong src_ty here can - // route the cast through coerceToType (e.g. a bogus s64→ptr bitcast) + // route the cast through coerceToType (e.g. a bogus i64→ptr bitcast) // and silently skip the user-space Into fallback. const src_ty = self.builder.getRefType(operand); const target_explicit = self.target_type != null; @@ -83,7 +83,7 @@ pub fn lowerXX(self: *Lowering, operand: Ref, operand_node: *const Node) Ref { const result = self.coerceExplicit(operand, src_ty, dst_ty); // User-space fallback via `impl Into(Target) for Source`. Only fires - // when the target was explicitly named (not the .s64 default), src and + // when the target was explicitly named (not the .i64 default), src and // dst differ, and the built-in ladder made no progress. Built-ins // always win. if (target_explicit and src_ty != dst_ty and result == operand) { @@ -445,14 +445,14 @@ pub fn lowerAnyToF64Dispatch(self: *Lowering, any_val: Ref) Ref { const result_slot = self.builder.alloca(.f64); // Extract type tag from Any - const tag = self.builder.structGet(any_val, 0, .s64); + const tag = self.builder.structGet(any_val, 0, .i64); const f32_bb = self.freshBlock("f32.unbox"); const f64_bb = self.freshBlock("f64.unbox"); const merge_bb = self.freshBlock("float.merge"); // Branch: tag == f32_tag ? f32_bb : f64_bb - const f32_tag = self.builder.constInt(TypeId.f32.index(), .s64); + const f32_tag = self.builder.constInt(TypeId.f32.index(), .i64); const cond = self.builder.emit(.{ .cmp_eq = .{ .lhs = tag, .rhs = f32_tag } }, .bool); self.builder.condBr(cond, f32_bb, &.{}, f64_bb, &.{}); @@ -479,7 +479,7 @@ pub fn lowerAnyToF64Dispatch(self: *Lowering, any_val: Ref) Ref { } /// Produce a default value for a type, applying struct field defaults. -/// For structs with defaults (e.g., `b: s32 = 99`), creates a struct_literal with defaults applied. +/// For structs with defaults (e.g., `b: i32 = 99`), creates a struct_literal with defaults applied. /// For other types, returns a zero value. pub fn buildDefaultValue(self: *Lowering, ty: TypeId) Ref { if (ty.isBuiltin()) return self.builder.constInt(0, ty); @@ -534,7 +534,7 @@ pub fn zeroValue(self: *Lowering, ty: TypeId) Ref { if (ty.isBuiltin()) return self.builder.constInt(0, ty); const info = self.module.types.get(ty); return switch (info) { - // Arbitrary-width integer types (u1, u2, s4, ...) interned as + // Arbitrary-width integer types (u1, u2, i4, ...) interned as // `.signed`/`.unsigned` variants — fall through `isBuiltin()`. .signed, .unsigned => self.builder.constInt(0, ty), .pointer, .tuple, .optional => self.builder.constNull(ty), @@ -610,8 +610,8 @@ pub fn coerceMode(self: *Lowering, val: Ref, src_ty: TypeId, dst_ty: TypeId, mod } return val; }, - // Tuple → Tuple element-wise coercion (e.g. a `(s64, s64)` literal - // flowing into a `(s32, s32)` slot — the multi-value failable success + // Tuple → Tuple element-wise coercion (e.g. a `(i64, i64)` literal + // flowing into a `(i32, i32)` slot — the multi-value failable success // tuple). Same arity: extract each slot, coerce it, rebuild. .tuple_elementwise => { const si = self.module.types.get(src_ty); @@ -693,14 +693,14 @@ pub fn coerceMode(self: *Lowering, val: Ref, src_ty: TypeId, dst_ty: TypeId, mod } /// Apply C default argument promotion to variadic-tail args. These rules -/// (bool/s8/s16/u8/u16 → s32, f32 → f64) match the C calling convention's +/// (bool/i8/i16/u8/u16 → i32, f32 → f64) match the C calling convention's /// implicit promotions when an argument is passed through `...`. pub fn promoteCVariadicArgs(self: *Lowering, args: []Ref, fixed_count: usize) void { if (args.len <= fixed_count) return; for (args[fixed_count..]) |*arg| { const src_ty = self.builder.getRefType(arg.*); const promoted: TypeId = switch (src_ty) { - .bool, .s8, .s16, .u8, .u16 => .s32, + .bool, .i8, .i16, .u8, .u16 => .i32, .f32 => .f64, else => continue, }; @@ -720,7 +720,7 @@ pub fn coerceCallArgs(self: *Lowering, args: []Ref, params: []const Function.Par if (src_info == .array and dst_info == .many_pointer) { const slot = self.builder.alloca(src_ty); self.builder.store(slot, args[i]); - const zero = self.builder.constInt(0, .s64); + const zero = self.builder.constInt(0, .i64); args[i] = self.builder.emit(.{ .index_gep = .{ .lhs = slot, .rhs = zero } }, dst_ty); continue; } diff --git a/src/ir/lower/comptime.zig b/src/ir/lower/comptime.zig index f22d6e2..529e01c 100644 --- a/src/ir/lower/comptime.zig +++ b/src/ir/lower/comptime.zig @@ -287,7 +287,7 @@ pub fn evalComptimeInt(self: *Lowering, node: *const Node) ?i64 { pub fn lowerComptimeGlobal(self: *Lowering, name: []const u8, expr: *const Node, type_ann: ?*const Node) void { // When the user writes `NAME :: #run expr;` with no type annotation, // infer the global's type from the comptime expression's return - // shape. `resolveType(null)` returns `.s64` for legacy reasons — + // shape. `resolveType(null)` returns `.i64` for legacy reasons — // good for primitive helpers, silently wrong for anything else. const expr_ty = self.inferExprType(expr); // A failable `#run` (bare, no `catch`/`or`): the comptime function @@ -1130,7 +1130,7 @@ pub fn foldComptimeFloatInit(self: *Lowering, node: *const Node, dst: TypeId) ?R // `evalConstFloatExpr` only succeeds for literal / const-arithmetic // nodes, never an unbound pack index. `inferExprType` is the primary // signal, but it reads a const's DECLARED type — which is a placeholder - // `s64` for an untyped float-EXPRESSION const (`ME :: 4.0 + 1.0`), so + // `i64` for an untyped float-EXPRESSION const (`ME :: 4.0 + 1.0`), so // `ME / 2` would look like integer division; `isFloatValuedExpr` (judging // by VALUE) catches that case so it narrows under the unified rule too. if (!isFloat(self.inferExprType(node)) and !program_index_mod.isFloatValuedExpr(node, self)) return null; diff --git a/src/ir/lower/control_flow.zig b/src/ir/lower/control_flow.zig index b4ed707..d544868 100644 --- a/src/ir/lower/control_flow.zig +++ b/src/ir/lower/control_flow.zig @@ -61,7 +61,7 @@ pub fn lowerIfExpr(self: *Lowering, ie: *const ast.IfExpr) Ref { // Optional binding: `if val := expr { ... }` // Clear target_type so the ternary's result type doesn't leak into the condition - // (e.g., `if x != 0 then 1.0 else 2.0` — the `0` must be s64, not f32) + // (e.g., `if x != 0 then 1.0 else 2.0` — the `0` must be i64, not f32) const saved_cond_target = self.target_type; self.target_type = null; const opt_val = self.lowerExpr(ie.condition); @@ -273,12 +273,12 @@ pub fn listView(self: *Lowering, value: Ref, ty: TypeId) ?struct { data: Ref, da return .{ .data = self.builder.emit(.{ .struct_get = .{ .base = value, .field_index = items_idx.? } }, items_ty), .data_ty = items_ty, - .len = self.builder.emit(.{ .struct_get = .{ .base = value, .field_index = len_idx.? } }, .s64), + .len = self.builder.emit(.{ .struct_get = .{ .base = value, .field_index = len_idx.? } }, .i64), }; } /// Lowered prep for one position of a multi-iterable `for` header. Every -/// position gets its own s64 cursor slot (ranges start at their `start`, +/// position gets its own i64 cursor slot (ranges start at their `start`, /// collections at 0); all cursors advance by 1 per iteration, and ONLY the /// first position's bound terminates the loop (first-iterable-wins). const IterPrep = struct { @@ -316,13 +316,13 @@ pub fn lowerFor(self: *Lowering, fe: *const ast.ForExpr) Ref { for (fe.iterables, 0..) |it, i| { if (it.is_range) { var start_ref = self.lowerExpr(it.expr); - if (it.start_exclusive) start_ref = self.builder.add(start_ref, self.builder.constInt(1, .s64), .s64); - const slot = self.builder.alloca(.s64); + if (it.start_exclusive) start_ref = self.builder.add(start_ref, self.builder.constInt(1, .i64), .i64); + const slot = self.builder.alloca(.i64); self.builder.store(slot, start_ref); if (i == 0) { // Parser guarantees the first iterable is bounded. var end_ref = self.lowerExpr(it.range_end.?); - if (it.end_inclusive) end_ref = self.builder.add(end_ref, self.builder.constInt(1, .s64), .s64); + if (it.end_inclusive) end_ref = self.builder.add(end_ref, self.builder.constInt(1, .i64), .i64); limit = end_ref; } preps.append(self.alloc, .{ .is_range = true, .slot = slot }) catch unreachable; @@ -349,7 +349,7 @@ pub fn lowerFor(self: *Lowering, fe: *const ast.ForExpr) Ref { data_ty = lv.data_ty; len = lv.len; } else if (i == 0) { - len = self.builder.emit(.{ .length = .{ .operand = data } }, .s64); + len = self.builder.emit(.{ .length = .{ .operand = data } }, .i64); } const elem_ty = self.getElementType(data_ty); @@ -367,8 +367,8 @@ pub fn lowerFor(self: *Lowering, fe: *const ast.ForExpr) Ref { } const is_array = !data_ty.isBuiltin() and self.module.types.get(data_ty) == .array; const storage = if (is_array and !was_deref) self.getExprAlloca(it.expr) else null; - const slot = self.builder.alloca(.s64); - self.builder.store(slot, self.builder.constInt(0, .s64)); + const slot = self.builder.alloca(.i64); + self.builder.store(slot, self.builder.constInt(0, .i64)); if (i == 0) limit = len; preps.append(self.alloc, .{ .is_range = false, @@ -391,7 +391,7 @@ pub fn lowerFor(self: *Lowering, fe: *const ast.ForExpr) Ref { // Header: first cursor against the first bound. self.builder.switchToBlock(header_bb); - const cur0 = self.builder.load(preps.items[0].slot, .s64); + const cur0 = self.builder.load(preps.items[0].slot, .i64); const cmp = self.builder.cmpLt(cur0, limit); self.builder.condBr(cmp, body_bb, &.{}, exit_bb, &.{}); @@ -404,9 +404,9 @@ pub fn lowerFor(self: *Lowering, fe: *const ast.ForExpr) Ref { for (fe.captures, 0..) |cap, i| { const prep = preps.items[i]; - const cur = if (i == 0) cur0 else self.builder.load(prep.slot, .s64); + const cur = if (i == 0) cur0 else self.builder.load(prep.slot, .i64); if (prep.is_range) { - body_scope.put(cap.name, .{ .ref = cur, .ty = .s64, .is_alloca = false }); + body_scope.put(cap.name, .{ .ref = cur, .ty = .i64, .is_alloca = false }); continue; } const bind_ty = if (cap.by_ref) self.module.types.ptrTo(prep.elem_ty) else prep.elem_ty; @@ -453,10 +453,10 @@ pub fn lowerFor(self: *Lowering, fe: *const ast.ForExpr) Ref { // Increment block: advance every cursor and jump back to header. self.builder.switchToBlock(inc_bb); { - const one = self.builder.constInt(1, .s64); + const one = self.builder.constInt(1, .i64); for (preps.items) |prep| { - const cur = self.builder.load(prep.slot, .s64); - const next = self.builder.add(cur, one, .s64); + const cur = self.builder.load(prep.slot, .i64); + const next = self.builder.add(cur, one, .i64); self.builder.store(prep.slot, next); } self.builder.br(header_bb, &.{}); @@ -556,7 +556,7 @@ pub fn lowerInlineRangeFor(self: *Lowering, fe: *const ast.ForExpr) Ref { // uses like `print(i)`) and as a comptime constant (for // `xs[i]` substitution). const v = start + i; - body_scope.put(cap.name, .{ .ref = self.builder.constInt(v, .s64), .ty = .s64, .is_alloca = false }); + body_scope.put(cap.name, .{ .ref = self.builder.constInt(v, .i64), .ty = .i64, .is_alloca = false }); var save = CursorSave{ .name = cap.name, .had_prev = false, .prev = undefined }; if (self.comptime_constants.get(cap.name)) |p| { save.had_prev = true; @@ -796,11 +796,11 @@ pub fn lowerMatch(self: *Lowering, me: *const ast.MatchExpr) Ref { } // Switch on the subject (for type match, subject is either a - // bare TypeId (s64) or an Any-shaped Type value — unbox in the + // bare TypeId (i64) or an Any-shaped Type value — unbox in the // latter case so the switch sees the i64 type id). const tag = if (is_type_match) tag_blk: { if (subject_ty == .any) { - break :tag_blk self.builder.emit(.{ .unbox_any = .{ .operand = subject } }, .s64); + break :tag_blk self.builder.emit(.{ .unbox_any = .{ .operand = subject } }, .i64); } break :tag_blk subject; } else if (is_optional_match) self.builder.emit(.{ .optional_has_value = .{ .operand = subject } }, .bool) else if (is_error_set_match) subject else blk: { @@ -810,7 +810,7 @@ pub fn lowerMatch(self: *Lowering, me: *const ast.MatchExpr) Ref { const ty_info = self.module.types.get(subject_ty); if (ty_info == .tagged_union) break :tt ty_info.tagged_union.tag_type; } - break :tt .s32; + break :tt .i32; }; break :blk self.builder.enumTag(subject, tag_ty); }; @@ -836,7 +836,7 @@ pub fn lowerMatch(self: *Lowering, me: *const ast.MatchExpr) Ref { if (is_optional_match) { // For optional match, unwrap the optional value const opt_info = self.module.types.get(subject_ty); - const child_ty = if (opt_info == .optional) opt_info.optional.child else .s64; + const child_ty = if (opt_info == .optional) opt_info.optional.child else .i64; const unwrapped = self.builder.emit(.{ .optional_unwrap = .{ .operand = subject } }, child_ty); arm_scope.put(capture_name, .{ .ref = unwrapped, .ty = child_ty, .is_alloca = false }); } else { diff --git a/src/ir/lower/decl.zig b/src/ir/lower/decl.zig index 638bd53..ea3beaf 100644 --- a/src/ir/lower/decl.zig +++ b/src/ir/lower/decl.zig @@ -268,7 +268,7 @@ pub fn injectComptimeConstants(self: *Lowering) void { } } - // POINTER_SIZE: s64 (4 for wasm32, 8 for wasm64 and other 64-bit targets) + // POINTER_SIZE: i64 (4 for wasm32, 8 for wasm64 and other 64-bit targets) const ptr_size: i64 = if (tc.isWasm32()) 4 else 8; self.comptime_constants.put("POINTER_SIZE", .{ .int_val = ptr_size }) catch {}; } @@ -437,7 +437,7 @@ pub fn dropModuleConst(self: *Lowering, source: ?[]const u8, name: []const u8) v /// Pass 1: Scan declarations — register ASTs and extern stubs, but don't lower bodies. pub fn scanDecls(self: *Lowering, decls: []const *const Node) void { // Pass 0: register every numeric-literal module const (`N :: 16` and the - // typed `N : s64 : 16`, plus float-valued `N :: 4.0` / `N : f64 : 4.0`) + // typed `N : i64 : 16`, plus float-valued `N :: 4.0` / `N : f64 : 4.0`) // BEFORE any type alias is resolved below. A type alias whose dimension is // a named const (`Arr :: [N]T`) resolves its dimension eagerly here, on // the stateless registration path; that path can only read @@ -455,7 +455,7 @@ pub fn scanDecls(self: *Lowering, decls: []const *const Node) void { const cd = decl.data.const_decl; switch (cd.value.data) { .int_literal => { - const info = program_index_mod.ModuleConstInfo{ .value = cd.value, .ty = .s64 }; + const info = program_index_mod.ModuleConstInfo{ .value = cd.value, .ty = .i64 }; self.putModuleConst(decl.source_file, cd.name, info); }, .float_literal => { @@ -465,11 +465,11 @@ pub fn scanDecls(self: *Lowering, decls: []const *const Node) void { // A const whose RHS is an integer EXPRESSION over other consts // (`M :: 2; N :: M + 1`) is itself a usable count: register it so // `moduleConstInt` can fold the RHS through `evalConstIntExpr` - //. Placeholder `.s64` type — the count consumers read + //. Placeholder `.i64` type — the count consumers read // only the value; if the expression doesn't fold (references a // non-const), `moduleConstInt` yields null and the use diagnoses. .binary_op, .unary_op => { - const info = program_index_mod.ModuleConstInfo{ .value = cd.value, .ty = .s64 }; + const info = program_index_mod.ModuleConstInfo{ .value = cd.value, .ty = .i64 }; self.putModuleConst(decl.source_file, cd.name, info); }, else => {}, @@ -565,7 +565,7 @@ pub fn scanDecls(self: *Lowering, decls: []const *const Node) void { cd.value.data == .optional_type_expr or cd.value.data == .function_type_expr) { - // Type alias: MyFloat :: f64; Ptr :: *u8; Cb :: (s32) -> s32; + // Type alias: MyFloat :: f64; Ptr :: *u8; Cb :: (i32) -> i32; const target_ty = type_bridge.resolveAstType(cd.value, &self.module.types, &self.program_index.type_alias_map, &self.program_index.module_const_map); // The stateless resolver yields `.unresolved` for a shape // it cannot build — e.g. `Arr :: []T`, whose @@ -651,7 +651,7 @@ pub fn scanDecls(self: *Lowering, decls: []const *const Node) void { // A namespaced callee (`ns.Box(..)`) is an explicit qualified // reach, exempt from the bare-head visibility gate (E4). const head_qualified = call_data.callee.data == .field_access; - // A qualified head `ABox :: a.Box(s64)` selects a's OWN + // A qualified head `ABox :: a.Box(i64)` selects a's OWN // template via the namespace edge (mirrors the annotation // head site `resolveTypeCallWithBindings`), not the bare // last-wins `struct_template_map`. @@ -660,8 +660,8 @@ pub fn scanDecls(self: *Lowering, decls: []const *const Node) void { else null; if (callee_name.len > 0) { - // Generic-struct alias head (`ABox :: Box(s64)` / - // `a.Box(s64)`): route layout selection through the single + // Generic-struct alias head (`ABox :: Box(i64)` / + // `a.Box(i64)`): route layout selection through the single // choke-point (CP-1); the Vector / type-fn branches stay // as the non-generic fall-through. switch (self.selectGenericStructHead(callee_name, qual_alias, head_qualified, call_data.callee.span)) { @@ -698,7 +698,7 @@ pub fn scanDecls(self: *Lowering, decls: []const *const Node) void { const pt = &cd.value.data.parameterized_type_expr; const base_name = if (std.mem.lastIndexOfScalar(u8, pt.name, '.')) |dot| pt.name[dot + 1 ..] else pt.name; const pt_qualified = std.mem.indexOfScalar(u8, pt.name, '.') != null; - // A qualified base `ABox :: a.Box(s64)` selects a's OWN + // A qualified base `ABox :: a.Box(i64)` selects a's OWN // template via the namespace edge (mirrors the annotation // head site `resolveParameterizedWithBindings`), not the // bare last-wins `struct_template_map`. @@ -723,7 +723,7 @@ pub fn scanDecls(self: *Lowering, decls: []const *const Node) void { } // comptime_expr handled in Pass 2 - // Typed value constants (`AF_INET :s32: 2`) are registered in + // Typed value constants (`AF_INET :i32: 2`) are registered in // pass 2 below — after the forward-alias fixpoint — so a // forward identifier alias in the annotation resolves to its // target instead of a fabricated stub. Untyped @@ -733,7 +733,7 @@ pub fn scanDecls(self: *Lowering, decls: []const *const Node) void { // Untyped literal constants (e.g. UI_VERT_SRC :: #string GLSL...GLSL;) const lit_ty: ?TypeId = switch (cd.value.data) { .string_literal => .string, - .int_literal => .s64, + .int_literal => .i64, .float_literal => .f64, .bool_literal => .bool, // Complex constant expressions (e.g. COLOR_WHITE :: Color.{ r = 255, ... }) @@ -825,19 +825,19 @@ pub fn scanDecls(self: *Lowering, decls: []const *const Node) void { .own_opaque, .ambiguous, .none => false, }; if (!recv_is_agg) continue; - self.putModuleConst(decl.source_file, cd.name, .{ .value = cd.value, .ty = .s64 }); + self.putModuleConst(decl.source_file, cd.name, .{ .value = cd.value, .ty = .i64 }); } } -/// Register a typed module-level value constant (`AF_INET :s32: 2`). Run in +/// Register a typed module-level value constant (`AF_INET :i32: 2`). Run in /// scanDecls pass 2 (after `resolveForwardIdentifierAliases`) so a forward -/// identifier alias in the annotation (`A :: B; B :: s32; K : A : 42;`) +/// identifier alias in the annotation (`A :: B; B :: i32; K : A : 42;`) /// resolves to its target rather than a fabricated empty-struct stub, which /// would otherwise mistype the constant. pub fn registerTypedModuleConst(self: *Lowering, cd: *const ast.ConstDecl) void { const ta = cd.type_annotation orelse return; // Only initializer shapes that pass 0 (binary_op / unary_op → placeholder - // `.s64`) or the literal path register as a USABLE module const need + // `.i64`) or the literal path register as a USABLE module const need // reconciling against the annotation. Every other shape (call, // struct/array literal, bare identifier) is never registered as a // foldable / emittable const, so it cannot manifest a @@ -860,7 +860,7 @@ pub fn registerTypedModuleConst(self: *Lowering, cd: *const ast.ConstDecl) void // silently-accepted const — registering it would let `emitModuleConst` // stamp the value with the wrong IR type (an int emitted as a `string` // const → a bogus pointer that segfaults at the use site) and let the - // count path fold it (`[N]s64` → 4). Issue 0088. + // count path fold it (`[N]i64` → 4). Issue 0088. if (!self.typedConstInitFits(cd.value, ty)) { // A non-integral compile-time float into an integer const is the // same implicit-narrowing failure as a typed local/field/param — @@ -880,7 +880,7 @@ pub fn registerTypedModuleConst(self: *Lowering, cd: *const ast.ConstDecl) void }); } // Evict the pass-0 placeholder (`N : string : 4` and - // `N : string : M + 2` are both pre-registered as `.s64` in scanDecls + // `N : string : M + 2` are both pre-registered as `.i64` in scanDecls // pass 0); leaving it would let a count use still fold `N`. self.dropModuleConst(self.current_source_file, cd.name); return; @@ -904,13 +904,13 @@ pub fn registerTypedModuleConst(self: *Lowering, cd: *const ast.ConstDecl) void /// unsound as a compile-time literal-representability oracle here — a `null` /// literal's natural type is `.void`, so `classify(.void, *T)` yields `.none` /// and would reject the valid `P : *void : null`; `bool` is 1 bit wide, so -/// `classify(.bool, s64)` yields `.widen` and would accept the bogus -/// `B : s64 : true`. +/// `classify(.bool, i64)` yields `.widen` and would accept the bogus +/// `B : i64 : true`. pub fn typedConstInitFits(self: *Lowering, value: *const Node, dst_ty: TypeId) bool { // An INTEGER-annotated constant accepts a compile-time INTEGRAL float — - // a literal (`K : s64 : 4.0`), an int-leaf expression (`K : s64 : M + 2.0` + // a literal (`K : i64 : 4.0`), an int-leaf expression (`K : i64 : M + 2.0` // → 4), or a float-const-leaf expression whose SUM is integral - // (`F : f64 : 2.5; K : s64 : F + 1.5` → 4). Integrality is judged on the + // (`F : f64 : 2.5; K : i64 : F + 1.5` → 4). Integrality is judged on the // FLOAT fold (`evalConstFloatExpr` + `floatToIntExact`) — the SAME facility // the typed-local path (`foldComptimeFloatInit`) uses — not the int-only // folder, which folds leaf-by-leaf in `i64` and so misses an integral SUM @@ -969,7 +969,7 @@ pub fn constExprInitFits(self: *Lowering, init_ty: TypeId, dst_ty: TypeId) bool return init_ty == dst_ty; } -/// Register an array-typed `::` constant (`K : [4]s64 : .[...]`, or the +/// Register an array-typed `::` constant (`K : [4]i64 : .[...]`, or the /// untyped `A :: .[1, 2, 3]`) as an IMMUTABLE module global: one storage, /// reads GEP it, the emitter marks it LLVMSetGlobalConstant, dead-global /// elimination drops it when unused. Source-aware reads come for free via @@ -1016,7 +1016,7 @@ pub fn registerConstArrayGlobal(self: *Lowering, cd: *const ast.ConstDecl) void } /// Infer `[N]T` for an untyped array-literal constant. Element types unify: -/// all ints → s64; ANY float promotes the element type to f64 (ints convert +/// all ints → i64; ANY float promotes the element type to f64 (ints convert /// exactly — the int+float promotion rule for consts, element-wise); bool / /// string homogeneous only. A non-numeric mix or a non-inferable element /// shape (nested aggregate, enum literal, named const) asks for an @@ -1024,18 +1024,18 @@ pub fn registerConstArrayGlobal(self: *Lowering, cd: *const ast.ConstDecl) void pub fn inferConstArrayType(self: *Lowering, name: []const u8, elements: []const *const Node, span: ast.Span) ?TypeId { if (elements.len == 0) { if (self.diagnostics) |d| - d.addFmt(.err, span, "constant '{s}' is an empty array literal — annotate the type (e.g. `{s} : [0]s64 : .[]`)", .{ name, name }); + d.addFmt(.err, span, "constant '{s}' is an empty array literal — annotate the type (e.g. `{s} : [0]i64 : .[]`)", .{ name, name }); return null; } var elem_ty: ?TypeId = null; for (elements) |e| { const leaf: ?TypeId = switch (e.data) { - .int_literal => .s64, + .int_literal => .i64, .float_literal => .f64, .bool_literal => .bool, .string_literal => .string, .unary_op => |uo| if (uo.op == .negate) switch (uo.operand.data) { - .int_literal => .s64, + .int_literal => .i64, .float_literal => .f64, else => null, } else null, @@ -1049,7 +1049,7 @@ pub fn inferConstArrayType(self: *Lowering, name: []const u8, elements: []const if (elem_ty) |prev| { if (prev == lt) continue; // Numeric mix promotes to the float element type. - const numeric_pair = (prev == .s64 and lt == .f64) or (prev == .f64 and lt == .s64); + const numeric_pair = (prev == .i64 and lt == .f64) or (prev == .f64 and lt == .i64); if (numeric_pair) { elem_ty = .f64; continue; @@ -1089,7 +1089,7 @@ pub fn maybeRegisterConstStructGlobal(self: *Lowering, cd: *const ast.ConstDecl) /// Register a top-level mutable global (e.g., `context : Context = ---;`). /// Run AFTER `resolveForwardIdentifierAliases` so a forward identifier alias -/// in the type annotation (`A :: B; B :: s32; g : A = 7;`) resolves to its +/// in the type annotation (`A :: B; B :: i32; g : A = 7;`) resolves to its /// target instead of a fabricated empty-struct stub, which would otherwise /// give the global a type that mismatches its initializer at LLVM /// verification. Globals can't be named in a type position, so @@ -1143,7 +1143,7 @@ pub fn globalInitValue(self: *Lowering, vd: *const ast.VarDecl, var_ty: TypeId) self.checkIntLiteralFits(il.value, var_ty, v.span); break :blk .{ .int = il.value }; }, - // A negated literal (`g : s64 = -1;`) folds through the shared + // A negated literal (`g : i64 = -1;`) folds through the shared // const-expr serializer. The folded value follows the same rules as // the direct literal arms: int fits-check; a float at an integer // global narrows only when integral. @@ -1239,8 +1239,8 @@ pub fn diagnoseNonConstGlobal(self: *Lowering, vd: *const ast.VarDecl, v: *const /// is already resolved as a type author; a forward target isn't yet present, /// so `A` is left unregistered and its uses get falsely flagged as an unknown /// type. Re-resolve to a fixpoint now that every top-level name -/// has been seen, so `A :: B; B :: s32;` converges the same as the ordered -/// `B :: s32; A :: B;`. A value const is never an `.identifier` node +/// has been seen, so `A :: B; B :: i32;` converges the same as the ordered +/// `B :: i32; A :: B;`. A value const is never an `.identifier` node /// (`NotAType :: 123` is an int literal), and an alias whose target is a value /// const stays unresolved, so neither this pass nor the unknown-type suppression can register a /// non-type name. @@ -1274,8 +1274,8 @@ pub fn resolveForwardIdentifierAliases(self: *Lowering, decls: []const *const No if (self.aliasResolvedInSource(src, cd.name)) continue; const rhs = cd.value.data.identifier; // Pass the backtick raw flag so a forward alias whose RHS is a raw - // identifier (`` RawAlias :: `s2 ``, target declared later) resolves - // to the nominal `` `s2 `` author, not the builtin `s2` spelling. + // identifier (`` RawAlias :: `i2 ``, target declared later) resolves + // to the nominal `` `i2 `` author, not the builtin `i2` spelling. switch (self.selectNominalLeaf(rhs.name, src, rhs.is_raw)) { .resolved => |tid| { self.putTypeAlias(decl.source_file, cd.name, tid); @@ -1934,9 +1934,9 @@ pub fn structMethodFn(sd: *const ast.StructDecl, method: []const u8) ?*const ast /// TRUE iff `ref` is a TYPE-FUNCTION head author — a `fn_decl` (or const- /// wrapped fn) declaring at least one `$`-parameter, i.e. instantiable as a -/// bare type head (`Make(s64)` where `Make :: ($T) -> Type`). Mirrors the +/// bare type head (`Make(i64)` where `Make :: ($T) -> Type`). Mirrors the /// `fd.type_params.len > 0` gate every instantiation site uses to recognize a -/// type-fn head, so an ORDINARY same-name function (`Make :: () -> s32`, zero +/// type-fn head, so an ORDINARY same-name function (`Make :: () -> i32`, zero /// type params) is NOT a type-fn author and does NOT vouch for a hidden 2-flat- /// hop type-fn head (E4 attempt-8: a `fn_decl != null` author view let any /// visible function — type-fn or not — authorize a type head). @@ -2262,7 +2262,7 @@ pub fn lazyLowerFunction(self: *Lowering, name: []const u8) void { // Defer functions with type-category matches until all types are registered. // any_to_string uses `if type == { case slice: ... }` which compiles a switch // with type tags from resolveTypeCategoryTags. This must happen AFTER main is - // fully lowered so all types ([]s32, List__s32, etc.) are in the TypeTable. + // fully lowered so all types ([]i32, List__i32, etc.) are in the TypeTable. if (!self.processing_deferred and std.mem.eql(u8, name, "any_to_string")) { self.deferred_type_fns.append(self.alloc, name) catch {}; return; @@ -2557,8 +2557,8 @@ pub fn emitModuleConst(self: *Lowering, ci: ModuleConstInfo, author_source: ?[]c // accepted under the unified narrowing rule — materializes as its folded // int through the SAME `program_index.foldCountI64` the count / array-dim // path uses, so the const's emitted VALUE and its use as a COUNT come from - // one fold (`K : s64 : 4.0` → 4; `K : s64 : M + 2.0` → 4; and a float-const- - // leaf `KF : s64 : F + 1.5` → 4, which the int-only folder could not reach). + // one fold (`K : i64 : 4.0` → 4; `K : i64 : M + 2.0` → 4; and a float-const- + // leaf `KF : i64 : F + 1.5` → 4, which the int-only folder could not reach). // A non-integral float never arrives (it was rejected at registration); any // other non-foldable shape falls through to the per-kind emitters below. if (self.isIntEx(ci.ty)) { @@ -2597,5 +2597,5 @@ pub fn emitModuleConst(self: *Lowering, ci: ModuleConstInfo, author_source: ?[]c pub fn emitPlaceholder(self: *Lowering, name: []const u8) Ref { const sid = self.module.types.internString(name); - return self.builder.emit(.{ .placeholder = sid }, .s64); + return self.builder.emit(.{ .placeholder = sid }, .i64); } diff --git a/src/ir/lower/error.zig b/src/ir/lower/error.zig index 2e52a44..8987bba 100644 --- a/src/ir/lower/error.zig +++ b/src/ir/lower/error.zig @@ -428,8 +428,8 @@ pub fn lowerCallerLocation(self: *Lowering, node: *const Node) Ref { const func_name = self.currentFunctionName(); var fields = [_]Ref{ self.builder.constString(self.module.types.internString(file)), - self.builder.constInt(@intCast(loc.line), .s32), - self.builder.constInt(@intCast(loc.col), .s32), + self.builder.constInt(@intCast(loc.line), .i32), + self.builder.constInt(@intCast(loc.col), .i32), self.builder.constString(self.module.types.internString(func_name)), }; return self.builder.emit(.{ .struct_init = .{ .fields = self.alloc.dupe(Ref, &fields) catch unreachable } }, sl_tid); diff --git a/src/ir/lower/expr.zig b/src/ir/lower/expr.zig index fe527ba..82f23ed 100644 --- a/src/ir/lower/expr.zig +++ b/src/ir/lower/expr.zig @@ -82,7 +82,7 @@ pub fn lowerStructLiteral(self: *Lowering, sl: *const ast.StructLiteral, span: a // `.ambiguous`/`.not_visible` surface their loud diagnostic + poison. self.resolveNominalLeaf(name, false, span) else if (sl.type_expr) |te| - // Generic struct literal: Pair(s32).{ ... } — resolve type from type_expr + // Generic struct literal: Pair(i32).{ ... } — resolve type from type_expr self.resolveTypeWithBindings(te) else self.target_type orelse .unresolved; @@ -315,7 +315,7 @@ pub fn fixupMethodReceiver(self: *Lowering, method_args: *std.ArrayList(Ref), fu /// Get the name of a struct type (dereferencing pointers). Returns null for non-struct types. pub fn getStructTypeName(self: *Lowering, ty: TypeId) ?[]const u8 { if (ty.isBuiltin()) { - // Map builtin types to their names for method resolution (e.g., s64.eq) + // Map builtin types to their names for method resolution (e.g., i64.eq) return builtinTypeName(ty); } var resolved = ty; @@ -333,10 +333,10 @@ pub fn getStructTypeName(self: *Lowering, ty: TypeId) ?[]const u8 { pub fn builtinTypeName(ty: TypeId) ?[]const u8 { return switch (ty) { - .s8 => "s8", - .s16 => "s16", - .s32 => "s32", - .s64 => "s64", + .i8 => "i8", + .i16 => "i16", + .i32 => "i32", + .i64 => "i64", .u8 => "u8", .u16 => "u16", .u32 => "u32", @@ -351,7 +351,7 @@ pub fn builtinTypeName(ty: TypeId) ?[]const u8 { /// Resolve the type of a named field on a given type. pub fn resolveFieldType(self: *Lowering, ty: TypeId, field: []const u8) TypeId { - if (std.mem.eql(u8, field, "len")) return .s64; + if (std.mem.eql(u8, field, "len")) return .i64; if (std.mem.eql(u8, field, "ptr")) { const elem_ty = self.getElementType(ty); return self.module.types.manyPtrTo(elem_ty); @@ -497,7 +497,7 @@ pub fn lowerFieldAccess(self: *Lowering, fa: *const ast.FieldAccess, span: ast.S if (self.pack_param_count) |ppc| { if (fa.object.data == .identifier and std.mem.eql(u8, fa.field, "len")) { if (ppc.get(fa.object.data.identifier.name)) |n| { - return self.builder.constInt(@as(i64, @intCast(n)), .s64); + return self.builder.constInt(@as(i64, @intCast(n)), .i64); } } } @@ -606,7 +606,7 @@ pub fn lowerFieldAccess(self: *Lowering, fa: *const ast.FieldAccess, span: ast.S if (is_special) { if (std.mem.eql(u8, fa.field, "len")) { - return self.builder.emit(.{ .length = .{ .operand = obj } }, .s64); + return self.builder.emit(.{ .length = .{ .operand = obj } }, .i64); } { const elem_ty = self.getElementType(obj_ty); @@ -658,7 +658,7 @@ pub fn identifierBindsValue(self: *Lowering, name: []const u8) bool { /// a builtin type (a user struct → ordinary field lowering reports /// field-not-found). Two clean diagnostics (then a placeholder, so lowering /// finishes and `hasErrors()` aborts the build): -/// - a FLOAT-only accessor on an integer type (`s32.epsilon`, `u8.inf`); +/// - a FLOAT-only accessor on an integer type (`i32.epsilon`, `u8.inf`); /// - any accessor on a builtin NON-numeric receiver /// (`bool`/`string`/`void`/`Any`/`noreturn`). pub fn lowerNumericLimit(self: *Lowering, fa: *const ast.FieldAccess, span: ast.Span) ?Ref { @@ -704,7 +704,7 @@ pub fn lowerStructConstant(self: *Lowering, info: StructConstInfo) Ref { return switch (val_node.data) { .int_literal => |lit| blk: { if (info.ty) |t| self.checkIntLiteralFits(lit.value, t, val_node.span); - break :blk self.builder.constInt(lit.value, info.ty orelse .s64); + break :blk self.builder.constInt(lit.value, info.ty orelse .i64); }, .float_literal => |lit| self.builder.constFloat(lit.value, info.ty orelse .f64), .bool_literal => |lit| self.builder.constBool(lit.value), @@ -1199,9 +1199,9 @@ pub fn resolveArrayLiteralType(self: *Lowering, te: *const Node) TypeId { return self.module.types.vectorOf(elem, length); } } - // Generic-struct typed-literal head (`Box(s64).[...]`): route + // Generic-struct typed-literal head (`Box(i64).[...]`): route // through the single layout choke-point (CP-1). A qualified head - // `a.Box(s64).[...]` selects a's OWN template via the namespace edge + // `a.Box(i64).[...]` selects a's OWN template via the namespace edge // (Counter-1: was the global last-wins map); a bare head selects the // single bare-VISIBLE author. if (headNameOfCallee(cl.callee)) |hn| { @@ -1258,7 +1258,7 @@ pub fn lowerIndexExpr(self: *Lowering, ie: *const ast.IndexExpr) Ref { // bounds" instead of the generic "unresolved 'args'" that the // fall-through scope-lookup would produce. if (self.diagPackIndexOOB(ie)) { - return self.builder.constInt(0, .s64); + return self.builder.constInt(0, .i64); } // Runtime index into a comptime-only pack (Decision 1): a pack has no // runtime representation, so the index must be a compile-time constant. @@ -1271,7 +1271,7 @@ pub fn lowerIndexExpr(self: *Lowering, ie: *const ast.IndexExpr) Ref { if (self.diagnostics) |diags| { diags.addFmt(.err, ie.index.span, "pack '{s}' must be indexed by a compile-time constant — a pack is comptime-only and has no runtime value", .{pname}); } - return self.builder.constInt(0, .s64); + return self.builder.constInt(0, .i64); } } } @@ -1306,10 +1306,10 @@ pub fn lowerIndexExpr(self: *Lowering, ie: *const ast.IndexExpr) Ref { pub fn lowerSliceExpr(self: *Lowering, se: *const ast.SliceExpr) Ref { const obj = self.lowerExpr(se.object); - var lo = if (se.start) |s| self.lowerExpr(s) else self.builder.constInt(0, .s64); - if (se.start_exclusive) lo = self.builder.add(lo, self.builder.constInt(1, .s64), .s64); - var hi = if (se.end) |e| self.lowerExpr(e) else self.builder.emit(.{ .length = .{ .operand = obj } }, .s64); - if (se.end_inclusive) hi = self.builder.add(hi, self.builder.constInt(1, .s64), .s64); + var lo = if (se.start) |s| self.lowerExpr(s) else self.builder.constInt(0, .i64); + if (se.start_exclusive) lo = self.builder.add(lo, self.builder.constInt(1, .i64), .i64); + var hi = if (se.end) |e| self.lowerExpr(e) else self.builder.emit(.{ .length = .{ .operand = obj } }, .i64); + if (se.end_inclusive) hi = self.builder.add(hi, self.builder.constInt(1, .i64), .i64); // Infer result slice type from the object const obj_ty = self.inferExprType(se.object); // Subslice of string stays string (same {ptr, i64} layout, correct type category) @@ -1598,8 +1598,8 @@ pub fn lowerExpr(self: *Lowering, node: *const Node) Ref { } } const ty = if (self.target_type) |tt| blk: { - break :blk if (self.isIntEx(tt)) tt else .s64; - } else .s64; + break :blk if (self.isIntEx(tt)) tt else .i64; + } else .i64; self.checkIntLiteralFits(lit.value, ty, node.span); return self.builder.constInt(lit.value, ty); }, @@ -1645,7 +1645,7 @@ pub fn lowerExpr(self: *Lowering, node: *const Node) Ref { // Check compile-time constants (OS, ARCH, POINTER_SIZE) before globals if (self.comptime_constants.get(id.name)) |cv| { switch (cv) { - .int_val => |iv| break :blk self.builder.constInt(iv, .s64), + .int_val => |iv| break :blk self.builder.constInt(iv, .i64), .enum_tag => |et| break :blk self.builder.constInt(@intCast(et.tag), et.ty), } } @@ -1683,7 +1683,7 @@ pub fn lowerExpr(self: *Lowering, node: *const Node) Ref { .untracked => break :blk self.builder.emit(.{ .global_get = gi.id }, gi.ty), } } - // Check module-level value constants (e.g. AF_INET :s32: 2) + // Check module-level value constants (e.g. AF_INET :i32: 2) if (self.program_index.module_const_map.get(id.name)) |ci_global| { if (!self.isNameVisible(id.name)) { if (self.diagnostics) |d| @@ -1820,7 +1820,7 @@ pub fn lowerExpr(self: *Lowering, node: *const Node) Ref { // examples/50-smoke.sx has both shapes. } } - break :blk self.builder.emit(.{ .func_ref = fid }, .s64); + break :blk self.builder.emit(.{ .func_ref = fid }, .i64); } } // Type-as-value: a name that resolves to a TypeId @@ -1927,7 +1927,7 @@ pub fn lowerExpr(self: *Lowering, node: *const Node) Ref { break :blk self.builder.constFloat(@floatFromInt(v), tt); } } - const nty = if (self.target_type) |tt| (if (self.isIntEx(tt)) tt else TypeId.s64) else TypeId.s64; + const nty = if (self.target_type) |tt| (if (self.isIntEx(tt)) tt else TypeId.i64) else TypeId.i64; self.checkIntLiteralFits(v, nty, node.span); break :blk self.builder.constInt(v, nty); } @@ -2031,7 +2031,7 @@ pub fn lowerExpr(self: *Lowering, node: *const Node) Ref { }, // type_expr can appear as a variable reference when the name collides - // with a builtin type name (e.g. s2, u8). Check scope first. + // with a builtin type name (e.g. i2, u8). Check scope first. .type_expr => |te| blk: { if (self.scope) |scope| { if (scope.lookup(te.name)) |binding| { @@ -2057,8 +2057,8 @@ pub fn lowerExpr(self: *Lowering, node: *const Node) Ref { // Compound type literals (`*T`, `[]T`, `[*]T`, `?T`, `[N]T`, fn types) // in expression position are first-class `Type` values, exactly like - // the named form above (`t : Type = *s64;` ↔ `t : Type = f64;`). Also - // the path a static `cast(*s64) v` type argument takes — call args are + // the named form above (`t : Type = *i64;` ↔ `t : Type = f64;`). Also + // the path a static `cast(*i64) v` type argument takes — call args are // lowered before the cast handler inspects the AST (issue 0118). .pointer_type_expr, .many_pointer_type_expr, @@ -2128,7 +2128,7 @@ pub fn lowerBinaryOp(self: *Lowering, bop: *const ast.BinaryOp) Ref { } // Type-literal comparison fold: when both sides are type-shaped - // AST nodes (`s64`, `*u8`, `?T`, `[3]f64`, etc.) OR resolve to + // AST nodes (`i64`, `*u8`, `?T`, `[3]f64`, etc.) OR resolve to // a static TypeId at lower time (`type_of(x)` for any // statically-typed `x`), resolve each and emit a `const_bool`. // Same semantic as `type_eq(A, B)` but using the standard `==` @@ -2144,11 +2144,11 @@ pub fn lowerBinaryOp(self: *Lowering, bop: *const ast.BinaryOp) Ref { } } - // Any-shaped `==` (e.g. `t == s64` where `t: Type`): both + // Any-shaped `==` (e.g. `t == i64` where `t: Type`): both // operands are 16-byte `{tag, value}` aggregates. LLVM // doesn't accept `icmp` on aggregates directly. Decompose // via `unbox_any` (which extracts the value field at - // `.s64`) and compare the i64s. Tag fields are stable + // `.i64`) and compare the i64s. Tag fields are stable // across compilations of the same source so value-only // identity is enough. if (bop.op == .eq or bop.op == .neq) { @@ -2157,8 +2157,8 @@ pub fn lowerBinaryOp(self: *Lowering, bop: *const ast.BinaryOp) Ref { if (lhs_ty == .any and rhs_ty == .any) { const lhs = self.lowerExpr(bop.lhs); const rhs = self.lowerExpr(bop.rhs); - const lhs_val = self.builder.emit(.{ .unbox_any = .{ .operand = lhs } }, .s64); - const rhs_val = self.builder.emit(.{ .unbox_any = .{ .operand = rhs } }, .s64); + const lhs_val = self.builder.emit(.{ .unbox_any = .{ .operand = lhs } }, .i64); + const rhs_val = self.builder.emit(.{ .unbox_any = .{ .operand = rhs } }, .i64); if (bop.op == .eq) { return self.builder.emit(.{ .cmp_eq = .{ .lhs = lhs_val, .rhs = rhs_val } }, .bool); } else { @@ -2249,7 +2249,7 @@ pub fn lowerBinaryOp(self: *Lowering, bop: *const ast.BinaryOp) Ref { if (rhs_ref_pointee) |p| rhs = self.builder.load(rhs, p); self.target_type = saved_tt; // Result type follows the shared promotion rule: an int LHS with a - // float RHS promotes to the float (`s64 * f32` → `f32`); vectors / + // float RHS promotes to the float (`i64 * f32` → `f32`); vectors / // structs keep the LHS type. `inferExprType` reuses the same helper // so static typing agrees with the value produced here. const rhs_inferred = rhs_ref_pointee orelse self.inferExprType(bop.rhs); @@ -2298,7 +2298,7 @@ pub fn lowerBinaryOp(self: *Lowering, bop: *const ast.BinaryOp) Ref { } // Reject scalar ops on incompatible operand types (e.g. - // `s64 + string`, `s64 < string`, `s64 & string`). The result type + // `i64 + string`, `i64 < string`, `i64 & string`). The result type // `ty` is derived from the LHS, so without this the op lowers as // ` : ` and either reinterprets the RHS bytes (arithmetic // / bitwise → garbage) or feeds mismatched LLVM types to `icmp` @@ -2448,7 +2448,7 @@ pub fn lowerTupleOp(self: *Lowering, bop: *const ast.BinaryOp, lhs: Ref, rhs: Re // Lexicographic comparison return self.lowerTupleLexCompare(bop.op, lhs, rhs, lhs_fields); }, - else => return self.builder.constInt(0, .s64), + else => return self.builder.constInt(0, .i64), } } diff --git a/src/ir/lower/ffi.zig b/src/ir/lower/ffi.zig index c344910..05eb1ee 100644 --- a/src/ir/lower/ffi.zig +++ b/src/ir/lower/ffi.zig @@ -318,14 +318,14 @@ pub fn lowerForeignMethodCall( const ret_ty = if (method.return_type) |rt| self.resolveType(rt) else .void; // Reject return types the JNI emit path can't dispatch — emit_llvm's - // CallMethod switch only covers void / bool / s32 / s64 / f32 / f64 - // / pointer-returning. Anything else (s8 / s16 / u8 / u16 / aggregates) + // CallMethod switch only covers void / bool / i32 / i64 / f32 / f64 + // / pointer-returning. Anything else (i8 / i16 / u8 / u16 / aggregates) // would silently lower to LLVMGetUndef and produce wrong arguments at - // the call site (chess Android touch shipped broken because s32→s32+ + // the call site (chess Android touch shipped broken because i32→i32+ // f32 returns hit the undef path before .f32 was wired up). if (!jni_descriptor.isJniReturnTypeSupported(&self.module.types, ret_ty)) { if (self.diagnostics) |d| { - d.addFmt(.err, span, "JNI method '{s}.{s}' returns '{s}', which isn't supported by the JNI call-method lowering yet — only void/bool/s32/s64/f32/f64 and pointers are wired up", .{ fcd.name, method.name, self.module.types.typeName(ret_ty) }); + d.addFmt(.err, span, "JNI method '{s}.{s}' returns '{s}', which isn't supported by the JNI call-method lowering yet — only void/bool/i32/i64/f32/f64 and pointers are wired up", .{ fcd.name, method.name, self.module.types.typeName(ret_ty) }); } return Ref.none; } diff --git a/src/ir/lower/generic.zig b/src/ir/lower/generic.zig index 2eea14e..212d46e 100644 --- a/src/ir/lower/generic.zig +++ b/src/ir/lower/generic.zig @@ -190,7 +190,7 @@ pub fn monomorphizeFunction(self: *Lowering, fd: *const ast.FnDecl, mangled_name /// - type_expr AST nodes /// True iff `node` matches an AST shape that `resolveTypeArg` /// can resolve to a concrete TypeId without falling through to -/// the silent `.s64` default. Used by `tryLowerReflectionCall` +/// the silent `.i64` default. Used by `tryLowerReflectionCall` /// to split static-fold from dynamic-builtin-call paths. /// /// Static-arg shapes mirror the explicit arms of `resolveTypeArg`: @@ -206,9 +206,9 @@ pub fn monomorphizeFunction(self: *Lowering, fd: *const ast.FnDecl, mangled_name pub fn isStaticTypeArg(self: *Lowering, node: *const Node) bool { switch (node.data) { .type_expr => |te| { - // A type-keyword name (e.g. `s64`) is always static. + // A type-keyword name (e.g. `i64`) is always static. // A user-defined name that happens to be in scope as - // a runtime variable (`x: Type = s64; type_name(x)`) + // a runtime variable (`x: Type = i64; type_name(x)`) // is NOT static — route through the dynamic builtin // call so the runtime lookup table fires. if (self.scope) |scope| { @@ -245,7 +245,7 @@ pub fn isStaticTypeArg(self: *Lowering, node: *const Node) bool { pub fn isStaticTypeRef(self: *Lowering, node: *const Node) bool { switch (node.data) { .type_expr => |te| { - // Compound type names (`s64`, `Point`, `Vec4`) resolve + // Compound type names (`i64`, `Point`, `Vec4`) resolve // statically. If the name is also a runtime var in // scope, it's a value reference, not a type ref. if (self.scope) |scope| { @@ -286,10 +286,10 @@ pub fn isStaticTypeRef(self: *Lowering, node: *const Node) bool { } } -/// Resolve a tuple LITERAL used in a type position (`(s32, s32)` reinterpreted +/// Resolve a tuple LITERAL used in a type position (`(i32, i32)` reinterpreted /// as a tuple type at a type-demanding site such as `size_of`). Every element /// must itself denote a type; a non-type element — e.g. the `1` in -/// `(s32, 1)` — is a user error. Emit a diagnostic pointing at the offending +/// `(i32, 1)` — is a user error. Emit a diagnostic pointing at the offending /// element and return `.unresolved`; never fabricate a tuple with a bogus /// field. type_bridge.resolveAstType builds the tuple only after /// this validation passes. @@ -297,12 +297,12 @@ pub fn resolveTupleLiteralTypeArg(self: *Lowering, node: *const Node) TypeId { for (node.data.tuple_literal.elements) |el| { if (!type_bridge.isTypeShapedAstNode(el.value, &self.module.types)) { if (self.diagnostics) |diags| { - diags.addFmt(.err, el.value.span, "tuple type element is not a type (found `{s}`); a tuple used as a type must list only types, e.g. `(s32, s32)`", .{@tagName(el.value.data)}); + diags.addFmt(.err, el.value.span, "tuple type element is not a type (found `{s}`); a tuple used as a type must list only types, e.g. `(i32, i32)`", .{@tagName(el.value.data)}); } return .unresolved; } // E4 single-hop visibility gate: each element leaf is resolved through - // the source-aware resolver, so a 2-flat-hop inner leaf (`(COnly, s64)`) + // the source-aware resolver, so a 2-flat-hop inner leaf (`(COnly, i64)`) // emits "not visible" + poisons rather than leaking through // `type_bridge`'s ungated global lookup. A valid element resolves to the // same TypeId the delegated build produces below (no diagnostic, no @@ -314,10 +314,10 @@ pub fn resolveTupleLiteralTypeArg(self: *Lowering, node: *const Node) TypeId { pub fn resolveTypeArg(self: *Lowering, node: *const Node) TypeId { // Pack-index access in a type-arg slot (e.g. `type_name($args[0])` - // or `type_eq($args[i], s64)`). Same shape as the + // or `type_eq($args[i], i64)`). Same shape as the // `resolveTypeWithBindings` arm — looks up the bound pack types // and returns the i-th. OOB and no-active-binding emit focused - // diagnostics rather than silently defaulting to .s64 (the + // diagnostics rather than silently defaulting to .i64 (the // catch-all `else` below) — that fall-through is exactly the // "silent unimplemented arm" the project's REJECTED PATTERNS // forbid. @@ -392,8 +392,8 @@ pub fn resolveTypeArg(self: *Lowering, node: *const Node) TypeId { // time when `x`'s type is statically known (which it // is for any expression — type inference always // produces a concrete TypeId). Lets - // `type_of(a) == s64` fold the same as - // `inferExprType(a) == s64`. + // `type_of(a) == i64` fold the same as + // `inferExprType(a) == i64`. if (cl.callee.data == .identifier and std.mem.eql(u8, cl.callee.data.identifier.name, "type_of") and cl.args.len == 1) @@ -407,7 +407,7 @@ pub fn resolveTypeArg(self: *Lowering, node: *const Node) TypeId { // route through the gated `resolveTypeWithBindings`, whose // `resolveCompound` recurses each element through the source-aware leaf // (`resolveNominalLeaf`) — so a 2-hop inner leaf (`*COnly`, `[2]COnly`, - // `(COnly, s64)`) is rejected exactly as in a normal annotation, instead + // `(COnly, i64)`) is rejected exactly as in a normal annotation, instead // of `type_bridge.resolveAstType`'s ungated global lookup (E4). .tuple_literal, .pointer_type_expr, @@ -421,13 +421,13 @@ pub fn resolveTypeArg(self: *Lowering, node: *const Node) TypeId { } } -/// Format a type name for display (e.g. "*Point", "[]s32", "[3]f64"). +/// Format a type name for display (e.g. "*Point", "[]i32", "[3]f64"). pub fn formatTypeName(self: *Lowering, ty: TypeId) []const u8 { // Builtin types: use their canonical name - if (ty == .s8) return "s8"; - if (ty == .s16) return "s16"; - if (ty == .s32) return "s32"; - if (ty == .s64) return "s64"; + if (ty == .i8) return "i8"; + if (ty == .i16) return "i16"; + if (ty == .i32) return "i32"; + if (ty == .i64) return "i64"; if (ty == .u8) return "u8"; if (ty == .u16) return "u16"; if (ty == .u32) return "u32"; @@ -463,7 +463,7 @@ pub fn formatTypeName(self: *Lowering, ty: TypeId) []const u8 { const inner = self.formatTypeName(a.element); break :blk std.fmt.allocPrint(self.alloc, "[{d}]{s}", .{ a.length, inner }) catch "array"; }, - .signed => |w| std.fmt.allocPrint(self.alloc, "s{d}", .{w}) catch "signed", + .signed => |w| std.fmt.allocPrint(self.alloc, "i{d}", .{w}) catch "signed", .unsigned => |w| std.fmt.allocPrint(self.alloc, "u{d}", .{w}) catch "unsigned", .optional => |o| blk: { const inner = self.formatTypeName(o.child); @@ -477,7 +477,7 @@ pub fn formatTypeName(self: *Lowering, ty: TypeId) []const u8 { }; } -/// Format a function type string like "() -> s32" or "(s32, s32) -> s32". +/// Format a function type string like "() -> i32" or "(i32, i32) -> i32". pub fn formatFnTypeString(self: *Lowering, fd: *const ast.FnDecl) []const u8 { var buf: [512]u8 = undefined; var pos: usize = 0; @@ -509,7 +509,7 @@ pub fn formatFnTypeString(self: *Lowering, fd: *const ast.FnDecl) []const u8 { } /// Format a type name for function name mangling (identifier-safe). -/// E.g. *Point → "ptr_Point", []s32 → "slice_s32", [3]f64 → "array_3_f64". +/// E.g. *Point → "ptr_Point", []i32 → "slice_i32", [3]f64 → "array_3_f64". /// Check if a param type expression references a type param name (possibly nested). pub fn matchTypeParam(_: *Lowering, type_node: *const Node, tp_name: []const u8) bool { return switch (type_node.data) { @@ -548,7 +548,7 @@ pub fn matchTypeParamStatic(type_node: *const Node, tp_name: []const u8) bool { } /// Extract the concrete type that corresponds to a type param from an arg type. -/// E.g., param type []$T with arg type []s64 → T = s64. +/// E.g., param type []$T with arg type []i64 → T = i64. pub fn extractTypeParam(self: *Lowering, type_node: *const Node, arg_ty: TypeId, tp_name: []const u8) ?TypeId { return switch (type_node.data) { .type_expr => |te| if (std.mem.eql(u8, te.name, tp_name)) arg_ty else null, @@ -635,10 +635,10 @@ pub fn resolveTypeCategoryTags(self: *Lowering, name: []const u8) []const u64 { // Fixed builtin categories if (std.mem.eql(u8, name, "int")) { - tags.append(self.alloc, TypeId.s8.index()) catch {}; - tags.append(self.alloc, TypeId.s16.index()) catch {}; - tags.append(self.alloc, TypeId.s32.index()) catch {}; - tags.append(self.alloc, TypeId.s64.index()) catch {}; + tags.append(self.alloc, TypeId.i8.index()) catch {}; + tags.append(self.alloc, TypeId.i16.index()) catch {}; + tags.append(self.alloc, TypeId.i32.index()) catch {}; + tags.append(self.alloc, TypeId.i64.index()) catch {}; tags.append(self.alloc, TypeId.u8.index()) catch {}; tags.append(self.alloc, TypeId.u16.index()) catch {}; tags.append(self.alloc, TypeId.u32.index()) catch {}; @@ -823,7 +823,7 @@ pub fn isPlainFreeFn(fd: *const ast.FnDecl) bool { /// Resolve a generic value-param argument (`$K: u32`) to its compile-time /// integer AND verify it fits the param's declared integer type. The folded /// value is bound and mangled into the instantiation name, so a module/generic -/// const arg (`Vec(N, f32)`), a const expression (`Make(M + 1, s64)`), an +/// const arg (`Vec(N, f32)`), a const expression (`Make(M + 1, i64)`), an /// integral float (`Box(4.0)` → 4), and a literal (`Vec(3, f32)`) all bind the /// same value a literal would. An out-of-range arg (`Box(5_000_000_000)` for a /// `u32` param) or a non-const arg emits a clean diagnostic and returns null; @@ -838,8 +838,8 @@ pub fn isPlainFreeFn(fd: *const ast.FnDecl) bool { /// `program_index.intTypeRange`; an unrecognised type folds without bounding. pub fn resolveValueParamArg(self: *Lowering, arg_node: *const Node, param_name: []const u8, type_name: ?[]const u8) ?i64 { // Resolve an ALIASED integer constraint (`$K: Count` where `Count :: u32`, - // `$K: Small` where `Small :: s8`) to its underlying builtin so the range - // gate below treats it exactly like `$K: u32` / `$K: s8` (an + // `$K: Small` where `Small :: i8`) to its underlying builtin so the range + // gate below treats it exactly like `$K: u32` / `$K: i8` (an // alias previously slipped past `intTypeRange`, so `Box(5_000_000_000)` // with `$K: Count` bound a truncated value). A non-integer / unrecognised // constraint yields null → no range bound (fold only), as before. @@ -887,7 +887,7 @@ pub fn resolveValueParamArg(self: *Lowering, arg_node: *const Node, param_name: /// Resolve a generic value-param constraint type NAME to its canonical builtin /// integer type name, chasing a type alias (`Count :: u32` → "u32", -/// `Small :: s8` → "s8") so an ALIASED integer constraint range-checks exactly +/// `Small :: i8` → "i8") so an ALIASED integer constraint range-checks exactly /// like the builtin it names. Returns the name unchanged when it is already a /// builtin integer; null when it isn't an integer type (directly or via alias) /// — the caller then folds without a range bound rather than guessing. The @@ -914,8 +914,8 @@ pub fn diagValueParamRange(self: *Lowering, arg_node: *const Node, param_name: [ /// The poison-vs-proceed projection of `headTypeGate` for an UNQUALIFIED /// parameterized type HEAD that names a generic STRUCT, a parameterized -/// PROTOCOL, or a type-returning function used as a head (`Box(s64)`, -/// `VL(s64)`) — and the alias-registration / type-match sites that likewise +/// PROTOCOL, or a type-returning function used as a head (`Box(i64)`, +/// `VL(i64)`) — and the alias-registration / type-match sites that likewise /// only need "poison or proceed". Returns TRUE (the gate's loud diagnostic is /// already emitted) when the head is `.not_visible` (a 2-flat-hop leak) or /// `.ambiguous` (≥2 direct flat same-name authors — consistent with the leaf / @@ -1186,7 +1186,7 @@ pub fn flatFnAuthorAmbiguous(self: *Lowering, name: []const u8, from: []const u8 /// analogue of `isNameVisible` for a type-fn head: a same-name 1-hop /// NON-function (a value const `Make :: 123`, a named type) does NOT vouch /// (attempt-7), and — crucially — neither does a same-name 1-hop ORDINARY -/// function (`Make :: () -> s32`, zero `$`-params), which cannot be the type +/// function (`Make :: () -> i32`, zero `$`-params), which cannot be the type /// head being instantiated (attempt-8). So a type-fn whose only directly- /// visible same-name author is a non-fn OR a non-type-fn — its real author 2 /// flat hops away — is correctly invisible. Mirrors `flatFnAuthorAmbiguous`'s @@ -1290,7 +1290,7 @@ pub fn resolveParameterizedWithBindings(self: *Lowering, pt: *const ast.Paramete } } - // Parameterized protocol used as a value type (`VL(s64)`): materialize a + // Parameterized protocol used as a value type (`VL(i64)`): materialize a // 16-byte protocol value with the type-arg bound (not a 0-field stub). if (self.program_index.protocol_ast_map.get(base_name)) |pd| { if (pd.type_params.len > 0) { @@ -1300,7 +1300,7 @@ pub fn resolveParameterizedWithBindings(self: *Lowering, pt: *const ast.Paramete } // User-defined type-returning function used as a TYPE annotation - // (`b : Make(N, s64)` where `Make :: ($K: u32, $T: Type) -> Type`). The + // (`b : Make(N, i64)` where `Make :: ($K: u32, $T: Type) -> Type`). The // `.call`-node path (`resolveTypeCallWithBindings`) already routes here; // a `parameterized_type_expr` must too, or the function name falls through // to the empty-struct stub below and `b.field` / `b.len` fails. @@ -1409,7 +1409,7 @@ pub fn instantiateGenericStruct(self: *Lowering, tmpl: *const StructTemplate, ar // A qualified `ns.Box(..)` head can select a generic template whose bare // name also belongs to a DIFFERENT module's same-name template (the one // that won the last-wins `struct_template_map`). Both would mangle to - // `Box__s64` and the second instantiation would alias the first's layout. + // `Box__i64` and the second instantiation would alias the first's layout. // Tag the NON-canonical author's mangled name with its source so each // author's instantiation is a distinct type. The canonical (bare-map) // author keeps the untagged name — no churn for single-author generics. @@ -1548,7 +1548,7 @@ pub fn instantiateGenericStruct(self: *Lowering, tmpl: *const StructTemplate, ar table.updatePreservingKey(id, info); // Bind the template name to this concrete instance so a method's - // `self: *Combined` (the template name) resolves to `*Combined__s64_s64` + // `self: *Combined` (the template name) resolves to `*Combined__i64_i64` // — otherwise `self.field` hits the 0-field generic stub. tb.put(tmpl.name, id) catch {}; @@ -1694,7 +1694,7 @@ pub fn instantiateTypeFunction(self: *Lowering, alias_name: []const u8, template // struct/union/enum — `return [K]T`, `Vector(K, T)`, `*T`, an alias, etc. // Resolve it with the value/type bindings active (so `[K]T` folds K to a // compile-time integer). The result is interned structurally, so - // `Make(N, s64)`, `Make(3, s64)`, and `Make(M + 1, s64)` all yield the + // `Make(N, i64)`, `Make(3, i64)`, and `Make(M + 1, i64)` all yield the // same TypeId. `.unresolved` means the return wasn't a type expression // (e.g. a value-returning function in a type position) → fall through to // the caller's fallback rather than fabricating a type. @@ -1741,7 +1741,7 @@ pub fn instantiateTypeUnion(self: *Lowering, alias_name: []const u8, mangled_nam const info: types.TypeInfo = .{ .tagged_union = .{ .name = alias_name_id, .fields = variant_fields.items, - .tag_type = .s64, + .tag_type = .i64, } }; const id = if (table.findByName(alias_name_id)) |existing| existing else table.intern(info); table.updatePreservingKey(id, info); @@ -1752,7 +1752,7 @@ pub fn instantiateTypeUnion(self: *Lowering, alias_name: []const u8, mangled_nam const mangled_info: types.TypeInfo = .{ .tagged_union = .{ .name = mangled_name_id, .fields = variant_fields.items, - .tag_type = .s64, + .tag_type = .i64, } }; const mid = if (table.findByName(mangled_name_id)) |existing| existing else table.intern(mangled_info); table.updatePreservingKey(mid, mangled_info); diff --git a/src/ir/lower/nominal.zig b/src/ir/lower/nominal.zig index 99f148e..99704a0 100644 --- a/src/ir/lower/nominal.zig +++ b/src/ir/lower/nominal.zig @@ -102,7 +102,7 @@ pub fn reserveShadowEnumSlot(self: *Lowering, ed: *const ast.EnumDecl) void { const name_id = table.internString(ed.name); const nominal_id = self.shadowNominalId(name_id); const empty: types.TypeInfo = if (ed.variant_types.len > 0) - .{ .tagged_union = .{ .name = name_id, .fields = &.{}, .tag_type = .s64 } } + .{ .tagged_union = .{ .name = name_id, .fields = &.{}, .tag_type = .i64 } } else .{ .@"enum" = .{ .name = name_id, .variants = &.{} } }; const reserved = table.internNominal(empty, nominal_id); @@ -534,7 +534,7 @@ pub fn bareVisibleStructTemplate(self: *Lowering, name: []const u8) ?StructTempl } /// Instantiate a generic struct template and register the result under an -/// alias name (`Vec3 :: Vec(3, f32)` / `ABox :: a.Box(s64)`). Shared by the +/// alias name (`Vec3 :: Vec(3, f32)` / `ABox :: a.Box(i64)`). Shared by the /// `.call` and `.parameterized_type_expr` const-decl alias branches and the /// qualified-head selection that precedes the bare `struct_template_map` /// fallback in each. diff --git a/src/ir/lower/objc_class.zig b/src/ir/lower/objc_class.zig index 105fdf4..4e4a8de 100644 --- a/src/ir/lower/objc_class.zig +++ b/src/ir/lower/objc_class.zig @@ -906,10 +906,10 @@ pub fn emitObjcDefinedAllocAndInit( // (3) memset(state, 0, STATE_SIZE) — zero everything including the // allocator slot; the next store re-writes the allocator slot. - const memset_fid = self.ensureCRuntimeDecl("memset", &.{ ptr_void, .s32, .u64 }, ptr_void); + const memset_fid = self.ensureCRuntimeDecl("memset", &.{ ptr_void, .i32, .u64 }, ptr_void); const memset_args = self.alloc.alloc(Ref, 3) catch return null; memset_args[0] = state; - memset_args[1] = self.builder.constInt(0, .s32); + memset_args[1] = self.builder.constInt(0, .i32); memset_args[2] = size_const; _ = self.builder.emit(.{ .call = .{ .callee = memset_fid, .args = memset_args } }, ptr_void); diff --git a/src/ir/lower/pack.zig b/src/ir/lower/pack.zig index 7d4df20..80a3da5 100644 --- a/src/ir/lower/pack.zig +++ b/src/ir/lower/pack.zig @@ -176,10 +176,10 @@ pub fn lowerPackToSlice(self: *Lowering, pack_name: []const u8, slice_ty: TypeId }; const slice_slot = self.builder.alloca(slice_ty); const ptr_gep = self.builder.structGepTyped(slice_slot, 0, self.module.types.ptrTo(elem_ty), slice_ty); - const len_gep = self.builder.structGepTyped(slice_slot, 1, .s64, slice_ty); + const len_gep = self.builder.structGepTyped(slice_slot, 1, .i64, slice_ty); if (arg_nodes.len == 0) { self.builder.store(ptr_gep, self.builder.constNull(self.module.types.ptrTo(elem_ty))); - self.builder.store(len_gep, self.builder.constInt(0, .s64)); + self.builder.store(len_gep, self.builder.constInt(0, .i64)); return self.builder.load(slice_slot, slice_ty); } const array_ty = self.module.types.arrayOf(elem_ty, @intCast(arg_nodes.len)); @@ -193,12 +193,12 @@ pub fn lowerPackToSlice(self: *Lowering, pack_name: []const u8, slice_ty: TypeId } else if (elem_is_protocol) { if (source_ty != elem_ty) val = self.buildProtocolErasure(val, arg, source_ty, elem_ty); } - const ep = self.builder.emit(.{ .index_gep = .{ .lhs = array_slot, .rhs = self.builder.constInt(@intCast(i), .s64) } }, self.module.types.ptrTo(elem_ty)); + const ep = self.builder.emit(.{ .index_gep = .{ .lhs = array_slot, .rhs = self.builder.constInt(@intCast(i), .i64) } }, self.module.types.ptrTo(elem_ty)); self.builder.store(ep, val); } - const data_ptr = self.builder.emit(.{ .index_gep = .{ .lhs = array_slot, .rhs = self.builder.constInt(0, .s64) } }, self.module.types.ptrTo(elem_ty)); + const data_ptr = self.builder.emit(.{ .index_gep = .{ .lhs = array_slot, .rhs = self.builder.constInt(0, .i64) } }, self.module.types.ptrTo(elem_ty)); self.builder.store(ptr_gep, data_ptr); - self.builder.store(len_gep, self.builder.constInt(@intCast(arg_nodes.len), .s64)); + self.builder.store(len_gep, self.builder.constInt(@intCast(arg_nodes.len), .i64)); return self.builder.load(slice_slot, slice_ty); } @@ -211,12 +211,12 @@ pub fn lowerVariadicArgs(self: *Lowering, param_name: []const u8, call_args: []c if (n == 0) { // Empty slice: {null, 0} const null_ptr = self.builder.constNull(self.module.types.ptrTo(.any)); - const zero_len = self.builder.constInt(0, .s64); + const zero_len = self.builder.constInt(0, .i64); const slice_slot = self.builder.alloca(any_slice_ty); // Store ptr (field 0) and len (field 1) into the slice alloca const ptr_gep = self.builder.structGepTyped(slice_slot, 0, self.module.types.ptrTo(.any), any_slice_ty); self.builder.store(ptr_gep, null_ptr); - const len_gep = self.builder.structGepTyped(slice_slot, 1, .s64, any_slice_ty); + const len_gep = self.builder.structGepTyped(slice_slot, 1, .i64, any_slice_ty); self.builder.store(len_gep, zero_len); if (self.scope) |scope| { scope.put(param_name, .{ .ref = slice_slot, .ty = any_slice_ty, .is_alloca = true }); @@ -232,7 +232,7 @@ pub fn lowerVariadicArgs(self: *Lowering, param_name: []const u8, call_args: []c for (call_args[start_idx..], 0..) |arg, i| { var val = self.lowerExpr(arg); var source_ty = self.inferExprType(arg); - // If AST-based inference falls back to .s64 but the lowered ref is a string/struct, use that + // If AST-based inference falls back to .i64 but the lowered ref is a string/struct, use that if (source_ty == .unresolved) { const ref_ty = self.builder.getRefType(val); if (ref_ty == .string or ref_ty == .f32 or ref_ty == .f64 or ref_ty == .bool) { @@ -270,7 +270,7 @@ pub fn lowerVariadicArgs(self: *Lowering, param_name: []const u8, call_args: []c } const boxed = if (source_ty == .any) val else self.builder.boxAny(val, source_ty); // GEP to array[i] and store - const idx_ref = self.builder.constInt(@intCast(i), .s64); + const idx_ref = self.builder.constInt(@intCast(i), .i64); const elem_ptr = self.builder.emit(.{ .index_gep = .{ .lhs = array_slot, .rhs = idx_ref } }, self.module.types.ptrTo(.any)); self.builder.store(elem_ptr, boxed); } @@ -278,13 +278,13 @@ pub fn lowerVariadicArgs(self: *Lowering, param_name: []const u8, call_args: []c // Build slice {ptr_to_first_element, len} const slice_slot = self.builder.alloca(any_slice_ty); // Get pointer to first element (array_slot is *[N x Any], GEP to element 0 gives *Any) - const zero = self.builder.constInt(0, .s64); + const zero = self.builder.constInt(0, .i64); const data_ptr = self.builder.emit(.{ .index_gep = .{ .lhs = array_slot, .rhs = zero } }, self.module.types.ptrTo(.any)); - const len_ref = self.builder.constInt(@intCast(n), .s64); + const len_ref = self.builder.constInt(@intCast(n), .i64); // Store into slice fields const ptr_gep = self.builder.structGepTyped(slice_slot, 0, self.module.types.ptrTo(.any), any_slice_ty); self.builder.store(ptr_gep, data_ptr); - const len_gep = self.builder.structGepTyped(slice_slot, 1, .s64, any_slice_ty); + const len_gep = self.builder.structGepTyped(slice_slot, 1, .i64, any_slice_ty); self.builder.store(len_gep, len_ref); if (self.scope) |scope| { @@ -351,11 +351,11 @@ pub fn packVariadicCallArgs(self: *Lowering, fd: *const ast.FnDecl, c: *const as if (variadic_count == 0) { // Empty slice const null_ptr = self.builder.constNull(self.module.types.ptrTo(elem_ty)); - const zero_len = self.builder.constInt(0, .s64); + const zero_len = self.builder.constInt(0, .i64); const slice_slot = self.builder.alloca(slice_ty); const ptr_gep = self.builder.structGepTyped(slice_slot, 0, self.module.types.ptrTo(elem_ty), slice_ty); self.builder.store(ptr_gep, null_ptr); - const len_gep = self.builder.structGepTyped(slice_slot, 1, .s64, slice_ty); + const len_gep = self.builder.structGepTyped(slice_slot, 1, .i64, slice_ty); self.builder.store(len_gep, zero_len); const slice_val = self.builder.load(slice_slot, slice_ty); // Replace args: keep fixed args, append slice @@ -385,7 +385,7 @@ pub fn packVariadicCallArgs(self: *Lowering, fd: *const ast.FnDecl, c: *const as var val = args.items[fixed_count + i]; if (is_any) { var source_ty = self.inferExprType(c.args[fixed_count + i]); - // If AST-based inference falls back to .s64 but the lowered ref has a richer type, use that + // If AST-based inference falls back to .i64 but the lowered ref has a richer type, use that if (source_ty == .unresolved) { const ref_ty = self.builder.getRefType(val); if (ref_ty != .unresolved and ref_ty != .void) source_ty = ref_ty; @@ -432,19 +432,19 @@ pub fn packVariadicCallArgs(self: *Lowering, fd: *const ast.FnDecl, c: *const as val = self.buildProtocolErasure(val, arg_node, source_ty, elem_ty); } } - const idx_ref = self.builder.constInt(@intCast(i), .s64); + const idx_ref = self.builder.constInt(@intCast(i), .i64); const elem_ptr = self.builder.emit(.{ .index_gep = .{ .lhs = array_slot, .rhs = idx_ref } }, self.module.types.ptrTo(array_elem)); self.builder.store(elem_ptr, val); } // Build slice {ptr, len} const slice_slot = self.builder.alloca(slice_ty); - const zero = self.builder.constInt(0, .s64); + const zero = self.builder.constInt(0, .i64); const data_ptr = self.builder.emit(.{ .index_gep = .{ .lhs = array_slot, .rhs = zero } }, self.module.types.ptrTo(array_elem)); - const len_ref = self.builder.constInt(@intCast(variadic_count), .s64); + const len_ref = self.builder.constInt(@intCast(variadic_count), .i64); const ptr_gep = self.builder.structGepTyped(slice_slot, 0, self.module.types.ptrTo(array_elem), slice_ty); self.builder.store(ptr_gep, data_ptr); - const len_gep = self.builder.structGepTyped(slice_slot, 1, .s64, slice_ty); + const len_gep = self.builder.structGepTyped(slice_slot, 1, .i64, slice_ty); self.builder.store(len_gep, len_ref); const slice_val = self.builder.load(slice_slot, slice_ty); @@ -476,11 +476,11 @@ pub fn buildPackSliceValue(self: *Lowering, arg_types: []const TypeId) Ref { if (arg_types.len == 0) { const null_ptr = self.builder.constNull(any_ptr_ty); - const zero_len = self.builder.constInt(0, .s64); + const zero_len = self.builder.constInt(0, .i64); const slice_slot = self.builder.alloca(any_slice_ty); const ptr_gep = self.builder.structGepTyped(slice_slot, 0, any_ptr_ty, any_slice_ty); self.builder.store(ptr_gep, null_ptr); - const len_gep = self.builder.structGepTyped(slice_slot, 1, .s64, any_slice_ty); + const len_gep = self.builder.structGepTyped(slice_slot, 1, .i64, any_slice_ty); self.builder.store(len_gep, zero_len); return self.builder.load(slice_slot, any_slice_ty); } @@ -493,18 +493,18 @@ pub fn buildPackSliceValue(self: *Lowering, arg_types: []const TypeId) Ref { // (`{tag=.any, value=tid}`) — already the canonical Any // shape, so no re-box needed. const type_val = self.builder.constType(ty); - const idx_ref = self.builder.constInt(@intCast(i), .s64); + const idx_ref = self.builder.constInt(@intCast(i), .i64); const elem_ptr = self.builder.emit(.{ .index_gep = .{ .lhs = array_slot, .rhs = idx_ref } }, any_ptr_ty); self.builder.store(elem_ptr, type_val); } const slice_slot = self.builder.alloca(any_slice_ty); - const zero = self.builder.constInt(0, .s64); + const zero = self.builder.constInt(0, .i64); const data_ptr = self.builder.emit(.{ .index_gep = .{ .lhs = array_slot, .rhs = zero } }, any_ptr_ty); - const len_ref = self.builder.constInt(@intCast(arg_types.len), .s64); + const len_ref = self.builder.constInt(@intCast(arg_types.len), .i64); const ptr_gep = self.builder.structGepTyped(slice_slot, 0, any_ptr_ty, any_slice_ty); self.builder.store(ptr_gep, data_ptr); - const len_gep = self.builder.structGepTyped(slice_slot, 1, .s64, any_slice_ty); + const len_gep = self.builder.structGepTyped(slice_slot, 1, .i64, any_slice_ty); self.builder.store(len_gep, len_ref); return self.builder.load(slice_slot, any_slice_ty); } @@ -521,11 +521,11 @@ pub fn materialisePackSlice( if (arg_types.len == 0) { const null_ptr = self.builder.constNull(any_ptr_ty); - const zero_len = self.builder.constInt(0, .s64); + const zero_len = self.builder.constInt(0, .i64); const slice_slot = self.builder.alloca(any_slice_ty); const ptr_gep = self.builder.structGepTyped(slice_slot, 0, any_ptr_ty, any_slice_ty); self.builder.store(ptr_gep, null_ptr); - const len_gep = self.builder.structGepTyped(slice_slot, 1, .s64, any_slice_ty); + const len_gep = self.builder.structGepTyped(slice_slot, 1, .i64, any_slice_ty); self.builder.store(len_gep, zero_len); scope.put(pack_name, .{ .ref = slice_slot, .ty = any_slice_ty, .is_alloca = true }); return; @@ -537,18 +537,18 @@ pub fn materialisePackSlice( for (slot_refs, arg_types, 0..) |slot, ty, i| { const val = self.builder.load(slot, ty); const boxed = if (ty == .any) val else self.builder.boxAny(val, ty); - const idx_ref = self.builder.constInt(@intCast(i), .s64); + const idx_ref = self.builder.constInt(@intCast(i), .i64); const elem_ptr = self.builder.emit(.{ .index_gep = .{ .lhs = array_slot, .rhs = idx_ref } }, any_ptr_ty); self.builder.store(elem_ptr, boxed); } const slice_slot = self.builder.alloca(any_slice_ty); - const zero = self.builder.constInt(0, .s64); + const zero = self.builder.constInt(0, .i64); const data_ptr = self.builder.emit(.{ .index_gep = .{ .lhs = array_slot, .rhs = zero } }, any_ptr_ty); - const len_ref = self.builder.constInt(@intCast(arg_types.len), .s64); + const len_ref = self.builder.constInt(@intCast(arg_types.len), .i64); const ptr_gep = self.builder.structGepTyped(slice_slot, 0, any_ptr_ty, any_slice_ty); self.builder.store(ptr_gep, data_ptr); - const len_gep = self.builder.structGepTyped(slice_slot, 1, .s64, any_slice_ty); + const len_gep = self.builder.structGepTyped(slice_slot, 1, .i64, any_slice_ty); self.builder.store(len_gep, len_ref); scope.put(pack_name, .{ .ref = slice_slot, .ty = any_slice_ty, .is_alloca = true }); } @@ -558,8 +558,8 @@ pub fn materialisePackSlice( /// type: a `return X;` statement's value type, or — failing that — /// the tail expression of an arrow-form body. Caller must have /// `pack_arg_nodes` installed so `args[]` substitutes during -/// inference. Falls back to `.s64` if nothing concrete is found -/// (matches the broader "default to .s64" convention elsewhere). +/// inference. Falls back to `.i64` if nothing concrete is found +/// (matches the broader "default to .i64" convention elsewhere). pub fn inferPackBodyReturnType(self: *Lowering, body: *const Node) TypeId { // First try explicit `return X;` — walks past structured // control flow but stops at nested fn / lambda bodies. diff --git a/src/ir/lower/protocol.zig b/src/ir/lower/protocol.zig index 2565e46..3232e9e 100644 --- a/src/ir/lower/protocol.zig +++ b/src/ir/lower/protocol.zig @@ -67,10 +67,10 @@ pub fn registerProtocolDecl(self: *Lowering, pd: *const ast.ProtocolDecl) void { } /// Instantiate a parameterized protocol as a runtime VALUE type: -/// `VL(s64)` → a 16-byte `{ctx, __vtable}` protocol value (`is_protocol`), +/// `VL(i64)` → a 16-byte `{ctx, __vtable}` protocol value (`is_protocol`), /// with method infos resolved under the type-arg binding (so `get -> T` -/// becomes `get -> s64`) and the binding recorded for projection. Cached by -/// the mangled name `VL__s64`. Mirrors the non-parameterized path in +/// becomes `get -> i64`) and the binding recorded for projection. Cached by +/// the mangled name `VL__i64`. Mirrors the non-parameterized path in /// `registerProtocolDecl`. pub fn instantiateParamProtocol(self: *Lowering, pd: *const ast.ProtocolDecl, args: []const *const Node) TypeId { const table = &self.module.types; @@ -105,7 +105,7 @@ pub fn instantiateParamProtocol(self: *Lowering, pd: *const ast.ProtocolDecl, ar const id = if (table.findByName(name_id)) |existing| existing else table.intern(struct_info); table.updatePreservingKey(id, struct_info); - // Method infos resolved with the type-arg binding (T → s64), pinned to + // Method infos resolved with the type-arg binding (T → i64), pinned to // the protocol's OWN module (E4) so a method-signature type visible only // there resolves correctly when instantiated cross-module. `Self` and the // bound type-args short-circuit before the leaf; a concrete library type @@ -332,10 +332,10 @@ pub fn createProtocolThunk(self: *Lowering, proto_name: []const u8, concrete_typ if (self.program_index.fn_ast_map.contains(qualified)) { self.lazyLowerFunction(qualified); } else if (self.genericInstanceMethod(concrete_type_name, method.name)) |gm| { - // Generic-struct instance (`Combined__s64_s64`): the impl method is + // Generic-struct instance (`Combined__i64_i64`): the impl method is // authored on the instance's STAMPED decl (CP-4). Monomorphize it // for this instance's bindings so the thunk has a concrete - // `Combined__s64_s64.get` to call. + // `Combined__i64_i64.get` to call. self.monomorphizeFunction(gm.fd, qualified, gm.bindings); } } @@ -441,7 +441,7 @@ pub fn buildProtocolValue(self: *Lowering, concrete_ptr: Ref, proto_name: []cons var ctx_ptr = concrete_ptr; if (heap_copy) { const concrete_size = self.module.types.typeSizeBytes(concrete_ty); - const size_ref = self.builder.constInt(@intCast(concrete_size), .s64); + const size_ref = self.builder.constInt(@intCast(concrete_size), .i64); const heap_ptr = self.allocViaContext(size_ref, void_ptr_ty); _ = self.callForeign("memcpy", &.{ heap_ptr, concrete_ptr, size_ref }, void_ptr_ty); ctx_ptr = heap_ptr; @@ -591,7 +591,7 @@ pub fn emitProtocolDispatch(self: *Lowering, receiver: Ref, proto_info: Protocol /// Handles both direct types and pointer-to-types. pub fn resolveConcreteTypeName(self: *Lowering, ty: TypeId) ?[]const u8 { if (ty.isBuiltin()) { - // Primitive types like s64 — check if they have toName() + // Primitive types like i64 — check if they have toName() return self.module.types.typeName(ty); } const info = self.module.types.get(ty); diff --git a/src/ir/lower/stmt.zig b/src/ir/lower/stmt.zig index 28932eb..b85b9a0 100644 --- a/src/ir/lower/stmt.zig +++ b/src/ir/lower/stmt.zig @@ -329,7 +329,7 @@ pub fn lowerVarDecl(self: *Lowering, vd: *const ast.VarDecl) void { } } } - // Coerce value to match target type (e.g. u8 → s64 widening) + // Coerce value to match target type (e.g. u8 → i64 widening) { const ref_ty = self.builder.getRefType(ref); if (ref_ty != ty and ref_ty != .void and ty != .void) { @@ -354,7 +354,7 @@ pub fn lowerVarDecl(self: *Lowering, vd: *const ast.VarDecl) void { self.force_block_value = true; // An unannotated decl provides no target type: clear the ambient one // (the enclosing fn's implicit-return target) so literal initializers - // take their spec defaults (s64/f64) instead of adopting it. + // take their spec defaults (i64/f64) instead of adopting it. self.target_type = null; const ref = self.lowerExpr(val); self.force_block_value = saved_fbv; @@ -366,7 +366,7 @@ pub fn lowerVarDecl(self: *Lowering, vd: *const ast.VarDecl) void { scope.put(vd.name, .{ .ref = slot, .ty = ty, .is_alloca = true }); } } else { - const ty = TypeId.s64; + const ty = TypeId.i64; const slot = self.builder.alloca(ty); self.builder.store(slot, self.zeroValue(ty)); if (self.scope) |scope| { @@ -390,7 +390,7 @@ pub fn lowerLocalFnDecl(self: *Lowering, fd: *const ast.FnDecl) void { } pub fn lowerConstDecl(self: *Lowering, cd: *const ast.ConstDecl) void { - // Handle local function declarations: fx :: (s:s3) -> s3 { ... } + // Handle local function declarations: fx :: (s:i3) -> i3 { ... } if (cd.value.data == .fn_decl) { const fd = &cd.value.data.fn_decl; // Use mangled name for local functions to support block-scoped shadowing @@ -448,15 +448,15 @@ pub fn lowerReturn(self: *Lowering, rs: *const ast.ReturnStmt) void { } // Set target_type to function return type so null_literal etc. get the right type. // When inlining a comptime body, the *inlined* fn's declared return type wins - // over the caller's — otherwise `return 42` inside a `-> s64` body lowered into - // a `-> s32` caller would coerce 42 to s32 before storing into the s64 slot. + // over the caller's — otherwise `return 42` inside a `-> i64` body lowered into + // a `-> i32` caller would coerce 42 to i32 before storing into the i64 slot. const old_target = self.target_type; const ret_ty_for_target: TypeId = if (self.inline_return_target) |iri| iri.ret_ty else if (self.builder.func) |fid| self.module.functions.items[@intFromEnum(fid)].ret else - TypeId.s64; + TypeId.i64; // A value-carrying failable (`-> (T..., !)`) returns its VALUE part and // the success error slot (0) is appended by lowerFailableSuccessReturn. // Resolve a BARE returned value against that value type, NOT the failable @@ -523,7 +523,7 @@ pub fn lowerReturn(self: *Lowering, rs: *const ast.ReturnStmt) void { const ret_ty = if (self.builder.func) |fid| self.module.functions.items[@intFromEnum(fid)].ret else - TypeId.s64; + TypeId.i64; if (ret_ty == .void) { // Void function — just return void (the value expression was evaluated for side effects) self.builder.retVoid(); @@ -532,7 +532,7 @@ pub fn lowerReturn(self: *Lowering, rs: *const ast.ReturnStmt) void { // value part; the compiler appends the success error slot (0). self.lowerFailableSuccessReturn(ref, ret_ty, rs.value.?.span); } else { - // Coerce return value to match function return type (e.g., ?s32 → s32) + // Coerce return value to match function return type (e.g., ?i32 → i32) const val_ty = self.builder.getRefType(ref); const coerced = self.coerceToType(ref, val_ty, ret_ty); self.builder.ret(coerced, ret_ty); @@ -748,11 +748,11 @@ pub fn lowerAssignment(self: *Lowering, asgn: *const ast.Assignment) void { } else false); if (is_special_container and std.mem.eql(u8, fa.field, "len")) { - const gep = self.builder.structGepTyped(obj_ptr, 1, .s64, obj_ty); - self.storeOrCompound(gep, val, asgn.op, .s64); + const gep = self.builder.structGepTyped(obj_ptr, 1, .i64, obj_ty); + self.storeOrCompound(gep, val, asgn.op, .i64); } else if (is_special_container and std.mem.eql(u8, fa.field, "ptr")) { - const gep = self.builder.structGepTyped(obj_ptr, 0, .s64, obj_ty); - self.storeOrCompound(gep, val, asgn.op, .s64); + const gep = self.builder.structGepTyped(obj_ptr, 0, .i64, obj_ty); + self.storeOrCompound(gep, val, asgn.op, .i64); } else if (self.fieldLvaluePtr(obj_ptr, obj_ty, fa.field)) |fl| { // Resolve the target field (struct / union direct / promoted // anonymous-struct member / tuple element / vector lane) via @@ -986,7 +986,7 @@ pub fn lowerExprAsPtr(self: *Lowering, node: *const Node) Ref { // resolver so address-of and the multi-target store path never // disagree on the slot. No match → emit the read path's // field-not-found diagnostic (lowerFieldAccessOnType → - // emitFieldError) instead of silently GEPing field 0 as .s64; + // emitFieldError) instead of silently GEPing field 0 as .i64; // that bogus pointer reaches LLVM emission as ptrTo(.unresolved) // and panics. if (self.fieldLvaluePtr(obj_ptr, obj_ty, fa.field)) |r| return r.ptr; diff --git a/src/ir/module.test.zig b/src/ir/module.test.zig index f865fb7..d7a27d1 100644 --- a/src/ir/module.test.zig +++ b/src/ir/module.test.zig @@ -13,7 +13,7 @@ const GlobalId = inst_mod.GlobalId; const Module = mod_mod.Module; const Builder = mod_mod.Builder; -test "Builder: build add(a: s64, b: s64) -> s64" { +test "Builder: build add(a: i64, b: i64) -> i64" { const alloc = std.testing.allocator; var mod = Module.init(alloc); defer mod.deinit(); @@ -26,26 +26,26 @@ test "Builder: build add(a: s64, b: s64) -> s64" { const name_entry = mod.types.internString("entry"); const params = &[_]Function.Param{ - .{ .name = name_a, .ty = .s64 }, - .{ .name = name_b, .ty = .s64 }, + .{ .name = name_a, .ty = .i64 }, + .{ .name = name_b, .ty = .i64 }, }; - const func_id = b.beginFunction(name_add, params, .s64); + const func_id = b.beginFunction(name_add, params, .i64); const entry = b.appendBlock(name_entry, &.{}); b.switchToBlock(entry); // Load params (in real lowering, params are block params of entry) - const a_ref = b.constInt(0, .s64); // placeholder for param a - const b_ref = b.constInt(0, .s64); // placeholder for param b - const sum = b.add(a_ref, b_ref, .s64); - b.ret(sum, .s64); + const a_ref = b.constInt(0, .i64); // placeholder for param a + const b_ref = b.constInt(0, .i64); // placeholder for param b + const sum = b.add(a_ref, b_ref, .i64); + b.ret(sum, .i64); b.finalize(); // Verify const func = mod.getFunction(func_id); try std.testing.expectEqual(@as(usize, 2), func.params.len); - try std.testing.expectEqual(TypeId.s64, func.ret); + try std.testing.expectEqual(TypeId.i64, func.ret); try std.testing.expectEqual(@as(usize, 1), func.blocks.items.len); const blk = &func.blocks.items[0]; @@ -65,28 +65,28 @@ test "Builder: conditional branch" { const name_else = mod.types.internString("else"); const name_merge = mod.types.internString("merge"); - _ = b.beginFunction(name_fn, &.{}, .s32); + _ = b.beginFunction(name_fn, &.{}, .i32); const entry = b.appendBlock(name_entry, &.{}); const then_bb = b.appendBlock(name_then, &.{}); const else_bb = b.appendBlock(name_else, &.{}); - const merge_bb = b.appendBlock(name_merge, &[_]TypeId{.s32}); + const merge_bb = b.appendBlock(name_merge, &[_]TypeId{.i32}); b.switchToBlock(entry); const cond = b.constBool(true); b.condBr(cond, then_bb, &.{}, else_bb, &.{}); b.switchToBlock(then_bb); - const v1 = b.constInt(42, .s32); + const v1 = b.constInt(42, .i32); b.br(merge_bb, &.{v1}); b.switchToBlock(else_bb); - const v2 = b.constInt(0, .s32); + const v2 = b.constInt(0, .i32); b.br(merge_bb, &.{v2}); b.switchToBlock(merge_bb); - const result = b.emit(.{ .block_param = .{ .block = merge_bb, .param_index = 0 } }, .s32); - b.ret(result, .s32); + const result = b.emit(.{ .block_param = .{ .block = merge_bb, .param_index = 0 } }, .i32); + b.ret(result, .i32); b.finalize(); @@ -107,12 +107,12 @@ test "Module: globals" { const name = mod.types.internString("counter"); const id = mod.addGlobal(.{ .name = name, - .ty = .s32, + .ty = .i32, .init_val = .{ .int = 0 }, }); try std.testing.expectEqual(GlobalId.fromIndex(0), id); - try std.testing.expectEqual(TypeId.s32, mod.globals.items[0].ty); + try std.testing.expectEqual(TypeId.i32, mod.globals.items[0].ty); } test "Builder.constFloatInfo reads a const_float back, null for non-floats" { @@ -134,7 +134,7 @@ test "Builder.constFloatInfo reads a const_float back, null for non-floats" { try std.testing.expectEqual(@as(f64, 4.0), info.value); // A non-float instruction is not a const_float — null. - const iref = b.constInt(7, .s64); + const iref = b.constInt(7, .i64); try std.testing.expect(b.constFloatInfo(iref) == null); b.finalize(); diff --git a/src/ir/module.zig b/src/ir/module.zig index cef9c8f..dd477e7 100644 --- a/src/ir/module.zig +++ b/src/ir/module.zig @@ -336,7 +336,7 @@ pub const Builder = struct { /// Get the type of a previously emitted instruction Ref. A ref that can't /// be located (no active function, or an out-of-range ref) has no knowable - /// type — return the `.unresolved` sentinel rather than a fabricated `.s64`. + /// type — return the `.unresolved` sentinel rather than a fabricated `.i64`. pub fn getRefType(self: *Builder, ref: Ref) TypeId { if (self.func == null) return .unresolved; const func = self.currentFunc(); diff --git a/src/ir/packs.test.zig b/src/ir/packs.test.zig index a08f288..8477371 100644 --- a/src/ir/packs.test.zig +++ b/src/ir/packs.test.zig @@ -16,7 +16,7 @@ test "PackResolver.packTypeArgs: bound pack → element types; unbound → null" var pat = std.StringHashMap([]const TypeId).init(alloc); defer pat.deinit(); - const elems = [_]TypeId{ .s32, .s64 }; + const elems = [_]TypeId{ .i32, .i64 }; try pat.put("xs", &elems); lowering.pack_arg_types = pat; @@ -64,7 +64,7 @@ test "PackResolver.packTypeArgs: missing projection → diagnostic + .unresolved try lowering.program_index.protocol_ast_map.put("P", &pd); var pat = std.StringHashMap([]const TypeId).init(alloc); - const elems = [_]TypeId{.s64}; + const elems = [_]TypeId{.i64}; try pat.put("xs", &elems); lowering.pack_arg_types = pat; diff --git a/src/ir/print.test.zig b/src/ir/print.test.zig index 6614cc9..dc20715 100644 --- a/src/ir/print.test.zig +++ b/src/ir/print.test.zig @@ -26,17 +26,17 @@ test "print simple add function" { const name_entry = module.types.internString("entry"); const params = &[_]Function.Param{ - .{ .name = name_a, .ty = .s64 }, - .{ .name = name_b, .ty = .s64 }, + .{ .name = name_a, .ty = .i64 }, + .{ .name = name_b, .ty = .i64 }, }; - _ = b.beginFunction(name_add, params, .s64); + _ = b.beginFunction(name_add, params, .i64); const entry = b.appendBlock(name_entry, &.{}); b.switchToBlock(entry); - const a_ref = b.constInt(10, .s64); - const b_ref = b.constInt(20, .s64); - const sum = b.add(a_ref, b_ref, .s64); - b.ret(sum, .s64); + const a_ref = b.constInt(10, .i64); + const b_ref = b.constInt(20, .i64); + const sum = b.add(a_ref, b_ref, .i64); + b.ret(sum, .i64); b.finalize(); var aw = std.Io.Writer.Allocating.init(alloc); @@ -45,11 +45,11 @@ test "print simple add function" { defer result.deinit(alloc); const output = result.items; - try std.testing.expect(std.mem.indexOf(u8, output, "func @add(a: s64, b: s64) -> s64") != null); + try std.testing.expect(std.mem.indexOf(u8, output, "func @add(a: i64, b: i64) -> i64") != null); try std.testing.expect(std.mem.indexOf(u8, output, "entry:") != null); - try std.testing.expect(std.mem.indexOf(u8, output, "const 10 : s64") != null); + try std.testing.expect(std.mem.indexOf(u8, output, "const 10 : i64") != null); // Params occupy value slots %0/%1, so the two consts are %2/%3 and their sum %4. - try std.testing.expect(std.mem.indexOf(u8, output, "add %2, %3 : s64") != null); + try std.testing.expect(std.mem.indexOf(u8, output, "add %2, %3 : i64") != null); try std.testing.expect(std.mem.indexOf(u8, output, "ret %4") != null); } @@ -60,7 +60,7 @@ test "print conditional branch" { var b = Builder.init(&module); - _ = b.beginFunction(module.types.internString("test"), &.{}, .s32); + _ = b.beginFunction(module.types.internString("test"), &.{}, .i32); const entry = b.appendBlock(module.types.internString("entry"), &.{}); const then_bb = b.appendBlock(module.types.internString("then"), &.{}); const else_bb = b.appendBlock(module.types.internString("else"), &.{}); @@ -70,12 +70,12 @@ test "print conditional branch" { b.condBr(cond, then_bb, &.{}, else_bb, &.{}); b.switchToBlock(then_bb); - const v1 = b.constInt(1, .s32); - b.ret(v1, .s32); + const v1 = b.constInt(1, .i32); + b.ret(v1, .i32); b.switchToBlock(else_bb); - const v2 = b.constInt(0, .s32); - b.ret(v2, .s32); + const v2 = b.constInt(0, .i32); + b.ret(v2, .i32); b.finalize(); var aw = std.Io.Writer.Allocating.init(alloc); diff --git a/src/ir/program_index.test.zig b/src/ir/program_index.test.zig index 6ef0642..8354057 100644 --- a/src/ir/program_index.test.zig +++ b/src/ir/program_index.test.zig @@ -56,15 +56,15 @@ test "ProgramIndex declaration maps round-trip (A1.1b)" { try std.testing.expect(idx.fn_ast_map.get("main").? == &fd); // type_alias_map: alias name → target TypeId. - try idx.type_alias_map.put("ShaderHandle", .s64); - try std.testing.expectEqual(@as(?types.TypeId, .s64), idx.type_alias_map.get("ShaderHandle")); + try idx.type_alias_map.put("ShaderHandle", .i64); + try std.testing.expectEqual(@as(?types.TypeId, .i64), idx.type_alias_map.get("ShaderHandle")); // global_names: #run global name → GlobalInfo. - try idx.global_names.put("g", .{ .id = inst.GlobalId.fromIndex(0), .ty = .s64 }); + try idx.global_names.put("g", .{ .id = inst.GlobalId.fromIndex(0), .ty = .i64 }); try std.testing.expect(idx.global_names.get("g").?.id == inst.GlobalId.fromIndex(0)); // module_const_map: const name → ModuleConstInfo. - try idx.module_const_map.put("AF_INET", .{ .value = &blk, .ty = .s32 }); + try idx.module_const_map.put("AF_INET", .{ .value = &blk, .ty = .i32 }); try std.testing.expect(idx.module_const_map.get("AF_INET").?.value == &blk); // foreign_class_map: sx alias → ForeignClassDecl. @@ -110,22 +110,22 @@ test "ProgramIndex source-keyed caches partition same-name authors by source" { var blk_b = ast.Node{ .span = .{ .start = 1, .end = 1 }, .data = .{ .block = .{ .stmts = &.{} } } }; // SAME alias name `Foo` authored in two modules → two distinct TypeIds. - idx.putTypeAliasBySource("a.sx", "Foo", .s64); + idx.putTypeAliasBySource("a.sx", "Foo", .i64); idx.putTypeAliasBySource("b.sx", "Foo", .f64); - try std.testing.expectEqual(@as(?types.TypeId, .s64), idx.type_aliases_by_source.get("a.sx").?.get("Foo")); + try std.testing.expectEqual(@as(?types.TypeId, .i64), idx.type_aliases_by_source.get("a.sx").?.get("Foo")); try std.testing.expectEqual(@as(?types.TypeId, .f64), idx.type_aliases_by_source.get("b.sx").?.get("Foo")); try std.testing.expectEqual(@as(u32, 2), idx.type_aliases_by_source.count()); // SAME const name `K` authored in two modules → two distinct ModuleConstInfos. - idx.putModuleConstBySource("a.sx", "K", .{ .value = &blk_a, .ty = .s32 }); + idx.putModuleConstBySource("a.sx", "K", .{ .value = &blk_a, .ty = .i32 }); idx.putModuleConstBySource("b.sx", "K", .{ .value = &blk_b, .ty = .f32 }); try std.testing.expect(idx.module_consts_by_source.get("a.sx").?.get("K").?.value == &blk_a); try std.testing.expect(idx.module_consts_by_source.get("b.sx").?.get("K").?.value == &blk_b); - try std.testing.expectEqual(@as(?types.TypeId, .s32), idx.module_consts_by_source.get("a.sx").?.get("K").?.ty); + try std.testing.expectEqual(@as(?types.TypeId, .i32), idx.module_consts_by_source.get("a.sx").?.get("K").?.ty); try std.testing.expectEqual(@as(?types.TypeId, .f32), idx.module_consts_by_source.get("b.sx").?.get("K").?.ty); // SAME global name `g` authored in two modules → two distinct GlobalInfos. - idx.putGlobalBySource("a.sx", "g", .{ .id = inst.GlobalId.fromIndex(0), .ty = .s64 }); + idx.putGlobalBySource("a.sx", "g", .{ .id = inst.GlobalId.fromIndex(0), .ty = .i64 }); idx.putGlobalBySource("b.sx", "g", .{ .id = inst.GlobalId.fromIndex(1), .ty = .f64 }); try std.testing.expect(idx.globals_by_source.get("a.sx").?.get("g").?.id == inst.GlobalId.fromIndex(0)); try std.testing.expect(idx.globals_by_source.get("b.sx").?.get("g").?.id == inst.GlobalId.fromIndex(1)); @@ -133,10 +133,10 @@ test "ProgramIndex source-keyed caches partition same-name authors by source" { // Compat readers: the legacy global maps stay keyed by NAME alone, so a // same-name author is last-wins there — exactly ONE entry for `Foo` / `K`, // unchanged by the source-keyed writes above. - idx.type_alias_map.put("Foo", .s64) catch unreachable; + idx.type_alias_map.put("Foo", .i64) catch unreachable; idx.type_alias_map.put("Foo", .f64) catch unreachable; try std.testing.expectEqual(@as(u32, 1), idx.type_alias_map.count()); - idx.module_const_map.put("K", .{ .value = &blk_a, .ty = .s32 }) catch unreachable; + idx.module_const_map.put("K", .{ .value = &blk_a, .ty = .i32 }) catch unreachable; idx.module_const_map.put("K", .{ .value = &blk_b, .ty = .f32 }) catch unreachable; try std.testing.expectEqual(@as(u32, 1), idx.module_const_map.count()); @@ -315,9 +315,9 @@ test "moduleConstInt folds expression-RHS consts and rejects cycles" { var f_val = nFloat(4.0); var g_val = nFloat(4.5); - try map.put("M", .{ .value = &m_val, .ty = .s64 }); - try map.put("N", .{ .value = &n_val, .ty = .s64 }); - try map.put("P", .{ .value = &p_val, .ty = .s64 }); + try map.put("M", .{ .value = &m_val, .ty = .i64 }); + try map.put("N", .{ .value = &n_val, .ty = .i64 }); + try map.put("P", .{ .value = &p_val, .ty = .i64 }); try map.put("F", .{ .value = &f_val, .ty = .f64 }); try map.put("G", .{ .value = &g_val, .ty = .f64 }); @@ -338,9 +338,9 @@ test "moduleConstInt folds expression-RHS consts and rejects cycles" { var a_val = nBin(.add, &b_id, &zero); var b_val = nBin(.add, &a_id, &zero); var c_val = nBin(.add, &c_id, &zero); - try map.put("A", .{ .value = &a_val, .ty = .s64 }); - try map.put("B", .{ .value = &b_val, .ty = .s64 }); - try map.put("C", .{ .value = &c_val, .ty = .s64 }); + try map.put("A", .{ .value = &a_val, .ty = .i64 }); + try map.put("B", .{ .value = &b_val, .ty = .i64 }); + try map.put("C", .{ .value = &c_val, .ty = .i64 }); try std.testing.expect(pi.moduleConstInt(&map, &table, "A") == null); try std.testing.expect(pi.moduleConstInt(&map, &table, "B") == null); try std.testing.expect(pi.moduleConstInt(&map, &table, "C") == null); @@ -354,7 +354,7 @@ test "moduleConstIsFloatTyped judges a const by VALUE, catching untyped float-EX // KT : f64 : 4.0 (typed float), MI :: 2 (untyped int), ML :: 5.0 (untyped // float literal → f64), ME :: 4.0 + 1.0 (untyped float EXPRESSION, placeholder - // type s64 yet float-valued), IE :: 1 + 2 (untyped int expression). + // type i64 yet float-valued), IE :: 1 + 2 (untyped int expression). var kt_val = nFloat(4.0); var mi_val = nLit(2); var ml_val = nFloat(5.0); @@ -365,13 +365,13 @@ test "moduleConstIsFloatTyped judges a const by VALUE, catching untyped float-EX var l2 = nLit(2); var ie_val = nBin(.add, &l1, &l2); try map.put("KT", .{ .value = &kt_val, .ty = .f64 }); - try map.put("MI", .{ .value = &mi_val, .ty = .s64 }); + try map.put("MI", .{ .value = &mi_val, .ty = .i64 }); try map.put("ML", .{ .value = &ml_val, .ty = .f64 }); // pass-0 stores a float literal as f64 - try map.put("ME", .{ .value = &me_val, .ty = .s64 }); // pass-0 placeholder for a binary_op - try map.put("IE", .{ .value = &ie_val, .ty = .s64 }); + try map.put("ME", .{ .value = &me_val, .ty = .i64 }); // pass-0 placeholder for a binary_op + try map.put("IE", .{ .value = &ie_val, .ty = .i64 }); // Float-valued: a typed float const, an untyped float literal, AND an untyped - // float EXPRESSION whose declared type is the s64 placeholder (judged by value). + // float EXPRESSION whose declared type is the i64 placeholder (judged by value). try std.testing.expect(pi.moduleConstIsFloatTyped(&map, &table, "KT")); try std.testing.expect(pi.moduleConstIsFloatTyped(&map, &table, "ML")); try std.testing.expect(pi.moduleConstIsFloatTyped(&map, &table, "ME")); @@ -386,8 +386,8 @@ test "moduleConstIsFloatTyped judges a const by VALUE, catching untyped float-EX var az = nFloat(0.0); var a_val = nBin(.add, &b_id, &az); var b_val = nBin(.add, &a_id, &az); - try map.put("A", .{ .value = &a_val, .ty = .s64 }); - try map.put("B", .{ .value = &b_val, .ty = .s64 }); + try map.put("A", .{ .value = &a_val, .ty = .i64 }); + try map.put("B", .{ .value = &b_val, .ty = .i64 }); // The `+ 0.0` literal still makes them float-valued (a finite, non-cyclic leaf // is reached before the cycle); the point is it TERMINATES. try std.testing.expect(pi.moduleConstIsFloatTyped(&map, &table, "A")); @@ -404,7 +404,7 @@ test "moduleConstInt gates the fold on the declared type, not the initializer no // initializer must never be folded into a count: the count path // consults `ModuleConstInfo.ty`, not just the node shape. var int_val = nLit(4); - try map.put("OK", .{ .value = &int_val, .ty = .s64 }); + try map.put("OK", .{ .value = &int_val, .ty = .i64 }); try map.put("STR", .{ .value = &int_val, .ty = .string }); try map.put("BOOLEAN", .{ .value = &int_val, .ty = .bool }); @@ -415,12 +415,12 @@ test "moduleConstInt gates the fold on the declared type, not the initializer no // The same gate holds for a const-EXPRESSION value node (`M + 2`), not just // a bare literal: a `string`-typed const whose initializer is a foldable // integer expression must still never fold as a count (the - // const-expression leak). `KEXPR : s64 : M + 2` (numeric type) folds; the + // const-expression leak). `KEXPR : i64 : M + 2` (numeric type) folds; the // same expression declared `string` does not. var m_lit = nLit(2); var add2 = nLit(2); var expr_val = nBin(.add, &m_lit, &add2); - try map.put("KEXPR", .{ .value = &expr_val, .ty = .s64 }); + try map.put("KEXPR", .{ .value = &expr_val, .ty = .i64 }); try map.put("STREXPR", .{ .value = &expr_val, .ty = .string }); try std.testing.expectEqual(@as(?i64, 4), pi.moduleConstInt(&map, &table, "KEXPR")); try std.testing.expect(pi.moduleConstInt(&map, &table, "STREXPR") == null); @@ -539,21 +539,21 @@ test "a backtick raw-shadow receiver is a field read, not a numeric-limit fold ( const ctx = DimCtx{}; // BARE type receiver (`is_raw = false`) → the numeric-limit accessor folds: - // `f64.epsilon` is the builtin eps, `s8.max` is 127. + // `f64.epsilon` is the builtin eps, `i8.max` is 127. var f64ty = nIdent("f64"); - var s8ty = nIdent("s8"); + var s8ty = nIdent("i8"); var bare_feps = nField(&f64ty, "epsilon"); var bare_smax = nField(&s8ty, "max"); try std.testing.expectEqual(@as(?f64, @as(f64, std.math.floatEps(f64))), evalf(&bare_feps, ctx)); try std.testing.expectEqual(@as(?i64, std.math.maxInt(i8)), evali(&bare_smax, ctx)); - // RAW receiver (`` `f64 ``/`` `s8 ``) shadows the builtin with a VALUE — the + // RAW receiver (`` `f64 ``/`` `i8 ``) shadows the builtin with a VALUE — the // field access is an ordinary runtime field READ, so it is NOT a compile-time // leaf in either evaluator (→ null), exactly as the sibling `isFloatValuedExpr` // already treats it. The whole point: a value-shadow can never be misread as // the builtin limit. var f64raw = nIdentRaw("f64"); - var s8raw = nIdentRaw("s8"); + var s8raw = nIdentRaw("i8"); var raw_feps = nField(&f64raw, "epsilon"); var raw_smax = nField(&s8raw, "max"); try std.testing.expect(evalf(&raw_feps, ctx) == null); diff --git a/src/ir/program_index.zig b/src/ir/program_index.zig index a2d37d1..6a0ce0b 100644 --- a/src/ir/program_index.zig +++ b/src/ir/program_index.zig @@ -150,7 +150,7 @@ pub fn isFloatConstType(ty: TypeId) bool { /// True iff `name` is a FLOAT-valued module const — judged by the const's VALUE, /// not only its DECLARED type, so it catches both a typed float const /// (`K : f64 : 4.0`, `F : f64 : 2.5`) AND an UNTYPED float-EXPRESSION const -/// (`ME :: 4.0 + 1.0`), whose pass-0 placeholder type is `s64` even though its +/// (`ME :: 4.0 + 1.0`), whose pass-0 placeholder type is `i64` even though its /// value is float. The int folder's division arm consults this to tell a FLOAT /// division apart from an integer one even when both operands fold to integers /// (`K / 3`, `ME / 3`). `frame` cycle-guards a const whose value references @@ -170,11 +170,11 @@ fn moduleConstFloatValuedFramed(consts: *const std.StringHashMap(ModuleConstInfo /// is gated on `ModuleConstInfo.ty`, not just the shape of the initializer node: /// a `string`/`bool`/pointer/struct-typed const can never be folded into a count /// off an integer-looking initializer (the second symptom, where -/// `N : string : 4` folded `[N]s64` to 4 by reading the `int_literal` node and +/// `N : string : 4` folded `[N]i64` to 4 by reading the `int_literal` node and /// ignoring the `string` annotation). pub fn isCountableConstType(table: *const types.TypeTable, ty: TypeId) bool { return switch (ty) { - .s8, .s16, .s32, .s64, .u8, .u16, .u32, .u64, .usize, .isize, .f32, .f64 => true, + .i8, .i16, .i32, .i64, .u8, .u16, .u32, .u64, .usize, .isize, .f32, .f64 => true, else => if (ty.isBuiltin()) false else switch (table.get(ty)) { .signed, .unsigned => true, else => false, @@ -198,7 +198,7 @@ fn moduleConstIntFramed(consts: *const std.StringHashMap(ModuleConstInfo), table /// laid out via a type alias (`Arr :: [N]T`, stateless) gets a different length /// than the direct form (`a : [N]T`, stateful) — that miscompile class. /// Every const's RHS is folded through the shared `evalConstIntExpr`, so an -/// untyped (`N :: 16`) / typed (`N : s64 : 16`) literal, an integral float +/// untyped (`N :: 16`) / typed (`N : i64 : 16`) literal, an integral float /// (`N : f64 : 4.0` → 4, via `floatToIntExact`; `4.5` → null), AND an expression /// RHS over other consts (`M :: 2; N :: M + 1` → 3) all resolve identically and /// everywhere a count is accepted. Cyclic consts fold to null (see @@ -212,8 +212,8 @@ pub fn moduleConstInt(consts: *const std.StringHashMap(ModuleConstInfo), table: /// `moduleConstIntFramed` exactly — same `isCountableConstType` gate, same cyclic- /// definition frame — but recovers the value through `evalConstFloatExpr`, so the /// unified float→int narrowing rule resolves a NON-INTEGRAL float-const leaf -/// (`y : s64 = F + 0.25`) the same way the int folder resolves an int-const leaf -/// (`M :: 2; y : s64 = M + 0.5`). An integral float / integer const folds through +/// (`y : i64 = F + 0.25`) the same way the int folder resolves an int-const leaf +/// (`M :: 2; y : i64 = M + 0.5`). An integral float / integer const folds through /// the int path inside `evalConstFloatExpr` and never reaches the leaf arm that /// calls this; this surfaces the genuinely non-integral float so `floatToIntExact` /// can reject it. @@ -231,7 +231,7 @@ pub fn moduleConstFloat(consts: *const std.StringHashMap(ModuleConstInfo), table /// True iff `name` is a FLOAT-valued module const — judged by VALUE, so it covers /// a typed float const (`K : f64 : 4.0`), an untyped float-EXPRESSION const -/// (`ME :: 4.0 + 1.0`, whose placeholder type is `s64`), and a non-integral float +/// (`ME :: 4.0 + 1.0`, whose placeholder type is `i64`), and a non-integral float /// const (`F : f64 : 2.5`). SINGLE source for the stateful (`Lowering`) and /// stateless (`type_bridge`) division-arm float checks, so they agree on which /// const-leaf divisions are float. @@ -255,7 +255,7 @@ pub fn moduleConstIsFloatTyped(consts: *const std.StringHashMap(ModuleConstInfo) /// Also the precise "is this a compile-time float-valued initializer" test the /// typed-binding narrowing path (`Lowering.foldComptimeFloatInit`) uses alongside /// `inferExprType`, so an untyped float-EXPRESSION const (`ME :: 4.0 + 1.0`, -/// placeholder type `s64`) flowing into an integer binding (`x : s64 = ME / 2`) +/// placeholder type `i64`) flowing into an integer binding (`x : i64 = ME / 2`) /// is judged float-valued even though `inferExprType` reads its placeholder type. pub fn isFloatValuedExpr(node: *const Node, ctx: anytype) bool { return switch (node.data) { @@ -323,7 +323,7 @@ pub fn evalConstIntExpr(node: *const Node, ctx: anytype) ?i64 { .identifier => |id| ctx.lookupDimName(id.name), .type_expr => |te| ctx.lookupDimName(te.name), .field_access => |fa| blk: { - // A backtick RAW receiver (`` `s64.max ``, `` `f64.epsilon ``) is an + // A backtick RAW receiver (`` `i64.max ``, `` `f64.epsilon ``) is an // ordinary field READ on a value whose spelling shadows a builtin // type name, NOT a numeric-limit / pack-arity accessor — so it is // never a compile-time leaf here; its field is a runtime value @@ -596,10 +596,10 @@ pub fn intTypeRange(name: []const u8) ?IntRange { if (eql(u8, name, "u16")) return .{ .min = 0, .max = std.math.maxInt(u16) }; if (eql(u8, name, "u32")) return .{ .min = 0, .max = std.math.maxInt(u32) }; if (eql(u8, name, "u64") or eql(u8, name, "usize")) return .{ .min = 0, .max = std.math.maxInt(i64) }; - if (eql(u8, name, "s8")) return .{ .min = std.math.minInt(i8), .max = std.math.maxInt(i8) }; - if (eql(u8, name, "s16")) return .{ .min = std.math.minInt(i16), .max = std.math.maxInt(i16) }; - if (eql(u8, name, "s32")) return .{ .min = std.math.minInt(i32), .max = std.math.maxInt(i32) }; - if (eql(u8, name, "s64") or eql(u8, name, "isize") or eql(u8, name, "int")) + if (eql(u8, name, "i8")) return .{ .min = std.math.minInt(i8), .max = std.math.maxInt(i8) }; + if (eql(u8, name, "i16")) return .{ .min = std.math.minInt(i16), .max = std.math.maxInt(i16) }; + if (eql(u8, name, "i32")) return .{ .min = std.math.minInt(i32), .max = std.math.maxInt(i32) }; + if (eql(u8, name, "i64") or eql(u8, name, "isize") or eql(u8, name, "int")) return .{ .min = std.math.minInt(i64), .max = std.math.maxInt(i64) }; return null; } @@ -682,7 +682,7 @@ pub const ProgramIndex = struct { protocol_decl_map: std.StringHashMap(ProtocolDeclInfo), /// Protocol name → AST node. protocol_ast_map: std.StringHashMap(*const ast.ProtocolDecl), - /// Module-level value constants (e.g. AF_INET :s32: 2). + /// Module-level value constants (e.g. AF_INET :i32: 2). module_const_map: std.StringHashMap(ModuleConstInfo), /// UFCS alias name → target function name. ufcs_alias_map: std.StringHashMap([]const u8), diff --git a/src/ir/protocols.test.zig b/src/ir/protocols.test.zig index 9c511c1..eae36c6 100644 --- a/src/ir/protocols.test.zig +++ b/src/ir/protocols.test.zig @@ -52,7 +52,7 @@ test "protocols: getProtocolInfo resolves registered protocol structs only" { try std.testing.expectEqual(@as(usize, 1), info.methods.len); // A builtin and an unrelated plain struct are not protocols. - try std.testing.expect(pr.getProtocolInfo(.s32) == null); + try std.testing.expect(pr.getProtocolInfo(.i32) == null); const plain = module.types.intern(.{ .@"struct" = .{ .name = module.types.internString("Point"), .fields = &.{} } }); try std.testing.expect(pr.getProtocolInfo(plain) == null); @@ -162,8 +162,8 @@ test "protocols: registerParamImpl flags a same-file duplicate impl" { const pr = ProtocolResolver{ .l = &l }; _ = module.types.intern(.{ .@"struct" = .{ .name = module.types.internString("IntCell"), .fields = &.{} } }); - // impl Into(s64) for IntCell { ... } — a parameterised-protocol impl. - const args = [_]*Node{typeExpr(alloc, "s64")}; + // impl Into(i64) for IntCell { ... } — a parameterised-protocol impl. + const args = [_]*Node{typeExpr(alloc, "i64")}; const conv = mk(alloc, .{ .fn_decl = .{ .name = "convert", .params = &.{}, .return_type = null, .body = emptyBody(alloc) } }); const methods = [_]*Node{conv}; const ib = ast.ImplBlock{ @@ -218,8 +218,8 @@ test "protocols: findVisibleImpls filters by transitive import visibility" { var l = Lowering.init(&module); const pr = ProtocolResolver{ .l = &l }; - const here_entry: Lowering.ParamImplEntry = .{ .methods = &.{}, .source_ty = .s64, .target_args = &.{}, .defining_module = "a.sx", .span = .{ .start = 0, .end = 0 } }; - const other_entry: Lowering.ParamImplEntry = .{ .methods = &.{}, .source_ty = .s64, .target_args = &.{}, .defining_module = "b.sx", .span = .{ .start = 0, .end = 0 } }; + const here_entry: Lowering.ParamImplEntry = .{ .methods = &.{}, .source_ty = .i64, .target_args = &.{}, .defining_module = "a.sx", .span = .{ .start = 0, .end = 0 } }; + const other_entry: Lowering.ParamImplEntry = .{ .methods = &.{}, .source_ty = .i64, .target_args = &.{}, .defining_module = "b.sx", .span = .{ .start = 0, .end = 0 } }; const entries = [_]Lowering.ParamImplEntry{ here_entry, other_entry }; // No source-file context → falls open (all entries visible). @@ -279,6 +279,6 @@ test "protocols: matchPackImpl selects a pack impl whose prefix + return match" try std.testing.expectEqual(TypeId.void, m.src_ret); // A non-closure source does not match; an unknown key does not match. - try std.testing.expect(pr.matchPackImpl(.s64, pack_key) == null); + try std.testing.expect(pr.matchPackImpl(.i64, pack_key) == null); try std.testing.expect(pr.matchPackImpl(src, "Into\x00Nope") == null); } diff --git a/src/ir/protocols.zig b/src/ir/protocols.zig index eccd280..52c3155 100644 --- a/src/ir/protocols.zig +++ b/src/ir/protocols.zig @@ -459,7 +459,7 @@ pub const ProtocolResolver = struct { // Concrete-struct source: also register the impl's methods as // `.` in fn_ast_map so UFCS resolves them (e.g. // `xs[i].get()` on a pack element). For a concrete impl like - // `impl Box(s64) for IntCell`, the method is already fully concrete — + // `impl Box(i64) for IntCell`, the method is already fully concrete — // nothing to monomorphize, unlike generic/pack sources (which stay // lazy in param_impl_map and are handled below). { diff --git a/src/ir/resolver.test.zig b/src/ir/resolver.test.zig index 5b340bd..01fccc3 100644 --- a/src/ir/resolver.test.zig +++ b/src/ir/resolver.test.zig @@ -94,10 +94,10 @@ test "resolver: collectVisibleAuthors — own author, two distinct flat authors, var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); - try tmp.dir.writeFile(io, .{ .sub_path = "a.sx", .data = "dup :: () -> s64 { 1 }\n" }); - try tmp.dir.writeFile(io, .{ .sub_path = "b.sx", .data = "dup :: () -> s64 { 2 }\n" }); - try tmp.dir.writeFile(io, .{ .sub_path = "p.sx", .data = "secret :: () -> s64 { 9 }\n" }); - try tmp.dir.writeFile(io, .{ .sub_path = "main.sx", .data = "#import \"a.sx\";\n#import \"b.sx\";\ng :: #import \"p.sx\";\nselfauthored :: () -> s64 { 0 }\nmain :: () -> s32 { 0 }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "a.sx", .data = "dup :: () -> i64 { 1 }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "b.sx", .data = "dup :: () -> i64 { 2 }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "p.sx", .data = "secret :: () -> i64 { 9 }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "main.sx", .data = "#import \"a.sx\";\n#import \"b.sx\";\ng :: #import \"p.sx\";\nselfauthored :: () -> i64 { 0 }\nmain :: () -> i32 { 0 }\n" }); var dirbuf: [4096]u8 = undefined; const absdir = dirbuf[0..try tmp.dir.realPath(io, &dirbuf)]; @@ -190,8 +190,8 @@ test "resolver: collectNamespaceAuthors — returns target members, walks no gra var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); - try tmp.dir.writeFile(io, .{ .sub_path = "point.sx", .data = "Point :: struct { x: s64 }\nhelper :: () -> s64 { 0 }\n" }); - try tmp.dir.writeFile(io, .{ .sub_path = "main.sx", .data = "g :: #import \"point.sx\";\nmain :: () -> s32 { 0 }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "point.sx", .data = "Point :: struct { x: i64 }\nhelper :: () -> i64 { 0 }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "main.sx", .data = "g :: #import \"point.sx\";\nmain :: () -> i32 { 0 }\n" }); var dirbuf: [4096]u8 = undefined; const absdir = dirbuf[0..try tmp.dir.realPath(io, &dirbuf)]; @@ -297,15 +297,15 @@ test "resolver: resolveBare — own_wins / single / ambiguous / not_visible / do var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); - try tmp.dir.writeFile(io, .{ .sub_path = "a.sx", .data = "dup :: () -> s64 { 1 }\n" }); - try tmp.dir.writeFile(io, .{ .sub_path = "b.sx", .data = "dup :: () -> s64 { 2 }\n" }); - try tmp.dir.writeFile(io, .{ .sub_path = "ns.sx", .data = "secret :: () -> s64 { 9 }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "a.sx", .data = "dup :: () -> i64 { 1 }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "b.sx", .data = "dup :: () -> i64 { 2 }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "ns.sx", .data = "secret :: () -> i64 { 9 }\n" }); try tmp.dir.writeFile(io, .{ .sub_path = "main.sx", .data = \\#import "a.sx"; \\#import "b.sx"; \\g :: #import "ns.sx"; - \\selfauthored :: () -> s64 { 0 } - \\main :: () -> s32 { 0 } + \\selfauthored :: () -> i64 { 0 } + \\main :: () -> i32 { 0 } \\ }); @@ -340,8 +340,8 @@ test "resolver: resolveBare — own_wins / single / ambiguous / not_visible / do const df = r.resolveBare("selfauthored", main_path, .bare_type); try std.testing.expectEqual(resolver.Verdict.domain_filtered, df.verdict); - // domain_filtered with empty set: s64 is a builtin, no user author - const builtin = r.resolveBare("s64", main_path, .bare_type); + // domain_filtered with empty set: i64 is a builtin, no user author + const builtin = r.resolveBare("i64", main_path, .bare_type); try std.testing.expectEqual(resolver.Verdict.domain_filtered, builtin.verdict); try std.testing.expectEqual(@as(usize, 0), builtin.set.distinctCount()); } @@ -357,8 +357,8 @@ test "resolver: resolveQualified — single for existing member, domain_filtered var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); - try tmp.dir.writeFile(io, .{ .sub_path = "point.sx", .data = "Point :: struct { x: s64 }\nhelper :: () -> s64 { 0 }\n" }); - try tmp.dir.writeFile(io, .{ .sub_path = "main.sx", .data = "g :: #import \"point.sx\";\nmain :: () -> s32 { 0 }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "point.sx", .data = "Point :: struct { x: i64 }\nhelper :: () -> i64 { 0 }\n" }); + try tmp.dir.writeFile(io, .{ .sub_path = "main.sx", .data = "g :: #import \"point.sx\";\nmain :: () -> i32 { 0 }\n" }); var dirbuf: [4096]u8 = undefined; const absdir = dirbuf[0..try tmp.dir.realPath(io, &dirbuf)]; diff --git a/src/ir/semantic_diagnostics.zig b/src/ir/semantic_diagnostics.zig index 8393c20..2b35493 100644 --- a/src/ir/semantic_diagnostics.zig +++ b/src/ir/semantic_diagnostics.zig @@ -136,8 +136,8 @@ pub const UnknownTypeChecker = struct { }, .fn_decl => |fd| { // A function NAME is a binding site too: a bare reserved-name - // `s2 :: (…) {…}` (free fn or struct/impl method) is rejected, - // exactly like `s2 := …`. Backtick (`` `s2 :: … ``) and + // `i2 :: (…) {…}` (free fn or struct/impl method) is rejected, + // exactly like `i2 := …`. Backtick (`` `i2 :: … ``) and // `#import c` foreign fns set `is_raw` and are exempt (0089). self.checkBindingName(fd.name, fd.name_span, fd.is_raw); self.checkParamNames(fd.params); @@ -366,7 +366,7 @@ pub const UnknownTypeChecker = struct { /// (a lambda default), so recurse into it. fn checkParamNames(self: UnknownTypeChecker, params: []const ast.Param) void { for (params) |p| { - // A backtick raw param (`` (`s2: T) ``) or a `#import c` foreign + // A backtick raw param (`` (`i2: T) ``) or a `#import c` foreign // param is exempt from the reserved-type-name rule — // the exemption is honored inside `checkBindingName` via `p.is_raw`. self.checkBindingName(p.name, p.name_span, p.is_raw); @@ -721,7 +721,7 @@ pub const UnknownTypeChecker = struct { /// struct template's value-param positions come from its declared params; a /// type-RETURNING function (`Make :: ($K: u32, $T: Type) -> Type`) classifies /// each param from its constraint, mirroring `instantiateTypeFunction` — so - /// `Make(N, s64)` (N a module const) is not walked as the type name "N". + /// `Make(N, i64)` (N a module const) is not walked as the type name "N". fn isValueParamPosition(self: UnknownTypeChecker, base: []const u8, i: usize) bool { if (std.mem.eql(u8, base, "Vector")) return i == 0; if (self.index.struct_template_map.get(base)) |tmpl| { @@ -812,11 +812,11 @@ pub const UnknownTypeChecker = struct { // Only bare identifiers are validated. Inline-spelled compound types // (`[:0]u8`, `mod.Type`, …) carry non-identifier characters — trust them. if (!isIdentLike(name)) return; - // A backtick raw reference (`` `s2 ``) is the LITERAL name used as a + // A backtick raw reference (`` `i2 ``) is the LITERAL name used as a // type — explicitly NOT the builtin/reserved spelling — so it must - // resolve to a `` `s2 ``-declared type, else a normal "unknown type" + // resolve to a `` `i2 ``-declared type, else a normal "unknown type" // error. Skip the builtin-name exemption that would otherwise wave a - // bare `s2` through. + // bare `i2` through. if (!is_raw and isBuiltinTypeName(name)) return; for (in_scope) |tp| { if (!std.mem.eql(u8, tp.name, name)) continue; @@ -891,7 +891,7 @@ pub const UnknownTypeChecker = struct { /// is that classifier (`parser.zig` uses it to choose `.type_expr` over /// `.identifier`), so deferring to it ties the rejection to the parser's set and /// keeps the two from drifting: the named builtins (`bool`, `string`, `void`, -/// `f32`, `f64`, `usize`, `isize`, `Any`) and the `[su]N` arbitrary-width ints +/// `f32`, `f64`, `usize`, `isize`, `Any`) and the `[iu]N` arbitrary-width ints /// over sx's supported 1–64 range. A bare value name (`s`, `buf`, `index`, /// `self`) is not a type spelling and is left alone. fn isReservedTypeName(name: []const u8) bool { @@ -900,8 +900,8 @@ fn isReservedTypeName(name: []const u8) bool { fn isBuiltinTypeName(name: []const u8) bool { if (TypeResolver.resolvePrimitive(name) != null) return true; - // Arbitrary-width integers / floats: u1, s7, u128, f16, f80, … - if (name.len >= 2 and (name[0] == 'u' or name[0] == 's' or name[0] == 'f')) { + // Arbitrary-width integers / floats: u1, i7, u128, f16, f80, … + if (name.len >= 2 and (name[0] == 'u' or name[0] == 'i' or name[0] == 'f')) { var all_digits = true; for (name[1..]) |c| { if (!std.ascii.isDigit(c)) { @@ -918,7 +918,7 @@ fn isBuiltinTypeName(name: []const u8) bool { /// True when a `const_decl`'s value introduces a TYPE name — a type declaration /// (`struct`/`enum`/`union`/`error`) or a type-expression alias (`Alias :: u32`, -/// `Ptr :: *u8`, `Cb :: (s32) -> s32`, …). Only these belong in the declared- +/// `Ptr :: *u8`, `Cb :: (i32) -> i32`, …). Only these belong in the declared- /// type-name set; a value const (`NotAType :: 123`) does NOT declare a type and /// must stay subject to the unknown-type check. /// diff --git a/src/ir/type_bridge.test.zig b/src/ir/type_bridge.test.zig index c2cb411..24274d3 100644 --- a/src/ir/type_bridge.test.zig +++ b/src/ir/type_bridge.test.zig @@ -30,14 +30,14 @@ test "resolveAstType: pointer type" { const inner = try alloc.create(Node); defer alloc.destroy(inner); - inner.* = .{ .span = .{ .start = 0, .end = 0 }, .data = .{ .type_expr = .{ .name = "s32" } } }; + inner.* = .{ .span = .{ .start = 0, .end = 0 }, .data = .{ .type_expr = .{ .name = "i32" } } }; const node = try alloc.create(Node); defer alloc.destroy(node); node.* = .{ .span = .{ .start = 0, .end = 0 }, .data = .{ .pointer_type_expr = .{ .pointee_type = inner } } }; const id = type_bridge.resolveAstType(node, &table, null, null); - try std.testing.expectEqual(TypeInfo{ .pointer = .{ .pointee = .s32 } }, table.get(id)); + try std.testing.expectEqual(TypeInfo{ .pointer = .{ .pointee = .i32 } }, table.get(id)); } test "resolveAstType: optional slice" { @@ -68,7 +68,7 @@ test "resolveAstType: optional slice" { } } -test "resolveAstType: null surfaces as .unresolved (no silent s64 default)" { +test "resolveAstType: null surfaces as .unresolved (no silent i64 default)" { const alloc = std.testing.allocator; var table = TypeTable.init(alloc); defer table.deinit(); @@ -129,12 +129,12 @@ test "resolveAstType: named-const array dimension resolves to the same length as n_val.* = .{ .span = .{ .start = 0, .end = 0 }, .data = .{ .int_literal = .{ .value = 4 } } }; var consts = std.StringHashMap(ModuleConstInfo).init(alloc); defer consts.deinit(); - try consts.put("N", .{ .value = n_val, .ty = .s64 }); + try consts.put("N", .{ .value = n_val, .ty = .i64 }); - // `[N]s64` — dimension is the named const `N`, not a literal. + // `[N]i64` — dimension is the named const `N`, not a literal. const elem = try alloc.create(Node); defer alloc.destroy(elem); - elem.* = .{ .span = .{ .start = 0, .end = 0 }, .data = .{ .type_expr = .{ .name = "s64" } } }; + elem.* = .{ .span = .{ .start = 0, .end = 0 }, .data = .{ .type_expr = .{ .name = "i64" } } }; const len_node = try alloc.create(Node); defer alloc.destroy(len_node); len_node.* = .{ .span = .{ .start = 0, .end = 0 }, .data = .{ .identifier = .{ .name = "N" } } }; @@ -142,11 +142,11 @@ test "resolveAstType: named-const array dimension resolves to the same length as defer alloc.destroy(arr); arr.* = .{ .span = .{ .start = 0, .end = 0 }, .data = .{ .array_type_expr = .{ .length = len_node, .element_type = elem } } }; - // With the const table threaded, `[N]s64` lays out identically to `[4]s64`. + // With the const table threaded, `[N]i64` lays out identically to `[4]i64`. const id = type_bridge.resolveAstType(arr, &table, null, &consts); const info = table.get(id); try std.testing.expect(info == .array); - try std.testing.expectEqual(TypeId.s64, info.array.element); + try std.testing.expectEqual(TypeId.i64, info.array.element); try std.testing.expectEqual(@as(u32, 4), info.array.length); } @@ -211,7 +211,7 @@ test "resolveAstType: bare `!` resolves to a shared inferred placeholder set" { try std.testing.expectEqual(ia, ib); // all bare `!` share the placeholder for now } -test "resolveAstType: `(s32, !Named)` result list is a tuple ending in the error set" { +test "resolveAstType: `(i32, !Named)` result list is a tuple ending in the error set" { // resolveTupleType allocates its field slice via `table.alloc` (the real // compiler backs the table with an arena), so use one here. var arena = std.heap.ArenaAllocator.init(std.testing.allocator); @@ -223,7 +223,7 @@ test "resolveAstType: `(s32, !Named)` result list is a tuple ending in the error const val_ty = try alloc.create(Node); defer alloc.destroy(val_ty); - val_ty.* = .{ .span = .{ .start = 0, .end = 0 }, .data = .{ .type_expr = .{ .name = "s32" } } }; + val_ty.* = .{ .span = .{ .start = 0, .end = 0 }, .data = .{ .type_expr = .{ .name = "i32" } } }; const err_ty = try alloc.create(Node); defer alloc.destroy(err_ty); err_ty.* = .{ .span = .{ .start = 0, .end = 0 }, .data = .{ .error_type_expr = .{ .name = "IoErr" } } }; @@ -236,6 +236,6 @@ test "resolveAstType: `(s32, !Named)` result list is a tuple ending in the error const info = table.get(id); try std.testing.expect(info == .tuple); try std.testing.expectEqual(@as(usize, 2), info.tuple.fields.len); - try std.testing.expectEqual(TypeId.s32, info.tuple.fields[0]); + try std.testing.expectEqual(TypeId.i32, info.tuple.fields[0]); try std.testing.expectEqual(set, info.tuple.fields[1]); // error channel = last slot } diff --git a/src/ir/type_bridge.zig b/src/ir/type_bridge.zig index 6ce173f..918667a 100644 --- a/src/ir/type_bridge.zig +++ b/src/ir/type_bridge.zig @@ -41,7 +41,7 @@ const StatelessInner = struct { return resolveAstType(node, self.table, self.alias_map, self.consts); } /// Fixed-array dimension at registration time: a literal `[16]T`, a named - /// module-global const `N :: 16; [N]T` (typed `N : s64 : 16` too), or a + /// module-global const `N :: 16; [N]T` (typed `N : i64 : 16` too), or a /// constant-foldable expression over those (`[M + 1]`, `[(M + 1) * 2]`). /// Folds and narrows through the shared `program_index.foldDimU32` (min 0) — /// the SAME range-checked fold-to-u32 the stateful body-lowering path uses — @@ -133,7 +133,7 @@ pub fn resolveAstType(node: ?*const Node, table: *TypeTable, alias_map: AliasMap // A null node means a caller reached type resolution without a type node. // Every current caller either passes a non-optional node or handles the // "no type" case itself (returning `.void`), so this is a caller bug — and - // `.s64` here would silently fabricate an 8-byte int. Surface it via the + // `.i64` here would silently fabricate an 8-byte int. Surface it via the // `.unresolved` sentinel (trips the sizeOf/toLLVMType panic at codegen). const n = node orelse return .unresolved; const si = StatelessInner{ .table = table, .alias_map = alias_map, .consts = consts }; @@ -167,7 +167,7 @@ pub fn resolveAstType(node: ?*const Node, table: *TypeTable, alias_map: AliasMap // to that state. The pack-aware caller (lowering's // `resolveTypeWithBindings`) handles this case directly *before* // delegating here, so reaching this bare path means the binding - // was missing. `.s64` would silently fabricate an 8-byte int; + // was missing. `.i64` would silently fabricate an 8-byte int; // return `.unresolved` so it surfaces (trips the sizeOf/toLLVMType // panic at codegen). std.debug.print("type_bridge: pack-index type expression encountered outside a pack-aware context — returning .unresolved\n", .{}); @@ -177,7 +177,7 @@ pub fn resolveAstType(node: ?*const Node, table: *TypeTable, alias_map: AliasMap .parameterized_type_expr => |pt| resolveParameterizedType(&pt, table, alias_map, consts), // An unannotated param. Its type must be resolved from context // (contextual closure typing, generic binding, or pack substitution) - // *before* reaching here; if it doesn't, returning a plausible `.s64` + // *before* reaching here; if it doesn't, returning a plausible `.i64` // silently fabricates an 8-byte int (the classic silent-default trap). // Return the dedicated `.unresolved` sentinel — never a legitimate // type — so the omission surfaces; the lowering-side `resolveParamType` @@ -191,7 +191,7 @@ pub fn resolveAstType(node: ?*const Node, table: *TypeTable, alias_map: AliasMap .error_type_expr => |ete| resolveErrorType(&ete, table, alias_map), else => { // A non-type AST node reached type resolution — a caller bug. - // Returning a plausible `.s64` would silently fabricate an 8-byte + // Returning a plausible `.i64` would silently fabricate an 8-byte // int; return the `.unresolved` sentinel so it surfaces (and trips // the sizeOf/toLLVMType panic if it ever reaches codegen). std.debug.print("type_bridge: unhandled node type {s} in type position — returning .unresolved\n", .{@tagName(n.data)}); @@ -258,8 +258,8 @@ fn resolveTupleSpreadShape(tt: *const ast.TupleTypeExpr, table: *TypeTable, alia // Treat a tuple value literal as the corresponding tuple TYPE — valid only when // every element is itself a type expression. A non-type element (e.g. the `1` -// in `(s32, 1)`) means this literal is NOT a type: refuse to fabricate a tuple -// and return the `.unresolved` sentinel (never `.s64`, which would silently lie +// in `(i32, 1)`) means this literal is NOT a type: refuse to fabricate a tuple +// and return the `.unresolved` sentinel (never `.i64`, which would silently lie // about the size). type_bridge is stateless and has no diagnostics; // the user-facing diagnostic is emitted by the stateful caller // (`Lowering.resolveTupleLiteralTypeArg`), which validates before delegating @@ -447,7 +447,7 @@ pub fn buildEnumInfo(ed: *const ast.EnumDecl, table: *TypeTable, alias_map: Alia return .{ .tagged_union = .{ .name = name_id, .fields = fields.items, - .tag_type = tag_type orelse .s64, // enum unions are always tagged (default i64) + .tag_type = tag_type orelse .i64, // enum unions are always tagged (default i64) .backing_type = backing_type, .explicit_tag_values = explicit_tag_vals, } }; diff --git a/src/ir/type_resolver.test.zig b/src/ir/type_resolver.test.zig index b81945f..7dc05bc 100644 --- a/src/ir/type_resolver.test.zig +++ b/src/ir/type_resolver.test.zig @@ -32,7 +32,7 @@ const PrimInner = struct { }; test "TypeResolver.resolvePrimitive maps builtin keywords, null otherwise" { - try std.testing.expectEqual(@as(?TypeId, .s64), TypeResolver.resolvePrimitive("s64")); + try std.testing.expectEqual(@as(?TypeId, .i64), TypeResolver.resolvePrimitive("i64")); try std.testing.expectEqual(@as(?TypeId, .bool), TypeResolver.resolvePrimitive("bool")); try std.testing.expectEqual(@as(?TypeId, .f64), TypeResolver.resolvePrimitive("f64")); try std.testing.expectEqual(@as(?TypeId, .void), TypeResolver.resolvePrimitive("void")); @@ -56,14 +56,14 @@ test "TypeResolver.resolveCompound builds structural compound types" { var table = TypeTable.init(alloc); const inner = PrimInner{}; - var s64n = typeExpr("s64"); + var s64n = typeExpr("i64"); var u8n = typeExpr("u8"); var f32n = typeExpr("f32"); var booln = typeExpr("bool"); - var s32n = typeExpr("s32"); + var s32n = typeExpr("i32"); var ptr = Node{ .span = .{ .start = 0, .end = 0 }, .data = .{ .pointer_type_expr = .{ .pointee_type = &s64n } } }; - try std.testing.expectEqual(@as(?TypeId, table.ptrTo(.s64)), TypeResolver.resolveCompound(&table, &ptr, inner)); + try std.testing.expectEqual(@as(?TypeId, table.ptrTo(.i64)), TypeResolver.resolveCompound(&table, &ptr, inner)); var mptr = Node{ .span = .{ .start = 0, .end = 0 }, .data = .{ .many_pointer_type_expr = .{ .element_type = &u8n } } }; try std.testing.expectEqual(@as(?TypeId, table.manyPtrTo(.u8)), TypeResolver.resolveCompound(&table, &mptr, inner)); @@ -76,22 +76,22 @@ test "TypeResolver.resolveCompound builds structural compound types" { var len = Node{ .span = .{ .start = 0, .end = 0 }, .data = .{ .int_literal = .{ .value = 3 } } }; var arr = Node{ .span = .{ .start = 0, .end = 0 }, .data = .{ .array_type_expr = .{ .length = &len, .element_type = &s32n } } }; - try std.testing.expectEqual(@as(?TypeId, table.arrayOf(.s32, 3)), TypeResolver.resolveCompound(&table, &arr, inner)); + try std.testing.expectEqual(@as(?TypeId, table.arrayOf(.i32, 3)), TypeResolver.resolveCompound(&table, &arr, inner)); - // Function type `(s64) -> bool` — resolveCompound owns it (A2.3b). + // Function type `(i64) -> bool` — resolveCompound owns it (A2.3b). const fparams = [_]*Node{&s64n}; var fnode = Node{ .span = .{ .start = 0, .end = 0 }, .data = .{ .function_type_expr = .{ .param_types = &fparams, .return_type = &booln } } }; - try std.testing.expectEqual(@as(?TypeId, table.functionTypeCC(&[_]TypeId{.s64}, .bool, .default)), TypeResolver.resolveCompound(&table, &fnode, inner)); + try std.testing.expectEqual(@as(?TypeId, table.functionTypeCC(&[_]TypeId{.i64}, .bool, .default)), TypeResolver.resolveCompound(&table, &fnode, inner)); - // Plain closure `Closure(s64) -> bool` (no pack) — owned here. + // Plain closure `Closure(i64) -> bool` (no pack) — owned here. const cparams = [_]*Node{&s64n}; var cnode = Node{ .span = .{ .start = 0, .end = 0 }, .data = .{ .closure_type_expr = .{ .param_types = &cparams, .return_type = &booln } } }; - try std.testing.expectEqual(@as(?TypeId, table.closureType(&[_]TypeId{.s64}, .bool)), TypeResolver.resolveCompound(&table, &cnode, inner)); + try std.testing.expectEqual(@as(?TypeId, table.closureType(&[_]TypeId{.i64}, .bool)), TypeResolver.resolveCompound(&table, &cnode, inner)); - // Plain positional tuple `(s64, bool)` — owned here. + // Plain positional tuple `(i64, bool)` — owned here. const tfields = [_]*Node{ &s64n, &booln }; var tnode = Node{ .span = .{ .start = 0, .end = 0 }, .data = .{ .tuple_type_expr = .{ .field_types = &tfields, .field_names = null } } }; - const want_tuple = table.intern(.{ .tuple = .{ .fields = &[_]TypeId{ .s64, .bool }, .names = null } }); + const want_tuple = table.intern(.{ .tuple = .{ .fields = &[_]TypeId{ .i64, .bool }, .names = null } }); try std.testing.expectEqual(@as(?TypeId, want_tuple), TypeResolver.resolveCompound(&table, &tnode, inner)); // Pack-shaped `Closure(..p)` → null (needs caller pack state → PackResolver). @@ -121,11 +121,11 @@ test "TypeResolver.resolveBinding reads ResolveEnv type bindings ($T)" { const alloc = std.testing.allocator; var tb = std.StringHashMap(TypeId).init(alloc); defer tb.deinit(); - try tb.put("T", .s64); + try tb.put("T", .i64); const env = ResolveEnv{ .type_bindings = &tb }; var bound = typeExpr("T"); - try std.testing.expectEqual(@as(?TypeId, .s64), TypeResolver.resolveBinding(&bound, env)); + try std.testing.expectEqual(@as(?TypeId, .i64), TypeResolver.resolveBinding(&bound, env)); // Unbound name → null (caller continues with primitive / alias / struct). var unbound = typeExpr("U"); try std.testing.expect(TypeResolver.resolveBinding(&unbound, env) == null); @@ -140,22 +140,22 @@ test "TypeResolver.resolveName resolves aliases via ProgramIndex (not the TypeTa var index = ProgramIndex.init(alloc); defer index.deinit(); try index.type_alias_map.put("ShaderHandle", .u32); // alias → primitive - const ptr_s64 = table.ptrTo(.s64); - try index.type_alias_map.put("NodeRef", ptr_s64); // alias → pointer + const ptr_i64 = table.ptrTo(.i64); + try index.type_alias_map.put("NodeRef", ptr_i64); // alias → pointer const tr = TypeResolver{ .alloc = alloc, .types = &table, .diagnostics = null, .index = &index }; try std.testing.expectEqual(@as(TypeId, .u32), tr.resolveName("ShaderHandle", false)); - try std.testing.expectEqual(ptr_s64, tr.resolveName("NodeRef", false)); + try std.testing.expectEqual(ptr_i64, tr.resolveName("NodeRef", false)); // Primitive is checked before alias. - try std.testing.expectEqual(@as(TypeId, .s64), tr.resolveName("s64", false)); + try std.testing.expectEqual(@as(TypeId, .i64), tr.resolveName("i64", false)); } test "TypeResolver.resolveNamed: width-int, string-prefix, unknown→stub" { const alloc = std.testing.allocator; var table = TypeTable.init(alloc); defer table.deinit(); - try std.testing.expectEqual(table.intern(.{ .signed = 7 }), TypeResolver.resolveNamed("s7", &table, null, false)); - try std.testing.expectEqual(table.ptrTo(.s64), TypeResolver.resolveNamed("*s64", &table, null, false)); + try std.testing.expectEqual(table.intern(.{ .signed = 7 }), TypeResolver.resolveNamed("i7", &table, null, false)); + try std.testing.expectEqual(table.ptrTo(.i64), TypeResolver.resolveNamed("*i64", &table, null, false)); // Unknown name, no alias map → empty-struct stub (preserved behavior; // never `.unresolved`, which is reserved for failed *generic* resolution). try std.testing.expect(TypeResolver.resolveNamed("Unknown", &table, null, false) != .unresolved); @@ -165,23 +165,23 @@ test "TypeResolver.resolveNamed: skip_builtin resolves a raw reserved-name type, const alloc = std.testing.allocator; var table = TypeTable.init(alloc); defer table.deinit(); - // A registered user type named "s2" (a reserved int spelling). - const name_id = table.internString("s2"); - const user_s2 = table.intern(.{ .@"struct" = .{ .name = name_id, .fields = &.{} } }); + // A registered user type named "i2" (a reserved int spelling). + const name_id = table.internString("i2"); + const user_i2 = table.intern(.{ .@"struct" = .{ .name = name_id, .fields = &.{} } }); // Bare lookup → the builtin 2-bit signed int; raw lookup → the user type. - try std.testing.expectEqual(table.intern(.{ .signed = 2 }), TypeResolver.resolveNamed("s2", &table, null, false)); - try std.testing.expectEqual(user_s2, TypeResolver.resolveNamed("s2", &table, null, true)); + try std.testing.expectEqual(table.intern(.{ .signed = 2 }), TypeResolver.resolveNamed("i2", &table, null, false)); + try std.testing.expectEqual(user_i2, TypeResolver.resolveNamed("i2", &table, null, true)); } test "TypeResolver.parseWidthInt: every width 1..64, both signs; rejects out-of-range / non-int" { - // The single width parser — covers the named primitives (s8/u64/…) too. - try std.testing.expectEqual(@as(?TypeResolver.WidthInt, .{ .width = 1, .signed = true }), TypeResolver.parseWidthInt("s1")); - try std.testing.expectEqual(@as(?TypeResolver.WidthInt, .{ .width = 3, .signed = true }), TypeResolver.parseWidthInt("s3")); - try std.testing.expectEqual(@as(?TypeResolver.WidthInt, .{ .width = 64, .signed = true }), TypeResolver.parseWidthInt("s64")); + // The single width parser — covers the named primitives (i8/u64/…) too. + try std.testing.expectEqual(@as(?TypeResolver.WidthInt, .{ .width = 1, .signed = true }), TypeResolver.parseWidthInt("i1")); + try std.testing.expectEqual(@as(?TypeResolver.WidthInt, .{ .width = 3, .signed = true }), TypeResolver.parseWidthInt("i3")); + try std.testing.expectEqual(@as(?TypeResolver.WidthInt, .{ .width = 64, .signed = true }), TypeResolver.parseWidthInt("i64")); try std.testing.expectEqual(@as(?TypeResolver.WidthInt, .{ .width = 1, .signed = false }), TypeResolver.parseWidthInt("u1")); try std.testing.expectEqual(@as(?TypeResolver.WidthInt, .{ .width = 64, .signed = false }), TypeResolver.parseWidthInt("u64")); // Width 0 and >64, and non-`s`/`u` names, are not width-ints. - try std.testing.expect(TypeResolver.parseWidthInt("s0") == null); + try std.testing.expect(TypeResolver.parseWidthInt("i0") == null); try std.testing.expect(TypeResolver.parseWidthInt("u65") == null); try std.testing.expect(TypeResolver.parseWidthInt("usize") == null); try std.testing.expect(TypeResolver.parseWidthInt("f32") == null); @@ -207,33 +207,33 @@ test "TypeResolver.integerLimitFor: pinned min/max across widths and extremes" { } }; // Sub-byte widths (arbitrary bit-width arithmetic, not a per-name table). - try std.testing.expectEqual(@as(i64, -1), L.v("s1", "min")); - try std.testing.expectEqual(@as(i64, 0), L.v("s1", "max")); - try std.testing.expectEqual(@as(i64, -2), L.v("s2", "min")); - try std.testing.expectEqual(@as(i64, 1), L.v("s2", "max")); - try std.testing.expectEqual(@as(i64, 3), L.v("s3", "max")); + try std.testing.expectEqual(@as(i64, -1), L.v("i1", "min")); + try std.testing.expectEqual(@as(i64, 0), L.v("i1", "max")); + try std.testing.expectEqual(@as(i64, -2), L.v("i2", "min")); + try std.testing.expectEqual(@as(i64, 1), L.v("i2", "max")); + try std.testing.expectEqual(@as(i64, 3), L.v("i3", "max")); try std.testing.expectEqual(@as(i64, 0), L.v("u1", "min")); try std.testing.expectEqual(@as(i64, 1), L.v("u1", "max")); try std.testing.expectEqual(@as(i64, 3), L.v("u2", "max")); // Byte / word. - try std.testing.expectEqual(@as(i64, -128), L.v("s8", "min")); - try std.testing.expectEqual(@as(i64, 127), L.v("s8", "max")); + try std.testing.expectEqual(@as(i64, -128), L.v("i8", "min")); + try std.testing.expectEqual(@as(i64, 127), L.v("i8", "max")); try std.testing.expectEqual(@as(i64, 255), L.v("u8", "max")); - try std.testing.expectEqual(@as(i64, -2147483648), L.v("s32", "min")); - try std.testing.expectEqual(@as(i64, 2147483647), L.v("s32", "max")); - // s64 extremes = i64 extremes. - try std.testing.expectEqual(std.math.minInt(i64), L.v("s64", "min")); - try std.testing.expectEqual(std.math.maxInt(i64), L.v("s64", "max")); + try std.testing.expectEqual(@as(i64, -2147483648), L.v("i32", "min")); + try std.testing.expectEqual(@as(i64, 2147483647), L.v("i32", "max")); + // i64 extremes = i64 extremes. + try std.testing.expectEqual(std.math.minInt(i64), L.v("i64", "min")); + try std.testing.expectEqual(std.math.maxInt(i64), L.v("i64", "max")); // u63.max fits i64; u64.max is all-ones (= -1 as i64, maxInt(u64) as u64). try std.testing.expectEqual(std.math.maxInt(i64), L.v("u63", "max")); try std.testing.expectEqual(@as(i64, -1), L.v("u64", "max")); try std.testing.expectEqual(std.math.maxInt(u64), @as(u64, @bitCast(L.v("u64", "max")))); try std.testing.expectEqual(@as(i64, 0), L.v("u64", "min")); - // usize/isize track u64/s64 on the host. + // usize/isize track u64/i64 on the host. try std.testing.expectEqual(L.v("u64", "max"), L.v("usize", "max")); try std.testing.expectEqual(@as(i64, 0), L.v("usize", "min")); - try std.testing.expectEqual(L.v("s64", "min"), L.v("isize", "min")); - try std.testing.expectEqual(L.v("s64", "max"), L.v("isize", "max")); + try std.testing.expectEqual(L.v("i64", "min"), L.v("isize", "min")); + try std.testing.expectEqual(L.v("i64", "max"), L.v("isize", "max")); } test "TypeResolver.integerLimitFor: null for non-integer receivers and non-limit fields" { @@ -243,7 +243,7 @@ test "TypeResolver.integerLimitFor: null for non-integer receivers and non-limit try std.testing.expect(TypeResolver.integerLimitFor("void", "min") == null); try std.testing.expect(TypeResolver.integerLimitFor("MyStruct", "min") == null); // A builtin int with a non-limit field is not a fold here. - try std.testing.expect(TypeResolver.integerLimitFor("s64", "len") == null); + try std.testing.expect(TypeResolver.integerLimitFor("i64", "len") == null); try std.testing.expect(TypeResolver.integerLimitFor("u8", "epsilon") == null); } @@ -308,7 +308,7 @@ test "TypeResolver.floatLimitFor: pinned f32 bit patterns (widened value narrows test "TypeResolver.floatLimitFor: null for non-float receivers and non-limit fields" { // Integer / non-numeric / user names are not float-limit folds. - try std.testing.expect(TypeResolver.floatLimitFor("s32", "epsilon") == null); + try std.testing.expect(TypeResolver.floatLimitFor("i32", "epsilon") == null); try std.testing.expect(TypeResolver.floatLimitFor("u64", "max") == null); try std.testing.expect(TypeResolver.floatLimitFor("usize", "min") == null); try std.testing.expect(TypeResolver.floatLimitFor("bool", "nan") == null); diff --git a/src/ir/type_resolver.zig b/src/ir/type_resolver.zig index e8fcf2e..38a98ef 100644 --- a/src/ir/type_resolver.zig +++ b/src/ir/type_resolver.zig @@ -43,10 +43,10 @@ pub const TypeResolver = struct { /// Namespaced (no `self`) — primitive resolution is stateless. pub fn resolvePrimitive(name: []const u8) ?TypeId { if (name.len == 0) return null; - if (std.mem.eql(u8, name, "s64")) return .s64; - if (std.mem.eql(u8, name, "s32")) return .s32; - if (std.mem.eql(u8, name, "s16")) return .s16; - if (std.mem.eql(u8, name, "s8")) return .s8; + if (std.mem.eql(u8, name, "i64")) return .i64; + if (std.mem.eql(u8, name, "i32")) return .i32; + if (std.mem.eql(u8, name, "i16")) return .i16; + if (std.mem.eql(u8, name, "i8")) return .i8; if (std.mem.eql(u8, name, "u64")) return .u64; if (std.mem.eql(u8, name, "u32")) return .u32; if (std.mem.eql(u8, name, "u16")) return .u16; @@ -67,8 +67,8 @@ pub const TypeResolver = struct { return null; } - /// An arbitrary-bit-width integer type NAME (`s1`–`s64`, `u1`–`u64`, which - /// also subsumes `s8`/`u8`/…/`s64`/`u64`): its width + signedness, else + /// An arbitrary-bit-width integer type NAME (`i1`–`i64`, `u1`–`u64`, which + /// also subsumes `i8`/`u8`/…/`i64`/`u64`): its width + signedness, else /// null. THE single width parser — `resolveBuiltinName` (to intern the /// `TypeId`) and the numeric-limit accessors (`.min`/`.max`, via /// `integerWidthSign`) both classify through here, so the recognized width @@ -76,10 +76,10 @@ pub const TypeResolver = struct { pub const WidthInt = struct { width: u8, signed: bool }; pub fn parseWidthInt(name: []const u8) ?WidthInt { if (name.len < 2) return null; - if (name[0] != 's' and name[0] != 'u') return null; + if (name[0] != 'i' and name[0] != 'u') return null; const width = std.fmt.parseInt(u8, name[1..], 10) catch return null; if (width < 1 or width > 64) return null; - return .{ .width = width, .signed = name[0] == 's' }; + return .{ .width = width, .signed = name[0] == 'i' }; } /// A bare name → its builtin `TypeId` (primitive keyword OR arbitrary-width @@ -96,7 +96,7 @@ pub const TypeResolver = struct { return null; } - /// Width + signedness of a builtin INTEGER type NAME: the `s`/`u` widths via + /// Width + signedness of a builtin INTEGER type NAME: the `i`/`u` widths via /// `parseWidthInt`, plus `usize`/`isize` (target-width = 64 on the host). /// null for a non-integer name (floats, `bool`, `string`, a user type, …) — /// so the `.min`/`.max` fold fires for integers only. @@ -280,7 +280,7 @@ pub const TypeResolver = struct { } /// Resolve a bare type NAME to a `TypeId`: primitive → arbitrary-width int - /// (`s1`–`u64`) → string-form pointer/slice/optional prefixes → already- + /// (`i1`–`u64`) → string-form pointer/slice/optional prefixes → already- /// registered named type → alias (`alias_map`) → fresh empty-struct stub. /// `alias_map` is the single-source alias table (owned by `ProgramIndex`); /// callers pass it explicitly — Lowering via the index (`resolveName`), @@ -288,15 +288,15 @@ pub const TypeResolver = struct { /// stub fall-through preserves long-standing behavior for as-yet- /// unregistered names. /// - /// `skip_builtin` is the backtick raw-identifier escape (`` `s2 `` in type + /// `skip_builtin` is the backtick raw-identifier escape (`` `i2 `` in type /// position): a raw reference is the LITERAL name used as a /// type, so it bypasses the builtin/reserved classifier and resolves only - /// through registered-type → alias → stub. A bare `s2` keeps the default + /// through registered-type → alias → stub. A bare `i2` keeps the default /// (`false`) and resolves to the builtin int type. The string-prefix /// recursion always passes `false`: the inner names (`*T`/`?T`) are bare, /// never raw. pub fn resolveNamed(name: []const u8, table: *TypeTable, alias_map: ?*const std.StringHashMap(TypeId), skip_builtin: bool) TypeId { - // Builtin primitive keyword or arbitrary-width integer (`s1`-`s64`, + // Builtin primitive keyword or arbitrary-width integer (`i1`-`i64`, // `u1`-`u64`) — the single builtin classifier, also reused by the // numeric-limit accessor intercept. if (!skip_builtin) { diff --git a/src/ir/types.test.zig b/src/ir/types.test.zig index f252b4f..966792c 100644 --- a/src/ir/types.test.zig +++ b/src/ir/types.test.zig @@ -14,7 +14,7 @@ test "builtin types pre-populated" { // Verify builtin slots try std.testing.expectEqual(TypeInfo.void, table.get(.void)); try std.testing.expectEqual(TypeInfo.bool, table.get(.bool)); - try std.testing.expectEqual(TypeInfo{ .signed = 32 }, table.get(.s32)); + try std.testing.expectEqual(TypeInfo{ .signed = 32 }, table.get(.i32)); try std.testing.expectEqual(TypeInfo{ .unsigned = 8 }, table.get(.u8)); try std.testing.expectEqual(TypeInfo.f64, table.get(.f64)); try std.testing.expectEqual(TypeInfo.string, table.get(.string)); @@ -26,8 +26,8 @@ test "intern deduplicates structural types" { var table = TypeTable.init(alloc); defer table.deinit(); - const ptr1 = table.ptrTo(.s32); - const ptr2 = table.ptrTo(.s32); + const ptr1 = table.ptrTo(.i32); + const ptr2 = table.ptrTo(.i32); try std.testing.expectEqual(ptr1, ptr2); const ptr3 = table.ptrTo(.f64); @@ -39,8 +39,8 @@ test "slice and array interning" { var table = TypeTable.init(alloc); defer table.deinit(); - const slice1 = table.sliceOf(.s32); - const slice2 = table.sliceOf(.s32); + const slice1 = table.sliceOf(.i32); + const slice2 = table.sliceOf(.i32); try std.testing.expectEqual(slice1, slice2); const arr1 = table.arrayOf(.u8, 10); @@ -55,8 +55,8 @@ test "optional interning" { var table = TypeTable.init(alloc); defer table.deinit(); - const opt1 = table.optionalOf(.s32); - const opt2 = table.optionalOf(.s32); + const opt1 = table.optionalOf(.i32); + const opt2 = table.optionalOf(.i32); try std.testing.expectEqual(opt1, opt2); const opt3 = table.optionalOf(.f64); @@ -68,9 +68,9 @@ test "function type interning" { var table = TypeTable.init(alloc); defer table.deinit(); - const params = &[_]TypeId{ .s32, .s32 }; - const fn1 = table.functionType(params, .s64); - const fn2 = table.functionType(params, .s64); + const params = &[_]TypeId{ .i32, .i32 }; + const fn1 = table.functionType(params, .i64); + const fn2 = table.functionType(params, .i64); try std.testing.expectEqual(fn1, fn2); const fn3 = table.functionType(params, .f64); @@ -99,14 +99,14 @@ test "sizeOf builtins" { try std.testing.expectEqual(@as(u32, 0), table.sizeOf(.void)); try std.testing.expectEqual(@as(u32, 1), table.sizeOf(.bool)); - try std.testing.expectEqual(@as(u32, 4), table.sizeOf(.s32)); - try std.testing.expectEqual(@as(u32, 8), table.sizeOf(.s64)); + try std.testing.expectEqual(@as(u32, 4), table.sizeOf(.i32)); + try std.testing.expectEqual(@as(u32, 8), table.sizeOf(.i64)); try std.testing.expectEqual(@as(u32, 1), table.sizeOf(.u8)); try std.testing.expectEqual(@as(u32, 4), table.sizeOf(.f32)); try std.testing.expectEqual(@as(u32, 8), table.sizeOf(.f64)); try std.testing.expectEqual(@as(u32, 16), table.sizeOf(.string)); - try std.testing.expectEqual(@as(u32, 8), table.sizeOf(table.ptrTo(.s32))); - try std.testing.expectEqual(@as(u32, 16), table.sizeOf(table.sliceOf(.s32))); + try std.testing.expectEqual(@as(u32, 8), table.sizeOf(table.ptrTo(.i32))); + try std.testing.expectEqual(@as(u32, 16), table.sizeOf(table.sliceOf(.i32))); } test "typeName for builtins" { @@ -114,7 +114,7 @@ test "typeName for builtins" { var table = TypeTable.init(alloc); defer table.deinit(); - try std.testing.expectEqualStrings("s32", table.typeName(.s32)); + try std.testing.expectEqualStrings("i32", table.typeName(.i32)); try std.testing.expectEqualStrings("bool", table.typeName(.bool)); try std.testing.expectEqualStrings("string", table.typeName(.string)); try std.testing.expectEqualStrings("void", table.typeName(.void)); @@ -128,7 +128,7 @@ test "pack type: construct, element access, intern dedup (N=3)" { var table = TypeTable.init(alloc); defer table.deinit(); - const elems = &[_]TypeId{ .bool, .s32, .string }; + const elems = &[_]TypeId{ .bool, .i32, .string }; const p1 = table.packType(elems); const p2 = table.packType(elems); try std.testing.expectEqual(p1, p2); // structural dedup @@ -137,7 +137,7 @@ test "pack type: construct, element access, intern dedup (N=3)" { try std.testing.expect(info == .pack); try std.testing.expectEqual(@as(usize, 3), info.pack.elements.len); try std.testing.expectEqual(TypeId.bool, info.pack.elements[0]); - try std.testing.expectEqual(TypeId.s32, info.pack.elements[1]); + try std.testing.expectEqual(TypeId.i32, info.pack.elements[1]); try std.testing.expectEqual(TypeId.string, info.pack.elements[2]); } @@ -170,14 +170,14 @@ test "pack type: distinct element lists are distinct types" { var table = TypeTable.init(alloc); defer table.deinit(); - const a = table.packType(&[_]TypeId{ .bool, .s32 }); - const b = table.packType(&[_]TypeId{ .s32, .bool }); // order matters + const a = table.packType(&[_]TypeId{ .bool, .i32 }); + const b = table.packType(&[_]TypeId{ .i32, .bool }); // order matters const c = table.packType(&[_]TypeId{.bool}); // arity matters try std.testing.expect(a != b); try std.testing.expect(a != c); try std.testing.expect(b != c); // A pack is distinct from the tuple of the same elements. - const tup = table.intern(.{ .tuple = .{ .fields = &[_]TypeId{ .bool, .s32 }, .names = null } }); + const tup = table.intern(.{ .tuple = .{ .fields = &[_]TypeId{ .bool, .i32 }, .names = null } }); try std.testing.expect(a != tup); } @@ -189,8 +189,8 @@ test "pack type: formatTypeName" { var arena = std.heap.ArenaAllocator.init(alloc); defer arena.deinit(); - const p = table.packType(&[_]TypeId{ .bool, .s32, .string }); - try std.testing.expectEqualStrings("pack(bool, s32, string)", table.formatTypeName(arena.allocator(), p)); + const p = table.packType(&[_]TypeId{ .bool, .i32, .string }); + try std.testing.expectEqualStrings("pack(bool, i32, string)", table.formatTypeName(arena.allocator(), p)); const empty = table.packType(&.{}); try std.testing.expectEqualStrings("pack()", table.formatTypeName(arena.allocator(), empty)); @@ -266,7 +266,7 @@ test "isUnsignedInt: builtin signedness classification" { } // Signed / non-integer builtins are not unsigned. inline for (.{ - TypeId.s8, TypeId.s16, TypeId.s32, TypeId.s64, TypeId.isize, + TypeId.i8, TypeId.i16, TypeId.i32, TypeId.i64, TypeId.isize, TypeId.bool, TypeId.f32, TypeId.f64, TypeId.string, TypeId.void, TypeId.any, TypeId.unresolved, }) |ty| { @@ -280,9 +280,9 @@ test "isUnsignedInt: user-defined arbitrary-width ints" { defer table.deinit(); const u24_ty = table.intern(.{ .unsigned = 24 }); - const s24_ty = table.intern(.{ .signed = 24 }); + const i24_ty = table.intern(.{ .signed = 24 }); try std.testing.expect(table.isUnsignedInt(u24_ty)); - try std.testing.expect(!table.isUnsignedInt(s24_ty)); + try std.testing.expect(!table.isUnsignedInt(i24_ty)); // A non-integer user type is never unsigned. const ptr_ty = table.ptrTo(.u32); @@ -303,8 +303,8 @@ test "phase D: forward-decl field fill preserves intern key" { // Full definition arrives later; same name (and nominal id) → same key. const fields = [_]TypeInfo.StructInfo.Field{ - .{ .name = table.internString("x"), .ty = .s64 }, - .{ .name = table.internString("y"), .ty = .s64 }, + .{ .name = table.internString("x"), .ty = .i64 }, + .{ .name = table.internString("y"), .ty = .i64 }, }; table.updatePreservingKey(id, .{ .@"struct" = .{ .name = foo, .fields = &fields } }); @@ -322,7 +322,7 @@ test "phase D: anon rename re-keys intern_map" { const anon = table.internString("__anon"); const fields = [_]TypeInfo.StructInfo.Field{ - .{ .name = table.internString("x"), .ty = .s64 }, + .{ .name = table.internString("x"), .ty = .i64 }, }; const id = table.internNominal(.{ .@"struct" = .{ .name = anon, .fields = &fields } }, 0); try std.testing.expectEqual(id, table.findByName(anon).?); @@ -387,13 +387,13 @@ test "phase D: parameterized protocol value struct interns stably" { defer table.deinit(); // `instantiateParamProtocol` registers a `{ctx, __vtable}` value struct - // under a mangled name (e.g. `VL__s64`). Same instantiation → same id. + // under a mangled name (e.g. `VL__i64`). Same instantiation → same id. const void_ptr = table.ptrTo(.void); const fields = [_]TypeInfo.StructInfo.Field{ .{ .name = table.internString("ctx"), .ty = void_ptr }, .{ .name = table.internString("__vtable"), .ty = void_ptr }, }; - const info: TypeInfo = .{ .@"struct" = .{ .name = table.internString("VL__s64"), .fields = &fields, .is_protocol = true } }; + const info: TypeInfo = .{ .@"struct" = .{ .name = table.internString("VL__i64"), .fields = &fields, .is_protocol = true } }; const a = table.intern(info); const b = table.intern(info); try std.testing.expectEqual(a, b); @@ -408,7 +408,7 @@ test "phase D: same display-name distinct nominal ids" { defer table.deinit(); const foo = table.internString("Foo"); - const f = [_]TypeInfo.StructInfo.Field{.{ .name = table.internString("x"), .ty = .s64 }}; + const f = [_]TypeInfo.StructInfo.Field{.{ .name = table.internString("x"), .ty = .i64 }}; const base: TypeInfo = .{ .@"struct" = .{ .name = foo, .fields = &f } }; const a = table.internNominal(base, 1); @@ -445,7 +445,7 @@ test "phase D: internNominal(.,0) is byte-identical to legacy intern (old==new)" var table = TypeTable.init(alloc); defer table.deinit(); - const f = [_]TypeInfo.StructInfo.Field{.{ .name = table.internString("x"), .ty = .s64 }}; + const f = [_]TypeInfo.StructInfo.Field{.{ .name = table.internString("x"), .ty = .i64 }}; const variants = [_]types.StringId{table.internString("v")}; const tags = [_]u32{7}; @@ -453,7 +453,7 @@ test "phase D: internNominal(.,0) is byte-identical to legacy intern (old==new)" .{ .@"struct" = .{ .name = table.internString("S"), .fields = &f } }, .{ .@"enum" = .{ .name = table.internString("E"), .variants = &variants } }, .{ .@"union" = .{ .name = table.internString("U"), .fields = &f } }, - .{ .tagged_union = .{ .name = table.internString("T"), .fields = &f, .tag_type = .s64 } }, + .{ .tagged_union = .{ .name = table.internString("T"), .fields = &f, .tag_type = .i64 } }, .{ .error_set = .{ .name = table.internString("Err"), .tags = &tags } }, }; for (cases) |info| { diff --git a/src/ir/types.zig b/src/ir/types.zig index 8bc2836..97af153 100644 --- a/src/ir/types.zig +++ b/src/ir/types.zig @@ -9,7 +9,7 @@ pub const TypeId = enum(u32) { // Builtin slots 0–17. /// Resolution failed (e.g. an unannotated param whose type was never /// inferred from context). A dedicated sentinel — never a legitimate - /// result — so downstream `== .void`/`== .s64` checks can't silently + /// result — so downstream `== .void`/`== .i64` checks can't silently /// swallow it. Must never reach codegen; sizeOf/toLLVMType panic on it. /// /// Deliberately slot 0: a zero-initialised or forgotten `TypeId` (the most @@ -17,10 +17,10 @@ pub const TypeId = enum(u32) { /// tripwire, rather than silently masquerading as `.void`. unresolved = 0, bool = 1, - s8 = 2, - s16 = 3, - s32 = 4, - s64 = 5, + i8 = 2, + i16 = 3, + i32 = 4, + i64 = 5, u8 = 6, u16 = 7, u32 = 8, @@ -125,7 +125,7 @@ pub const TypeInfo = union(enum) { pub const TaggedUnionInfo = struct { name: StringId, fields: []const StructInfo.Field, - tag_type: TypeId, // tag integer type (e.g. .u32, .s64) + tag_type: TypeId, // tag integer type (e.g. .u32, .i64) backing_type: ?TypeId = null, // enum struct backing (e.g. { tag: u32; _: u32; payload: [30]u32; }) explicit_tag_values: ?[]const i64 = null, // explicit variant values (e.g., quit :: 0x100) nominal_id: u32 = 0, // stable nominal identity; 0 == structural (legacy) @@ -366,10 +366,10 @@ pub const TypeTable = struct { const builtins = [_]TypeInfo{ .unresolved, // 0: resolution-failure sentinel .bool, // 1 - .{ .signed = 8 }, // 2: s8 - .{ .signed = 16 }, // 3: s16 - .{ .signed = 32 }, // 4: s32 - .{ .signed = 64 }, // 5: s64 + .{ .signed = 8 }, // 2: i8 + .{ .signed = 16 }, // 3: i16 + .{ .signed = 32 }, // 4: i32 + .{ .signed = 64 }, // 5: i64 .{ .unsigned = 8 }, // 6: u8 .{ .unsigned = 16 }, // 7: u16 .{ .unsigned = 32 }, // 8: u32 @@ -662,11 +662,11 @@ pub const TypeTable = struct { /// True iff `ty` is an unsigned integer — a builtin (u8/u16/u32/u64/usize) /// or a user-defined arbitrary-width unsigned int. Canonical signedness /// query for reflection (`type_is_unsigned`) and the `{}` formatter so a - /// u64 value renders as unsigned decimal rather than the s64 reinterpretation. + /// u64 value renders as unsigned decimal rather than the i64 reinterpretation. pub fn isUnsignedInt(self: *const TypeTable, ty: TypeId) bool { switch (ty) { .u8, .u16, .u32, .u64, .usize => return true, - .bool, .s8, .s16, .s32, .s64, .isize => return false, + .bool, .i8, .i16, .i32, .i64, .isize => return false, else => {}, } if (ty.isBuiltin()) return false; @@ -677,10 +677,10 @@ pub const TypeTable = struct { const ptr_size: usize = self.pointer_size; if (ty == .void) return 0; if (ty == .bool) return 1; - if (ty == .u8 or ty == .s8) return 1; - if (ty == .u16 or ty == .s16) return 2; - if (ty == .s32 or ty == .u32 or ty == .f32) return 4; - if (ty == .s64 or ty == .u64 or ty == .f64) return 8; + if (ty == .u8 or ty == .i8) return 1; + if (ty == .u16 or ty == .i16) return 2; + if (ty == .i32 or ty == .u32 or ty == .f32) return 4; + if (ty == .i64 or ty == .u64 or ty == .f64) return 8; if (ty == .usize or ty == .isize) return ptr_size; if (ty == .string) return 16; // {ptr, i64} — always 16 (i64 alignment pads on wasm32) if (ty == .any) return 16; // {i64 tag, i64 value} — Any boxed layout @@ -777,10 +777,10 @@ pub const TypeTable = struct { const ptr_align: usize = self.pointer_size; if (ty == .void) return 1; if (ty == .bool) return 1; - if (ty == .u8 or ty == .s8) return 1; - if (ty == .u16 or ty == .s16) return 2; - if (ty == .s32 or ty == .u32 or ty == .f32) return 4; - if (ty == .s64 or ty == .u64 or ty == .f64) return 8; + if (ty == .u8 or ty == .i8) return 1; + if (ty == .u16 or ty == .i16) return 2; + if (ty == .i32 or ty == .u32 or ty == .f32) return 4; + if (ty == .i64 or ty == .u64 or ty == .f64) return 8; if (ty == .usize or ty == .isize) return ptr_align; if (ty == .string) return 8; // i64 drives alignment if (ty == .any) return 8; // {i64, i64} aligns to 8 @@ -836,16 +836,16 @@ pub const TypeTable = struct { return self.strings.get(id); } - /// Format a TypeId for display (e.g., "s32", "*bool", "[]u8"). + /// Format a TypeId for display (e.g., "i32", "*bool", "[]u8"). pub fn typeName(self: *const TypeTable, id: TypeId) []const u8 { // Fast path for builtins return switch (id) { .void => "void", .bool => "bool", - .s8 => "s8", - .s16 => "s16", - .s32 => "s32", - .s64 => "s64", + .i8 => "i8", + .i16 => "i16", + .i32 => "i32", + .i64 => "i64", .u8 => "u8", .u16 => "u16", .u32 => "u32", @@ -965,7 +965,7 @@ pub const TypeTable = struct { buf.append(alloc, ')') catch break :blk "pack(?)"; break :blk buf.toOwnedSlice(alloc) catch "pack(?)"; }, - .signed => |w| std.fmt.allocPrint(alloc, "s{d}", .{w}) catch "s?", + .signed => |w| std.fmt.allocPrint(alloc, "i{d}", .{w}) catch "i?", .unsigned => |w| std.fmt.allocPrint(alloc, "u{d}", .{w}) catch "u?", else => self.typeName(id), }; diff --git a/src/lexer.zig b/src/lexer.zig index b32847c..006905f 100644 --- a/src/lexer.zig +++ b/src/lexer.zig @@ -54,7 +54,7 @@ pub const Lexer = struct { // following identifier to be RAW (never type-classified, never // reserved-checked). The emitted token's span excludes the backtick, so // its text is the bare name, and a backticked keyword spelling - // (`` `s2 ``, `` `string ``) is still an `.identifier`, never a keyword. + // (`` `i2 ``, `` `string ``) is still an `.identifier`, never a keyword. if (c == '`') { const id_start = start + 1; if (id_start < self.source.len and isIdentStart(self.source[id_start])) { @@ -538,22 +538,22 @@ test "lex keywords" { } test "lex type-like identifiers" { - // s32, u8, bool, string are identifiers, not keywords - var lex = Lexer.init("s32 u8 bool string"); + // i32, u8, bool, string are identifiers, not keywords + var lex = Lexer.init("i32 u8 bool string"); for (0..4) |_| { try std.testing.expectEqual(Tag.identifier, lex.next().tag); } } test "lex backtick raw identifier" { - const source: [:0]const u8 = "`s2 `string `for"; + const source: [:0]const u8 = "`i2 `string `for"; var lex = Lexer.init(source); // Each is an `.identifier` carrying `is_raw`, even a keyword spelling // (`for`), with text that excludes the leading backtick. const t1 = lex.next(); try std.testing.expectEqual(Tag.identifier, t1.tag); try std.testing.expect(t1.is_raw); - try std.testing.expectEqualStrings("s2", t1.slice(source)); + try std.testing.expectEqualStrings("i2", t1.slice(source)); const t2 = lex.next(); try std.testing.expectEqual(Tag.identifier, t2.tag); try std.testing.expect(t2.is_raw); @@ -566,7 +566,7 @@ test "lex backtick raw identifier" { } test "lex bare identifier is not raw" { - var lex = Lexer.init("s2"); + var lex = Lexer.init("i2"); const tok = lex.next(); try std.testing.expectEqual(Tag.identifier, tok.tag); try std.testing.expect(!tok.is_raw); diff --git a/src/lsp/server.zig b/src/lsp/server.zig index 28e5a7e..b949486 100644 --- a/src/lsp/server.zig +++ b/src/lsp/server.zig @@ -646,16 +646,16 @@ pub const Server = struct { const builtins = [_]struct { label: []const u8, detail: []const u8 }{ .{ .label = "type_of", .detail = "(val: $T) -> Type" }, .{ .label = "type_name", .detail = "($T: Type) -> string" }, - .{ .label = "field_count", .detail = "($T: Type) -> s32" }, - .{ .label = "field_name", .detail = "($T: Type, idx: s32) -> string" }, - .{ .label = "field_value", .detail = "(s: $T, idx: s32) -> Any" }, - .{ .label = "size_of", .detail = "($T: Type) -> s64" }, - .{ .label = "align_of", .detail = "($T: Type) -> s64" }, + .{ .label = "field_count", .detail = "($T: Type) -> i32" }, + .{ .label = "field_name", .detail = "($T: Type, idx: i32) -> string" }, + .{ .label = "field_value", .detail = "(s: $T, idx: i32) -> Any" }, + .{ .label = "size_of", .detail = "($T: Type) -> i64" }, + .{ .label = "align_of", .detail = "($T: Type) -> i64" }, .{ .label = "cast", .detail = "(Type) expr — prefix type cast" }, - .{ .label = "malloc", .detail = "(size: s64) -> *void" }, + .{ .label = "malloc", .detail = "(size: i64) -> *void" }, .{ .label = "free", .detail = "(ptr: *void) -> void" }, - .{ .label = "memcpy", .detail = "(dst: *void, src: *void, size: s64) -> *void" }, - .{ .label = "memset", .detail = "(dst: *void, val: s64, size: s64) -> void" }, + .{ .label = "memcpy", .detail = "(dst: *void, src: *void, size: i64) -> *void" }, + .{ .label = "memset", .detail = "(dst: *void, val: i64, size: i64) -> void" }, .{ .label = "sqrt", .detail = "(x: $T) -> T" }, }; for (&keywords) |kw| { @@ -1116,16 +1116,16 @@ pub const Server = struct { const builtin_sigs = [_]struct { name: []const u8, label: []const u8, params: []const []const u8 }{ .{ .name = "type_of", .label = "type_of(val: $T) -> Type", .params = &.{"val: $T"} }, .{ .name = "type_name", .label = "type_name($T: Type) -> string", .params = &.{"$T: Type"} }, - .{ .name = "field_count", .label = "field_count($T: Type) -> s32", .params = &.{"$T: Type"} }, - .{ .name = "field_name", .label = "field_name($T: Type, idx: s32) -> string", .params = &.{ "$T: Type", "idx: s32" } }, - .{ .name = "field_value", .label = "field_value(s: $T, idx: s32) -> Any", .params = &.{ "s: $T", "idx: s32" } }, - .{ .name = "size_of", .label = "size_of($T: Type) -> s64", .params = &.{"$T: Type"} }, - .{ .name = "align_of", .label = "align_of($T: Type) -> s64", .params = &.{"$T: Type"} }, + .{ .name = "field_count", .label = "field_count($T: Type) -> i32", .params = &.{"$T: Type"} }, + .{ .name = "field_name", .label = "field_name($T: Type, idx: i32) -> string", .params = &.{ "$T: Type", "idx: i32" } }, + .{ .name = "field_value", .label = "field_value(s: $T, idx: i32) -> Any", .params = &.{ "s: $T", "idx: i32" } }, + .{ .name = "size_of", .label = "size_of($T: Type) -> i64", .params = &.{"$T: Type"} }, + .{ .name = "align_of", .label = "align_of($T: Type) -> i64", .params = &.{"$T: Type"} }, .{ .name = "cast", .label = "cast(Type) expr", .params = &.{"Type"} }, - .{ .name = "malloc", .label = "malloc(size: s64) -> *void", .params = &.{"size: s64"} }, + .{ .name = "malloc", .label = "malloc(size: i64) -> *void", .params = &.{"size: i64"} }, .{ .name = "free", .label = "free(ptr: *void) -> void", .params = &.{"ptr: *void"} }, - .{ .name = "memcpy", .label = "memcpy(dst: *void, src: *void, size: s64) -> *void", .params = &.{ "dst: *void", "src: *void", "size: s64" } }, - .{ .name = "memset", .label = "memset(dst: *void, val: s64, size: s64) -> void", .params = &.{ "dst: *void", "val: s64", "size: s64" } }, + .{ .name = "memcpy", .label = "memcpy(dst: *void, src: *void, size: i64) -> *void", .params = &.{ "dst: *void", "src: *void", "size: i64" } }, + .{ .name = "memset", .label = "memset(dst: *void, val: i64, size: i64) -> void", .params = &.{ "dst: *void", "val: i64", "size: i64" } }, .{ .name = "sqrt", .label = "sqrt(x: $T) -> T", .params = &.{"x: $T"} }, .{ .name = "print", .label = "print(fmt: string, args: ..Any)", .params = &.{ "fmt: string", "args: ..Any" } }, .{ .name = "out", .label = "out(str: string) -> void", .params = &.{"str: string"} }, @@ -3188,7 +3188,7 @@ test "analyzeDocument: parse and sema basic function" { const alloc = arena.allocator(); var store = doc_mod.DocumentStore.init(alloc, test_io(), &.{}); - const src: [:0]const u8 = "add :: (a: s32, b: s32) -> s32 { a + b; }"; + const src: [:0]const u8 = "add :: (a: i32, b: i32) -> i32 { a + b; }"; const doc = try store.openOrUpdate("main.sx", src, 1); try store.analyzeDocument(doc); @@ -3207,14 +3207,14 @@ test "analyzeDocument: flat import pre-registers symbols" { var store = doc_mod.DocumentStore.init(alloc, test_io(), &.{}); // Pre-load the imported module - const lib_src: [:0]const u8 = "mul :: (a: s32, b: s32) -> s32 { a * b; }"; + const lib_src: [:0]const u8 = "mul :: (a: i32, b: i32) -> i32 { a * b; }"; const lib_doc = try store.openOrUpdate("lib.sx", lib_src, 1); try store.analyzeDocument(lib_doc); // Load main file with flat import const main_src: [:0]const u8 = \\#import "lib.sx"; - \\main :: () -> s32 { mul(3, 4); } + \\main :: () -> i32 { mul(3, 4); } ; const main_doc = try store.openOrUpdate("main.sx", main_src, 1); try store.analyzeDocument(main_doc); @@ -3234,14 +3234,14 @@ test "analyzeDocument: namespaced import registers namespace symbol" { var store = doc_mod.DocumentStore.init(alloc, test_io(), &.{}); // Pre-load the imported module - const lib_src: [:0]const u8 = "add :: (a: s32, b: s32) -> s32 { a + b; }"; + const lib_src: [:0]const u8 = "add :: (a: i32, b: i32) -> i32 { a + b; }"; const lib_doc = try store.openOrUpdate("lib.sx", lib_src, 1); try store.analyzeDocument(lib_doc); // Load main file with namespaced import const main_src: [:0]const u8 = \\pkg :: #import "lib.sx"; - \\main :: () -> s32 { pkg.add(3, 4); } + \\main :: () -> i32 { pkg.add(3, 4); } ; const main_doc = try store.openOrUpdate("main.sx", main_src, 1); try store.analyzeDocument(main_doc); @@ -3260,13 +3260,13 @@ test "analyzeDocument: namespaced import fn_signatures have prefix" { var store = doc_mod.DocumentStore.init(alloc, test_io(), &.{}); - const lib_src: [:0]const u8 = "add :: (a: s32, b: s32) -> s32 { a + b; }"; + const lib_src: [:0]const u8 = "add :: (a: i32, b: i32) -> i32 { a + b; }"; const lib_doc = try store.openOrUpdate("lib.sx", lib_src, 1); try store.analyzeDocument(lib_doc); const main_src: [:0]const u8 = \\pkg :: #import "lib.sx"; - \\main :: () -> s32 { pkg.add(1, 2); } + \\main :: () -> i32 { pkg.add(1, 2); } ; const main_doc = try store.openOrUpdate("main.sx", main_src, 1); try store.analyzeDocument(main_doc); @@ -3283,14 +3283,14 @@ test "analyzeDocument: pipe operator desugars to call" { var store = doc_mod.DocumentStore.init(alloc, test_io(), &.{}); - const lib_src: [:0]const u8 = "add :: (a: s32, b: s32) -> s32 { a + b; }"; + const lib_src: [:0]const u8 = "add :: (a: i32, b: i32) -> i32 { a + b; }"; const lib_doc = try store.openOrUpdate("lib.sx", lib_src, 1); try store.analyzeDocument(lib_doc); // Pipe operator should parse and analyze without errors const main_src: [:0]const u8 = \\pkg :: #import "lib.sx"; - \\main :: () -> s32 { 3 |> pkg.add(4); } + \\main :: () -> i32 { 3 |> pkg.add(4); } ; const main_doc = try store.openOrUpdate("main.sx", main_src, 1); try store.analyzeDocument(main_doc); @@ -3309,7 +3309,7 @@ test "analyzeDocument: for-loop capture variables are registered" { const src: [:0]const u8 = \\main :: () { - \\ arr : [3]s32 = ---; + \\ arr : [3]i32 = ---; \\ for arr, 0.. (it, ix) { \\ x := it + ix; \\ } @@ -3335,7 +3335,7 @@ test "analyzeDocument: for-loop with underscore capture" { const src: [:0]const u8 = \\main :: () { - \\ arr : [3]s32 = ---; + \\ arr : [3]i32 = ---; \\ for arr, 0.. (_, ix) { \\ x := ix; \\ } @@ -3360,7 +3360,7 @@ test "analyzeDocument: for-loop value-only capture" { const src: [:0]const u8 = \\main :: () { - \\ arr : [3]s32 = ---; + \\ arr : [3]i32 = ---; \\ for arr (val) { \\ x := val; \\ } @@ -3393,13 +3393,13 @@ test "lsp/references: a field's uses are found across documents" { var store = doc_mod.DocumentStore.init(alloc, test_io(), &.{}); - const lib_src: [:0]const u8 = "Move :: struct { flag: s64; }"; + const lib_src: [:0]const u8 = "Move :: struct { flag: i64; }"; const lib_doc = try store.openOrUpdate("lib.sx", lib_src, 1); try store.analyzeDocument(lib_doc); const main_src: [:0]const u8 = \\#import "lib.sx"; - \\use :: (m: *Move) -> s64 { m.flag; } + \\use :: (m: *Move) -> i64 { m.flag; } ; const main_doc = try store.openOrUpdate("main.sx", main_src, 1); try store.analyzeDocument(main_doc); @@ -3423,7 +3423,7 @@ test "lsp/references: excluding the declaration drops the definition" { const alloc = arena.allocator(); var store = doc_mod.DocumentStore.init(alloc, test_io(), &.{}); - const src: [:0]const u8 = "Move :: struct { flag: s64; } use :: (m: *Move) -> s64 { m.flag; }"; + const src: [:0]const u8 = "Move :: struct { flag: i64; } use :: (m: *Move) -> i64 { m.flag; }"; const doc = try store.openOrUpdate("main.sx", src, 1); try store.analyzeDocument(doc); @@ -3442,7 +3442,7 @@ test "lsp/definition: cursor on a member declaration resolves to itself" { const alloc = arena.allocator(); var store = doc_mod.DocumentStore.init(alloc, test_io(), &.{}); - const src: [:0]const u8 = "Move :: struct { flag: s64; }"; + const src: [:0]const u8 = "Move :: struct { flag: i64; }"; const doc = try store.openOrUpdate("main.sx", src, 1); try store.analyzeDocument(doc); const sema = doc.sema orelse return error.SkipZigTest; @@ -3465,8 +3465,8 @@ test "lsp/inlayHint: a for-loop capture in a struct method shows its element typ var store = doc_mod.DocumentStore.init(alloc, test_io(), &.{}); const lib_src: [:0]const u8 = - \\Move :: struct { flag: s64; } - \\List :: struct ($T: Type) { items: [*]T = null; len: s64 = 0; } + \\Move :: struct { flag: i64; } + \\List :: struct ($T: Type) { items: [*]T = null; len: i64 = 0; } ; const lib_doc = try store.openOrUpdate("lib.sx", lib_src, 1); try store.analyzeDocument(lib_doc); @@ -3509,8 +3509,8 @@ test "lsp/workspace: loadWorkspaceFiles analyses .sx files that were never opene std.Io.Dir.deleteFile(.cwd(), io, dir ++ "/b.sx") catch {}; std.Io.Dir.deleteDir(.cwd(), io, dir) catch {}; } - try std.Io.Dir.writeFile(.cwd(), io, .{ .sub_path = dir ++ "/a.sx", .data = "Foo :: struct { x: s64; }" }); - try std.Io.Dir.writeFile(.cwd(), io, .{ .sub_path = dir ++ "/b.sx", .data = "Bar :: struct { y: s64; }" }); + try std.Io.Dir.writeFile(.cwd(), io, .{ .sub_path = dir ++ "/a.sx", .data = "Foo :: struct { x: i64; }" }); + try std.Io.Dir.writeFile(.cwd(), io, .{ .sub_path = dir ++ "/b.sx", .data = "Bar :: struct { y: i64; }" }); var store = doc_mod.DocumentStore.init(alloc, io, &.{}); store.root_path = dir; @@ -3541,12 +3541,12 @@ test "lsp/project: whole-program check attributes a reachable error to its modul // only sees because `main` calls `use` (reachability). Lowering mod.sx alone // would miss it; the whole-program check catches it and pins it to mod.sx. try std.Io.Dir.writeFile(.cwd(), io, .{ .sub_path = dir ++ "/mod.sx", .data = - "Move :: struct { flag: s64; }\n" ++ - "take :: (m: Move) -> s64 { return m.flag; }\n" ++ - "use :: (p: *Move) -> s64 { return take(p); }\n" }); + "Move :: struct { flag: i64; }\n" ++ + "take :: (m: Move) -> i64 { return m.flag; }\n" ++ + "use :: (p: *Move) -> i64 { return take(p); }\n" }); try std.Io.Dir.writeFile(.cwd(), io, .{ .sub_path = dir ++ "/main.sx", .data = "#import \"mod.sx\";\n" ++ - "main :: () -> s32 { mv : Move = .{ flag = 1 }; return xx use(@mv); }\n" }); + "main :: () -> i32 { mv : Move = .{ flag = 1 }; return xx use(@mv); }\n" }); const store = doc_mod.DocumentStore.init(alloc, io, &.{}); var server = Server{ diff --git a/src/parser.zig b/src/parser.zig index e50903f..ace1d1c 100644 --- a/src/parser.zig +++ b/src/parser.zig @@ -640,14 +640,14 @@ pub const Parser = struct { } if (self.current.tag.isTypeKeyword() or self.isIdentLike()) { - // A backtick raw identifier (`` `s2 ``) in type position is the - // LITERAL name `s2` used as a type reference — never the builtin / + // A backtick raw identifier (`` `i2 ``) in type position is the + // LITERAL name `i2` used as a type reference — never the builtin / // reserved keyword. The raw flag rides the type ATOM through the // SAME qualified-path / `Closure` / parameterized continuations as a - // bare name (so `` `s2(s64) ``, `` `s2.Inner ``, `` *`s2 `` all + // bare name (so `` `i2(i64) ``, `` `i2.Inner ``, `` *`i2 `` all // parse); it is threaded onto the final `type_expr` / // `parameterized_type_expr` so resolution skips the builtin - // classifier and looks up a `` `s2 ``-declared type. + // classifier and looks up a `` `i2 ``-declared type. const atom_is_raw = self.current.is_raw; var name = self.tokenSlice(self.current); self.advance(); @@ -2787,10 +2787,10 @@ pub const Parser = struct { .identifier => { const name = self.tokenSlice(self.current); const is_raw = self.current.is_raw; - // A backtick raw identifier (`` `s2 ``) is NEVER type-classified — + // A backtick raw identifier (`` `i2 ``) is NEVER type-classified — // it is always a value identifier, bypassing the reserved-type-name // rule. Only a bare spelling is checked for a type name - // (e.g. s32, u8, s128). + // (e.g. i32, u8, s128). if (!is_raw and Type.fromName(name) != null) { self.advance(); return try self.createNode(start, .{ .type_expr = .{ .name = name } }); @@ -2900,7 +2900,7 @@ pub const Parser = struct { return try self.parseEnumDecl("__anon", start, false); }, .kw_union => { - // Anonymous C-style union expression: union { f: f32; i: s32; } + // Anonymous C-style union expression: union { f: f32; i: i32; } return try self.parseUnionDecl("__anon", start, false); }, .kw_if => { @@ -3978,7 +3978,7 @@ test "parse minimal main" { test "block value: trailing expr without `;` produces a value" { var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); - var parser = Parser.init(arena.allocator(), "f :: () -> s32 { 42 }"); + var parser = Parser.init(arena.allocator(), "f :: () -> i32 { 42 }"); const root = try parser.parse(); const body = root.data.root.decls[0].data.fn_decl.body; try std.testing.expect(body.data.block.produces_value); @@ -3988,7 +3988,7 @@ test "block value: trailing expr without `;` produces a value" { test "block value: trailing `;` discards the value" { var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); - var parser = Parser.init(arena.allocator(), "f :: () -> s32 { 42; }"); + var parser = Parser.init(arena.allocator(), "f :: () -> i32 { 42; }"); const root = try parser.parse(); const body = root.data.root.decls[0].data.fn_decl.body; try std.testing.expect(!body.data.block.produces_value); @@ -3998,7 +3998,7 @@ test "block value: trailing `;` discards the value" { test "block value: match arms are exempt (keep `;`, still produce a value)" { var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); - var parser = Parser.init(arena.allocator(), "f :: (n: s32) -> s32 { if n == { case 1: 5; else: 0; } }"); + var parser = Parser.init(arena.allocator(), "f :: (n: i32) -> i32 { if n == { case 1: 5; else: 0; } }"); const root = try parser.parse(); const body = root.data.root.decls[0].data.fn_decl.body; // Function body's trailing match has no `;` → the body is a value. @@ -4092,7 +4092,7 @@ test "parse void function with builtin body" { } test "parse void function with foreign body" { - const source = "InitWindow :: (width: s32, height: s32, title: *u8) -> void #foreign rl;"; + const source = "InitWindow :: (width: i32, height: i32, title: *u8) -> void #foreign rl;"; var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); var parser = Parser.init(arena.allocator(), source); @@ -4170,7 +4170,7 @@ test "parse lambda with generic params" { } test "parse lambda with return type" { - const source = "f :: (x: s32) -> s32 => x;"; + const source = "f :: (x: i32) -> i32 => x;"; var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); var parser = Parser.init(arena.allocator(), source); @@ -4180,7 +4180,7 @@ test "parse lambda with return type" { const fd = decl.data.fn_decl; try std.testing.expect(fd.return_type != null); try std.testing.expect(fd.return_type.?.data == .type_expr); - try std.testing.expectEqualStrings("s32", fd.return_type.?.data.type_expr.name); + try std.testing.expectEqualStrings("i32", fd.return_type.?.data.type_expr.name); } test "parse match with else arm" { @@ -4315,7 +4315,7 @@ test "parse pack expansion: tuple type (..F(Ts))" { } test "parse pack expansion: closure sig projection Closure(..sources.T)" { - const source = "h :: (cb: Closure(..sources.T) -> s32) => cb;"; + const source = "h :: (cb: Closure(..sources.T) -> i32) => cb;"; var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); var parser = Parser.init(arena.allocator(), source); @@ -4327,7 +4327,7 @@ test "parse pack expansion: closure sig projection Closure(..sources.T)" { } test "parse closure sig bare pack Closure(..Ts) has no projection" { - const source = "j :: (cb: Closure(..Ts) -> s32) => cb;"; + const source = "j :: (cb: Closure(..Ts) -> i32) => cb;"; var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); var parser = Parser.init(arena.allocator(), source); @@ -4405,7 +4405,7 @@ test "parse bare failable return: named `!Foo`" { } test "parse multi-return with inferred `!` as trailing element" { - const source = "f :: () -> (s32, !) { 0; }"; + const source = "f :: () -> (i32, !) { 0; }"; var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); var parser = Parser.init(arena.allocator(), source); @@ -4415,13 +4415,13 @@ test "parse multi-return with inferred `!` as trailing element" { const fields = rt.data.tuple_type_expr.field_types; try std.testing.expectEqual(@as(usize, 2), fields.len); try std.testing.expect(fields[0].data == .type_expr); - try std.testing.expectEqualStrings("s32", fields[0].data.type_expr.name); + try std.testing.expectEqualStrings("i32", fields[0].data.type_expr.name); try std.testing.expect(fields[1].data == .error_type_expr); try std.testing.expect(fields[1].data.error_type_expr.name == null); } test "parse multi-return with named `!Foo` as trailing element" { - const source = "f :: () -> (s32, s64, !ParseErr) { 0; }"; + const source = "f :: () -> (i32, i64, !ParseErr) { 0; }"; var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); var parser = Parser.init(arena.allocator(), source); @@ -4435,7 +4435,7 @@ test "parse multi-return with named `!Foo` as trailing element" { } test "parse error type rejected when not the trailing result element" { - const source = "f :: () -> (!, s32) { 0; }"; + const source = "f :: () -> (!, i32) { 0; }"; var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); var parser = Parser.init(arena.allocator(), source); @@ -4443,7 +4443,7 @@ test "parse error type rejected when not the trailing result element" { } test "parse error type rejected in the middle of a result list" { - const source = "f :: () -> (s32, !, s64) { 0; }"; + const source = "f :: () -> (i32, !, i64) { 0; }"; var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); var parser = Parser.init(arena.allocator(), source); @@ -4679,7 +4679,7 @@ test "E1.7 return inside a closure within a cleanup body is allowed" { // flags, so `return` from the closure body is legal even inside `defer`. var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); - var parser = Parser.init(arena.allocator(), "f :: () { defer g((x: s32) -> s32 { return x; }); }"); + var parser = Parser.init(arena.allocator(), "f :: () { defer g((x: i32) -> i32 { return x; }); }"); _ = try parser.parse(); } @@ -4812,7 +4812,7 @@ test "E0.3 or value-terminator: parse(s) or 0" { test "E0.3 full failable function parses end-to-end (all E0 forms)" { const source = - \\parse :: (s: string) -> (s32, !ParseErr) { + \\parse :: (s: string) -> (i32, !ParseErr) { \\ onfail (e) { cleanup(s); } \\ v := try inner(s) or 0; \\ w := other(s) catch (e2) { return 0; }; diff --git a/src/sema.test.zig b/src/sema.test.zig index a4b9be9..8dfa258 100644 --- a/src/sema.test.zig +++ b/src/sema.test.zig @@ -12,8 +12,8 @@ const types = @import("types.zig"); const Type = types.Type; // the backtick raw escape must hold in BOTH classifiers. A raw -// reserved-name type reference (`` `s2 ``) resolves to the user-declared type, -// while a BARE `s2` stays the builtin int. Before the fix sema's +// reserved-name type reference (`` `i2 ``) resolves to the user-declared type, +// while a BARE `i2` stays the builtin int. Before the fix sema's // `resolveTypeNode` ran `Type.fromName` first and ignored `is_raw`, so the // editor index would show the builtin for backtick code (the // two-resolver divergence applied to raw types). @@ -23,7 +23,7 @@ test "sema: backtick raw type reference resolves to the user type; bare stays bu const alloc = arena.allocator(); const src = - \\`s2 :: struct { x: s64; } + \\`i2 :: struct { x: i64; } \\ ; var parser = Parser.init(alloc, src); @@ -33,16 +33,16 @@ test "sema: backtick raw type reference resolves to the user type; bare stays bu _ = try analyzer.analyze(root); // The reserved-spelled user type registered under its plain name. - try std.testing.expect(analyzer.struct_types.contains("s2")); + try std.testing.expect(analyzer.struct_types.contains("i2")); - // RAW reference (`` `s2 ``) → the user struct, NOT the 2-bit signed int. - var raw_node = Node{ .span = .{ .start = 0, .end = 0 }, .data = .{ .type_expr = .{ .name = "s2", .is_raw = true } } }; + // RAW reference (`` `i2 ``) → the user struct, NOT the 2-bit signed int. + var raw_node = Node{ .span = .{ .start = 0, .end = 0 }, .data = .{ .type_expr = .{ .name = "i2", .is_raw = true } } }; const raw_ty = analyzer.resolveTypeNode(&raw_node); try std.testing.expect(raw_ty == .struct_type); - try std.testing.expectEqualStrings("s2", raw_ty.struct_type); + try std.testing.expectEqualStrings("i2", raw_ty.struct_type); - // BARE `s2` → the builtin 2-bit signed int. - var bare_node = Node{ .span = .{ .start = 0, .end = 0 }, .data = .{ .type_expr = .{ .name = "s2", .is_raw = false } } }; + // BARE `i2` → the builtin 2-bit signed int. + var bare_node = Node{ .span = .{ .start = 0, .end = 0 }, .data = .{ .type_expr = .{ .name = "i2", .is_raw = false } } }; const bare_ty = analyzer.resolveTypeNode(&bare_node); try std.testing.expect(bare_ty == .signed); try std.testing.expectEqual(@as(u8, 2), bare_ty.signed); @@ -58,7 +58,7 @@ test "sema: a raw struct-field annotation resolves to the user type; bare stays const alloc = arena.allocator(); const src = - \\`u8 :: struct { y: s64; } + \\`u8 :: struct { y: i64; } \\Holder :: struct { a: `u8; b: u8; } \\ ; @@ -87,12 +87,12 @@ test "sema: a raw struct-field annotation resolves to the user type; bare stays // ── raw provenance through sema's COMPOUND type metadata ──────── // -// The direct-case fix (above) only covered a bare `` `s2 `` reference. A -// COMPOUND raw type (`*`s2`, `?`s2`, `[N]`s2`, …) stores its inner name as a +// The direct-case fix (above) only covered a bare `` `i2 `` reference. A +// COMPOUND raw type (`*`i2`, `?`i2`, `[N]`i2`, …) stores its inner name as a // bare string on the Type's info struct; the resolver re-reads that name via // `resolveTypeNameStr`. Before threading `is_raw` ALONGSIDE the stored name, // the resolver passed `skip_builtin = false`, so the LSP index reclassified a -// user type named `s2` as the builtin int — diverging from codegen. These +// user type named `i2` as the builtin int — diverging from codegen. These // pin every compound form: the raw inner resolves to the user type (FAILS on // pre-fix sema), the bare inner stays the builtin (control, preserved). @@ -103,15 +103,15 @@ fn symType(res: sema.SemaResult, name: []const u8) ?Type { return null; } -test "sema: field access through a raw `*`s2` pointer resolves the user field; bare `*s2` stays builtin" { +test "sema: field access through a raw `*`i2` pointer resolves the user field; bare `*i2` stays builtin" { var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); const alloc = arena.allocator(); const src = - \\`s2 :: struct { x: s64; } - \\f :: (p: *`s2) { y := p.x; } - \\g :: (q: *s2) { w := q.*; } + \\`i2 :: struct { x: i64; } + \\f :: (p: *`i2) { y := p.x; } + \\g :: (q: *i2) { w := q.*; } \\ ; var parser = Parser.init(alloc, src); @@ -119,27 +119,27 @@ test "sema: field access through a raw `*`s2` pointer resolves the user field; b var analyzer = sema.Analyzer.init(alloc); const res = try analyzer.analyze(root); - // RAW: `p: *`s2` → field `x` on the user struct → s64. (Pre-fix: the - // pointee `s2` reclassified to the 2-bit int, `.x` not found → unresolved.) + // RAW: `p: *`i2` → field `x` on the user struct → i64. (Pre-fix: the + // pointee `i2` reclassified to the 2-bit int, `.x` not found → unresolved.) const y = symType(res, "y") orelse return error.MissingSymbol; try std.testing.expect(y == .signed); try std.testing.expectEqual(@as(u8, 64), y.signed); - // CONTROL: `q: *s2` (bare) → deref yields the builtin 2-bit signed int. + // CONTROL: `q: *i2` (bare) → deref yields the builtin 2-bit signed int. const w = symType(res, "w") orelse return error.MissingSymbol; try std.testing.expect(w == .signed); try std.testing.expectEqual(@as(u8, 2), w.signed); } -test "sema: unwrapping a raw `?`s2` optional resolves the user field; bare `?s2` stays builtin" { +test "sema: unwrapping a raw `?`i2` optional resolves the user field; bare `?i2` stays builtin" { var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); const alloc = arena.allocator(); const src = - \\`s2 :: struct { x: s64; } - \\f :: (o: ?`s2) { if val := o { y := val.x; } } - \\g :: (b: ?s2) { if v := b { w := v; } } + \\`i2 :: struct { x: i64; } + \\f :: (o: ?`i2) { if val := o { y := val.x; } } + \\g :: (b: ?i2) { if v := b { w := v; } } \\ ; var parser = Parser.init(alloc, src); @@ -147,26 +147,26 @@ test "sema: unwrapping a raw `?`s2` optional resolves the user field; bare `?s2` var analyzer = sema.Analyzer.init(alloc); const res = try analyzer.analyze(root); - // RAW: `o: ?`s2` → `if val := o` unwraps to the user struct → `val.x` is s64. - // (Pre-fix: the optional child `s2` reclassified to the 2-bit int.) + // RAW: `o: ?`i2` → `if val := o` unwraps to the user struct → `val.x` is i64. + // (Pre-fix: the optional child `i2` reclassified to the 2-bit int.) const y = symType(res, "y") orelse return error.MissingSymbol; try std.testing.expect(y == .signed); try std.testing.expectEqual(@as(u8, 64), y.signed); - // CONTROL: `b: ?s2` (bare) unwraps to the builtin 2-bit signed int. + // CONTROL: `b: ?i2` (bare) unwraps to the builtin 2-bit signed int. const w = symType(res, "w") orelse return error.MissingSymbol; try std.testing.expect(w == .signed); try std.testing.expectEqual(@as(u8, 2), w.signed); } -test "sema: indexing a raw `[N]`s2` array resolves the user element; bare `[N]s2` stays builtin" { +test "sema: indexing a raw `[N]`i2` array resolves the user element; bare `[N]i2` stays builtin" { var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); const alloc = arena.allocator(); const src = - \\`s2 :: struct { x: s64; } - \\f :: (a: [4]`s2, b: [4]s2) { y := a[0]; w := b[0]; } + \\`i2 :: struct { x: i64; } + \\f :: (a: [4]`i2, b: [4]i2) { y := a[0]; w := b[0]; } \\ ; var parser = Parser.init(alloc, src); @@ -174,32 +174,32 @@ test "sema: indexing a raw `[N]`s2` array resolves the user element; bare `[N]s2 var analyzer = sema.Analyzer.init(alloc); const res = try analyzer.analyze(root); - // RAW: `a: [4]`s2` → element is the user struct. (Pre-fix: reclassified to + // RAW: `a: [4]`i2` → element is the user struct. (Pre-fix: reclassified to // the 2-bit int.) const y = symType(res, "y") orelse return error.MissingSymbol; try std.testing.expect(y == .struct_type); - try std.testing.expectEqualStrings("s2", y.struct_type); + try std.testing.expectEqualStrings("i2", y.struct_type); - // CONTROL: `b: [4]s2` (bare) → element is the builtin 2-bit signed int. + // CONTROL: `b: [4]i2` (bare) → element is the builtin 2-bit signed int. const w = symType(res, "w") orelse return error.MissingSymbol; try std.testing.expect(w == .signed); try std.testing.expectEqual(@as(u8, 2), w.signed); } -// Parameterized raw type (`` `s2(s64) ``). Unlike the shapes above this never +// Parameterized raw type (`` `i2(i64) ``). Unlike the shapes above this never // had the divergence — instantiation resolves the base name straight against // `struct_types` (no builtin classifier in the path), so it passes before AND // after. Included as coverage that the universal model holds for the -// parameterized form too: a `` `s2 ``-declared generic instantiates and its +// parameterized form too: a `` `i2 ``-declared generic instantiates and its // field resolves. -test "sema: a raw parameterized type `` `s2(s64) `` instantiates the user generic" { +test "sema: a raw parameterized type `` `i2(i64) `` instantiates the user generic" { var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); const alloc = arena.allocator(); const src = - \\`s2 :: struct ($T: Type) { items: [*]T = null; n: s64 = 0; } - \\f :: (v: `s2(s64)) { y := v.n; } + \\`i2 :: struct ($T: Type) { items: [*]T = null; n: i64 = 0; } + \\f :: (v: `i2(i64)) { y := v.n; } \\ ; var parser = Parser.init(alloc, src); @@ -207,8 +207,8 @@ test "sema: a raw parameterized type `` `s2(s64) `` instantiates the user generi var analyzer = sema.Analyzer.init(alloc); const res = try analyzer.analyze(root); - // `v: `s2(s64)` instantiates the `` `s2 ``-declared generic; its concrete - // field `n` resolves to s64 (the raw base name was not misread as a builtin). + // `v: `i2(i64)` instantiates the `` `i2 ``-declared generic; its concrete + // field `n` resolves to i64 (the raw base name was not misread as a builtin). const y = symType(res, "y") orelse return error.MissingSymbol; try std.testing.expect(y == .signed); try std.testing.expectEqual(@as(u8, 64), y.signed); diff --git a/src/sema.zig b/src/sema.zig index ab8e6bb..e23ea8d 100644 --- a/src/sema.zig +++ b/src/sema.zig @@ -197,7 +197,7 @@ pub const Analyzer = struct { // Variadic param becomes a slice type const elem_name = switch (param.type_expr.data) { .type_expr => |te| te.name, - // `..xs: []T` — the element is T, not a guessed s32. + // `..xs: []T` — the element is T, not a guessed i32. .slice_type_expr => |st| if (st.element_type.data == .type_expr) st.element_type.data.type_expr.name else "", else => "", }; @@ -447,7 +447,7 @@ pub const Analyzer = struct { return .void_type; } // type_expr or identifier — check aliases, enums, structs. A raw - // reference (`` `s2 ``) skips the builtin classifier and resolves + // reference (`` `i2 ``) skips the builtin classifier and resolves // through user-defined types only. if (tn.data == .type_expr or tn.data == .identifier) { const name = if (tn.data == .type_expr) tn.data.type_expr.name else tn.data.identifier.name; @@ -471,7 +471,7 @@ pub const Analyzer = struct { /// structs), falling back to primitive spellings. Unlike `Type.fromName`, /// this knows user-defined types; returns `unresolved` when it can't place /// the name. `skip_builtin` is the backtick raw escape — a raw - /// reference (`` `s2 ``) bypasses the builtin/reserved classifier and + /// reference (`` `i2 ``) bypasses the builtin/reserved classifier and /// resolves only through user-defined types, mirroring the codegen-side /// `TypeResolver.resolveNamed`. Inner names of compound shapes /// (pointer/slice element/pointee) are always bare, so their callers pass @@ -501,10 +501,10 @@ pub const Analyzer = struct { }; } - /// The backtick raw bit of an inner type-name node (`` `s2 ``). A compound + /// The backtick raw bit of an inner type-name node (`` `i2 ``). A compound /// shape (`*T`, `?T`, `[]T`, …) stores its inner name as a bare string, so /// this bit must travel ALONGSIDE that name — otherwise the - /// resolver re-reads `s2` as the builtin int. Non-leaf nodes are never raw. + /// resolver re-reads `i2` as the builtin int. Non-leaf nodes are never raw. fn typeExprIsRaw(node: *Node) bool { return switch (node.data) { .type_expr => |te| te.is_raw, @@ -516,7 +516,7 @@ pub const Analyzer = struct { /// When a compound shape stores the NAME of an ALREADY-resolved inner type /// (no syntactic node to read `is_raw` from — e.g. a for-loop element), a /// user nominal type must be re-resolved with `skip_builtin` so a struct/ - /// enum/union named `s2` is not reclassified as the builtin. Builtins keep + /// enum/union named `i2` is not reclassified as the builtin. Builtins keep /// `false`. Harmless for non-colliding names (the registry lookup is the /// same either way). fn innerNameIsRaw(inner: Type) bool { @@ -768,7 +768,7 @@ pub const Analyzer = struct { if (self.struct_types.contains(target)) return .{ .struct_type = target }; } } else if (sl.type_expr) |te| { - // Handle parameterized struct: List(s32).{} parses as call node + // Handle parameterized struct: List(i32).{} parses as call node if (te.data == .call) { if (self.resolveCalleeName(te.data.call)) |callee| { if (self.instantiateGeneric(callee, te.data.call.args)) |inst| return inst; @@ -1925,7 +1925,7 @@ test "sema: collect top-level declarations" { test "sema: function params as symbols" { const parser_mod = @import("parser.zig"); - const source = "add :: (a: s32, b: s32) -> s32 { a + b; }"; + const source = "add :: (a: i32, b: i32) -> i32 { a + b; }"; var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); const alloc = arena.allocator(); @@ -2020,7 +2020,7 @@ test "sema: enum and struct declarations" { test "sema: var_decl infers struct type from parameterized struct literal" { const parser_mod = @import("parser.zig"); - const source = "List :: struct { len: s64; } main :: () { list := List.{}; }"; + const source = "List :: struct { len: i64; } main :: () { list := List.{}; }"; var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); const alloc = arena.allocator(); @@ -2050,8 +2050,8 @@ test "sema: var_decl infers struct type from parameterized struct literal" { test "sema: var_decl infers struct type from parameterized call literal" { const parser_mod = @import("parser.zig"); - // List(s32).{} — parser produces struct_literal with type_expr = call node - const source = "List :: struct { len: s64; } main :: () { list := List(s32).{}; }"; + // List(i32).{} — parser produces struct_literal with type_expr = call node + const source = "List :: struct { len: i64; } main :: () { list := List(i32).{}; }"; var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); const alloc = arena.allocator(); @@ -2081,8 +2081,8 @@ test "sema: index into generic List(T).items resolves the element struct" { const parser_mod = @import("parser.zig"); const source = - "Move :: struct { score: s64; }" ++ - "List :: struct ($T: Type) { items: [*]T = null; len: s64; }" ++ + "Move :: struct { score: i64; }" ++ + "List :: struct ($T: Type) { items: [*]T = null; len: i64; }" ++ "main :: () { legal := List(Move).{}; m := legal.items[0]; }"; var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); @@ -2114,8 +2114,8 @@ test "sema: generic index resolves with pre-registered (imported) struct types" const alloc = arena.allocator(); // An "imported" module defining List + Move. - const lib_src = "Move :: struct { score: s64; }" ++ - "List :: struct ($T: Type) { items: [*]T = null; len: s64; }"; + const lib_src = "Move :: struct { score: i64; }" ++ + "List :: struct ($T: Type) { items: [*]T = null; len: i64; }"; var lib_parser = parser_mod.Parser.init(alloc, lib_src); const lib_root = try lib_parser.parse(); var lib = Analyzer.init(alloc); @@ -2152,10 +2152,10 @@ test "sema: generic index resolves with realistic List/Move (methods, cross-refs const alloc = arena.allocator(); const lib_src = - "Square :: struct { index: s64; }" ++ + "Square :: struct { index: i64; }" ++ "MoveFlag :: enum { none; promote_rook; }" ++ "Move :: struct { from: Square; to: Square; flag: MoveFlag; is_capture :: (self: Move) -> bool { true; } }" ++ - "List :: struct ($T: Type) { items: [*]T = null; len: s64 = 0; cap: s64 = 0; append :: (list: *List(T), item: T) {} }"; + "List :: struct ($T: Type) { items: [*]T = null; len: i64 = 0; cap: i64 = 0; append :: (list: *List(T), item: T) {} }"; var lib_parser = parser_mod.Parser.init(alloc, lib_src); const lib_root = try lib_parser.parse(); var lib = Analyzer.init(alloc); @@ -2191,7 +2191,7 @@ test "sema: method-return slice + .ptr index + tagged-enum element" { const alloc = arena.allocator(); const source = - "Event :: enum { none; click: s64; }" ++ + "Event :: enum { none; click: i64; }" ++ "Plat :: protocol { poll :: () -> []Event; }" ++ "go :: (p: *Plat) { evs := p.poll(); e := evs.ptr[0]; }"; var parser = parser_mod.Parser.init(alloc, source); @@ -2220,7 +2220,7 @@ test "sema: field access + index through a *Struct param" { const alloc = arena.allocator(); const source = - "Cell :: struct { v: s64; }" ++ + "Cell :: struct { v: i64; }" ++ "Grid :: struct { cells: [4]Cell; }" ++ "look :: (g: *Grid) { c := g.cells[0]; }"; var parser = parser_mod.Parser.init(alloc, source); @@ -2243,8 +2243,8 @@ test "sema: for-loop captures resolve element, by-ref pointer, and range cursor" const alloc = arena.allocator(); const source = - "Move :: struct { flag: s64; }" ++ - "List :: struct ($T: Type) { items: [*]T = null; len: s64 = 0; }" ++ + "Move :: struct { flag: i64; }" ++ + "List :: struct ($T: Type) { items: [*]T = null; len: i64 = 0; }" ++ "Game :: struct { legal: List(Move);" ++ " scan :: (self: *Game) {" ++ " for self.legal (m) { a := m.flag; }" ++ @@ -2271,7 +2271,7 @@ test "sema: for-loop captures resolve element, by-ref pointer, and range cursor" // by-ref capture yields a pointer to the element. try std.testing.expect(p_ty != null and p_ty.? == .pointer_type); try std.testing.expectEqualStrings("Move", p_ty.?.pointer_type.pointee_name); - // range cursor is s64. + // range cursor is i64. try std.testing.expect(i_ty != null and i_ty.? == .signed); try std.testing.expect(i_ty.?.signed == 64); @@ -2303,11 +2303,11 @@ test "sema: passing *T where a T value is expected is diagnosed" { const alloc = arena.allocator(); const source = - "Move :: struct { flag: s64; }" ++ - "take :: (m: Move) -> s64 { m.flag; }" ++ - "take_ptr :: (m: *Move) -> s64 { m.flag; }" ++ - "bad :: (p: *Move) -> s64 { take(p); }" ++ // *Move into a Move param → flagged - "good :: (p: *Move) -> s64 { take_ptr(p); }"; // *Move into a *Move param → fine + "Move :: struct { flag: i64; }" ++ + "take :: (m: Move) -> i64 { m.flag; }" ++ + "take_ptr :: (m: *Move) -> i64 { m.flag; }" ++ + "bad :: (p: *Move) -> i64 { take(p); }" ++ // *Move into a Move param → flagged + "good :: (p: *Move) -> i64 { take_ptr(p); }"; // *Move into a *Move param → fine var parser = parser_mod.Parser.init(alloc, source); const root = try parser.parse(); var an = Analyzer.init(alloc); @@ -2329,7 +2329,7 @@ test "sema: member references record fields, methods, and enum variants" { const source = "Color :: enum { red; green; }" ++ - "P :: struct { x: s64; m :: (self: P) -> s64 { self.x; } }" ++ + "P :: struct { x: i64; m :: (self: P) -> i64 { self.x; } }" ++ "use :: (p: *P) { a := p.x; b := p.m(); c := Color.red; }"; var parser = parser_mod.Parser.init(alloc, source); const root = try parser.parse(); @@ -2358,9 +2358,9 @@ test "sema: context in a callconv(.c) function reports a specific diagnostic" { const alloc = arena.allocator(); const source = - "Context :: struct { allocator: s64; data: s64; }" ++ - "cb :: () -> s64 callconv(.c) { context; 0; }" ++ - "ok :: () -> s64 { context; 0; }"; + "Context :: struct { allocator: i64; data: i64; }" ++ + "cb :: () -> i64 callconv(.c) { context; 0; }" ++ + "ok :: () -> i64 { context; 0; }"; var parser = parser_mod.Parser.init(alloc, source); const root = try parser.parse(); var an = Analyzer.init(alloc); @@ -2381,7 +2381,7 @@ test "sema: variable shadowing in same scope is allowed" { const parser_mod = @import("parser.zig"); // Two variables with the same name in the same function body — sx allows this - const source = "main :: () { x : s64 = 1; x : f64 = 2.0; }"; + const source = "main :: () { x : i64 = 1; x : f64 = 2.0; }"; var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); const alloc = arena.allocator(); @@ -2403,7 +2403,7 @@ test "sema: variable shadowing in same scope is allowed" { test "sema: ufcs_alias registers symbol" { const parser_mod = @import("parser.zig"); - const source = "add :: (a: s64, b: s64) -> s64 { a + b; } main :: () { sum :: ufcs add; sum(1, 2); }"; + const source = "add :: (a: i64, b: i64) -> i64 { a + b; } main :: () { sum :: ufcs add; sum(1, 2); }"; var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); const alloc = arena.allocator(); @@ -2436,7 +2436,7 @@ test "sema: ufcs_alias registers symbol" { test "sema: top-level ufcs_alias registers symbol" { const parser_mod = @import("parser.zig"); - const source = "add :: (a: s64, b: s64) -> s64 { a + b; } sum :: ufcs add;"; + const source = "add :: (a: i64, b: i64) -> i64 { a + b; } sum :: ufcs add;"; var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); const alloc = arena.allocator(); diff --git a/src/token.zig b/src/token.zig index eee1442..c1c2d1b 100644 --- a/src/token.zig +++ b/src/token.zig @@ -227,7 +227,7 @@ pub const Token = struct { tag: Tag, loc: Loc, /// True when an `.identifier` was introduced by a leading backtick - /// (`` `s2 ``): a RAW identifier whose text excludes the backtick and which + /// (`` `i2 ``): a RAW identifier whose text excludes the backtick and which /// the parser must NEVER type-classify (it bypasses the reserved-type-name /// rule). `loc` already spans only the un-backticked name, so `slice` returns /// the bare text. diff --git a/src/types.zig b/src/types.zig index 6b34f2a..66380a2 100644 --- a/src/types.zig +++ b/src/types.zig @@ -43,10 +43,10 @@ pub const Type = union(enum) { unresolved, /// `is_raw` records whether the inner type-name came from a backtick raw - /// reference (`` `s2 ``) or an already-resolved user type. It is the + /// reference (`` `i2 ``) or an already-resolved user type. It is the /// `skip_builtin` the resolver MUST pass when re-resolving the stored inner /// name — without it `resolveTypeNameStr` would reclassify a - /// user type named `s2` as the builtin int, diverging from codegen. The + /// user type named `i2` as the builtin int, diverging from codegen. The /// field is REQUIRED (no default) so a future construction site cannot /// silently drop the bit, the way the LSP index did for compound shapes. pub const SliceTypeInfo = struct { @@ -115,14 +115,7 @@ pub const Type = union(enum) { pub fn fromName(name: []const u8) ?Type { if (name.len == 0) return null; return switch (name[0]) { - 's' => { - if (std.mem.eql(u8, name, "string")) return .string_type; - if (name.len >= 2) { - const width = std.fmt.parseInt(u8, name[1..], 10) catch return null; - if (width >= 1 and width <= 64) return Type.s(width); - } - return null; - }, + 's' => if (std.mem.eql(u8, name, "string")) .string_type else null, 'u' => { if (std.mem.eql(u8, name, "usize")) return .usize_type; if (name.len >= 2) { @@ -133,6 +126,10 @@ pub const Type = union(enum) { }, 'i' => { if (std.mem.eql(u8, name, "isize")) return .isize_type; + if (name.len >= 2) { + const width = std.fmt.parseInt(u8, name[1..], 10) catch return null; + if (width >= 1 and width <= 64) return Type.s(width); + } return null; }, 'b' => if (std.mem.eql(u8, name, "bool")) .boolean else null, @@ -181,14 +178,14 @@ pub const Type = union(enum) { } /// Returns the canonical type name for this type, or null for complex types. - /// Used for looking up impl methods on non-struct types (e.g., s32.eq). + /// Used for looking up impl methods on non-struct types (e.g., i32.eq). pub fn toName(self: Type) ?[]const u8 { return switch (self) { .signed => |w| switch (w) { - 8 => "s8", - 16 => "s16", - 32 => "s32", - 64 => "s64", + 8 => "i8", + 16 => "i16", + 32 => "i32", + 64 => "i64", else => null, }, .unsigned => |w| switch (w) { @@ -214,7 +211,7 @@ pub const Type = union(enum) { pub fn fromTypeExpr(node: *Node) ?Type { if (node.data != .type_expr) return null; - // A backtick raw type reference (`` `s2 ``) is the LITERAL name used as + // A backtick raw type reference (`` `i2 ``) is the LITERAL name used as // a type — it must skip this builtin/reserved classifier and resolve // through user-defined types only, mirroring the codegen- // side `resolveNamed`'s `skip_builtin`. Returning null lets the sema @@ -272,12 +269,12 @@ pub const Type = union(enum) { return try allocator.dupe(u8, result); } - /// Format type name for mangling and display (e.g. "s32", "u8", "f64") + /// Format type name for mangling and display (e.g. "i32", "u8", "f64") pub fn displayName(self: Type, allocator: std.mem.Allocator) ![]const u8 { return switch (self) { .signed => |w| { var buf: [4]u8 = undefined; - const result = std.fmt.bufPrint(&buf, "s{d}", .{w}) catch unreachable; + const result = std.fmt.bufPrint(&buf, "i{d}", .{w}) catch unreachable; return try allocator.dupe(u8, result); }, .unsigned => |w| { diff --git a/tests/fixtures/testpkg/math.sx b/tests/fixtures/testpkg/math.sx index 4cb5c2b..44c24d0 100644 --- a/tests/fixtures/testpkg/math.sx +++ b/tests/fixtures/testpkg/math.sx @@ -1,2 +1,2 @@ -add :: (a: s32, b: s32) -> s32 { a + b } -mul :: (a: s32, b: s32) -> s32 { a * b } +add :: (a: i32, b: i32) -> i32 { a + b } +mul :: (a: i32, b: i32) -> i32 { a * b } diff --git a/tests/resolver-target/cases/e6br5-nested-pack-source-ambiguous.sx b/tests/resolver-target/cases/e6br5-nested-pack-source-ambiguous.sx index 3360b06..bfe80f4 100644 --- a/tests/resolver-target/cases/e6br5-nested-pack-source-ambiguous.sx +++ b/tests/resolver-target/cases/e6br5-nested-pack-source-ambiguous.sx @@ -31,7 +31,7 @@ #import "e6br5-nested-pack-source-ambiguous/a.sx"; #import "e6br5-nested-pack-source-ambiguous/b.sx"; -Block :: struct { tag: s32; } +Block :: struct { tag: i32; } Sink :: protocol(T: Type) { convert :: () -> T; @@ -43,6 +43,6 @@ impl Sink(Block) for Closure(Closure(*Box, ..$inner) -> $IR, ..$args) -> $R { } } -main :: () -> s32 { +main :: () -> i32 { 0 } diff --git a/tests/resolver-target/cases/e6br5-nested-pack-source-ambiguous/a.sx b/tests/resolver-target/cases/e6br5-nested-pack-source-ambiguous/a.sx index ae773df..734bd17 100644 --- a/tests/resolver-target/cases/e6br5-nested-pack-source-ambiguous/a.sx +++ b/tests/resolver-target/cases/e6br5-nested-pack-source-ambiguous/a.sx @@ -1,4 +1,4 @@ // One of two flat-imported `Box` authors. With no own author, the concrete // `*Box` leaf — even when NESTED inside a parameterized pattern — is a genuine // collision the importing source cannot disambiguate. -Box :: struct { a: s32; } +Box :: struct { a: i32; } diff --git a/tests/resolver-target/cases/e6br5-nested-pack-source-ambiguous/b.sx b/tests/resolver-target/cases/e6br5-nested-pack-source-ambiguous/b.sx index 121be91..b05dcc0 100644 --- a/tests/resolver-target/cases/e6br5-nested-pack-source-ambiguous/b.sx +++ b/tests/resolver-target/cases/e6br5-nested-pack-source-ambiguous/b.sx @@ -1,3 +1,3 @@ // The second flat-imported `Box` author — a DISTINCT nominal from a.sx's `Box`, // so the nested `*Box` leaf is a real ambiguity the source cannot resolve. -Box :: struct { b: s32; } +Box :: struct { b: i32; } diff --git a/tests/resolver-target/expected/0815-route-all-new-surfaces-ambiguous.stderr b/tests/resolver-target/expected/0815-route-all-new-surfaces-ambiguous.stderr index 0e12591..e2a93ef 100644 --- a/tests/resolver-target/expected/0815-route-all-new-surfaces-ambiguous.stderr +++ b/tests/resolver-target/expected/0815-route-all-new-surfaces-ambiguous.stderr @@ -7,7 +7,7 @@ error: type 'Box' is ambiguous: it is declared in multiple flat-imported modules error: type 'Box' is ambiguous: it is declared in multiple flat-imported modules; qualify the reference or remove the duplicate import --> examples/0815-route-all-new-surfaces-ambiguous.sx:27:21 | -27 | WrapU :: union { b: Box; n: s32; } +27 | WrapU :: union { b: Box; n: i32; } | ^^^ error: type 'Box' is ambiguous: it is declared in multiple flat-imported modules; qualify the reference or remove the duplicate import @@ -19,11 +19,11 @@ error: type 'Box' is ambiguous: it is declared in multiple flat-imported modules error: type 'Box' is ambiguous: it is declared in multiple flat-imported modules; qualify the reference or remove the duplicate import --> examples/0815-route-all-new-surfaces-ambiguous.sx:32:20 | -32 | sz := size_of((Box, s32)); +32 | sz := size_of((Box, i32)); | ^^^ error: type 'Box' is ambiguous: it is declared in multiple flat-imported modules; qualify the reference or remove the duplicate import --> examples/0815-route-all-new-surfaces-ambiguous.sx:33:20 | -33 | x : union { b: Box; n: s32 } = ---; +33 | x : union { b: Box; n: i32 } = ---; | ^^^