wip(E2): partial nominal-identity/shadow work [stdlib E2 attempt-1 WIP checkpoint]

Incomplete WIP from a worker killed at the 30-min wall; committed as a
checkpoint so the resumed session continues on a clean tree. May not build.
This commit is contained in:
agra
2026-06-07 22:17:07 +03:00
parent a8c7404a2f
commit 4b2a067991
3 changed files with 292 additions and 74 deletions

View File

@@ -332,11 +332,15 @@ pub const TypeTable = struct {
tags: TagRegistry,
/// Maps TypeInfo → TypeId for dedup of structural types
intern_map: std.HashMap(TypeKey, TypeId, TypeKeyContext, 80),
/// Stable nominal identity: type-decl AST node → its TypeId. The
/// `fn_decl_fids` analogue — one entry per declaring node, so two
/// same-display-name declarations resolve to distinct TypeIds via their
/// own node pointer. Populated by the resolver when it assigns nominal ids.
type_decl_tids: std.AutoHashMap(*const ast.Node, TypeId),
/// Stable nominal identity: the declaring decl's pointer → its TypeId. The
/// `fn_decl_fids` analogue — one entry per declaring decl, so two
/// same-display-name declarations resolve to distinct TypeIds via their own
/// decl pointer. Keyed by the opaque `RawDeclRef` inner pointer (e.g.
/// `*const ast.StructDecl`) — the SAME pointer the import raw-facts hold and
/// `registerStructDecl` receives, so registration and resolution agree on
/// identity without threading the wrapping `ast.Node`. Populated by the
/// resolver (E2) as it assigns nominal ids.
type_decl_tids: std.AutoHashMap(*const anyopaque, TypeId),
alloc: Allocator,
/// Owns the element/param slices duped by the type constructors
/// (`functionType*`, `closureType*`, `packType`). Freed wholesale in
@@ -353,7 +357,7 @@ pub const TypeTable = struct {
.strings = StringPool.init(alloc),
.tags = TagRegistry.init(alloc),
.intern_map = std.HashMap(TypeKey, TypeId, TypeKeyContext, 80).init(alloc),
.type_decl_tids = std.AutoHashMap(*const ast.Node, TypeId).init(alloc),
.type_decl_tids = std.AutoHashMap(*const anyopaque, TypeId).init(alloc),
.alloc = alloc,
.slice_arena = std.heap.ArenaAllocator.init(alloc),
};