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/09/20 17:30:36 UTC
[groovy] branch GROOVY_3_0_X updated: GROOVY-10756: STC: upper bound for unresolved placeholder
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 4a76149d68 GROOVY-10756: STC: upper bound for unresolved placeholder
4a76149d68 is described below
commit 4a76149d68c81c3b3b06bd8a8fc0c23a26578421
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Tue Sep 20 09:20:01 2022 -0500
GROOVY-10756: STC: upper bound for unresolved placeholder
---
.../org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java | 4 ++--
.../groovy/transform/stc/ClosureParamTypeInferenceSTCTest.groovy | 5 +++++
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java b/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java
index c441658693..4278f045f5 100644
--- a/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java
+++ b/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java
@@ -1333,8 +1333,8 @@ public abstract class StaticTypeCheckingSupport {
if (gt != null) {
return gt.getType();
}
- ClassNode cn = type.redirect();
- return cn != type ? cn : OBJECT_TYPE;
+ ClassNode cn = extractType(type.asGenericsType()); // GROOVY-10756
+ return cn != type ? cn : OBJECT_TYPE; // do not return placeholder
}
GenericsType[] gts = type.getGenericsTypes();
diff --git a/src/test/groovy/transform/stc/ClosureParamTypeInferenceSTCTest.groovy b/src/test/groovy/transform/stc/ClosureParamTypeInferenceSTCTest.groovy
index 293004b38a..4075d38db4 100644
--- a/src/test/groovy/transform/stc/ClosureParamTypeInferenceSTCTest.groovy
+++ b/src/test/groovy/transform/stc/ClosureParamTypeInferenceSTCTest.groovy
@@ -1527,5 +1527,10 @@ class ClosureParamTypeInferenceSTCTest extends StaticTypeCheckingTestCase {
Java10756.files?.collect { it.name }
// ^^ File
"""
+
+ assertScript """import ${Java10756.name.replace('$','.')}
+ def file = Java10756.files?[0]
+ file?.name
+ """
}
}