Skip to content

fix: preserve generic call declaration identity - #479

Merged
akonwi merged 1 commit into
mainfrom
fix/generic-method-declaration-identity
Sep 7, 2026
Merged

fix: preserve generic call declaration identity#479
akonwi merged 1 commit into
mainfrom
fix/generic-method-declaration-identity

Conversation

@akonwi

@akonwi akonwi commented Sep 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • keep canonical Ard declarations separate from call-local specialized signatures
  • carry source function-reference provenance and resolved trait method slots into AIR
  • remove AIR name-based recovery for generic functions, methods, module symbols, and trait slots
  • route synthesized interpolation calls through receiver-aware specialization
  • cover direct and closure forward calls, imports, recursion, function values, traits, interpolation, and variadics
  • document the checker-to-AIR identity contract in ADRs 0002 and 0055

Why

Generic receiver inference copied a later method's hoisted FunctionDef before its body was checked. The call-local copy permanently retained a nil body even after the canonical declaration was completed, making AIR lowering depend on source order. Direct calls and closure calls had the same root cause.

Calls now retain both the canonical declaration that owns the body and the specialized signature that owns call-local types and generic bindings. Dynamic function-value calls intentionally have no source declaration.

The separate closure lexical-generic visibility problem discovered during investigation is tracked by #478 and is not changed here.

Validation

  • cd compiler && go test ./... -count=1
  • cd compiler && go test -race ./checker ./air ./go ./lsp ./lsp/analysis -count=1
  • cd compiler && go vet ./...
  • gopls check on all changed Go files
  • git diff --check
  • LSP harness: 18/18 passed
  • downstream projects with this branch compiler:
    • Tinear: 150 tests, check, and build
    • Decode: 11 tests
    • SQL: 6 tests
    • Maestro: 103 tests and check
    • Cooper: 265 tests and all examples checked

Fixes #477

Keep canonical function and method declarations separate from call-local specialized signatures so forward generic calls always retain their checked bodies. Carry resolved trait slots and source function-reference provenance into AIR instead of rediscovering targets by name.

Fixes #477
@vercel

vercel Bot commented Sep 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ard-lang-dev Ready Ready Preview Sep 7, 2026 4:44am UTC

@akonwi
akonwi merged commit 8c2f18b into main Sep 7, 2026
6 checks passed
@akonwi
akonwi deleted the fix/generic-method-declaration-identity branch September 7, 2026 04:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lowering fails when a closure in a generic impl method calls an instance method declared later in the impl block

1 participant