diff --git a/idea/src/org/jetbrains/jet/codegen/ExpressionCodegen.java b/idea/src/org/jetbrains/jet/codegen/ExpressionCodegen.java index 71764de0f87..608c24e90d4 100644 --- a/idea/src/org/jetbrains/jet/codegen/ExpressionCodegen.java +++ b/idea/src/org/jetbrains/jet/codegen/ExpressionCodegen.java @@ -506,7 +506,7 @@ public class ExpressionCodegen extends JetVisitor { } private static boolean isIntLikePrimitive(Type type) { - return type == Type.INT_TYPE || type == Type.BYTE_TYPE; + return type == Type.INT_TYPE || type == Type.SHORT_TYPE || type == Type.BYTE_TYPE; } private static int opcodeForMethod(final String name) { diff --git a/idea/tests/org/jetbrains/jet/codegen/NamespaceGenTest.java b/idea/tests/org/jetbrains/jet/codegen/NamespaceGenTest.java index 96f69c92ad1..197f12c4ec5 100644 --- a/idea/tests/org/jetbrains/jet/codegen/NamespaceGenTest.java +++ b/idea/tests/org/jetbrains/jet/codegen/NamespaceGenTest.java @@ -249,6 +249,11 @@ public class NamespaceGenTest extends LightCodeInsightFixtureTestCase { Short.valueOf((short) 32767), Short.valueOf((short) 32767), 65534); } + public void testShortCmp() throws Exception { + binOpTest("fun foo(a: Short, b: Short): Boolean = a == b", + Short.valueOf((short) 32767), Short.valueOf((short) 32767), true); + } + public void testByte() throws Exception { binOpTest("fun foo(a: Byte, b: Byte): Int = a + b", Byte.valueOf((byte) 127), Byte.valueOf((byte) 127), 254); @@ -264,7 +269,7 @@ public class NamespaceGenTest extends LightCodeInsightFixtureTestCase { Byte.valueOf((byte) 126), Byte.valueOf((byte) 127), 1); } - private void binOpTest(final String text, final Object arg1, final Object arg2, final int expected) throws Exception { + private void binOpTest(final String text, final Object arg1, final Object arg2, final Object expected) throws Exception { loadText(text); System.out.println(generateToText()); final Method main = generateFunction();