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 2017/11/17 10:34:05 UTC
[1/2] groovy git commit: fix typo
Repository: groovy
Updated Branches:
refs/heads/master 0f77eb19d -> afe5851af
fix typo
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/4425a702
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/4425a702
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/4425a702
Branch: refs/heads/master
Commit: 4425a702b91addf334ed46199da5e70a435b4ae7
Parents: 0f77eb1
Author: paulk <pa...@asert.com.au>
Authored: Fri Nov 17 15:56:58 2017 +1000
Committer: paulk <pa...@asert.com.au>
Committed: Fri Nov 17 20:33:45 2017 +1000
----------------------------------------------------------------------
.../codehaus/groovy/classgen/asm/sc/StaticInvocationWriter.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/4425a702/src/main/org/codehaus/groovy/classgen/asm/sc/StaticInvocationWriter.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/classgen/asm/sc/StaticInvocationWriter.java b/src/main/org/codehaus/groovy/classgen/asm/sc/StaticInvocationWriter.java
index 778d740..640d775 100644
--- a/src/main/org/codehaus/groovy/classgen/asm/sc/StaticInvocationWriter.java
+++ b/src/main/org/codehaus/groovy/classgen/asm/sc/StaticInvocationWriter.java
@@ -59,7 +59,7 @@ import static org.objectweb.asm.Opcodes.*;
public class StaticInvocationWriter extends InvocationWriter {
private static final ClassNode INVOKERHELPER_CLASSNODE = ClassHelper.make(InvokerHelper.class);
- private static final Expression INVOKERHELER_RECEIVER = new ClassExpression(INVOKERHELPER_CLASSNODE);
+ private static final Expression INVOKERHELPER_RECEIVER = new ClassExpression(INVOKERHELPER_CLASSNODE);
private static final MethodNode INVOKERHELPER_INVOKEMETHOD = INVOKERHELPER_CLASSNODE.getMethod(
"invokeMethodSafe",
new Parameter[]{
@@ -290,7 +290,7 @@ public class StaticInvocationWriter extends InvocationWriter {
// replace call with an invoker helper call
ArrayExpression arr = new ArrayExpression(ClassHelper.OBJECT_TYPE, args.getExpressions());
MethodCallExpression mce = new MethodCallExpression(
- INVOKERHELER_RECEIVER,
+ INVOKERHELPER_RECEIVER,
target.isStatic() ? "invokeStaticMethod" : "invokeMethodSafe",
new ArgumentListExpression(
target.isStatic() ?
[2/2] groovy git commit: GROOVY-8380: Regression in 2.4.13 (snapshot)
with and/or/xor and @CS
Posted by pa...@apache.org.
GROOVY-8380: Regression in 2.4.13 (snapshot) with and/or/xor and @CS
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/afe5851a
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/afe5851a
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/afe5851a
Branch: refs/heads/master
Commit: afe5851affd5756fb6065560909e498c07905660
Parents: 4425a70
Author: paulk <pa...@asert.com.au>
Authored: Fri Nov 17 20:32:34 2017 +1000
Committer: paulk <pa...@asert.com.au>
Committed: Fri Nov 17 20:33:46 2017 +1000
----------------------------------------------------------------------
.../asm/sc/StaticTypesCallSiteWriter.java | 3 ++-
.../stc/StaticTypeCheckingVisitor.java | 6 +++---
.../groovy/transform/stc/MiscSTCTest.groovy | 20 ++++++++++++++++++++
3 files changed, 25 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/afe5851a/src/main/org/codehaus/groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java b/src/main/org/codehaus/groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java
index 2eaa934..9968ef6 100644
--- a/src/main/org/codehaus/groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java
+++ b/src/main/org/codehaus/groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java
@@ -654,7 +654,8 @@ public class StaticTypesCallSiteWriter extends CallSiteWriter implements Opcodes
} else if ("power".equals(message)) {
writePowerCall(receiver, arguments, rType, aType);
return true;
- } else if ("mod".equals(message) || "leftShift".equals(message) || "rightShift".equals(message) || "rightShiftUnsigned".equals(message)) {
+ } else if ("mod".equals(message) || "leftShift".equals(message) || "rightShift".equals(message) || "rightShiftUnsigned".equals(message)
+ || "and".equals(message) || "or".equals(message) || "xor".equals(message)) {
writeOperatorCall(receiver, arguments, message);
return true;
}
http://git-wip-us.apache.org/repos/asf/groovy/blob/afe5851a/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java b/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
index e7133bd..8efe2b6 100644
--- a/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
+++ b/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
@@ -3659,9 +3659,9 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport {
} else if (isPowerOperator(op)) {
return Number_TYPE;
} else if (isBitOperator(op)) {
- if (isIntCategory(leftRedirect) && isIntCategory(rightRedirect)) return int_TYPE;
- if (isLongCategory(leftRedirect) && isLongCategory(rightRedirect)) return long_TYPE;
- if (isBigIntCategory(leftRedirect) && isBigIntCategory(rightRedirect)) return BigInteger_TYPE;
+ if (isIntCategory(getUnwrapper(leftRedirect)) && isIntCategory(getUnwrapper(rightRedirect))) return int_TYPE;
+ if (isLongCategory(getUnwrapper(leftRedirect)) && isLongCategory(getUnwrapper(rightRedirect))) return long_TYPE;
+ if (isBigIntCategory(getUnwrapper(leftRedirect)) && isBigIntCategory(getUnwrapper(rightRedirect))) return BigInteger_TYPE;
} else if (isCompareToBoolean(op) || op == COMPARE_EQUAL || op == COMPARE_NOT_EQUAL) {
return boolean_TYPE;
}
http://git-wip-us.apache.org/repos/asf/groovy/blob/afe5851a/src/test/groovy/transform/stc/MiscSTCTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/groovy/transform/stc/MiscSTCTest.groovy b/src/test/groovy/transform/stc/MiscSTCTest.groovy
index fd132e3..0b786d8 100644
--- a/src/test/groovy/transform/stc/MiscSTCTest.groovy
+++ b/src/test/groovy/transform/stc/MiscSTCTest.groovy
@@ -389,4 +389,24 @@ class MiscSTCTest extends StaticTypeCheckingTestCase {
''', 'Cannot find matching method Foo#newInstance2(CustomNumber)'
}
+ // GROOVY-8380
+ void testBitOperatorsWithNumbers() {
+ assertScript '''
+ def method() {
+ Long wl = 2L
+ long pl = 3L
+ assert new Long(wl & 3L) == 2
+ assert new Long(pl & pl) == 3
+ assert new Long(6L & 3L) == 2
+ assert new Long(-2L & 3L) == 2
+ Integer wi = 2
+ int pi = 2
+ assert new Integer(wi & 34) == 2
+ assert new Integer(pi & pi) == 2
+ assert new Integer(6 & 3) == 2
+ assert new Integer(-2 & 3) == 2
+ }
+ method()
+ '''
+ }
}