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

Paul King edited comment on GROOVY-7930 at 9/22/16 8:31 AM:
------------------------------------------------------------

You are correct that the code shouldn't compile but it is about SelfType. After 
applying the PR, the sample code won't compile just like it wouldn't if 
referencing the trait directly instead of via Middle.


was (Author: paulk):
That is correct. After applying the PR, the sample code won't compile just like 
it wouldn't if referencing the trait directly instead of via Middle.

> @SelfType in hierarchy with an interface in the middle
> ------------------------------------------------------
>
>                 Key: GROOVY-7930
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7930
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 2.4.7
>            Reporter: Daniil Ovchinnikov
>
> {code}
> interface Self {
>     def bar()
> }
> @SelfType(Self)
> trait T {
>     def foo() {
>         println "foo called"
>         bar()
>     }
> }
> interface Middle extends T {}
> class C implements Middle {}
> new C().foo()
> {code}
> Above code compiles fine but fails at run time with:
> {noformat}
> groovy.lang.MissingMethodException: No signature of method: 
> selftype.baseinterface.C.bar() is applicable for argument types: () values: []
> {noformat}
> The compilation should fail like if {{Middle}} was a trait.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to