Fix ExtensionMethod target typing for poly expressions in Eclipse - #4036
Open
z-xhh wants to merge 1 commit into
Open
Fix ExtensionMethod target typing for poly expressions in Eclipse#4036z-xhh wants to merge 1 commit into
z-xhh wants to merge 1 commit into
Conversation
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
This change fixes Eclipse
@ExtensionMethodresolution when an argument is a poly expression that already carries an overly broad resolved type.In the failing case, a call like:
could be treated as passing
List<Object>instead ofList<RefundOrderDto>. That caused extension method resolution to fail before the call could be rewritten to the static extension method form.What Changed
PolyTypeBindingfor poly-expression arguments in the Eclipse extension-method resolution path, instead of only doing so whenresolvedTypeisnull.Collections.emptyList()in the regression test so the case stays valid on the ECJ test path and isolates the actual inference issue.Why This Matters
Without this change, valid extension-method calls can be rejected in Eclipse/JDT because argument typing is finalized too early and loses the target type required by the extension method signature.
Repro
Given an extension method like:
a call such as:
could fail in Eclipse/JDT with an error equivalent to:
Validation
dist test.eclipse-202503test.compile