Thodoris Sotiropoulos created GROOVY-11087:
----------------------------------------------

             Summary: Local variable inference leads to incorrect type when 
having a complex parameterized type
                 Key: GROOVY-11087
                 URL: https://issues.apache.org/jira/browse/GROOVY-11087
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
            Reporter: Thodoris Sotiropoulos


I have the following program

{code}
class Main {
  static final void test() {
    Class<Class<Number>> d = null;
    var x = d.cast("");
    m(x);
  }

  static void m(Class<?> x) {}
}
{code}

h3. Actual behaviour

{code}
Main.groovy: 5: [Static type checking] - Cannot find matching method 
Main#m(java.lang.Number). Please check if the declared type is correct and if 
the method exists.
 @ line 5, column 5.
       m(x);
       ^

1 error
{code}

h3. Expected behaviour

Compile successfully

h3. Notes

Tested against master (commit: b71df4a88afa4f82d9db3dd7938a3db3090bdf55).

The error occurs only when you pass variable x as argument to a method call.



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

Reply via email to