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

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

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

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




> A static accessor method of a trait cannot be referenced as a property from a 
> static method of the implementing class
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12605
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12605
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 4.0.33, 5.0.8, 6.0.0
>            Reporter: Scott Murphy Heiberg
>            Priority: Major
>
> {code:groovy}
> trait T { static boolean isVr() { true } }
> class C implements T { static m() { vr } }
> assert C.m()
> {code}
> Actual: compilation fails in dynamic, type-checked and statically compiled 
> code alike:
> {noformat}
> Apparent variable 'vr' was found in a static scope but doesn't refer to a 
> local variable, static field or class.
> {noformat}
> The same happens for a static getter, for a static setter used as an 
> assignment target, and for a static property or accessor inherited through a 
> super trait (trait U extends T, class C implements U).
> Expected: the bare name resolves to the static accessor woven into C, as it 
> does when the method is declared in a superclass and as it already does from 
> instance methods of C.
> Cause: VariableScopeVisitor.findClassMember creates a pseudo-property for 
> accessor methods of the class and its superclasses, but for traits it looks 
> only at fields and properties, and it does not follow a super trait that is 
> still in the extends clause before the trait transformation. StaticVerifier 
> then rejects the unresolved name.
> Seen in 4.0.33, 5.0.8 and 6.0.0.
> PR: https://github.com/apache/groovy/pull/3132



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

Reply via email to