Short
This commit is contained in:
@@ -468,7 +468,7 @@ public class ExpressionCodegen extends JetVisitor {
|
|||||||
DeclarationDescriptor cls = op.getContainingDeclaration();
|
DeclarationDescriptor cls = op.getContainingDeclaration();
|
||||||
if (cls instanceof ClassDescriptor) {
|
if (cls instanceof ClassDescriptor) {
|
||||||
final String className = cls.getName();
|
final String className = cls.getName();
|
||||||
if (className.equals("Int") || className.equals("Long")) {
|
if (className.equals("Int") || className.equals("Long") || className.equals("Short")) {
|
||||||
if (op.getName().equals("compareTo")) {
|
if (op.getName().equals("compareTo")) {
|
||||||
generateCompareOp(expression, opToken);
|
generateCompareOp(expression, opToken);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ public class JetTypeMapper {
|
|||||||
if (jetType.equals(standardLibrary.getLongType())) {
|
if (jetType.equals(standardLibrary.getLongType())) {
|
||||||
return Type.LONG_TYPE;
|
return Type.LONG_TYPE;
|
||||||
}
|
}
|
||||||
|
if (jetType.equals(standardLibrary.getShortType())) {
|
||||||
|
return Type.SHORT_TYPE;
|
||||||
|
}
|
||||||
if (jetType.equals(standardLibrary.getBooleanType())) {
|
if (jetType.equals(standardLibrary.getBooleanType())) {
|
||||||
return Type.BOOLEAN_TYPE;
|
return Type.BOOLEAN_TYPE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -237,7 +237,12 @@ public class NamespaceGenTest extends LightCodeInsightFixtureTestCase {
|
|||||||
assertEquals(0L, main.invoke(null, 1, 0));
|
assertEquals(0L, main.invoke(null, 1, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void binOpTest(final String text, final int arg1, final int arg2, final int expected) throws Exception {
|
public void testShort() throws Exception {
|
||||||
|
binOpTest("fun foo(a: Short, b: Short): Int = a + b",
|
||||||
|
Short.valueOf((short) 32767), Short.valueOf((short) 32767), 65534);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void binOpTest(final String text, final Object arg1, final Object arg2, final int expected) throws Exception {
|
||||||
loadText(text);
|
loadText(text);
|
||||||
System.out.println(generateToText());
|
System.out.println(generateToText());
|
||||||
final Method main = generateFunction();
|
final Method main = generateFunction();
|
||||||
|
|||||||
Reference in New Issue
Block a user