Byte
This commit is contained in:
@@ -471,7 +471,8 @@ public class ExpressionCodegen extends JetVisitor {
|
||||
DeclarationDescriptor cls = op.getContainingDeclaration();
|
||||
if (cls instanceof ClassDescriptor) {
|
||||
final String className = cls.getName();
|
||||
if (className.equals("Int") || className.equals("Long") || className.equals("Short")) {
|
||||
if (className.equals("Int") || className.equals("Long") || className.equals("Short") ||
|
||||
className.equals("Byte")) {
|
||||
if (op.getName().equals("compareTo")) {
|
||||
generateCompareOp(expression, opToken);
|
||||
}
|
||||
|
||||
@@ -26,6 +26,9 @@ public class JetTypeMapper {
|
||||
if (jetType.equals(standardLibrary.getShortType())) {
|
||||
return Type.SHORT_TYPE;
|
||||
}
|
||||
if (jetType.equals(standardLibrary.getByteType())) {
|
||||
return Type.BYTE_TYPE;
|
||||
}
|
||||
if (jetType.equals(standardLibrary.getBooleanType())) {
|
||||
return Type.BOOLEAN_TYPE;
|
||||
}
|
||||
|
||||
@@ -242,6 +242,11 @@ public class NamespaceGenTest extends LightCodeInsightFixtureTestCase {
|
||||
Short.valueOf((short) 32767), Short.valueOf((short) 32767), 65534);
|
||||
}
|
||||
|
||||
public void testByte() throws Exception {
|
||||
binOpTest("fun foo(a: Byte, b: Byte): Int = a + b",
|
||||
Byte.valueOf((byte) 127), Byte.valueOf((byte) 127), 254);
|
||||
}
|
||||
|
||||
private void binOpTest(final String text, final Object arg1, final Object arg2, final int expected) throws Exception {
|
||||
loadText(text);
|
||||
System.out.println(generateToText());
|
||||
|
||||
Reference in New Issue
Block a user