[ 
https://issues.apache.org/jira/browse/GROOVY-12624?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18135718#comment-18135718
 ] 

ASF GitHub Bot commented on GROOVY-12624:
-----------------------------------------

testlens-app[bot] commented on PR #3150:
URL: https://github.com/apache/groovy/pull/3150#issuecomment-6541039652

   ## 🚨 All tests passed but jobs failed 🚨
   
   ### Failed Jobs without Test Failures
   
   ❌ [Build and test / lts \(17, windows-latest, 
1\)](https://github.com/apache/groovy/actions/runs/41180240992/job/124476374989?pr=3150)
   
   🏷️ Commit: e7d0085b4f4fcc049167a34da91f12fd518fb940
   ▶️ Tests:  124159 executed
   🟡 Checks: 21/24 completed
   
   ### Rerun Controls
   
   Click the checkbox to trigger a rerun:
   
   🔲 **Rerun jobs**
   
   ---
   _Learn more about TestLens at 
[testlens.app/docs](https://testlens.app/docs/features/pr-comment/)._
   




> SC resolves calls that the trait transformation adds in a closure against the 
> closure's delegate
> ------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12624
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12624
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 6.0.0
>            Reporter: Scott Murphy Heiberg
>            Priority: Major
>
> {code:groovy}
> @groovy.transform.CompileStatic
> trait V {
>     static String who() { this.simpleName }
>     def m() { new Object().with { who() } }
> }
> class E implements V {}
> assert new E().m() == 'E'
> class Dg {
>     String who(Class c) { 'delegate' }
> }
> @groovy.transform.CompileStatic
> trait T {
>     static String who() { this.simpleName }
>     def m() { new Dg().with { who() } }
> }
> class C implements T {}
> assert new C().m() == 'C'
> {code}
> Actual: under static compilation the first m() returns 'Object' (the 
> delegate's class), also when who is declared in a super trait or called as 
> this.who(). The second m() returns 'delegate': it calls Dg.who(Class) with 
> the self argument that the trait transformation added.
> Expected: 'E' and 'C', as dynamic Groovy and @TypeChecked return.
> Cause: TraitReceiverTransformer rewrites the call to a trait helper call with 
> the receiver class as first argument. Both the outer helper call and the 
> inner getClass() call keep the default implicit-this flag, so the static 
> compiler resolves them against the closure's delegate.
> Seen on master; 5.0.8 and 6.0.0 reported the same.
> PR: https://github.com/apache/groovy/pull/3150



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to