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 25919b0c40 GROOVY-10589: add test cases
25919b0c40 is described below
commit 25919b0c405505a452a3bf038af2f95d43ef450d
Author: Eric Milles <[email protected]>
AuthorDate: Wed Apr 20 10:51:35 2022 -0500
GROOVY-10589: add test cases
---
.../groovy/transform/stc/GenericsSTCTest.groovy | 25 +++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/src/test/groovy/transform/stc/GenericsSTCTest.groovy
b/src/test/groovy/transform/stc/GenericsSTCTest.groovy
index 021cba68fb..0750e61810 100644
--- a/src/test/groovy/transform/stc/GenericsSTCTest.groovy
+++ b/src/test/groovy/transform/stc/GenericsSTCTest.groovy
@@ -521,7 +521,7 @@ class GenericsSTCTest extends StaticTypeCheckingTestCase {
// GROOVY-8638
void testReturnTypeInferenceWithMethodGenerics18() {
assertScript '''
- @Grab('com.google.guava:guava:30.1.1-jre')
+ @Grab('com.google.guava:guava:31.1-jre')
import com.google.common.collect.*
ListMultimap<String, Integer> mmap = ArrayListMultimap.create()
@@ -639,6 +639,29 @@ class GenericsSTCTest extends StaticTypeCheckingTestCase {
'''
}
+ // GROOVY-10589
+ void testReturnTypeInferenceWithMethodGenerics25() {
+ String pogo = '''
+ @groovy.transform.TupleConstructor
+ class Pogo {
+ final java.time.Instant timestamp
+ }
+ List<Pogo> pogos = []
+ '''
+ assertScript pogo + '''
+ Comparator<Pogo> cmp = { Pogo a, Pogo b -> a.timestamp <=>
b.timestamp }
+ pogos = pogos.sort(false, cmp)
+ '''
+ assertScript pogo + '''
+ pogos = pogos.sort(false) { Pogo a, Pogo b ->
+ a.timestamp <=> b.timestamp
+ }
+ '''
+ assertScript pogo + '''
+ pogos = pogos.sort(false) { it.timestamp }
+ '''
+ }
+
void testDiamondInferrenceFromConstructor1() {
assertScript '''
class Foo<U> {