Char
This commit is contained in:
@@ -472,7 +472,7 @@ public class ExpressionCodegen extends JetVisitor {
|
|||||||
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")) {
|
className.equals("Byte") || className.equals("Char")) {
|
||||||
if (op.getName().equals("compareTo")) {
|
if (op.getName().equals("compareTo")) {
|
||||||
generateCompareOp(expression, opToken);
|
generateCompareOp(expression, opToken);
|
||||||
}
|
}
|
||||||
@@ -506,7 +506,7 @@ public class ExpressionCodegen extends JetVisitor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isIntLikePrimitive(Type type) {
|
private static boolean isIntLikePrimitive(Type type) {
|
||||||
return type == Type.INT_TYPE || type == Type.SHORT_TYPE || type == Type.BYTE_TYPE;
|
return type == Type.INT_TYPE || type == Type.SHORT_TYPE || type == Type.BYTE_TYPE || type == Type.CHAR_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int opcodeForMethod(final String name) {
|
private static int opcodeForMethod(final String name) {
|
||||||
|
|||||||
@@ -29,6 +29,9 @@ public class JetTypeMapper {
|
|||||||
if (jetType.equals(standardLibrary.getByteType())) {
|
if (jetType.equals(standardLibrary.getByteType())) {
|
||||||
return Type.BYTE_TYPE;
|
return Type.BYTE_TYPE;
|
||||||
}
|
}
|
||||||
|
if (jetType.equals(standardLibrary.getCharType())) {
|
||||||
|
return Type.CHAR_TYPE;
|
||||||
|
}
|
||||||
if (jetType.equals(standardLibrary.getBooleanType())) {
|
if (jetType.equals(standardLibrary.getBooleanType())) {
|
||||||
return Type.BOOLEAN_TYPE;
|
return Type.BOOLEAN_TYPE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -275,6 +275,10 @@ public class NamespaceGenTest extends LightCodeInsightFixtureTestCase {
|
|||||||
assertEquals(true, main.invoke(null));
|
assertEquals(true, main.invoke(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testChar() throws Exception {
|
||||||
|
binOpTest("fun foo(a: Char, b: Char): Int = a + b", 'A', (char) 3, (int) 'D');
|
||||||
|
}
|
||||||
|
|
||||||
private void binOpTest(final String text, final Object arg1, final Object arg2, final Object expected) throws Exception {
|
private void binOpTest(final String text, final Object arg1, final Object arg2, final Object expected) throws Exception {
|
||||||
loadText(text);
|
loadText(text);
|
||||||
System.out.println(generateToText());
|
System.out.println(generateToText());
|
||||||
|
|||||||
Reference in New Issue
Block a user