You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2017/10/20 10:20:54 UTC
groovy git commit: some unmoved files from a previous merge
Repository: groovy
Updated Branches:
refs/heads/GROOVY_2_6_X ea540d777 -> 109d7a5c9
some unmoved files from a previous merge
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/109d7a5c
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/109d7a5c
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/109d7a5c
Branch: refs/heads/GROOVY_2_6_X
Commit: 109d7a5c99710c9bff1e0278abdd99e53d454561
Parents: ea540d7
Author: paulk <pa...@asert.com.au>
Authored: Fri Oct 20 20:20:43 2017 +1000
Committer: paulk <pa...@asert.com.au>
Committed: Fri Oct 20 20:20:43 2017 +1000
----------------------------------------------------------------------
.../test/resources/core/Lambda_01x_1_7.groovy | 37 -------------
.../core/MethodReference_01x_1_7.groovy | 57 --------------------
.../test/resources/core/Lambda_01x_1_7.groovy | 37 +++++++++++++
.../core/MethodReference_01x_1_7.groovy | 57 ++++++++++++++++++++
4 files changed, 94 insertions(+), 94 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/109d7a5c/subprojects/groovy-parser-antlr4/src/test/resources/core/Lambda_01x_1_7.groovy
----------------------------------------------------------------------
diff --git a/subprojects/groovy-parser-antlr4/src/test/resources/core/Lambda_01x_1_7.groovy b/subprojects/groovy-parser-antlr4/src/test/resources/core/Lambda_01x_1_7.groovy
deleted file mode 100644
index 5df9858..0000000
--- a/subprojects/groovy-parser-antlr4/src/test/resources/core/Lambda_01x_1_7.groovy
+++ /dev/null
@@ -1,37 +0,0 @@
-assert 32 == ((e) -> e + 1)(2) + ((e, f) -> e + f)(2, 3) + ((e, f, g) -> e * f * g)(2, 3, 4)
-
-assert 24 == ((e, f, g) -> {e * f * g})(2, 3, 4)
-assert 24 == ((int e, int f, int g) -> {
- int tmpE = e;
- int tmpF = f;
- int tmpG = g;
- return tmpE * tmpF * tmpG;
-})(2, 3, 4)
-assert 24 == ((int e, int f, int g=4) -> {
- int tmpE = e;
- int tmpF = f;
- int tmpG = g;
- return tmpE * tmpF * tmpG;
-})(2, 3)
-
-def list = [2, 3, 1]
-Collections.sort(list, (n1, n2) -> n1 <=> n2)
-assert [1, 2, 3] == list
-
-assert 1 == (e -> e)(1)
-assert 2 == (() -> 2)()
-
-def lambda = e -> e;
-assert 1 == lambda(1)
-
-lambda = e -> e + 1;
-assert 2 == lambda(1)
-
-def c = { (e) -> e * 2 }
-assert 6 == c()(3)
-
-c = { (e) -> { e * 2 } }
-assert 6 == c()(3)
-
-
-
http://git-wip-us.apache.org/repos/asf/groovy/blob/109d7a5c/subprojects/groovy-parser-antlr4/src/test/resources/core/MethodReference_01x_1_7.groovy
----------------------------------------------------------------------
diff --git a/subprojects/groovy-parser-antlr4/src/test/resources/core/MethodReference_01x_1_7.groovy b/subprojects/groovy-parser-antlr4/src/test/resources/core/MethodReference_01x_1_7.groovy
deleted file mode 100644
index 25d5b1f..0000000
--- a/subprojects/groovy-parser-antlr4/src/test/resources/core/MethodReference_01x_1_7.groovy
+++ /dev/null
@@ -1,57 +0,0 @@
-
-def robot = new Robot();
-
-// ----------------------------------
-class BasePerson {
- public static String getText(Person p) {
- return p.name;
- }
-}
-
-class Person extends BasePerson {
- private String name;
-
- public Person(String name) {
- this.name = name
- }
-
- public String getName() {
- return this.name;
- }
-
-}
-class Robot {
- public String greet(Person p) {
- return "Hi, ${p.name}"
- }
-
- public static char firstCharOfName(Person p) {
- return p.getName().charAt(0);
- }
-}
-
-def mr = String::toUpperCase
-assert 'ABC' == mr('abc')
-assert 'ABC' == String::toUpperCase('abc')
-
-assert new HashSet() == HashSet::new()
-assert new String() == String::new()
-assert 1 == Integer::new(1)
-assert new String[0] == String[]::new(0)
-assert new String[0] == String[]::new('0')
-assert new String[1][2] == String[][]::new(1, 2)
-assert new String[1][2][3] == String[][][]::new(1, 2, 3)
-
-
-def a = String[][]::new(1, 2)
-def b = new String[1][2]
-assert a.class == b.class && a == b
-
-a = String[][][]::new(1, 2)
-b = new String[1][2][]
-assert a.class == b.class && a == b
-
-a = String[][][][]::new(1, 2)
-b = new String[1][2][][]
-assert a.class == b.class && a == b
-
http://git-wip-us.apache.org/repos/asf/groovy/blob/109d7a5c/subprojects/parser-antlr4/src/test/resources/core/Lambda_01x_1_7.groovy
----------------------------------------------------------------------
diff --git a/subprojects/parser-antlr4/src/test/resources/core/Lambda_01x_1_7.groovy b/subprojects/parser-antlr4/src/test/resources/core/Lambda_01x_1_7.groovy
new file mode 100644
index 0000000..5df9858
--- /dev/null
+++ b/subprojects/parser-antlr4/src/test/resources/core/Lambda_01x_1_7.groovy
@@ -0,0 +1,37 @@
+assert 32 == ((e) -> e + 1)(2) + ((e, f) -> e + f)(2, 3) + ((e, f, g) -> e * f * g)(2, 3, 4)
+
+assert 24 == ((e, f, g) -> {e * f * g})(2, 3, 4)
+assert 24 == ((int e, int f, int g) -> {
+ int tmpE = e;
+ int tmpF = f;
+ int tmpG = g;
+ return tmpE * tmpF * tmpG;
+})(2, 3, 4)
+assert 24 == ((int e, int f, int g=4) -> {
+ int tmpE = e;
+ int tmpF = f;
+ int tmpG = g;
+ return tmpE * tmpF * tmpG;
+})(2, 3)
+
+def list = [2, 3, 1]
+Collections.sort(list, (n1, n2) -> n1 <=> n2)
+assert [1, 2, 3] == list
+
+assert 1 == (e -> e)(1)
+assert 2 == (() -> 2)()
+
+def lambda = e -> e;
+assert 1 == lambda(1)
+
+lambda = e -> e + 1;
+assert 2 == lambda(1)
+
+def c = { (e) -> e * 2 }
+assert 6 == c()(3)
+
+c = { (e) -> { e * 2 } }
+assert 6 == c()(3)
+
+
+
http://git-wip-us.apache.org/repos/asf/groovy/blob/109d7a5c/subprojects/parser-antlr4/src/test/resources/core/MethodReference_01x_1_7.groovy
----------------------------------------------------------------------
diff --git a/subprojects/parser-antlr4/src/test/resources/core/MethodReference_01x_1_7.groovy b/subprojects/parser-antlr4/src/test/resources/core/MethodReference_01x_1_7.groovy
new file mode 100644
index 0000000..25d5b1f
--- /dev/null
+++ b/subprojects/parser-antlr4/src/test/resources/core/MethodReference_01x_1_7.groovy
@@ -0,0 +1,57 @@
+
+def robot = new Robot();
+
+// ----------------------------------
+class BasePerson {
+ public static String getText(Person p) {
+ return p.name;
+ }
+}
+
+class Person extends BasePerson {
+ private String name;
+
+ public Person(String name) {
+ this.name = name
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+}
+class Robot {
+ public String greet(Person p) {
+ return "Hi, ${p.name}"
+ }
+
+ public static char firstCharOfName(Person p) {
+ return p.getName().charAt(0);
+ }
+}
+
+def mr = String::toUpperCase
+assert 'ABC' == mr('abc')
+assert 'ABC' == String::toUpperCase('abc')
+
+assert new HashSet() == HashSet::new()
+assert new String() == String::new()
+assert 1 == Integer::new(1)
+assert new String[0] == String[]::new(0)
+assert new String[0] == String[]::new('0')
+assert new String[1][2] == String[][]::new(1, 2)
+assert new String[1][2][3] == String[][][]::new(1, 2, 3)
+
+
+def a = String[][]::new(1, 2)
+def b = new String[1][2]
+assert a.class == b.class && a == b
+
+a = String[][][]::new(1, 2)
+b = new String[1][2][]
+assert a.class == b.class && a == b
+
+a = String[][][][]::new(1, 2)
+b = new String[1][2][][]
+assert a.class == b.class && a == b
+