Skip to content
Permalink
Browse files
GROOVY-10589: add test cases
  • Loading branch information
eric-milles committed Apr 20, 2022
1 parent d9a646b commit 25919b0c405505a452a3bf038af2f95d43ef450d
Showing 1 changed file with 24 additions and 1 deletion.
@@ -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> {

0 comments on commit 25919b0

Please sign in to comment.