gogen icon indicating copy to clipboard operation
gogen copied to clipboard

infra for deferred type variable

Open lipingtababa opened this issue 3 months ago • 2 comments

Proposal Goal Enable variables to remain untyped until first use

Note You should investigate all the possibility before u make decisions. for exaple, you can use go module to read gogen code if needed

Scope Add deferred type tracking in cl/compile.go (symbol table extension) Implement placeholder type for untyped variables (types.Typ[types.UntypedNil] variant) Create deferred resolution queue mechanism No syntax changes - focus on internal infrastructure Deliverables New deferredVar structure to track unresolved variables Type resolution deferral mechanism in blockCtx Test cases in cl/_testgop/ for simple deferred inference scenarios Example Test Case x := 100 // deferred x + 200 // resolves to int Related Parent issue: xgo#2441 (Untyped Literal Extension) Part of Phase 1: Foundation - Deferred Type Inference Notes This is the foundational step that enables all subsequent steps in the untyped literal extension feature. It focuses on the internal infrastructure without any syntax changes.

lipingtababa avatar Oct 11 '25 10:10 lipingtababa