Summary
CBMRegisteredType.alias_of (internal/cbm/lsp/type_registry.h:54) is followed correctly by the method-lookup chain (type_registry.c:675-701), but it is only ever set during the same-file AST scan. Cross-file, def-driven type registration never carries the alias target, so a type A = B declared in one file is invisible to method resolution on A in any other file of the same package.
Where
- Only assignments of
alias_of: internal/cbm/lsp/go_lsp.c:2233, :2243, :3065, :3075 — all inside the "Phase 1b: scan AST" blocks that walk the current file's tree.
- The def-driven registration that ingests cross-file types (
go_lsp.c ~2988-3010, guarded by cbm_label_is_type_like(d->label)) sets qualified_name, short_name, is_interface, embedded_types, method_names and field defs — never alias_of.
src/pipeline/pass_lsp_cross.c contains zero cbm_registry_add_type calls.
Corpus shape (kubernetes, staging/src/k8s.io/component-helpers/nodedeclaredfeatures/)
featureset.go:26 — type FeatureSet = bitmap (a true alias)
bitmap.go:38 — func (b bitmap) Set(i int)
framework.go:100 — reqs := f.NewFeatureSet() … reqs.Set(i)
Three different files, one package. Today reqs.Set resolves — but via resolve_same_module hashing the flat QN pkg.Set (same_module, 0.9, cand=1), which is only right because exactly one Set exists in the package. It is a name hash, not type knowledge. With receiver-qualified QNs (#1913) the QN becomes pkg.bitmap.Set, the exact hash misses, and the edge is lost. b.Set in bitmap_test.go, where the receiver is typed in-file, resolves as lsp_type_dispatch 0.95.
Proposed fix
Carry alias_of through the def-driven cross-file registration: a Go def for type A = B records its aliased target so the shared registry can set rt.alias_of. Go semantics to keep straight: type A = B is an identity alias and inherits B's method set; type A B is a defined type and does not — only the former may be followed.
Summary
CBMRegisteredType.alias_of(internal/cbm/lsp/type_registry.h:54) is followed correctly by the method-lookup chain (type_registry.c:675-701), but it is only ever set during the same-file AST scan. Cross-file, def-driven type registration never carries the alias target, so atype A = Bdeclared in one file is invisible to method resolution onAin any other file of the same package.Where
alias_of:internal/cbm/lsp/go_lsp.c:2233,:2243,:3065,:3075— all inside the "Phase 1b: scan AST" blocks that walk the current file's tree.go_lsp.c~2988-3010, guarded bycbm_label_is_type_like(d->label)) setsqualified_name,short_name,is_interface,embedded_types,method_namesand field defs — neveralias_of.src/pipeline/pass_lsp_cross.ccontains zerocbm_registry_add_typecalls.Corpus shape (kubernetes,
staging/src/k8s.io/component-helpers/nodedeclaredfeatures/)featureset.go:26—type FeatureSet = bitmap(a true alias)bitmap.go:38—func (b bitmap) Set(i int)framework.go:100—reqs := f.NewFeatureSet()…reqs.Set(i)Three different files, one package. Today
reqs.Setresolves — but viaresolve_same_modulehashing the flat QNpkg.Set(same_module, 0.9,cand=1), which is only right because exactly oneSetexists in the package. It is a name hash, not type knowledge. With receiver-qualified QNs (#1913) the QN becomespkg.bitmap.Set, the exact hash misses, and the edge is lost.b.Setinbitmap_test.go, where the receiver is typed in-file, resolves aslsp_type_dispatch0.95.Proposed fix
Carry
alias_ofthrough the def-driven cross-file registration: a Go def fortype A = Brecords its aliased target so the shared registry can setrt.alias_of. Go semantics to keep straight:type A = Bis an identity alias and inheritsB's method set;type A Bis a defined type and does not — only the former may be followed.