blackdrag commented on code in PR #3002:
URL: https://github.com/apache/groovy/pull/3002#discussion_r4432806948
##########
src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java:
##########
@@ -821,6 +821,9 @@ public void visitVariableExpression(final
VariableExpression vexp) {
ClassNode inferredType =
getInferredTypeFromTempInfo(localVariable,
localVariable.getNodeMetaData(INFERRED_TYPE));
if (inferredType != null && !isObjectType(inferredType) &&
!inferredType.equals(isTraitSelf(vexp))) {
vexp.putNodeMetaData(INFERRED_TYPE, inferredType);
+ } else if (vexp != localVariable) {
+ // a reference node may be shared (e.g. by a transform) across
branches; drop any type narrowed elsewhere
+ vexp.removeNodeMetaData(INFERRED_TYPE);
Review Comment:
not sure about this solution.... Why is it legal to remove it?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]