cleanup: drop resolved-issue citations from src comments

Sweep all src/**.zig comments that cite resolved issues (issue NNNN /
fix-NNNN / KB-N): the invariant or mechanism each comment states is
kept; the historical citation is dropped, per the no-conclusion-comments
rule. Pure-history parentheticals are removed outright. References to
the 16 still-open issues (0030, 0041-0056) are untouched, as are test
NAMES carrying regression provenance (matching the sanctioned
"Regression (issue NNNN)" example-header convention).

Also removes the issues/0019-import-non-transitive-c-scope/ fixture dir
— the issue is superseded and its behavior is covered by
examples/0706-modules-import-non-transitive.sx (the .md writeup stays).
issues/0030's repro .sx stays: that issue is an open feature request.

Gate: zig build OK; zig build test 426/426; run_examples 541/0; zero
expected/ snapshot churn.
This commit is contained in:
agra
2026-06-10 16:34:17 +03:00
parent 8b2a6598a9
commit 2b8041a828
40 changed files with 254 additions and 301 deletions

View File

@@ -92,7 +92,7 @@ pub fn lowerRoot(self: *Lowering, root: *const Node) void {
// any error before codegen.
self.errorFlow().checkErrorFlow(decls);
// Pass 1f: reject identifiers used in a type position that name no
// declared type / primitive / in-scope generic param (issue 0064).
// declared type / primitive / in-scope generic param.
// Runs after scanning (so every real type name is registered) and
// before body lowering, so the diagnostic halts via `core.zig`
// `hasErrors()` before the empty-struct stub can reach codegen. Owned by
@@ -447,11 +447,11 @@ pub fn scanDecls(self: *Lowering, decls: []const *const Node) void {
// declaration order (pass 1) and typed ones only after the alias fixpoint
// (pass 2) — so an alias declared before its const, or any alias over a
// typed const, saw an empty table and miscompiled the dimension to length
// 0 (issue 0083). A float-valued const resolves to a dimension only when
// 0. A float-valued const resolves to a dimension only when
// its value is integral (`floatToIntExact`); pre-registering it keeps the
// forward-alias float path identical to the int path. The dimension only
// needs the value, so a placeholder type is fine; pass 2 overwrites typed
// consts with the resolved annotation type (issue 0070).
// consts with the resolved annotation type.
for (decls) |decl| {
if (decl.data != .const_decl) continue;
const cd = decl.data.const_decl;
@@ -467,7 +467,7 @@ 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`
// (issue 0083). Placeholder `.s64` type — the count consumers read
//. Placeholder `.s64` 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 => {
@@ -483,7 +483,7 @@ pub fn scanDecls(self: *Lowering, decls: []const *const Node) void {
// self (`next: *Box`), or a forward / mutual ref to a shadow declared LATER
// in the same module (`peer: *Node`) — then binds to its OWN nominal TypeId
// via `type_decl_tids`, never the global findByName first-author fallback
// (issue 0105).
//
// "Genuine" = ≥2 DISTINCT decls of the SAME KIND in THIS scan author the name
// (so it needs ≥2 distinct nominal TypeIds). Grouping by (kind, name) keeps a
@@ -529,7 +529,7 @@ pub fn scanDecls(self: *Lowering, decls: []const *const Node) void {
// re-introduces a same-named function (e.g. a second module
// also exporting `parse`) must NOT clobber the AST while the
// function table keeps the first — that split lowers one
// signature against the other's body (issue 0100). The
// signature against the other's body. The
// shadowed function stays reachable via its qualified name.
if (!self.program_index.fn_ast_map.contains(fd.name)) {
self.program_index.fn_ast_map.put(fd.name, &decl.data.fn_decl) catch {};
@@ -574,7 +574,7 @@ pub fn scanDecls(self: *Lowering, decls: []const *const Node) void {
// dimension is not a compile-time integer constant. Surface
// it as a clean diagnostic so the build aborts here rather
// than letting `.unresolved` reach codegen and `@panic` in
// sizeOf (issue 0083 — no fabricated 0-length array). For a
// sizeOf (no fabricated 0-length array). For a
// top-level array alias, re-fold the dimension so an
// oversized / negative constant emits the SAME precise
// message as the direct form (`a : [N]T`) via the shared
@@ -710,7 +710,7 @@ pub fn scanDecls(self: *Lowering, decls: []const *const Node) void {
// Typed value constants (`AF_INET :s32: 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 (issue 0070). Untyped
// target instead of a fabricated stub. Untyped
// literal constants carry no annotation to resolve, so they
// stay here (their type comes from the literal / inference).
if (cd.type_annotation == null) {
@@ -765,7 +765,7 @@ pub fn scanDecls(self: *Lowering, decls: []const *const Node) void {
},
// Top-level globals are registered in a second pass (below),
// after the forward-alias fixpoint, so a forward identifier
// alias used as a global's type annotation resolves (issue 0070).
// alias used as a global's type annotation resolves.
.var_decl => {},
else => {},
}
@@ -773,7 +773,7 @@ pub fn scanDecls(self: *Lowering, decls: []const *const Node) void {
self.resolveForwardIdentifierAliases(decls);
// Pass 2: registrations that resolve a top-level type annotation run
// after the alias fixpoint, so a forward identifier alias used as the
// annotation resolves to its target (issue 0070).
// annotation resolves to its target.
for (decls) |decl| {
self.setCurrentSourceFile(decl.source_file);
switch (decl.data) {
@@ -788,14 +788,14 @@ pub fn scanDecls(self: *Lowering, decls: []const *const Node) void {
/// scanDecls pass 2 (after `resolveForwardIdentifierAliases`) so a forward
/// identifier alias in the annotation (`A :: B; B :: s32; K : A : 42;`)
/// resolves to its target rather than a fabricated empty-struct stub, which
/// would otherwise mistype the constant (issue 0070).
/// 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
// 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 the issue-0088
// foldable / emittable const, so it cannot manifest a
// wrong-type fold/emit; a use-site diagnostic covers it.
switch (cd.value.data) {
.int_literal, .float_literal, .bool_literal, .string_literal, .undef_literal, .null_literal, .binary_op, .unary_op => {},
@@ -901,8 +901,7 @@ pub fn typedConstInitFits(self: *Lowering, value: *const Node, dst_ty: TypeId) b
// Const-EXPRESSION initializer (binary_op / unary_op — the only
// non-literal kinds the caller admits): validate by the initializer's
// INFERRED type so coverage is type-based, not a per-node-kind
// allowlist where an unenumerated kind silently escapes (issue 0088,
// attempt 2). The integer/float fit mirrors the literal arms above.
// allowlist where an unenumerated kind silently escapes. The integer/float fit mirrors the literal arms above.
else => self.constExprInitFits(self.inferExprType(value), dst_ty),
};
}
@@ -930,7 +929,7 @@ pub fn constExprInitFits(self: *Lowering, init_ty: TypeId, dst_ty: TypeId) bool
/// in the type annotation (`A :: B; B :: s32; 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 (issue 0070). Globals can't be named in a type position, so
/// verification. Globals can't be named in a type position, so
/// deferring them past type/alias registration introduces no ordering hazard.
pub fn registerTopLevelGlobal(self: *Lowering, vd: *const ast.VarDecl) void {
// Use self.resolveType so type aliases like `Handle :: u32;` resolve
@@ -967,7 +966,7 @@ pub fn registerTopLevelGlobal(self: *Lowering, vd: *const ast.VarDecl) void {
/// Foreign globals (extern symbol) and value-less declarations carry no
/// payload — they default to zero/extern at link, which is correct. An
/// identifier initializer that names a module constant is materialized from
/// the recorded constant (`K : A : 42; g : A = K;` → 42, issue 0071); a
/// the recorded constant (`K : A : 42; g : A = K;` → 42); a
/// global initialized from an identifier that resolves to no usable constant
/// is rejected with a diagnostic rather than silently zero-initialized — a
/// global has no run site for a dynamic initializer.
@@ -1026,7 +1025,7 @@ pub fn globalInitValue(self: *Lowering, vd: *const ast.VarDecl, var_ty: TypeId)
// Any other initializer shape (`.field_access` on a const, a call, an
// arithmetic expression, …) is not a static constant the compiler can
// evaluate here. Diagnose loudly rather than emit a null payload that
// silently zero-initializes the global (issues 0071/0072).
// silently zero-initializes the global.
else => blk: {
if (self.diagnostics) |d|
d.addFmt(.err, v.span, "global '{s}' must be initialized by a compile-time constant", .{vd.name});
@@ -1038,7 +1037,7 @@ pub fn globalInitValue(self: *Lowering, vd: *const ast.VarDecl, var_ty: TypeId)
/// A global aggregate initializer (array/struct literal) that does not fully
/// reduce to a compile-time constant is rejected loudly. Without this the
/// `null` payload would fall through to a zero-initialized global, silently
/// dropping the declared fields (issues 0071/0072/0080).
/// dropping the declared fields.
pub fn diagnoseNonConstGlobal(self: *Lowering, vd: *const ast.VarDecl, v: *const Node) ?inst_mod.ConstantValue {
if (self.diagnostics) |d|
d.addFmt(.err, v.span, "global '{s}' must be initialized by a compile-time constant", .{vd.name});
@@ -1049,11 +1048,11 @@ pub fn diagnoseNonConstGlobal(self: *Lowering, vd: *const ast.VarDecl, v: *const
/// file. The forward scan above only registers an alias (`A :: B`) when `B`
/// 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 (issue 0069). Re-resolve to a fixpoint now that every top-level name
/// 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
/// (`NotAType :: 123` is an int literal), and an alias whose target is a value
/// const stays unresolved, so neither this pass nor issue 0068 can register a
/// const stays unresolved, so neither this pass nor the unknown-type suppression can register a
/// non-type name.
///
/// SOURCE-AWARE (R5 §4, E1.5). The target `B` is resolved AS SEEN FROM `A`'s
@@ -1116,8 +1115,7 @@ pub fn aliasResolvedInSource(self: *Lowering, src: []const u8, name: []const u8)
/// Pass 2: Lower main function body and comptime side-effects.
pub fn lowerMainAndComptime(self: *Lowering, decls: []const *const Node) void {
for (decls) |decl| {
// A `#run` body lowers in its OWN module's source context (fix-0102d
// site 4): `NAME :: #run f()` written in an imported module must
// A `#run` body lowers in its OWN module's source context: `NAME :: #run f()` written in an imported module must
// resolve a bare `f` from that module's flat imports, not the main
// file's. Without this, `selectPlainCallableAuthor` runs with the main
// file's perspective and reports a genuine per-source author as
@@ -1154,15 +1152,15 @@ pub fn lowerMainAndComptime(self: *Lowering, decls: []const *const Node) void {
/// Lower every SHADOWED same-name function author into its OWN FuncId with a
/// real (non-extern) body — the identity-addressable lowering PATH this step
/// adds (fix-0102b). It does NOT run during a default compile: the name path
/// stays the sole resolver, so the suite is byte-for-byte unchanged. fix-0102c
/// invokes it as part of routing bare flat calls to the right author; until
/// adds. It does NOT run during a default compile: the name path
/// stays the sole resolver, so the suite is byte-for-byte unchanged. The bare-call
/// disambiguation invokes it as part of routing bare flat calls to the right author; until
/// then it is exercised by the lower-test regression that asserts two distinct
/// non-extern bodies for a same-name collision.
///
/// The first-wins flat/directory merge keeps exactly one author per name in
/// the merged decl list; `scanDecls` declares that WINNER (lowered on demand
/// through the name-keyed `lazyLowerFunction`). fix-0102a retained every
/// through the name-keyed `lazyLowerFunction`). The merge retains every
/// dropped same-name author in the `module_decls` raw facts (path → name →
/// `RawDeclRef`) without touching resolution; this walks that index, filters
/// each author to its `*FnDecl` (`fnDeclOfRaw`), and gives each shadowed
@@ -1211,7 +1209,7 @@ pub fn lowerRetainedSameNameAuthors(self: *Lowering) void {
}
}
/// Result of bare-call disambiguation (fix-0102c, now over the Phase B
/// Result of bare-call disambiguation (now over the Phase B
/// author collector).
pub const BareCallee = union(enum) {
/// Bind the call to this specific author, carried as the shared
@@ -1219,7 +1217,7 @@ pub const BareCallee = union(enum) {
/// materialized on demand. Every callee-signature decision in the call
/// path (variadic packing, param typing, default expansion) reads the
/// RESOLVED author from this one object — never a first-wins re-lookup
/// by name (fix-0102c F1).
/// by name.
func: SelectedFunc,
/// ≥2 distinct flat authors are reachable from the caller and none is
/// the caller's own — the bare call can't pick one; require a qualifier.
@@ -1285,13 +1283,13 @@ pub const TypeHeadResolution = union(enum) {
/// would mis-size it).
not_visible,
/// ≥2 DISTINCT same-name type authors are flat-visible from the querying
/// source and none is its own (E2, issue 0105). The selection is genuinely
/// source and none is its own (E2). The selection is genuinely
/// ambiguous: `resolveNominalLeaf` emits a loud diagnostic and returns the
/// `.unresolved` poison sentinel — never a silent first-/last-wins pick.
ambiguous,
};
/// THE plain bare-name call selector (fix-0102c, R5 §C). `resolveBareCallee`'s
/// THE plain bare-name call selector. `resolveBareCallee`'s
/// body verbatim, now over the Phase B author collector
/// (`resolver.collectVisibleAuthors` — the ONE graph-walk) instead of a direct
/// `module_decls` + `flat_import_graph` traversal. Routes a bare identifier
@@ -1372,7 +1370,7 @@ pub fn selectPlainCallableAuthor(self: *Lowering, name: []const u8, caller_file:
/// selected author's OWN source — never the global `findByName` first-match
/// nor the global `type_alias_map`.
///
/// `raw` is the backtick raw-identifier escape (issue 0089): a raw reference
/// `raw` is the backtick raw-identifier escape: a raw reference
/// bypasses the builtin classifier and resolves only through the nominal
/// author / alias path.
///
@@ -1454,7 +1452,7 @@ pub fn selectNominalLeaf(self: *Lowering, name: []const u8, from: []const u8, ra
const author_set = res_walk.collectVisibleAuthors(name, from, .user_bare_flat);
defer if (author_set.flat.len > 0) self.alloc.free(author_set.flat);
// 1a. Own type author wins outright (own-wins, issue 0105/0107).
// 1a. Own type author wins outright (own-wins).
if (author_set.own) |own| switch (own.raw) {
.const_decl => {
// Type alias: present in type_aliases_by_source → resolved.
@@ -1462,7 +1460,7 @@ pub fn selectNominalLeaf(self: *Lowering, name: []const u8, from: []const u8, ra
if (inner.get(name)) |tid| return .{ .resolved = tid };
}
// Own const_decl not yet resolved: pending (own takes priority
// over any flat author — prevents issue 0107 flat-preemption).
// over any flat author — prevents flat-preemption).
return .pending;
},
else => if (isNamedTypeKind(own.raw)) {
@@ -1559,7 +1557,7 @@ pub fn isNamedTypeKind(raw: resolver_mod.RawDeclRef) bool {
/// mid-registration → the caller yields the legacy empty-struct stub). A
/// STRUCT resolves first through its `type_decl_tids` nominal identity (E2)
/// keyed by the raw-facts decl pointer, so two same-name struct authors in
/// different sources resolve to their OWN distinct TypeIds (issue 0105). A
/// different sources resolve to their OWN distinct TypeIds. A
/// `type_decl_tids` MISS falls back to the global `findByName` — correct for a
/// SINGLE-author struct registered via a non-`internNamedTypeDecl` path (a
/// `struct #compiler`, a protocol-backed struct, a generic instance) or before
@@ -1773,7 +1771,7 @@ pub fn selectedFuncId(self: *Lowering, sf: *SelectedFunc, name: []const u8) Func
/// winner): the winner owns the name-keyed slot and lowers through the
/// normal lazy path, so `selectPlainCallableAuthor` returns `.none` for it. A shadow
/// is declared a fresh same-name FuncId in its OWN module's visibility
/// context and its body lowered into that slot via fix-0102b's identity-
/// context and its body lowered into that slot via the identity-
/// addressable `lowerFunctionBodyInto`. Idempotent: `lowered_fids` tracks
/// which slots already carry a body.
pub fn bareAuthorFuncId(self: *Lowering, fd: *const ast.FnDecl, name: []const u8, path: []const u8) FuncId {
@@ -1868,7 +1866,7 @@ pub fn declareFunction(self: *Lowering, fd: *const ast.FnDecl, name: []const u8)
/// modules each exporting a top-level `parse` otherwise collide in the
/// bare-name `fn_ast_map` / function table (last-wins) while `resolveFuncByName`
/// picks the first declared, so `lazyLowerFunction` lowers one signature
/// against the other's body and trips its param-count assert (issue 0100).
/// against the other's body and trips its param-count assert.
/// The bare recursion in `scanDecls` still registers intra-module bare calls;
/// this adds the qualified identity the `pkg.fn(...)` resolution paths in
/// `CallResolver.plan` / `lowerCall` already prefer.
@@ -1894,7 +1892,7 @@ pub fn registerQualifiedFn(self: *Lowering, ns_name: []const u8, fd: *const ast.
// comptime / pack functions (`Vector`, `print`, `any_to_string`) are
// dispatched by monomorphization off their BARE template name, not the
// plain `resolveFuncByName` / `lazyLowerFunction` path that trips the
// collision assert (issue 0100); registering a qualified alias for them
// collision assert; registering a qualified alias for them
// would divert that machinery and strand a per-call type binding.
if (fd.type_params.len > 0 or hasComptimeParams(fd) or isPackFn(fd)) return;
// Foreign / builtin / #compiler bodies keep their literal name; a
@@ -1911,7 +1909,7 @@ pub fn registerQualifiedFn(self: *Lowering, ns_name: []const u8, fd: *const ast.
// `registerNamespaceQualifiedFns` pins `current_source_file` to the
// decl's source before each call). `lazyLowerFunction`'s null-FuncId
// path restores this so `ns.fn`'s body lowers in its own module's
// visibility context, not the call site's (issue 0100 F1).
// visibility context, not the call site's.
if (self.current_source_file) |src| {
self.program_index.qualified_fn_source.put(qualified, src) catch {};
}
@@ -2032,7 +2030,7 @@ pub fn lazyLowerFunction(self: *Lowering, name: []const u8) void {
// Find the existing extern stub (from scanDecls), keyed by NAME — the
// FIRST author of a name owns this slot. A shadowed same-name author is
// not here (it has no name-keyed slot); it is lowered out-of-line into
// its OWN FuncId by `lowerRetainedSameNameAuthors` (fix-0102b).
// its OWN FuncId by `lowerRetainedSameNameAuthors`.
const name_id = self.module.types.internString(name);
var func_id: ?FuncId = null;
for (self.module.functions.items, 0..) |func, i| {
@@ -2048,7 +2046,7 @@ pub fn lazyLowerFunction(self: *Lowering, name: []const u8) void {
}
// Function not yet declared — create it fresh via lowerFunction. A
// module-qualified alias (`ns.fn`, issue 0100) is registered in
// module-qualified alias (`ns.fn`) is registered in
// `fn_ast_map` without an eager `declareFunction`, so there's no
// `Function.source_file` to switch to. Restore the alias's OWN declaring
// source before lowering its body, otherwise it lowers in the caller's
@@ -2067,9 +2065,9 @@ pub fn lazyLowerFunction(self: *Lowering, name: []const u8) void {
/// real function. Identity-addressable: the caller passes the exact FuncId,
/// so a SHADOWED same-name author lowers into its OWN slot instead of
/// colliding on the name-keyed `resolveFuncByName` (which returns the first
/// author, the very split that trips issue 0100's param-count assert). Self-
/// author, the very split that trips the param-count assert). Self-
/// contained — the `FnBodyReentry` guard makes the nested lowering
/// transparent to any in-progress caller body (issue 0100 F2) — so it serves
/// transparent to any in-progress caller body — so it serves
/// both `lazyLowerFunction`'s name-keyed found path and the out-of-line
/// `lowerRetainedSameNameAuthors` pass.
pub fn lowerFunctionBodyInto(self: *Lowering, fd: *const ast.FnDecl, fid: FuncId, name: []const u8) void {
@@ -2086,7 +2084,7 @@ pub fn lowerFunctionBodyInto(self: *Lowering, fd: *const ast.FnDecl, fid: FuncId
// Re-use the existing function slot — switch builder to it. Pin the
// function's OWN source BEFORE resolving the return type, so a same-name
// shadowed type in the signature (issue 0105) resolves against THIS
// shadowed type in the signature resolves against THIS
// function's module rather than the caller's (which, importing two
// same-name authors, would be ambiguous). Param types below already
// resolve after this point.
@@ -2229,7 +2227,7 @@ pub fn lowerFunction(self: *Lowering, fd: *const ast.FnDecl, name: []const u8, i
// Record the declaring source so the function carries its own module
// for diagnostics/emit and for any later `lazyLowerFunction` re-entry
// that switches to `func.source_file`. The caller sets
// `current_source_file` to the decl's source before lowering (issue 0100 F1).
// `current_source_file` to the decl's source before lowering.
self.builder.currentFunc().source_file = self.current_source_file;
// Set linkage. Default for fn defs is `internal` (LLVM DCE-friendly,