You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Christopher Smith (Jira)" <ji...@apache.org> on 2020/12/01 23:07:00 UTC

[jira] [Created] (GROOVY-9844) STC infers too-narrow bounds for inline map

Christopher Smith created GROOVY-9844:
-----------------------------------------

             Summary: STC infers too-narrow bounds for inline map
                 Key: GROOVY-9844
                 URL: https://issues.apache.org/jira/browse/GROOVY-9844
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
    Affects Versions: 3.0.6
            Reporter: Christopher Smith


I thought this had been resolved, but I just ran into it again.

The static type checker always infers the strictest possible generic bounds for an inline map.

{code:groovy}
void consume(Map<String, Object> map) {}

void run() {
  consume([key: 'value']) // compilation fails
}
{code}

{code}
Cannot call example#consume(java.util.Map <java.lang.String, java.lang.Object>) with arguments [java.util.LinkedHashMap <java.lang.String, java.lang.String>]
{code}



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