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

Eric Milles resolved GROOVY-11259.
----------------------------------
    Fix Version/s: 4.0.18
       Resolution: Fixed

https://github.com/apache/groovy/commit/1ef88006afc5a3e8589a6abd4e4b1087e9e5e8a8

> STC loses generic information on method references
> --------------------------------------------------
>
>                 Key: GROOVY-11259
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11259
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>    Affects Versions: 4.0.17
>            Reporter: Christopher Smith
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 4.0.18, 3.0.21
>
>
> In the following code, the correct return type of {{Map.Entry::getKey}} is 
> {{K = String}}, but the STC loses track of it and returns {{Object}}, leading 
> to downstream type mismatches.
> {code:groovy}
> @CompileStatic
> class Repro {
>     void repro(Map<String, String> input) {
>         var keys = input.entrySet().stream()
>             .map(Map.Entry::getKey)
>             .toSet()
>         consume(keys)
>     }
>     static void consume(Set<String> keys) {}
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to