Konstantin Nisht created GROOVY-10006:
-----------------------------------------

             Summary: @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



{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)

Reply via email to