You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2018/08/24 19:52:35 UTC
groovy git commit: Add a test for GROOVY-8084
Repository: groovy
Updated Branches:
refs/heads/GROOVY_2_5_X acfdf6bb4 -> 2a704b5a2
Add a test for GROOVY-8084
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/2a704b5a
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/2a704b5a
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/2a704b5a
Branch: refs/heads/GROOVY_2_5_X
Commit: 2a704b5a2814a9f4e242bc5775d53eacf059edf9
Parents: acfdf6b
Author: Daniel Sun <su...@apache.org>
Authored: Sat Aug 25 03:50:16 2018 +0800
Committer: Daniel Sun <su...@apache.org>
Committed: Sat Aug 25 03:50:41 2018 +0800
----------------------------------------------------------------------
src/test/groovy/bugs/Groovy6271Bug.groovy | 2 +-
src/test/groovy/bugs/Groovy8084Bug.groovy | 39 ++++++++++++++++++++++++++
2 files changed, 40 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/2a704b5a/src/test/groovy/bugs/Groovy6271Bug.groovy
----------------------------------------------------------------------
diff --git a/src/test/groovy/bugs/Groovy6271Bug.groovy b/src/test/groovy/bugs/Groovy6271Bug.groovy
index e0ba0dd..8d6131d 100644
--- a/src/test/groovy/bugs/Groovy6271Bug.groovy
+++ b/src/test/groovy/bugs/Groovy6271Bug.groovy
@@ -38,7 +38,7 @@ TestScripttestTraitWithCompileStaticAndCoercedClosure0.groovy: 33: [Static type
2 errors
*/
@NotYetImplemented
- void testTraitWithCompileStaticAndCoercedClosure() {
+ void testGroovy6271Bug() {
shouldCompile '''
@Grab('org.functionaljava:functionaljava:3.1')
import static fj.data.hlist.HList.HCons;
http://git-wip-us.apache.org/repos/asf/groovy/blob/2a704b5a/src/test/groovy/bugs/Groovy8084Bug.groovy
----------------------------------------------------------------------
diff --git a/src/test/groovy/bugs/Groovy8084Bug.groovy b/src/test/groovy/bugs/Groovy8084Bug.groovy
new file mode 100644
index 0000000..db92df8
--- /dev/null
+++ b/src/test/groovy/bugs/Groovy8084Bug.groovy
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package groovy.bugs
+
+import gls.CompilableTestSupport
+import groovy.transform.NotYetImplemented
+
+class Groovy8084Bug extends CompilableTestSupport {
+ // TODO REFINE ME
+ void testGroovy8084Bug() {
+ assertScript '''
+ import groovy.transform.CompileStatic
+
+ @CompileStatic
+ static def method(List<? extends Serializable> captured) {
+ captured.add('some string') // though the test passes now, but I expect a STC error here because of adding an element to a producer, which is not allowed in Java
+ return captured
+ }
+
+ println method(new ArrayList<Integer>())
+ '''
+ }
+}