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

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

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

   ## ✅ All tests passed ✅
   
   🏷️ Commit: f995d38a190aa0b232132a1a6d40b39386e41b1e
   ▶️ Tests:  121143 executed
   ⚪️ Checks: 27/27 completed
   
   ---
   _Learn more about TestLens at 
[testlens.app/docs](https://testlens.app/docs/features/pr-comment/)._
   




> A public static super trait method called from a closure in trait code 
> ignores the closure's delegate
> -----------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12618
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12618
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 5.0.8, 6.0.0
>            Reporter: Scott Murphy Heiberg
>            Priority: Major
>
> {code:groovy}
> trait T { static int size() { 1 } }
> trait U extends T {
>     def m() { [5, 6].with { size() } }
>     static sm() { [5, 6].with { size() } }
> }
> class C implements U {}
> assert new C().m() == 2
> assert C.sm() == 2
> {code}
> Actual: both calls return 1, in dynamic, @TypeChecked and @CompileStatic code.
> Expected: 2, as with the same code written with classes. Inside a with 
> closure, the list delegate's size() comes before the owner's.
> The trait transformation rewrites an implicit-this call to a public static 
> method inherited from a super trait into a direct call on the trait helper 
> class, so the closure's delegate is never consulted. GROOVY-12611 changes 
> this for private and static methods declared by the trait itself, but not for 
> methods inherited from a super trait.
> Seen in 5.0.8 and 6.0.0.
> PR: https://github.com/apache/groovy/pull/3144



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

Reply via email to