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

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

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

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




> STC rejects the remapped name of a super trait field in a closure or for an 
> instance field ("The variable [T__x] is undeclared" / "No such property: 
> T__x")
> -----------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12609
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12609
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 4.0.33, 5.0.8, 6.0.0
>            Reporter: Scott Murphy Heiberg
>            Priority: Major
>
> {code:groovy}
> @groovy.transform.TypeChecked // or @CompileStatic
> trait T {
>     public static String shared = 'x'
>     public String f = 'i'
> }
> @groovy.transform.TypeChecked
> trait U extends T {
>     static m() { def c = { T__shared }; c() }
>     def n() { T__f }
> }
> class C implements U {}
> assert C.m() == 'x'
> assert new C().n() == 'i'
> {code}
> Actual: compilation fails with "[Static type checking] - The variable 
> [T__shared] is undeclared." and "[Static type checking] - No such property: 
> T__f for class: U". The same happens for writes, lambdas, an instance field 
> in a closure, and a precompiled super trait.
> Expected: both compile and return x and i, as they do in dynamic Groovy. The 
> remapped name is the documented way to use a super trait's field 
> (GROOVY-11641, GROOVY-11663).
> The trait transformation leaves a dynamic variable in a closure as it is, so 
> the GROOVY-11663 handling of the remapped name on the trait receiver never 
> sees it. That handling also only looks for static field getters.
> Seen in 5.0.8 and 6.0.0; 4.0.33 reports the closure case the same way.
> PR: https://github.com/apache/groovy/pull/3136



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

Reply via email to