You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniil Ovchinnikov (JIRA)" <ji...@apache.org> on 2018/12/05 11:34:00 UTC

[jira] [Created] (GROOVY-8909) List literal type inference does not take its context into account

Daniil Ovchinnikov created GROOVY-8909:
------------------------------------------

             Summary: List literal type inference does not take its context into account
                 Key: GROOVY-8909
                 URL: https://issues.apache.org/jira/browse/GROOVY-8909
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
    Affects Versions: 2.5.4
            Reporter: Daniil Ovchinnikov


{code:title=bug.groovy}
def methodAcceptingListOfObjects(List<Object> lo) {}

@groovy.transform.CompileStatic
def usage() {
    methodAcceptingListOfObjects([1, 2, 3]) 
}
{code}
Compilation fails with
{noformat}
[Static type checking] - Cannot call #methodAcceptingListOfObjects(java.util.List <java.lang.Object>) with arguments [java.util.List <java.lang.Integer>]
{noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)