GROOVY-8241 SAM parameter type inference for explicit parameter#643
Closed
avafanasiev wants to merge 1 commit intoapache:masterfrom
Closed
GROOVY-8241 SAM parameter type inference for explicit parameter#643avafanasiev wants to merge 1 commit intoapache:masterfrom
avafanasiev wants to merge 1 commit intoapache:masterfrom
Conversation
Contributor
|
+1 |
Contributor
|
Merged. Thanks :-) |
asfgit
pushed a commit
that referenced
this pull request
Dec 13, 2017
Contributor
Author
|
Thanks for merge! |
ghost
reviewed
Dec 17, 2017
|
|
||
| static def testPredicate() { | ||
| foo { it -> | ||
| it.toUpperCase() |
There was a problem hiding this comment.
I'm confused :) This works because foo happens to always pass a String to p::test, but what if it passed new Object() instead? If testPredicate were @CompileStatic I would expect a compile error here. Is this disparity intentional?
Contributor
Author
There was a problem hiding this comment.
Actually you can't pass anything except String to Predicate<? super String> p . Cause it should be able to be assigned to captured type '? super String' . This behavior matches java's lambda behavior.
There was a problem hiding this comment.
Oh, you're right. I forgot Groovy's interpretation of <? super X> is simply <X> :)
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.
It should fix GROOVY-8241, GROOVY-7061, GROOVY-8317.