You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2021/04/11 15:48:00 UTC

[jira] [Resolved] (GROOVY-10006) @CompileStatic fails to unify types

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

Eric Milles resolved GROOVY-10006.
----------------------------------
    Fix Version/s: 4.0.0-alpha-3
       Resolution: Fixed

> @CompileStatic fails to unify types
> -----------------------------------
>
>                 Key: GROOVY-10006
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10006
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation, Static Type Checker
>    Affects Versions: 3.0.6
>            Reporter: Konstantin Nisht
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 4.0.0-alpha-3
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> {code:groovy}
> @CompileStatic
> class A {
>     static <U> void foo(U a, U b) {}
>     static void main(String[] args) {
>         foo(1, "")
>     }
> }
> {code}
> The following code fails to compile with error
> {{Groovyc: [Static type checking] - Cannot call <U> A#foo(U, U) with arguments [int, java.lang.String]}}
>  {{U}} should be inferred to LUB(Integer, String), hence the call should be successful.



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