You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2018/05/14 11:17:09 UTC

groovy git commit: Refine "GROOVY-7753: regression of return type from ternary operator"

Repository: groovy
Updated Branches:
  refs/heads/master d88dfe679 -> 4439e3a27


Refine "GROOVY-7753: regression of return type from ternary operator"


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/4439e3a2
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/4439e3a2
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/4439e3a2

Branch: refs/heads/master
Commit: 4439e3a27ccf37c1ed5a03541ca145f12a3dd9d3
Parents: d88dfe6
Author: sunlan <su...@apache.org>
Authored: Mon May 14 19:17:04 2018 +0800
Committer: sunlan <su...@apache.org>
Committed: Mon May 14 19:17:04 2018 +0800

----------------------------------------------------------------------
 .../codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/4439e3a2/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
----------------------------------------------------------------------
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 865b97f..72cce39 100644
--- a/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
+++ b/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
@@ -3245,7 +3245,7 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport {
                         if (typeCheckMethodsWithGenericsOrFail(chosenReceiver.getType(), args, mn.get(0), call)) {
                             returnType = adjustWithTraits(directMethodCallCandidate, chosenReceiver.getType(), args, returnType);
 
-                            if (visitingReturnStatementCnt > 0) { // the method call is within return statement, we can try to infer type further
+                            if (1 == visitingReturnStatementCnt) { // the method call is within return statement, we can try to infer type further
                                 ClassNode inferredType = infer(returnType, typeCheckingContext.getEnclosingMethod().getReturnType());
                                 if (null != inferredType) {
                                     returnType = inferredType;