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/05/18 10:13:15 UTC
groovy git commit: Add a test for "GROOVY-7031: @CompileStatic breaks
assign in combination with dereferencing"
Repository: groovy
Updated Branches:
refs/heads/master c2cea059f -> 42aa69f74
Add a test for "GROOVY-7031: @CompileStatic breaks assign in combination with dereferencing"
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/42aa69f7
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/42aa69f7
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/42aa69f7
Branch: refs/heads/master
Commit: 42aa69f7467c26edbac3fe623b13c24a6adf9a1b
Parents: c2cea05
Author: sunlan <su...@apache.org>
Authored: Fri May 18 18:12:57 2018 +0800
Committer: sunlan <su...@apache.org>
Committed: Fri May 18 18:13:11 2018 +0800
----------------------------------------------------------------------
src/test/groovy/bugs/Groovy7031Bug.groovy | 44 ++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/42aa69f7/src/test/groovy/bugs/Groovy7031Bug.groovy
----------------------------------------------------------------------
diff --git a/src/test/groovy/bugs/Groovy7031Bug.groovy b/src/test/groovy/bugs/Groovy7031Bug.groovy
new file mode 100644
index 0000000..3bb4750
--- /dev/null
+++ b/src/test/groovy/bugs/Groovy7031Bug.groovy
@@ -0,0 +1,44 @@
+/*
+ * 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
+
+class Groovy7031Bug extends GroovyTestCase {
+
+ void test() {
+ assertScript """
+ @groovy.transform.CompileStatic
+ class StaticClass {
+ StringHolder holder = new StringHolder()
+ String str
+
+ StaticClass(String s) {
+ str = holder.str = s
+ }
+ }
+
+ class StringHolder {
+ String str
+ }
+
+ def s = new StaticClass('test')
+ assert s.holder.str == 'test'
+ assert s.str == 'test'
+ """
+ }
+}