[
https://issues.apache.org/jira/browse/GROOVY-7247?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles updated GROOVY-7247:
--------------------------------
Fix Version/s: 4.0.5
> spreadMap type inference is incorrect and STC reports on valid code
> -------------------------------------------------------------------
>
> Key: GROOVY-7247
> URL: https://issues.apache.org/jira/browse/GROOVY-7247
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Reporter: UEHARA Junji
> Assignee: Eric Milles
> Priority: Major
> Fix For: 4.0.5
>
>
> STC reports false error on spreadMap operation:
> {code}
> @groovy.transform.TypeChecked
> def f() {
> Map<String, Integer> map1 = [ *:[A:1], *:[B:2]] // [Static type checking]
> - Incompatible generic argument types. Cannot assign java.util.LinkedHashMap
> <java.util.Map, java.util.LinkedHashMap> to: java.util.Map <String, Integer>
> assert map1 == [A:1, B:2]
> println map1
> Map<String, Integer> submap1 = [A: 1]
> Map<String, Integer> submap2 = [B: 2]
> Map<String, Integer> map2 = [*:submap1, *:submap2] // [Static type
> checking] - Incompatible generic argument types. Cannot assign
> java.util.LinkedHashMap <java.util.Map, java.util.LinkedHashMap> to:
> java.util.Map <String, Integer>
> assert map2 == [A:1, B:2]
> println map2
> }
> f()
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)