[jira] [Updated] (GROOVY-10228) STC fails to substitute type variable in the presence of the diamond operator and a function call

2023-10-24 Thread Eric Milles (Jira)


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

Eric Milles updated GROOVY-10228:
-
Fix Version/s: 3.0.20

> 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
>Assignee: Eric Milles
>Priority: Major
> Fix For: 4.0.0-beta-2, 3.0.20
>
>
> 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.20.10#820010)


[jira] [Updated] (GROOVY-10228) STC fails to substitute type variable in the presence of the diamond operator and a function call

2021-09-13 Thread Thodoris Sotiropoulos (Jira)


 [ 
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)