== for Short

This commit is contained in:
Dmitry Jemerov
2011-04-07 15:01:31 +02:00
parent 6f3b9fe37d
commit 2781aa18ff
2 changed files with 7 additions and 2 deletions
@@ -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) {
@@ -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();