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 2023/04/27 18:00:00 UTC
[jira] [Updated] (GROOVY-11028) STC: empty map or list literal does not type check like emptyMap()
[ https://issues.apache.org/jira/browse/GROOVY-11028?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles updated GROOVY-11028:
---------------------------------
Summary: STC: empty map or list literal does not type check like emptyMap() (was: STC: empty map or list literal does not type check like Collections.emptyMap())
> STC: empty map or list literal does not type check like emptyMap()
> ------------------------------------------------------------------
>
> Key: GROOVY-11028
> URL: https://issues.apache.org/jira/browse/GROOVY-11028
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Reporter: Eric Milles
> Assignee: Eric Milles
> Priority: Major
>
> Consider the following:
> {code:groovy}
> @groovy.transform.TypeChecked
> void test() {
> List<Integer> list = [].withDefault { 0 }
> // Cannot assign ListWithDefault<? extends Object> to List<Integer>
> Map<String,Integer> map = [:].withDefault { 1 }
> // Cannot assign Map<Object, ? extends Object> to Map<String, Integer>
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)