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/03/31 01:11:00 UTC

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

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

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

> 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
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 4.0.0-alpha-3
>
>
> {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
(v8.3.4#803005)