codeconsole commented on PR #3089:
URL: https://github.com/apache/groovy/pull/3089#issuecomment-7073373766

   @daniellansun Thanks. I merged current master into the branch in 7823f759d6 
rather than rebasing, so no force-push. That picks up the `Groovy12720.groovy` 
fix, and `lintGate` passes locally. The only conflict was in 
`StaticTypeCheckingVisitor`, where master's GROOVY-12753/12755 rewrite of 
return-type inference met this PR's `inferGenericsOfCall`. I kept master's 
resolution logic and apply it to parameter types too. The description now says 
that a lambda written as a branch of a conditional isn't covered. While 
checking the operand case I found that `list << String::trim` didn't compile 
(class generation looked for `trim(T)`). That is fixed in 41eb183b9e, which 
gives the operand the interface's parameter types as an argument gets them. 
#3090 is stacked on this branch, so it will get master and these commits merged 
in.
   
   @paulk-asert On your point 2 (gate changes callers can observe), 5d3c725a5d 
does both things you suggested, one for each half:
   - **Lambdas are behind an option.** Statically compiled code now compiles a 
lambda for the interface only with the incubating 
`-Dgroovy.target.lambda.typearg=true` 
(`CompilerConfiguration.LAMBDA_TYPE_ARGUMENT`, forwarded by 
`org.apache.groovy-tested.gradle`). Without it the lambda is a closure as on 
master, so dynamic `list[0]()` and `.call()` keep working.
   - **Method references are not gated.** On master they were a compile error 
unless the type parameter's bound is a functional interface, so resolving them 
changes nothing that compiled before.
   - **Docs:** the `core-semantics.adoc` section covers both, including what 
callers can tell apart under the option.
   - **Tests:** `FunctionalTypeArgumentTest` pins the default, and 
`@TypeChecked` stays unchanged with and without the option.
   
   The STC and SC packages pass with the option off and on (5,958 tests).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to