diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/BranchedValue.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/BranchedValue.kt index 7eb32875fc1..a40ab234b95 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/BranchedValue.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/BranchedValue.kt @@ -101,9 +101,6 @@ open class BranchedValue(val arg1: StackValue, val arg2: StackValue? = null, val } fun createInvertValue(argument: StackValue): StackValue { - if (argument.type != Type.BOOLEAN_TYPE) { - throw UnsupportedOperationException("operand of ! must be boolean") - } return Invert(condJump(argument)) } diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java index 7d967cceb94..23622cf4abe 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java @@ -3051,11 +3051,11 @@ public class ExpressionCodegen extends JetVisitor implem } private StackValue generateBooleanAnd(JetBinaryExpression expression) { - return StackValue.and(genLazy(expression.getLeft(), Type.BOOLEAN_TYPE), genLazy(expression.getRight(), Type.BOOLEAN_TYPE)); + return StackValue.and(gen(expression.getLeft()), gen(expression.getRight())); } private StackValue generateBooleanOr(JetBinaryExpression expression) { - return StackValue.or(genLazy(expression.getLeft(), Type.BOOLEAN_TYPE), genLazy(expression.getRight(), Type.BOOLEAN_TYPE)); + return StackValue.or(gen(expression.getLeft()), gen(expression.getRight())); } private StackValue generateEquals(JetExpression left, JetExpression right, IElementType opToken) { diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/intrinsics/Not.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/intrinsics/Not.kt index b72a508cb3c..3886864170a 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/intrinsics/Not.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/intrinsics/Not.kt @@ -28,17 +28,6 @@ import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall import org.jetbrains.org.objectweb.asm.Type public class Not : IntrinsicMethod() { - fun generateImpl(codegen: ExpressionCodegen, returnType: Type, element: PsiElement?, arguments: List, receiver: StackValue): StackValue { - val stackValue: StackValue - if (arguments.size() == 1) { - stackValue = codegen.gen(arguments.get(0)) - } - else { - stackValue = receiver - } - return StackValue.not(StackValue.coercion(stackValue, Type.BOOLEAN_TYPE)) - } - override fun toCallable(method: CallableMethod): Callable { return object : IntrinsicCallable(method) { override fun invokeMethodWithArguments(resolvedCall: ResolvedCall<*>, receiver: StackValue, codegen: ExpressionCodegen): StackValue { @@ -50,7 +39,7 @@ public class Not : IntrinsicMethod() { else { StackValue.receiver(resolvedCall, receiver, codegen, this) } - return StackValue.not(StackValue.coercion(stackValue, Type.BOOLEAN_TYPE)) + return StackValue.not(stackValue) } } }