Skip to content

step 1 : infrastracture for deferred type variables #2467

@lipingtababa

Description

@lipingtababa

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: #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.

Background

it is a part of deferred type

Workarounds

no.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions