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 2017/04/07 13:30:45 UTC

[02/50] [abbrv] groovy git commit: fix groovy7797 - assign correct receiver in closure

fix groovy7797 - assign correct receiver in closure


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

Branch: refs/heads/parrot
Commit: 1ed615a2a770d7539c8a62d198a7d432ba5050f1
Parents: 5d3f747
Author: zhangbo <zh...@nanchao.org>
Authored: Wed Nov 2 13:33:32 2016 +0800
Committer: paulk <pa...@asert.com.au>
Committed: Thu Mar 2 18:59:12 2017 +1000

----------------------------------------------------------------------
 src/test/groovy/bugs/Groovy7797Bug.groovy | 38 ++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/1ed615a2/src/test/groovy/bugs/Groovy7797Bug.groovy
----------------------------------------------------------------------
diff --git a/src/test/groovy/bugs/Groovy7797Bug.groovy b/src/test/groovy/bugs/Groovy7797Bug.groovy
new file mode 100644
index 0000000..892b6eb
--- /dev/null
+++ b/src/test/groovy/bugs/Groovy7797Bug.groovy
@@ -0,0 +1,38 @@
+/*
+ *  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 Groovy7797Bug extends GroovyTestCase {
+    void test() {
+        new GroovyShell().evaluate('''
+trait MyTrait {
+    void greeter() {
+        { ->doGreeting("hi") }.call()
+        //doGreeting("hi")
+    }
+
+    private void doGreeting(String message) { println message }
+}
+
+class MyClass implements MyTrait {}
+new MyClass().greeter()
+''')
+    }
+}
+