groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject groovy git commit: Fix inferring return type issues(closes #755)
Date Thu, 14 Jun 2018 09:39:42 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_5_X 686565a6d -> be4852fad


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.

(cherry picked from commit fb5e7f5)


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

Branch: refs/heads/GROOVY_2_5_X
Commit: be4852fada58d095b2a3fabf2a1aacb7b998a86c
Parents: 686565a
Author: sunlan <sunlan@apache.org>
Authored: Thu Jun 14 17:38:08 2018 +0800
Committer: sunlan <sunlan@apache.org>
Committed: Thu Jun 14 17:39:36 2018 +0800

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


http://git-wip-us.apache.org/repos/asf/groovy/blob/be4852fa/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 623eb09..6bdcb36 100644
--- a/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
+++ b/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
@@ -3277,12 +3277,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);


Mime
View raw message