[NI] Store setValue with fresh type variables before substitution
This commit is contained in:
committed by
Stanislav Erokhin
parent
55d1130dfc
commit
e040a317cc
@@ -556,6 +556,14 @@ class DelegatedPropertyResolver(
|
|||||||
isGet = true, isComplete = true
|
isGet = true, isComplete = true
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (variableDescriptor.isVar && variableDescriptor.returnType !is DeferredType) {
|
||||||
|
getGetSetValueMethod(
|
||||||
|
variableDescriptor, delegateExpression, typeInfoForGetValueReceiver.type ?: return null,
|
||||||
|
traceToResolveConventionMethods, scopeForDelegate, typeInfoForGetValueReceiver.dataFlowInfo,
|
||||||
|
isGet = false, isComplete = true
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
val call = delegateExpression.getCall(traceToResolveConventionMethods.bindingContext)
|
val call = delegateExpression.getCall(traceToResolveConventionMethods.bindingContext)
|
||||||
val pretendReturnType = call.getResolvedCall(traceToResolveConventionMethods.bindingContext)?.resultingDescriptor?.returnType
|
val pretendReturnType = call.getResolvedCall(traceToResolveConventionMethods.bindingContext)?.resultingDescriptor?.returnType
|
||||||
return pretendReturnType?.takeUnless { it.contains { it.constructor is TypeVariableTypeConstructor } }
|
return pretendReturnType?.takeUnless { it.contains { it.constructor is TypeVariableTypeConstructor } }
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import kotlin.reflect.KProperty
|
||||||
|
|
||||||
|
class MyMetadata<in T, R>(val default: R) {
|
||||||
|
operator fun getValue(thisRef: T, desc: KProperty<*>): R = TODO()
|
||||||
|
operator fun setValue(thisRef: T, desc: KProperty<*>, value: R) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Something
|
||||||
|
class MyReceiver
|
||||||
|
var MyReceiver.something: Something? by MyMetadata(default = null)
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public var MyReceiver.something: Something?
|
||||||
|
|
||||||
|
public final class MyMetadata</*0*/ in T, /*1*/ R> {
|
||||||
|
public constructor MyMetadata</*0*/ in T, /*1*/ R>(/*0*/ default: R)
|
||||||
|
public final val default: R
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public final operator fun getValue(/*0*/ thisRef: T, /*1*/ desc: kotlin.reflect.KProperty<*>): R
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public final operator fun setValue(/*0*/ thisRef: T, /*1*/ desc: kotlin.reflect.KProperty<*>, /*2*/ value: R): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class MyReceiver {
|
||||||
|
public constructor MyReceiver()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface Something {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
@@ -16702,6 +16702,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("delegationWithReceiver.kt")
|
||||||
|
public void testDelegationWithReceiver() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/regressions/delegationWithReceiver.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("DoubleDefine.kt")
|
@TestMetadata("DoubleDefine.kt")
|
||||||
public void testDoubleDefine() throws Exception {
|
public void testDoubleDefine() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/regressions/DoubleDefine.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/regressions/DoubleDefine.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user