Skip to content

Fix duplicate error for partial call with type arguments#5335

Merged
SeanTAllen merged 2 commits into
mainfrom
fix-double-partial-call-error
May 27, 2026
Merged

Fix duplicate error for partial call with type arguments#5335
SeanTAllen merged 2 commits into
mainfrom
fix-double-partial-call-error

Conversation

@SeanTAllen
Copy link
Copy Markdown
Member

@SeanTAllen SeanTAllen commented May 16, 2026

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 partial fn[A]). The short-circuit eliminates that path as well; a regression test covers it.

Closes #5332

@SeanTAllen SeanTAllen added the changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge label May 16, 2026
@ponylang-main ponylang-main added the discuss during sync Should be discussed during an upcoming sync label May 16, 2026
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.
@SeanTAllen SeanTAllen force-pushed the fix-double-partial-call-error branch from 72fac6a to 89ba8e4 Compare May 22, 2026 18:39
@SeanTAllen SeanTAllen merged commit defd2a2 into main May 27, 2026
19 checks passed
@SeanTAllen SeanTAllen deleted the fix-double-partial-call-error branch May 27, 2026 19:18
@ponylang-main ponylang-main removed the discuss during sync Should be discussed during an upcoming sync label May 27, 2026
github-actions Bot pushed a commit that referenced this pull request May 27, 2026
github-actions Bot pushed a commit that referenced this pull request May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Partial method call with generic type arguments emits the partial-call-mismatch error twice

3 participants