Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
STC reports false error on spreadMap operation:
@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()