This is an automated email from the ASF dual-hosted git repository.
emilles pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/GROOVY_3_0_X by this push:
new b18592e504 GROOVY-8409, GROOVY-9915, GROOVY-10725: STC: resolve
varargs placeholder
b18592e504 is described below
commit b18592e504d95b7fad443e5bfa2c1d06f0c74687
Author: Eric Milles <[email protected]>
AuthorDate: Sat Aug 20 09:26:29 2022 -0500
GROOVY-8409, GROOVY-9915, GROOVY-10725: STC: resolve varargs placeholder
---
.../groovy/transform/stc/StaticTypeCheckingVisitor.java | 5 ++++-
src/test/groovy/transform/stc/GenericsSTCTest.groovy | 12 +++++++++++-
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git
a/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
b/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
index 7bf168fae1..58a0770f87 100644
---
a/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
+++
b/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
@@ -5376,7 +5376,10 @@ public class StaticTypeCheckingVisitor extends
ClassCodeVisitorSupport {
// and unknown generics
if (!GenericsUtils.hasUnresolvedGenerics(at)) continue;
- while (!at.equals(pt) && !at.equals(OBJECT_TYPE)) {
+ while (!at.equals(pt)
+ && !at.equals(OBJECT_TYPE)
+ && !isGenericsPlaceHolderOrArrayOf(at)
+ && !isGenericsPlaceHolderOrArrayOf(pt)) {
ClassNode sc = GenericsUtils.getSuperClass(at, pt);
at =
applyGenericsContext(GenericsUtils.extractPlaceholders(at), sc);
}
diff --git a/src/test/groovy/transform/stc/GenericsSTCTest.groovy
b/src/test/groovy/transform/stc/GenericsSTCTest.groovy
index 95ff8fc135..c2af8d8d31 100644
--- a/src/test/groovy/transform/stc/GenericsSTCTest.groovy
+++ b/src/test/groovy/transform/stc/GenericsSTCTest.groovy
@@ -2228,7 +2228,7 @@ class GenericsSTCTest extends StaticTypeCheckingTestCase {
'''
}
- @NotYetImplemented // GROOVY-8409, GROOVY-9915
+ // GROOVY-8409, GROOVY-9915
void testShouldUseMethodGenericType10() {
assertScript '''
interface OngoingStubbing<T> /*extends IOngoingStubbing*/ {
@@ -2370,6 +2370,16 @@ class GenericsSTCTest extends StaticTypeCheckingTestCase
{
'''
}
+ // GROOVY-10725
+ void testShouldUseMethodGenericType17() {
+ assertScript '''
+ List<String> list = ['foo','bar']
+ Set<Map<String,String>> set_of_maps = []
+ set_of_maps.addAll(list.collectEntries { [it, it.toUpperCase()] })
+ assert set_of_maps.first() == [foo: 'FOO', bar: 'BAR']
+ '''
+ }
+
// GROOVY-5516
void testAddAllWithCollectionShouldBeAllowed() {
assertScript '''import
org.codehaus.groovy.transform.stc.ExtensionMethodNode