added test for KT-243
This commit is contained in:
@@ -731,15 +731,21 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> {
|
||||
}
|
||||
}
|
||||
else if (descriptor instanceof ClassDescriptor) {
|
||||
final JetClassObject classObject = ((JetClass) declaration).getClassObject();
|
||||
if (classObject == null) {
|
||||
throw new UnsupportedOperationException("trying to reference a class which doesn't have a class object");
|
||||
if(declaration instanceof JetClass) {
|
||||
final JetClassObject classObject = ((JetClass) declaration).getClassObject();
|
||||
if (classObject == null) {
|
||||
throw new UnsupportedOperationException("trying to reference a class which doesn't have a class object");
|
||||
}
|
||||
final String type = typeMapper.jvmName(classObject);
|
||||
return StackValue.field(Type.getObjectType(type),
|
||||
typeMapper.jvmName((ClassDescriptor) descriptor, OwnerKind.IMPLEMENTATION),
|
||||
"$classobj",
|
||||
true);
|
||||
}
|
||||
else {
|
||||
// todo ?
|
||||
return StackValue.none();
|
||||
}
|
||||
final String type = typeMapper.jvmName(classObject);
|
||||
return StackValue.field(Type.getObjectType(type),
|
||||
typeMapper.jvmName((ClassDescriptor) descriptor, OwnerKind.IMPLEMENTATION),
|
||||
"$classobj",
|
||||
true);
|
||||
}
|
||||
else if (descriptor instanceof TypeParameterDescriptor) {
|
||||
loadTypeParameterTypeInfo((TypeParameterDescriptor) descriptor);
|
||||
|
||||
@@ -24,6 +24,7 @@ public class JetTypeMapper {
|
||||
public static final Type TYPE_OBJECT = Type.getObjectType("java/lang/Object");
|
||||
public static final Type TYPE_TYPEINFO = Type.getType(TypeInfo.class);
|
||||
public static final Type TYPE_JET_OBJECT = Type.getType(JetObject.class);
|
||||
public static final Type TYPE_CLASS = Type.getType(Class.class);
|
||||
|
||||
private final JetStandardLibrary standardLibrary;
|
||||
private final BindingContext bindingContext;
|
||||
@@ -61,6 +62,11 @@ public class JetTypeMapper {
|
||||
}
|
||||
|
||||
static Type psiTypeToAsm(PsiType type) {
|
||||
if(type instanceof PsiArrayType) {
|
||||
PsiArrayType psiArrayType = (PsiArrayType) type;
|
||||
return Type.getType("[" + psiTypeToAsm(psiArrayType.getComponentType()).getDescriptor());
|
||||
}
|
||||
|
||||
if (type instanceof PsiPrimitiveType) {
|
||||
if (type == PsiType.VOID) {
|
||||
return Type.VOID_TYPE;
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
fun box() : String {
|
||||
val t = java.lang.String.copyValueOf(java.lang.String("s").toCharArray())
|
||||
val i = java.lang.Integer.MAX_VALUE
|
||||
val j = java.lang.Integer.valueOf(15)
|
||||
val s = java.lang.String.valueOf(1)
|
||||
val l = java.util.Collections.emptyList<Int>()
|
||||
return "OK"
|
||||
}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package org.jetbrains.jet.codegen;
|
||||
|
||||
public class ArrayGetTestCase extends CodegenTestCase {
|
||||
public class ArrayGenTestCase extends CodegenTestCase {
|
||||
public void testKt238 () throws Exception {
|
||||
blackBoxFile("regressions/kt238.jet");
|
||||
}
|
||||
@@ -266,4 +266,8 @@ public class PrimitiveTypesTest extends CodegenTestCase {
|
||||
public void testKt239 () throws Exception {
|
||||
blackBoxFile("regressions/kt242.jet");
|
||||
}
|
||||
|
||||
public void testKt243 () throws Exception {
|
||||
blackBoxFile("regressions/kt243.jet");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user