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

   Merge note: #3129 (GROOVY-12602) and #3139 (GROOVY-12612) fix the two halves 
of an implicit-this call from a `@CompileStatic` lambda in a trait instance 
method:
   
   - `Supplier<String> s = () -> foo()` needs #3129. With #3139 alone it still 
throws `ClassCastException: class java.lang.Class cannot be cast to class T`.
   - `Supplier<String> s = () -> this.foo()` needs #3139. With #3129 alone it 
throws `ClassCastException: class C cannot be cast to class T$Trait$Helper`.
   
   With both applied, every shape I probed passes under dynamic, `@TypeChecked` 
and `@CompileStatic`. The shapes were a lambda with arguments, an overridden 
trait method, a nested lambda, a closure inside a lambda, `this::foo`, 
properties, private fields, static and private methods. 4.0.33, 5.0.8 and 6.0.0 
fail the same way, and both JIRA issues now list them. Both PRs append tests at 
the end of `TraitWithClosureOrLambda.groovy`, so the second to merge has a 
trivial conflict there.
   


-- 
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