Expand description
Name & type resolution (Playbook §3.2/§3.5): the resolve_external Phase-3 seam, the
GDScript source-annotation → Ty resolver, base-class resolution, the per-class
ClassScope (the class-member tier of the binder), and global resolution.
The binder’s lookup order (local → class member → inherited → global) is driven by
crate::infer; this module supplies the class-member and global tiers plus the type
resolution all tiers share. Everything here is a pure function of the item tree + the
Arc-shared EngineApi — no body, no cross-file state.
Structs§
- Class
Scope - The class-member tier of the binder (Playbook §3.2 step 2): this file’s own members + the
resolved base type. Anonymous-enum variants are flattened in as
intconstants.
Enums§
- Class
Item - What a class-level name resolves to within
ClassScope. - External
Ref - A reference that would require another file to resolve — the Phase-3 boundary. Phase 2
never reaches across files, so every variant resolves to the same non-cascading
Ty::Unknown; Phase 3 reimplements onlyresolve_external, leaving every inference body unchanged (Playbook §0 — “the biggest enabler in the whole phase; protect it”). - Global
Def - What a bare global name resolves to (Playbook §3.2 step 4). The caller (
crate::infer) decides how to use it given the syntactic context (bare value vs. call vs..-access).
Functions§
- layer_
to_ ty - Map a coarse engine-layer
LayerTy(used by the hand-authored GDScript layer, which predates the loaded model’s real ids) to aTy. - resolve_
base - Resolve a file’s (or inner class’s) base type from its
extends. A bare engine-class name resolves toObject(id); a script-path / dotted / unknown base goes through the seam toUnknown. With noextends, a script implicitly extendsRefCounted. - resolve_
external - The Phase-3 seam. Resolve a cross-file reference. In Phase 2 this is always
Ty::Unknown— a type that never warns, never cascades a diagnostic, and is elided from hover. Funnel every “would need another file” path through here so Phase 3 has exactly one function to reimplement. - resolve_
global - Resolve a bare global identifier. Order is deliberate: pseudo-constants and singletons take
precedence over the same-named type (bare
Inputis the singleton instance, not the class). - resolve_
type_ name - Resolve a bare type name (no type arguments) — for callers that only have a string (completion detail, inlay display).
- resolve_
type_ ref - Resolve a GDScript source type annotation (a
TypeRefCST node) to aTy. Handlesvoid/Variant, builtins, engine classes,Array/Array[T],Dictionary/Dictionary[K, V], global enums, andClass.Enum; an unknown bare name is treated as a (cross-file)class_nameand funneled through theresolve_externalseam.