Expand description
The Phase-2 type model (Playbook §2/§3.5): the gradual Ty lattice over Variant, the
hard/soft TypeSource, the ported is_assignable compatibility check, and TyRef→Ty
resolution against the engine API.
GDScript is gradually typed over one runtime value type, Variant. Three top-ish types are
kept distinct on purpose: Ty::Variant (the absorbing gradual top), Ty::Unknown (the
Phase-3 cross-file seam — never warns, never cascades, elided from hover), and Ty::Error
(already diagnosed — suppresses further cascade).
Structs§
- EnumRef
- A reference to an enum type, kept as the qualified name it was written with. Phase 2 does not
resolve it to a concrete enum table —
is_assignableonly needs the kind (enum values are assignable toint), and hover shows the qualified name. - Script
RefId - An opaque reference to another
.gdscript (byclass_name/path). Resolved to a concrete type only in Phase 3; in Phase 2 it never appears (the seam returnsTy::Unknowninstead), but the variant exists so the upgrade is additive. - Signal
SigId - An interned signal signature id (Phase 3+).
- Typed
Binding - A typed binding: its
Typlus how the type was established.
Enums§
- Assign
- The outcome of
is_assignable— richer than a bool so the caller can raise the right diagnostic (Playbook §3.5/§5). - Ty
- A Phase-2 type.
ClonenotCopy(theBoxes inArray/Dict). - Type
Source - How a binding’s type was established (Playbook §2). The ordering is load-bearing: a type is
hard (statically enforced) iff its source is greater than
TypeSource::Inferred.
Functions§
- is_
assignable - Whether a value of type
frommay be assigned to a slot of typeto(the engine’scheck_type_compatibility, ported — Playbook §3.5). Order matters. - resolve_
elemref - Resolve a typed-container element
ElemRefto aTy. - resolve_
tyref - Resolve an engine-API
TyRef(the unresolved form stored in the model) to aTy.