[jira] [Updated] (GROOVY-10080) Closure with type argument inference does not work as expected

2023-11-30 Thread Eric Milles (Jira)


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

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

> Closure with type argument inference does not work as expected
> --
>
> Key: GROOVY-10080
> URL: https://issues.apache.org/jira/browse/GROOVY-10080
> Project: Groovy
>  Issue Type: Bug
>  Components: Static compilation, Static Type Checker
>Reporter: Stefanos Chaliasos
>Assignee: Eric Milles
>Priority: Major
> Fix For: 4.0.0-beta-1, 3.0.20
>
>
> I have the following Groovy program.
> {code:groovy}
> @groovy.transform.CompileStatic
> public class Main {
>   public static void main(String[] args) {
> def closure = {
>   new Bar<>(new Foo());
> }
> closure().f.m(new BigDecimal[0]) // this doesn't work
> // the following works
> // Bar> x = closure()
> // x.f.m(new BigDecimal[0]);
>   }
> }
> class Foo {
>   void m(Object[] x) {}
> }
> class Bar {
>   X f;
>   Bar(X f) {
> this.f = f;
>   }
> }
> class Baz {}
> {code}
> h2. Actual Behavior
> The program does not compile, and I get the following error.
> {code:java}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
> failed:
> Main.groovy: 7: [Static type checking] - Cannot find matching method 
> java.lang.Object#m(java.math.BigDecimal[]). Please check if the declared type 
> is correct and if the method exists.
>  @ line 7, column 5.
>closure().f.m(new BigDecimal[0]) 
>^
> 1 error
> {code}
> h2. Expected Behavior
> Compile successfully.
> h2. Affected Version
> This programs fails when compiled with the compiler from the master (commit: 
> a8023b1b0d1d79800677ce2b4665ee3fb14688f4) and with 4.0.0-alpha-2.



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


[jira] [Updated] (GROOVY-10080) Closure with type argument inference does not work as expected

2021-06-08 Thread Stefanos Chaliasos (Jira)


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

Stefanos Chaliasos updated GROOVY-10080:

Component/s: Static Type Checker
 Static compilation

> Closure with type argument inference does not work as expected
> --
>
> Key: GROOVY-10080
> URL: https://issues.apache.org/jira/browse/GROOVY-10080
> Project: Groovy
>  Issue Type: Bug
>  Components: Static compilation, Static Type Checker
>Reporter: Stefanos Chaliasos
>Assignee: Eric Milles
>Priority: Major
> Fix For: 4.0.0-beta-1
>
>
> I have the following Groovy program.
> {code:groovy}
> @groovy.transform.CompileStatic
> public class Main {
>   public static void main(String[] args) {
> def closure = {
>   new Bar<>(new Foo());
> }
> closure().f.m(new BigDecimal[0]) // this doesn't work
> // the following works
> // Bar> x = closure()
> // x.f.m(new BigDecimal[0]);
>   }
> }
> class Foo {
>   void m(Object[] x) {}
> }
> class Bar {
>   X f;
>   Bar(X f) {
> this.f = f;
>   }
> }
> class Baz {}
> {code}
> h2. Actual Behavior
> The program does not compile, and I get the following error.
> {code:java}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
> failed:
> Main.groovy: 7: [Static type checking] - Cannot find matching method 
> java.lang.Object#m(java.math.BigDecimal[]). Please check if the declared type 
> is correct and if the method exists.
>  @ line 7, column 5.
>closure().f.m(new BigDecimal[0]) 
>^
> 1 error
> {code}
> h2. Expected Behavior
> Compile successfully.
> h2. Affected Version
> This programs fails when compiled with the compiler from the master (commit: 
> a8023b1b0d1d79800677ce2b4665ee3fb14688f4) and with 4.0.0-alpha-2.



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


[jira] [Updated] (GROOVY-10080) Closure with type argument inference does not work as expected

2021-05-11 Thread Stefanos Chaliasos (Jira)


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

Stefanos Chaliasos updated GROOVY-10080:

Description: 
I have the following Groovy program.
{code:groovy}
@groovy.transform.CompileStatic
public class Main {
  public static void main(String[] args) {
def closure = {
  new Bar<>(new Foo());
}
closure().f.m(new BigDecimal[0]) // this doesn't work
// the following works
// Bar> x = closure()
// x.f.m(new BigDecimal[0]);
  }
}

class Foo {
  void m(Object[] x) {}
}


class Bar {
  X f;

  Bar(X f) {
this.f = f;
  }
}

class Baz {}

{code}

h2. Actual Behavior

The program does not compile, and I get the following error.
{code:java}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Main.groovy: 7: [Static type checking] - Cannot find matching method 
java.lang.Object#m(java.math.BigDecimal[]). Please check if the declared type 
is correct and if the method exists.
 @ line 7, column 5.
   closure().f.m(new BigDecimal[0]) 
   ^

1 error

{code}
h2. Expected Behavior

Compile successfully.

h2. Affected Version

This programs fails when compiled with the compiler from the master (commit: 
a8023b1b0d1d79800677ce2b4665ee3fb14688f4) and with 4.0.0-alpha-2.

  was:
I have the following Groovy program.
{code:groovy}
@groovy.transform.CompileStatic
public class Main {
  public static void main(String[] args) {
def closure = {
  new Bar<>(new Foo());
}
closure().f.m(new BigDecimal[0]) // this doesn't work
// the following works
// Bar> x = closure()
// x.f.m(new BigDecimal[0]);
  }
}

class Foo {
  void m(Object[] x) {}
}


class Bar {
  X f;

  Bar(X f) {
this.f = f;
  }
}

class Baz {}

{code}

h2. Actual Behavior

The program does not compile, and I get the following error.
{code:java}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Main.groovy: 7: [Static type checking] - Cannot find matching method 
java.lang.Object#m(java.math.BigDecimal[]). Please check if the declared type 
is correct and if the method exists.
 @ line 7, column 5.
   closure().f.m(new BigDecimal[0]) // this doesn't work
   ^

1 error

{code}
h2. Expected Behavior

Compile successfully.

h2. Affected Version

This programs fails when compiled with the compiler from the master (commit: 
a8023b1b0d1d79800677ce2b4665ee3fb14688f4) and with 4.0.0-alpha-2.


> Closure with type argument inference does not work as expected
> --
>
> Key: GROOVY-10080
> URL: https://issues.apache.org/jira/browse/GROOVY-10080
> Project: Groovy
>  Issue Type: Bug
>Reporter: Stefanos Chaliasos
>Priority: Major
>
> I have the following Groovy program.
> {code:groovy}
> @groovy.transform.CompileStatic
> public class Main {
>   public static void main(String[] args) {
> def closure = {
>   new Bar<>(new Foo());
> }
> closure().f.m(new BigDecimal[0]) // this doesn't work
> // the following works
> // Bar> x = closure()
> // x.f.m(new BigDecimal[0]);
>   }
> }
> class Foo {
>   void m(Object[] x) {}
> }
> class Bar {
>   X f;
>   Bar(X f) {
> this.f = f;
>   }
> }
> class Baz {}
> {code}
> h2. Actual Behavior
> The program does not compile, and I get the following error.
> {code:java}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
> failed:
> Main.groovy: 7: [Static type checking] - Cannot find matching method 
> java.lang.Object#m(java.math.BigDecimal[]). Please check if the declared type 
> is correct and if the method exists.
>  @ line 7, column 5.
>closure().f.m(new BigDecimal[0]) 
>^
> 1 error
> {code}
> h2. Expected Behavior
> Compile successfully.
> h2. Affected Version
> This programs fails when compiled with the compiler from the master (commit: 
> a8023b1b0d1d79800677ce2b4665ee3fb14688f4) and with 4.0.0-alpha-2.



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