Fix for KT-12127: Undeclared type variable on delegated property backing field
#KT-12127 Fixed
This commit is contained in:
@@ -348,7 +348,7 @@ public class PropertyCodegen {
|
||||
|
||||
FieldVisitor fv = builder.newField(
|
||||
JvmDeclarationOriginKt.OtherOrigin(element, propertyDescriptor), modifiers, name, type.getDescriptor(),
|
||||
typeMapper.mapFieldSignature(kotlinType, propertyDescriptor), defaultValue
|
||||
isDelegate ? null : typeMapper.mapFieldSignature(kotlinType, propertyDescriptor), defaultValue
|
||||
);
|
||||
|
||||
Annotated fieldAnnotated = new AnnotatedWithFakeAnnotations(propertyDescriptor, annotations);
|
||||
|
||||
+2
-2
@@ -70,12 +70,12 @@ fun box(): String {
|
||||
|
||||
val classField5 = clz.getDeclaredField("delegateLazy\$delegate");
|
||||
|
||||
if (classField5.getGenericType().toString() != "kotlin.Lazy<Z<TParam>>")
|
||||
if (classField5.getGenericType().toString() != "interface kotlin.Lazy")
|
||||
return "fail5: " + classField5.getGenericType();
|
||||
|
||||
val classField6 = clz.getDeclaredField("delegateNotNull\$delegate");
|
||||
|
||||
if (classField6.getGenericType().toString() != "kotlin.properties.ReadWriteProperty<java.lang.Object, Z<TParam>>")
|
||||
if (classField6.getGenericType().toString() != "interface kotlin.properties.ReadWriteProperty")
|
||||
return "fail6: " + classField6.getGenericType();
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import kotlin.reflect.KProperty
|
||||
import kotlin.reflect.KProperty1
|
||||
|
||||
class DVal<T, R, P: KProperty1<T, R>>(val kmember: P) {
|
||||
operator fun getValue(t: T, p: KProperty<*>): R {
|
||||
return kmember.get(t)
|
||||
}
|
||||
}
|
||||
|
||||
class Value<T>(var text: String? = null)
|
||||
|
||||
class Test {
|
||||
val <T> Value<T>.additionalText by DVal(Value<T>::text)
|
||||
}
|
||||
|
||||
// field: Test::additionalText$delegate
|
||||
// jvm signature: LDVal;
|
||||
// generic signature: null
|
||||
@@ -47,6 +47,12 @@ public class WriteSignatureTestGenerated extends AbstractWriteSignatureTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("backingFieldForGenericDelegated.kt")
|
||||
public void testBackingFieldForGenericDelegated() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/writeSignature/backingFieldForGenericDelegated.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("Comparable.kt")
|
||||
public void testComparable() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/writeSignature/Comparable.kt");
|
||||
|
||||
Reference in New Issue
Block a user