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

Daniel Sun resolved GROOVY-11087.
---------------------------------
    Resolution: Fixed

> 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
>            Assignee: Daniel Sun
>            Priority: Minor
>             Fix For: 7.0.0-alpha-1
>
>
> 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
(v10.3.26#10030026)

Reply via email to