groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject groovy git commit: Add test for "GROOVY-8138: Compile static to support streams"
Date Mon, 07 May 2018 01:45:20 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_6_X fff408344 -> 5d42668e3


Add test for "GROOVY-8138: Compile static to support streams"


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/5d42668e
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/5d42668e
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/5d42668e

Branch: refs/heads/GROOVY_2_6_X
Commit: 5d42668e37667c2cc396df85164da73ab0d366d9
Parents: fff4083
Author: sunlan <sunlan@apache.org>
Authored: Mon May 7 09:45:15 2018 +0800
Committer: sunlan <sunlan@apache.org>
Committed: Mon May 7 09:45:15 2018 +0800

----------------------------------------------------------------------
 .../transform/stc/MethodCallsSTCTest.groovy      | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/5d42668e/src/test/groovy/transform/stc/MethodCallsSTCTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/groovy/transform/stc/MethodCallsSTCTest.groovy b/src/test/groovy/transform/stc/MethodCallsSTCTest.groovy
index 2df0685..d3447f1 100644
--- a/src/test/groovy/transform/stc/MethodCallsSTCTest.groovy
+++ b/src/test/groovy/transform/stc/MethodCallsSTCTest.groovy
@@ -1276,6 +1276,25 @@ class MethodCallsSTCTest extends StaticTypeCheckingTestCase {
         '''
     }
 
+    // GROOVY-8138
+    void testGroovy8138() {
+        if (IS_PRE_8) return
+
+        assertScript '''
+        import groovy.transform.CompileStatic
+        
+        import static java.util.stream.Collectors.toList
+        
+        @CompileStatic
+        class Test {
+            static void main(String[] args) {
+                List<String> tables = ['a', 'b']
+                assert ['a'] == tables.stream().filter { tableName -> tableName.contains('a')
}.collect(toList())
+            }
+        }
+        '''
+    }
+
     static class MyMethodCallTestClass {
 
         static int mul(int... args) { args.toList().inject(1) { x,y -> x*y } }


Mime
View raw message