You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by em...@apache.org on 2023/06/06 13:38:07 UTC

[groovy] branch GROOVY_4_0_X updated: GROOVY-11080: add test case

This is an automated email from the ASF dual-hosted git repository.

emilles pushed a commit to branch GROOVY_4_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/GROOVY_4_0_X by this push:
     new 77024ea1c1 GROOVY-11080: add test case
77024ea1c1 is described below

commit 77024ea1c171ebb6d5b2eb7d3878cf35d6e87120
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Tue Jun 6 08:37:50 2023 -0500

    GROOVY-11080: add test case
---
 .../groovy/transform/stc/ArraysAndCollectionsSTCTest.groovy   | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/test/groovy/transform/stc/ArraysAndCollectionsSTCTest.groovy b/src/test/groovy/transform/stc/ArraysAndCollectionsSTCTest.groovy
index f317fa19d6..297ae34a62 100644
--- a/src/test/groovy/transform/stc/ArraysAndCollectionsSTCTest.groovy
+++ b/src/test/groovy/transform/stc/ArraysAndCollectionsSTCTest.groovy
@@ -1105,7 +1105,7 @@ class ArraysAndCollectionsSTCTest extends StaticTypeCheckingTestCase {
         'Cannot assign value of type groovy.lang.ListWithDefault<java.lang.Integer> to variable of type java.util.Set<java.lang.Integer>'
     }
 
-    // GROOVY-8001, GROOVY-11028
+    // GROOVY-8001, GROOVY-11028, GROOVY-11080
     void testMapWithTypeArgumentsInitializedByMapLiteral() {
         for (spec in ['CharSequence,Integer', 'String,Number', 'CharSequence,Number']) {
             assertScript """
@@ -1116,6 +1116,13 @@ class ArraysAndCollectionsSTCTest extends StaticTypeCheckingTestCase {
             """
         }
 
+        assertScript '''
+            Map<String,Map<String,Object>> map = [:]
+            map.put('foo', [bar:null])
+            map.put('baz', [:])
+            assert 'foo' in map
+        '''
+
         assertScript '''
             class C {
                 Map<String,Object> map
@@ -1124,6 +1131,8 @@ class ArraysAndCollectionsSTCTest extends StaticTypeCheckingTestCase {
             def c = new C()
             c.map = [key:"$value"]
             assert c.map['key'] == '42'
+            c = new C(map: [key:value])
+            assert c.map.key.toString() == '42'
         '''
 
         assertScript '''