Fix duplicate error for partial call with type arguments#5335
Merged
Conversation
When a method is qualified with type arguments at the call site, the qualification wraps the original FUNREF/FUNCHAIN/NEWREF in another node of the same kind. The verify pass walks the tree in post-order and so ran the partial-call check against both the inner and outer nodes, each of which resolved to the same TK_CALL parent and emitted the same diagnostic. The same wrap shape arises from explicit `[...]` at the call site and from compiler-inserted qualification when type parameters have defaults. Short-circuit the partial-call check at the inner node when its parent is a same-kind funref/newref and it sits in the receiver position. The outer node already unwraps the receiver and performs the check. Closes #5332
The same wrap-shape that caused the duplicate diagnostic also triggered a `pony_assert(ast_id(call) == TK_CALL)` failure when the call was the operand of `addressof`. The inner-node short-circuit avoids the walk into the TK_ADDRESS grandparent, so the assertion no longer fires. Cover this surface explicitly and mention it in the release notes.
72fac6a to
89ba8e4
Compare
jemc
approved these changes
May 27, 2026
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.
Fixes the double-emission of the partial-call-mismatch diagnostic when a method is called with type arguments. Type-argument qualification wraps the original FUNREF/FUNCHAIN/NEWREF in another node of the same kind, and the verify pass was running the partiality check against both the inner and outer nodes — each resolving up to the same TK_CALL parent and emitting the same diagnostic. The inner node now short-circuits when wrapped; the outer keeps the existing receiver-unwrap path.
The wrap shape arises both from explicit
[...]qualification at the call site and from compiler-inserted qualification when a method's type parameters have defaults. Regression tests cover both, along with the.>chain and partial-constructor variants.The same wrap-shape also caused a pre-existing assertion failure when the call was the operand of
addressof(@foo(addressof fn[U32])with a partialfn[A]). The short-circuit eliminates that path as well; a regression test covers it.Closes #5332