refactor(ir): extract unknown-type diagnostic pass into semantic_diagnostics (A2.4)
Moves the issue-0064 unknown-type pass (checkUnknownTypeNames + 11 helpers: collectDeclaredTypeNames, harvestScopeDecls, checkStructFieldTypes, checkFnSignatureTypes, checkScope, walkBodyTypes, checkCastTarget, checkTypeNodeForUnknown, reportIfUnknownType, isBuiltinTypeName, isIdentLike) out of Lowering into a new src/ir/semantic_diagnostics.zig (UnknownTypeChecker). The checker holds borrowed references (alloc, *DiagnosticList, *TypeTable, *ProgramIndex, main_file) — not *Lowering — and queries the canonical facts: declared top-level names from ProgramIndex, primitives from TypeResolver.resolvePrimitive, registered concrete types from the TypeTable. The AST decl/scope walk stays (it collects LOCAL type decls, which ProgramIndex doesn't track — a per-pass scope need, not a parallel authoritative list). Lowering.lowerRoot builds the checker only when diagnostics are active and runs it; the 12 functions are deleted from lower.zig. Barrel-wired in ir.zig. Example snapshots (issue-0064 regressions 1111-1115) are the guard, matching the checkErrorFlow precedent (no .test.zig). Phase A2 complete. Gate: zig build, zig build test, run_examples 351/0.
This commit is contained in:
@@ -7,6 +7,7 @@ pub const lower = @import("lower.zig");
|
||||
pub const program_index = @import("program_index.zig");
|
||||
pub const type_resolver = @import("type_resolver.zig");
|
||||
pub const packs = @import("packs.zig");
|
||||
pub const semantic_diagnostics = @import("semantic_diagnostics.zig");
|
||||
|
||||
pub const TypeId = types.TypeId;
|
||||
pub const TypeInfo = types.TypeInfo;
|
||||
|
||||
Reference in New Issue
Block a user