[
https://issues.apache.org/jira/browse/GROOVY-10228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Thodoris Sotiropoulos updated GROOVY-10228:
---
Description:
I think this bug is related to GROOVY-9963.
I have the following program
{code:java}
class A {
T x; A(T x) {
this.x = x;
}
T getX() {
return x;
}
}
class B {}
class Main {
public static void m1() {
def x = new B();
m2(new A<>(x).getX());
} public static void m2(B x) {}
}
{code}
h3. Actual behaviour
{code:java}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
test.groovy: 18: [Static type checking] - Cannot find matching method
Main#m2(T). Please check if the declared type is correct and if the method
exists.
@ line 18, column 5.
m2(new A<>(x).getX());
^1 error
{code}
h3. Expected behaviour
Compile successfully
Tested against master.
was:
I think this bug is related to GROOVY-9963.
I have the following program
{code:java}
class A {
T x; A(T x) {
this.x = x;
} T getX() {
return x;
}
}
class B {}
class Main {
public static void m1() {
def x = new B();
m2(new A<>(x).getX());
} public static void m2(B x) {}
}
{code}
h3. Actual behaviour
{code:java}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
test.groovy: 18: [Static type checking] - Cannot find matching method
Main#m2(T). Please check if the declared type is correct and if the method
exists.
@ line 18, column 5.
m2(new A<>(x).getX());
^1 error
{code}
h3. Expected behaviour
Compile successfully
Tested against master.
> STC fails to substitute type variable in the presence of the diamond operator
> and a function call
> -
>
> Key: GROOVY-10228
> URL: https://issues.apache.org/jira/browse/GROOVY-10228
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
>Reporter: Thodoris Sotiropoulos
>Priority: Major
>
> I think this bug is related to GROOVY-9963.
>
> I have the following program
> {code:java}
> class A {
> T x; A(T x) {
> this.x = x;
> }
> T getX() {
> return x;
> }
> }
> class B {}
> class Main {
> public static void m1() {
> def x = new B();
> m2(new A<>(x).getX());
> } public static void m2(B x) {}
> }
> {code}
> h3. Actual behaviour
> {code:java}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup
> failed:
> test.groovy: 18: [Static type checking] - Cannot find matching method
> Main#m2(T). Please check if the declared type is correct and if the method
> exists.
> @ line 18, column 5.
>m2(new A<>(x).getX());
>^1 error
> {code}
> h3. Expected behaviour
> Compile successfully
>
> Tested against master.
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)