lang: rename signed integer types sN -> iN
Surface rename of the signed integer family: s1..s64 become i1..i64
(u1..u64, usize, isize unchanged). 'string' keeps the s-prefix arm in
name classification; width parsing moves to the i-prefix arm next to
isize.
Internal TypeId tags follow the surface (.s8/.s16/.s32/.s64 ->
.i8/.i16/.i32/.i64), as do mono-key mangle fragments (ptr_i64,
tu_i64_bool) and all display/diagnostic formatting (i{d}).
Migrated in the same sweep: stdlib + examples + issue repros + FFI C
companions (shared symbol names like ffi_id_i64), expected
stdout/stderr/ir snapshots, specs.md, readme.md, CLAUDE.md/AGENTS.md,
implementation_plan.md, docs/, issue writeups. Vendored stb_image and
historical flow state left untouched.
zig build test: 426/426; examples suite: 595/595.
This commit is contained in:
42
src/ast.zig
42
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).
|
||||
|
||||
Reference in New Issue
Block a user