[jira] [Updated] (GROOVY-10106) STC error for call to static trait method from closure

2022-09-22 Thread Eric Milles (Jira)


 [ 
https://issues.apache.org/jira/browse/GROOVY-10106?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Milles updated GROOVY-10106:
-
Labels: traits  (was: )

> STC error for call to static trait method from closure
> --
>
> Key: GROOVY-10106
> URL: https://issues.apache.org/jira/browse/GROOVY-10106
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 2.5.14
>Reporter: Renato Athaydes
>Assignee: Eric Milles
>Priority: Major
>  Labels: traits
> Fix For: 4.0.0-beta-1, 3.0.9, 2.5.16
>
>
> The following code fails to compile:
> {code:groovy}
> class Foo {
> String bar
> }
> @groovy.transformn.CompileStatic
> trait A {
> final Foo foo = new Foo().with {
> config(it)
> it
> }
> static void config(foo) {
> foo.bar = 'bar'
> }
> }
> class C implements A {
> }
> print new C().foo.bar
> {code}
>  
> The error is:
> {code}
> src/test/groovy/bar/Foo.groovy: 14: [Static type checking] - Cannot find 
> matching method bar.A#config(bar.Foo). Please check if the declared type is 
> correct and if the method exists.
>  @ line 14, column 9.
>config(it)
>^
> 1 error
> {code}
>  
> If I change {{trait}} to {{class}}, it compiles successfully.
> I think this has to do with the fact that trait cannot have constructors, and 
> hence the context in which the code executes does not have the right imports?
> Anyway, this was working fine before we upgraded to the latest Groovy 2.5.x 
> version from 2.4.x.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Updated] (GROOVY-10106) STC error for call to static trait method from closure

2022-02-01 Thread Eric Milles (Jira)


 [ 
https://issues.apache.org/jira/browse/GROOVY-10106?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Milles updated GROOVY-10106:
-
Fix Version/s: 2.5.16

> STC error for call to static trait method from closure
> --
>
> Key: GROOVY-10106
> URL: https://issues.apache.org/jira/browse/GROOVY-10106
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 2.5.14
>Reporter: Renato Athaydes
>Assignee: Eric Milles
>Priority: Major
> Fix For: 4.0.0-beta-1, 3.0.9, 2.5.16
>
>
> The following code fails to compile:
> {code:groovy}
> class Foo {
> String bar
> }
> @groovy.transformn.CompileStatic
> trait A {
> final Foo foo = new Foo().with {
> config(it)
> it
> }
> static void config(foo) {
> foo.bar = 'bar'
> }
> }
> class C implements A {
> }
> print new C().foo.bar
> {code}
>  
> The error is:
> {code}
> src/test/groovy/bar/Foo.groovy: 14: [Static type checking] - Cannot find 
> matching method bar.A#config(bar.Foo). Please check if the declared type is 
> correct and if the method exists.
>  @ line 14, column 9.
>config(it)
>^
> 1 error
> {code}
>  
> If I change {{trait}} to {{class}}, it compiles successfully.
> I think this has to do with the fact that trait cannot have constructors, and 
> hence the context in which the code executes does not have the right imports?
> Anyway, this was working fine before we upgraded to the latest Groovy 2.5.x 
> version from 2.4.x.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Updated] (GROOVY-10106) STC error for call to static trait method from closure

2021-08-18 Thread Eric Milles (Jira)


 [ 
https://issues.apache.org/jira/browse/GROOVY-10106?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Milles updated GROOVY-10106:
-
Fix Version/s: 3.0.9

> STC error for call to static trait method from closure
> --
>
> Key: GROOVY-10106
> URL: https://issues.apache.org/jira/browse/GROOVY-10106
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 2.5.14
>Reporter: Renato Athaydes
>Assignee: Eric Milles
>Priority: Major
> Fix For: 4.0.0-beta-1, 3.0.9
>
>
> The following code fails to compile:
> {code:groovy}
> class Foo {
> String bar
> }
> @groovy.transformn.CompileStatic
> trait A {
> final Foo foo = new Foo().with {
> config(it)
> it
> }
> static void config(foo) {
> foo.bar = 'bar'
> }
> }
> class C implements A {
> }
> print new C().foo.bar
> {code}
>  
> The error is:
> {code}
> src/test/groovy/bar/Foo.groovy: 14: [Static type checking] - Cannot find 
> matching method bar.A#config(bar.Foo). Please check if the declared type is 
> correct and if the method exists.
>  @ line 14, column 9.
>config(it)
>^
> 1 error
> {code}
>  
> If I change {{trait}} to {{class}}, it compiles successfully.
> I think this has to do with the fact that trait cannot have constructors, and 
> hence the context in which the code executes does not have the right imports?
> Anyway, this was working fine before we upgraded to the latest Groovy 2.5.x 
> version from 2.4.x.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (GROOVY-10106) STC error for call to static trait method from closure

2021-05-25 Thread Eric Milles (Jira)


 [ 
https://issues.apache.org/jira/browse/GROOVY-10106?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Milles updated GROOVY-10106:
-
Description: 
The following code fails to compile:
{code:groovy}
class Foo {
String bar
}
@groovy.transformn.CompileStatic
trait A {
final Foo foo = new Foo().with {
config(it)
it
}
static void config(foo) {
foo.bar = 'bar'
}
}
class C implements A {
}
print new C().foo.bar
{code}
 

The error is:
{code}
src/test/groovy/bar/Foo.groovy: 14: [Static type checking] - Cannot find 
matching method bar.A#config(bar.Foo). Please check if the declared type is 
correct and if the method exists.
 @ line 14, column 9.
   config(it)
   ^
1 error
{code}
 
If I change {{trait}} to {{class}}, it compiles successfully.

I think this has to do with the fact that trait cannot have constructors, and 
hence the context in which the code executes does not have the right imports?

Anyway, this was working fine before we upgraded to the latest Groovy 2.5.x 
version from 2.4.x.

  was:
The following code fails to compile:
{code:groovy}
class Foo {
String bar
}
@groovy.transformn.CompileStatic
trait A {
final Foo foo = new Foo().with {
config(it)
it
}
static void config(foo) {
foo.bar = 'bar'
}
}
class 
{code}
 

The error is:
{code}
src/test/groovy/bar/Foo.groovy: 14: [Static type checking] - Cannot find 
matching method bar.A#config(bar.Foo). Please check if the declared type is 
correct and if the method exists.
 @ line 14, column 9.
   config(it)
   ^
1 error
{code}
 
If I change {{trait}} to {{class}}, it compiles successfully.

I think this has to do with the fact that trait cannot have constructors, and 
hence the context in which the code executes does not have the right imports?

Anyway, this was working fine before we upgraded to the latest Groovy 2.5.x 
version from 2.4.x.


> STC error for call to static trait method from closure
> --
>
> Key: GROOVY-10106
> URL: https://issues.apache.org/jira/browse/GROOVY-10106
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 2.5.14
>Reporter: Renato Athaydes
>Assignee: Eric Milles
>Priority: Major
>
> The following code fails to compile:
> {code:groovy}
> class Foo {
> String bar
> }
> @groovy.transformn.CompileStatic
> trait A {
> final Foo foo = new Foo().with {
> config(it)
> it
> }
> static void config(foo) {
> foo.bar = 'bar'
> }
> }
> class C implements A {
> }
> print new C().foo.bar
> {code}
>  
> The error is:
> {code}
> src/test/groovy/bar/Foo.groovy: 14: [Static type checking] - Cannot find 
> matching method bar.A#config(bar.Foo). Please check if the declared type is 
> correct and if the method exists.
>  @ line 14, column 9.
>config(it)
>^
> 1 error
> {code}
>  
> If I change {{trait}} to {{class}}, it compiles successfully.
> I think this has to do with the fact that trait cannot have constructors, and 
> hence the context in which the code executes does not have the right imports?
> Anyway, this was working fine before we upgraded to the latest Groovy 2.5.x 
> version from 2.4.x.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (GROOVY-10106) STC error for call to static trait method from closure

2021-05-25 Thread Eric Milles (Jira)


 [ 
https://issues.apache.org/jira/browse/GROOVY-10106?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Milles updated GROOVY-10106:
-
Description: 
The following code fails to compile:
{code:groovy}
class Foo {
String bar
}
@groovy.transformn.CompileStatic
trait A {
final Foo foo = new Foo().with {
config(it)
it
}
static void config(foo) {
foo.bar = 'bar'
}
}
class 
{code}
 

The error is:
{code}
src/test/groovy/bar/Foo.groovy: 14: [Static type checking] - Cannot find 
matching method bar.A#config(bar.Foo). Please check if the declared type is 
correct and if the method exists.
 @ line 14, column 9.
   config(it)
   ^
1 error
{code}
 
If I change {{trait}} to {{class}}, it compiles successfully.

I think this has to do with the fact that trait cannot have constructors, and 
hence the context in which the code executes does not have the right imports?

Anyway, this was working fine before we upgraded to the latest Groovy 2.5.x 
version from 2.4.x.

  was:
The following code fails to compile:

 

 
{code:java}
class Foo {
String foo
}

@CompileStatic
trait A {
final Foo foo = new Foo().with {
config(it)
it
}

@CompileDynamic
static void config(foo) {
foo.foo = 'bar'
}
}
{code}
 

The error is:

 

 
{code:java}
src/test/groovy/bar/Foo.groovy: 14: [Static type checking] - Cannot find 
matching method bar.A#config(bar.Foo). Please check if the declared type is 
correct and if the method exists.
 @ line 14, column 9.
   config(it)
   ^
1 error

{code}
 

If I change {{trait}} to {{class}}, it compiles successfully.

I think this has to do with the fact that trait cannot have constructors, and 
hence the context in which the code executes does not have the right imports?

Anyway, this was working fine before we upgraded to the latest Groovy 2.5.x 
version from 2.4.x.


> STC error for call to static trait method from closure
> --
>
> Key: GROOVY-10106
> URL: https://issues.apache.org/jira/browse/GROOVY-10106
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 2.5.14
>Reporter: Renato Athaydes
>Assignee: Eric Milles
>Priority: Major
>
> The following code fails to compile:
> {code:groovy}
> class Foo {
> String bar
> }
> @groovy.transformn.CompileStatic
> trait A {
> final Foo foo = new Foo().with {
> config(it)
> it
> }
> static void config(foo) {
> foo.bar = 'bar'
> }
> }
> class 
> {code}
>  
> The error is:
> {code}
> src/test/groovy/bar/Foo.groovy: 14: [Static type checking] - Cannot find 
> matching method bar.A#config(bar.Foo). Please check if the declared type is 
> correct and if the method exists.
>  @ line 14, column 9.
>config(it)
>^
> 1 error
> {code}
>  
> If I change {{trait}} to {{class}}, it compiles successfully.
> I think this has to do with the fact that trait cannot have constructors, and 
> hence the context in which the code executes does not have the right imports?
> Anyway, this was working fine before we upgraded to the latest Groovy 2.5.x 
> version from 2.4.x.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (GROOVY-10106) STC error for call to static trait method from closure

2021-05-25 Thread Eric Milles (Jira)


 [ 
https://issues.apache.org/jira/browse/GROOVY-10106?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Milles updated GROOVY-10106:
-
Summary: STC error for call to static trait method from closure  (was: 
Cannot call dynamic method from CompileStatic method in a trait)

> STC error for call to static trait method from closure
> --
>
> Key: GROOVY-10106
> URL: https://issues.apache.org/jira/browse/GROOVY-10106
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 2.5.14
>Reporter: Renato Athaydes
>Assignee: Eric Milles
>Priority: Major
>
> The following code fails to compile:
>  
>  
> {code:java}
> class Foo {
> String foo
> }
> @CompileStatic
> trait A {
> final Foo foo = new Foo().with {
> config(it)
> it
> }
> @CompileDynamic
> static void config(foo) {
> foo.foo = 'bar'
> }
> }
> {code}
>  
> The error is:
>  
>  
> {code:java}
> src/test/groovy/bar/Foo.groovy: 14: [Static type checking] - Cannot find 
> matching method bar.A#config(bar.Foo). Please check if the declared type is 
> correct and if the method exists.
>  @ line 14, column 9.
>config(it)
>^
> 1 error
> {code}
>  
> If I change {{trait}} to {{class}}, it compiles successfully.
> I think this has to do with the fact that trait cannot have constructors, and 
> hence the context in which the code executes does not have the right imports?
> Anyway, this was working fine before we upgraded to the latest Groovy 2.5.x 
> version from 2.4.x.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)