You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2019/04/21 23:42:27 UTC
[groovy] 01/02: minor refactor: whitespace and formatting
This is an automated email from the ASF dual-hosted git repository.
paulk pushed a commit to branch GROOVY_2_5_X
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 992077308919d46570d349b8460fd0176b0ea4b0
Author: Paul King <pa...@asert.com.au>
AuthorDate: Mon Apr 22 07:44:11 2019 +1000
minor refactor: whitespace and formatting
---
.../transform/stc/StaticTypeCheckingVisitor.java | 19 +++++--------------
1 file changed, 5 insertions(+), 14 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 924eb35..bc67c5e 100644
--- a/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
+++ b/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
@@ -857,8 +857,8 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport {
if (lType.isUsingGenerics() && missesGenericsTypes(resultType) && isAssignment(op)) {
// unchecked assignment
// examples:
- // List<A> list = new LinkedList()
// List<A> list = []
+ // List<A> list = new LinkedList()
// Iterable<A> list = new LinkedList()
// in that case, the inferred type of the binary expression is the type of the RHS
@@ -868,11 +868,12 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport {
resultType = completedType;
}
- if (isArrayOp(op) &&
- enclosingBinaryExpression != null
+ if (isArrayOp(op)
+ && !lType.isArray()
+ && enclosingBinaryExpression != null
&& enclosingBinaryExpression.getLeftExpression() == expression
&& isAssignment(enclosingBinaryExpression.getOperation().getType())
- && !lType.isArray()) {
+ ) {
// left hand side of an assignment : map['foo'] = ...
Expression enclosingBE_rightExpr = enclosingBinaryExpression.getRightExpression();
if (!(enclosingBE_rightExpr instanceof ClosureExpression)) {
@@ -2745,7 +2746,6 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport {
}
}
-
private void inferSAMType(Parameter param, ClassNode receiver, MethodNode methodWithSAMParameter, ArgumentListExpression originalMethodCallArguments, ClosureExpression openBlock) {
// In a method call with SAM coercion the inference is to be
// understood as a two phase process. We have the normal method call
@@ -3409,15 +3409,6 @@ 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);
ClassNode declaringClass = directMethodCallCandidate.getDeclaringClass();