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 2020/02/12 17:39:34 UTC

[groovy] branch master updated: GROOVY-7304: separate direct access and indirect (extends) test cases

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

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


The following commit(s) were added to refs/heads/master by this push:
     new fbfa844  GROOVY-7304: separate direct access and indirect (extends) test cases
fbfa844 is described below

commit fbfa844d4433af3665aaee0ef7dc5b0224429528
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Wed Feb 12 11:38:01 2020 -0600

    GROOVY-7304: separate direct access and indirect (extends) test cases
---
 .../groovy/classgen/asm/sc/bugs/Groovy7276.groovy  | 89 +++++++++++++++-------
 1 file changed, 63 insertions(+), 26 deletions(-)

diff --git a/src/test/org/codehaus/groovy/classgen/asm/sc/bugs/Groovy7276.groovy b/src/test/org/codehaus/groovy/classgen/asm/sc/bugs/Groovy7276.groovy
index 1bd307d..a42177c 100644
--- a/src/test/org/codehaus/groovy/classgen/asm/sc/bugs/Groovy7276.groovy
+++ b/src/test/org/codehaus/groovy/classgen/asm/sc/bugs/Groovy7276.groovy
@@ -24,27 +24,79 @@ import org.codehaus.groovy.classgen.asm.sc.StaticCompilationTestSupport
 
 final class Groovy7276 extends StaticTypeCheckingTestCase implements StaticCompilationTestSupport {
 
-    void testShouldGoThroughPrivateBridgeAccessor() {
+    void testShouldGoThroughPrivateBridgeMethod1() {
+        ['i', 'i++'].each {
+            assertScript """
+                class Foo {
+                    private int i = 1
+                    int m() { new String().with { $it } }
+                }
+                assert new Foo().m() == 1
+            """
+        }
+    }
+
+    void testShouldGoThroughPrivateBridgeMethod2() {
+        ['i'/*, 'i++'*/].each { // GROOVY-7304
+            assertScript """
+                class Foo {
+                    private int i = 1
+                    int m() { new String().with { $it } }
+                }
+                class Bar extends Foo {
+                }
+                assert new Bar().m() == 1
+            """
+        }
+    }
+
+    void testShouldGoThroughPrivateBridgeMethod3() {
+        ['++i', 'i+=1', 'i=i+1'].each {
+            assertScript """
+                class Foo {
+                    private int i = 1
+                    int m() { new String().with { $it } }
+                }
+                assert new Foo().m() == 2
+            """
+        }
+    }
+
+    @NotYetImplemented // GROOVY-7304
+    void testShouldGoThroughPrivateBridgeMethod4() {
+        ['++i', 'i+=1', 'i=i+1'].each {
+            assertScript """
+                class Foo {
+                    private int i = 1
+                    int m() { new String().with { $it } }
+                }
+                class Bar extends Foo {
+                }
+                assert new Bar().m() == 2
+            """
+        }
+    }
+
+    void testShouldGoThroughPrivateBridgeMethod5() {
         assertScript '''
             class Foo {
-                private i = 1
-                def m() { new String().with {i}}
+                private int i = 1
+                private int pvI() { return i }
+                int m() { new String().with { pvI() } }
             }
             assert new Foo().m() == 1
-            class Bar extends Foo {}
-            assert new Bar().m() == 1
         '''
     }
 
-    void testShouldGoThroughPrivateBridgeMethod() {
+    void testShouldGoThroughPrivateBridgeMethod6() {
         assertScript '''
             class Foo {
-                private i = 1
-                private def pvI() { i }
-                def m() { new String().with {pvI()}}
+                private int i = 1
+                private int pvI() { return i }
+                int m() { new String().with { pvI() } }
+            }
+            class Bar extends Foo {
             }
-            assert new Foo().m() == 1
-            class Bar extends Foo {}
             assert new Bar().m() == 1
         '''
     }
@@ -68,19 +120,4 @@ final class Groovy7276 extends StaticTypeCheckingTestCase implements StaticCompi
             Outer.test()
         '''
     }
-
-    @NotYetImplemented // GROOVY-7304
-    void testShouldGoThroughPrivateBridgeAccessorWithWriteAccess() {
-        ['++i', 'i++', 'i+=1', 'i=i+1'].each {
-            assertScript """
-                class Foo {
-                    private int i = 1
-                    def m() { new String().with { $it } }
-                }
-                assert new Foo().m() == 2
-                class Bar extends Foo {}
-                assert new Bar().m() == 2
-            """
-        }
-    }
 }