[ 
https://issues.apache.org/jira/browse/GROOVY-11087?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18149210#comment-18149210
 ] 

Daniel Sun commented on GROOVY-11087:
-------------------------------------

Fixed on master; added a regression test in 
1f8a006ae366696cb676139740f6dace5b91a0d8 
(https://github.com/apache/groovy/commit/1f8a006ae366696cb676139740f6dace5b91a0d8).

> 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