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
The following commit(s) were added to refs/heads/GROOVY_4_0_X by this push:
new df914b5a67 restructure empty check
df914b5a67 is described below
commit df914b5a67ea31496461a616f72f37f1dc3caa01
Author: Eric Milles <[email protected]>
AuthorDate: Thu Jul 3 10:47:08 2025 -0500
restructure empty check
---
.../groovy/transform/stc/StaticTypeCheckingVisitor.java | 12 +++++-------
1 file changed, 5 insertions(+), 7 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 3b4fb270d7..1a019db841 100644
---
a/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
+++
b/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
@@ -5241,14 +5241,12 @@ public class StaticTypeCheckingVisitor extends
ClassCodeVisitorSupport {
}
if (variable instanceof Parameter) {
Parameter parameter = (Parameter) variable;
- // check if param part of control structure - but not if
inside instanceof
- List<ClassNode> temporaryTypesForExpression =
getTemporaryTypesForExpression(vexp);
- if (temporaryTypesForExpression == null ||
temporaryTypesForExpression.isEmpty()) {
+ if (getTemporaryTypesForExpression(vexp).isEmpty()) { // not
instanceof
+ // check if the parameter is part of a control structure
(for loop)
type =
typeCheckingContext.controlStructureVariables.get(parameter);
- }
- // now check for closure override
- if (type == null && temporaryTypesForExpression == null) {
- type = getTypeFromClosureArguments(parameter);
+ if (type == null) { // else check closure metadata
+ type = getTypeFromClosureArguments(parameter);
+ }
}
if (type != null) {
storeType(vexp, type);