提交 23098739 编写于 作者: D Dmitry Jemerov

Byte

上级 68d3c7a6
...@@ -471,7 +471,8 @@ public class ExpressionCodegen extends JetVisitor { ...@@ -471,7 +471,8 @@ 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") || className.equals("Short")) { if (className.equals("Int") || className.equals("Long") || className.equals("Short") ||
className.equals("Byte")) {
if (op.getName().equals("compareTo")) { if (op.getName().equals("compareTo")) {
generateCompareOp(expression, opToken); generateCompareOp(expression, opToken);
} }
......
...@@ -26,6 +26,9 @@ public class JetTypeMapper { ...@@ -26,6 +26,9 @@ public class JetTypeMapper {
if (jetType.equals(standardLibrary.getShortType())) { if (jetType.equals(standardLibrary.getShortType())) {
return Type.SHORT_TYPE; return Type.SHORT_TYPE;
} }
if (jetType.equals(standardLibrary.getByteType())) {
return Type.BYTE_TYPE;
}
if (jetType.equals(standardLibrary.getBooleanType())) { if (jetType.equals(standardLibrary.getBooleanType())) {
return Type.BOOLEAN_TYPE; return Type.BOOLEAN_TYPE;
} }
......
...@@ -242,6 +242,11 @@ public class NamespaceGenTest extends LightCodeInsightFixtureTestCase { ...@@ -242,6 +242,11 @@ public class NamespaceGenTest extends LightCodeInsightFixtureTestCase {
Short.valueOf((short) 32767), Short.valueOf((short) 32767), 65534); 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 { 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());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册