From commits-return-6279-archive-asf-public=cust-asf.ponee.io@groovy.apache.org Thu Apr 12 19:32:44 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id A2771180634 for ; Thu, 12 Apr 2018 19:32:43 +0200 (CEST) Received: (qmail 22125 invoked by uid 500); 12 Apr 2018 17:32:42 -0000 Mailing-List: contact commits-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.apache.org Delivered-To: mailing list commits@groovy.apache.org Received: (qmail 22116 invoked by uid 99); 12 Apr 2018 17:32:42 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Apr 2018 17:32:42 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 8D3A1E0904; Thu, 12 Apr 2018 17:32:42 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: paulk@apache.org To: commits@groovy.apache.org Message-Id: <1c6ea2f173844f4cb5d464a7a22dc7cc@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: groovy git commit: GROOVY-8539: Groovy fails to compile assignment operators on boolean array (closes #683) Date: Thu, 12 Apr 2018 17:32:42 +0000 (UTC) Repository: groovy Updated Branches: refs/heads/GROOVY_2_5_X a37b136c8 -> 1a13cf633 GROOVY-8539: Groovy fails to compile assignment operators on boolean array (closes #683) Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/1a13cf63 Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/1a13cf63 Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/1a13cf63 Branch: refs/heads/GROOVY_2_5_X Commit: 1a13cf633a6dce6277adfa3f9e7e80a71330b8a3 Parents: a37b136 Author: Paul King Authored: Wed Apr 11 16:12:59 2018 +1000 Committer: Paul King Committed: Fri Apr 13 03:32:31 2018 +1000 ---------------------------------------------------------------------- .../classgen/asm/BinaryBooleanExpressionHelper.java | 10 +++++----- src/test/groovy/operator/BooleanOperationsTest.groovy | 13 +++++++++++++ 2 files changed, 18 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/groovy/blob/1a13cf63/src/main/java/org/codehaus/groovy/classgen/asm/BinaryBooleanExpressionHelper.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/codehaus/groovy/classgen/asm/BinaryBooleanExpressionHelper.java b/src/main/java/org/codehaus/groovy/classgen/asm/BinaryBooleanExpressionHelper.java index 18e3169..def371b 100644 --- a/src/main/java/org/codehaus/groovy/classgen/asm/BinaryBooleanExpressionHelper.java +++ b/src/main/java/org/codehaus/groovy/classgen/asm/BinaryBooleanExpressionHelper.java @@ -24,8 +24,10 @@ import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.runtime.BytecodeInterface8; import org.objectweb.asm.MethodVisitor; +import static org.codehaus.groovy.syntax.Types.PLUS; + /** - * @author Jochen "blackdrag" Theodorou + * Binary write operations specialised for Booleans */ public class BinaryBooleanExpressionHelper extends BinaryIntExpressionHelper { @@ -49,6 +51,8 @@ public class BinaryBooleanExpressionHelper extends BinaryIntExpressionHelper { @Override protected boolean writeStdOperators(int type, boolean simulate) { + type = type - PLUS; + if (type < 0 || type > 5 || type == 3 /*DIV*/) return false; if (simulate) return false; throw new GroovyBugError("should not reach here"); } @@ -58,10 +62,6 @@ public class BinaryBooleanExpressionHelper extends BinaryIntExpressionHelper { throw new GroovyBugError("should not reach here"); } - protected int getBitwiseOperationBytecode(int type) { - return -1; - } - protected ClassNode getNormalOpResultType() { return ClassHelper.boolean_TYPE; } http://git-wip-us.apache.org/repos/asf/groovy/blob/1a13cf63/src/test/groovy/operator/BooleanOperationsTest.groovy ---------------------------------------------------------------------- diff --git a/src/test/groovy/operator/BooleanOperationsTest.groovy b/src/test/groovy/operator/BooleanOperationsTest.groovy index e864939..d062e73 100644 --- a/src/test/groovy/operator/BooleanOperationsTest.groovy +++ b/src/test/groovy/operator/BooleanOperationsTest.groovy @@ -141,4 +141,17 @@ class BooleanOperationsTest extends GroovyTestCase { assert z == false } + void testBooleanAssignArrayOps() { + boolean[] b = [true] + b[0] &= false + assert b == [false] + b[0] ^= true + assert b == [true] + b[0] ^= true + assert b == [false] + b[0] |= true + assert b == [true] + b[0] |= false + assert b == [true] + } }