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/06/14 09:38:16 UTC

groovy git commit: Fix inferring return type issues(closes #755)

Repository: groovy
Updated Branches:
  refs/heads/master 65daf37ea -> fb5e7f591


Fix inferring return type issues(closes #755)

When methods are mixed with other expressions in the return statement, isNestedOrSandwichedMethodCall fails to handle all cases and becomes the source of issues. As isNestedOrSandwichedMethodCall is a temporary solution, it's useless and can be removed now.


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

Branch: refs/heads/master
Commit: fb5e7f591eefb5ca5a195286a6b81b4ca29063a4
Parents: 65daf37
Author: sunlan <su...@apache.org>
Authored: Thu Jun 14 17:38:08 2018 +0800
Committer: sunlan <su...@apache.org>
Committed: Thu Jun 14 17:38:08 2018 +0800

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


http://git-wip-us.apache.org/repos/asf/groovy/blob/fb5e7f59/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 40fe3ba..d51491b 100644
--- a/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
+++ b/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
@@ -3288,12 +3288,14 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport {
                         if (typeCheckMethodsWithGenericsOrFail(chosenReceiver.getType(), args, mn.get(0), call)) {
                             returnType = adjustWithTraits(directMethodCallCandidate, chosenReceiver.getType(), args, returnType);
 
+                            /*
                             if (null != typeCheckingContext.getEnclosingReturnStatement() && !isNestedOrSandwichedMethodCall()) {
                                 ClassNode inferredType = infer(returnType, typeCheckingContext.getEnclosingMethod().getReturnType());
                                 if (null != inferredType) {
                                     returnType = inferredType;
                                 }
                             }
+                            */
 
                             storeType(call, returnType);
                             storeTargetMethod(call, directMethodCallCandidate);