fix: preserve generic call declaration identity - #479
Merged
Conversation
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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Why
Generic receiver inference copied a later method's hoisted
FunctionDefbefore 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=1cd compiler && go test -race ./checker ./air ./go ./lsp ./lsp/analysis -count=1cd compiler && go vet ./...gopls checkon all changed Go filesgit diff --checkFixes #477