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 2022/05/15 16:45:13 UTC
[groovy] 01/02: GROOVY-10589: add test cases
This is an automated email from the ASF dual-hosted git repository.
emilles pushed a commit to branch GROOVY_4_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit c761918565163c1036e7fa6aa6fea24b04f9a1a9
Author: Eric Milles <er...@thomsonreuters.com>
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 b75cd3fc32..1af2b449a4 100644
--- a/src/test/groovy/transform/stc/GenericsSTCTest.groovy
+++ b/src/test/groovy/transform/stc/GenericsSTCTest.groovy
@@ -493,7 +493,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()
@@ -611,6 +611,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> {