KT-535 no need in outer type info for class object
This commit is contained in:
@@ -101,7 +101,7 @@ public class CodegenUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ClassDescriptor outerClassDescriptor = getOuterClassDescriptor(type.getConstructor().getDeclarationDescriptor());
|
ClassDescriptor outerClassDescriptor = getOuterClassDescriptor(type.getConstructor().getDeclarationDescriptor());
|
||||||
if(outerClassDescriptor == null)
|
if(outerClassDescriptor == null || isClassObject(type.getConstructor().getDeclarationDescriptor()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return hasTypeInfoField(outerClassDescriptor.getDefaultType());
|
return hasTypeInfoField(outerClassDescriptor.getDefaultType());
|
||||||
|
|||||||
@@ -869,7 +869,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
|||||||
v.aconst(typeMapper.mapType(descriptor.getDefaultType(), OwnerKind.IMPLEMENTATION));
|
v.aconst(typeMapper.mapType(descriptor.getDefaultType(), OwnerKind.IMPLEMENTATION));
|
||||||
v.iconst(0);
|
v.iconst(0);
|
||||||
ClassDescriptor outerClassDescriptor = CodegenUtil.getOuterClassDescriptor(descriptor);
|
ClassDescriptor outerClassDescriptor = CodegenUtil.getOuterClassDescriptor(descriptor);
|
||||||
if(outerClassDescriptor == null) {
|
if(outerClassDescriptor == null || CodegenUtil.isClassObject(descriptor)) {
|
||||||
v.invokestatic("jet/typeinfo/TypeInfo", "getTypeInfo", "(Ljava/lang/Class;Z)Ljet/typeinfo/TypeInfo;");
|
v.invokestatic("jet/typeinfo/TypeInfo", "getTypeInfo", "(Ljava/lang/Class;Z)Ljet/typeinfo/TypeInfo;");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
class Identifier<T>(t : T?, myHasDollar : Boolean) {
|
||||||
|
private val myT : T?
|
||||||
|
|
||||||
|
public fun getName() : T? { return myT }
|
||||||
|
|
||||||
|
class object {
|
||||||
|
open public fun init<T>(name : T?) : Identifier<T> {
|
||||||
|
val __ = Identifier<T>(name, false)
|
||||||
|
return __
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
$myT = t
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box() : String {
|
||||||
|
var i3 : Identifier<String?>? = Identifier.init<String?>("name")
|
||||||
|
System.out?.println(i3?.getName())
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package org.jetbrains.jet.codegen;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @author yole
|
* @author yole
|
||||||
|
* @author alex.tkachman
|
||||||
*/
|
*/
|
||||||
public class ObjectGenTest extends CodegenTestCase {
|
public class ObjectGenTest extends CodegenTestCase {
|
||||||
public void testSimpleObject() throws Exception {
|
public void testSimpleObject() throws Exception {
|
||||||
@@ -16,4 +17,8 @@ public class ObjectGenTest extends CodegenTestCase {
|
|||||||
public void testMethodOnObject() throws Exception {
|
public void testMethodOnObject() throws Exception {
|
||||||
blackBoxFile("objects/methodOnObject.jet");
|
blackBoxFile("objects/methodOnObject.jet");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testKt535() throws Exception {
|
||||||
|
blackBoxFile("regressions/kt535.jet");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user