Fix delegated property resolve when provideDelegate has this as argument
#KT-41135 Fixed
This commit is contained in:
Generated
+5
@@ -9818,6 +9818,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
public void testPropertyMetadata() throws Exception {
|
public void testPropertyMetadata() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/delegatedProperty/provideDelegate/propertyMetadata.kt");
|
runTest("compiler/testData/codegen/box/delegatedProperty/provideDelegate/propertyMetadata.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("provideDelegateByExtensionFunction.kt")
|
||||||
|
public void testProvideDelegateByExtensionFunction() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/delegatedProperty/provideDelegate/provideDelegateByExtensionFunction.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+31
@@ -0,0 +1,31 @@
|
|||||||
|
// IGNORE_BACKEND_FIR: JVM_IR
|
||||||
|
|
||||||
|
import kotlin.reflect.KProperty
|
||||||
|
|
||||||
|
class TypeInference {
|
||||||
|
val explicitTypes by providerFun<TypeInference, String>()
|
||||||
|
val withoutTypes: String by providerFun()
|
||||||
|
}
|
||||||
|
|
||||||
|
class Inv<T>(val x: T)
|
||||||
|
|
||||||
|
fun <T, R> T.providerFun() = object : DelegateProvider<T, R>() {
|
||||||
|
override fun provideDelegate(thisRef: T, property: KProperty<*>): Inv<R> {
|
||||||
|
return Inv("OK") as Inv<R>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
operator fun <T> Inv<T>.getValue(thisRef: Any?, property: KProperty<*>): T = x
|
||||||
|
|
||||||
|
abstract class DelegateProvider<T, R> {
|
||||||
|
abstract operator fun provideDelegate(
|
||||||
|
thisRef: T,
|
||||||
|
property: KProperty<*>
|
||||||
|
): Inv<R>
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val t = TypeInference()
|
||||||
|
if (t.explicitTypes != t.withoutTypes) return "fail 1"
|
||||||
|
return t.withoutTypes
|
||||||
|
}
|
||||||
+5
@@ -11043,6 +11043,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
public void testPropertyMetadata() throws Exception {
|
public void testPropertyMetadata() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/delegatedProperty/provideDelegate/propertyMetadata.kt");
|
runTest("compiler/testData/codegen/box/delegatedProperty/provideDelegate/propertyMetadata.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("provideDelegateByExtensionFunction.kt")
|
||||||
|
public void testProvideDelegateByExtensionFunction() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/delegatedProperty/provideDelegate/provideDelegateByExtensionFunction.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
@@ -11043,6 +11043,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
public void testPropertyMetadata() throws Exception {
|
public void testPropertyMetadata() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/delegatedProperty/provideDelegate/propertyMetadata.kt");
|
runTest("compiler/testData/codegen/box/delegatedProperty/provideDelegate/propertyMetadata.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("provideDelegateByExtensionFunction.kt")
|
||||||
|
public void testProvideDelegateByExtensionFunction() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/delegatedProperty/provideDelegate/provideDelegateByExtensionFunction.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
@@ -9818,6 +9818,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
public void testPropertyMetadata() throws Exception {
|
public void testPropertyMetadata() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/delegatedProperty/provideDelegate/propertyMetadata.kt");
|
runTest("compiler/testData/codegen/box/delegatedProperty/provideDelegate/propertyMetadata.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("provideDelegateByExtensionFunction.kt")
|
||||||
|
public void testProvideDelegateByExtensionFunction() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/delegatedProperty/provideDelegate/provideDelegateByExtensionFunction.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ interface ClassicTypeSystemContext : TypeSystemInferenceExtensionContext, TypeSy
|
|||||||
|
|
||||||
override fun SimpleTypeMarker.isStubType(): Boolean {
|
override fun SimpleTypeMarker.isStubType(): Boolean {
|
||||||
require(this is SimpleType, this::errorMessage)
|
require(this is SimpleType, this::errorMessage)
|
||||||
return this is StubType
|
return this is AbstractStubType
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun CapturedTypeMarker.lowerType(): KotlinTypeMarker? {
|
override fun CapturedTypeMarker.lowerType(): KotlinTypeMarker? {
|
||||||
|
|||||||
Generated
+5
@@ -8383,6 +8383,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
|||||||
public void testPropertyMetadata() throws Exception {
|
public void testPropertyMetadata() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/delegatedProperty/provideDelegate/propertyMetadata.kt");
|
runTest("compiler/testData/codegen/box/delegatedProperty/provideDelegate/propertyMetadata.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("provideDelegateByExtensionFunction.kt")
|
||||||
|
public void testProvideDelegateByExtensionFunction() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/delegatedProperty/provideDelegate/provideDelegateByExtensionFunction.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Generated
+5
@@ -8383,6 +8383,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
|||||||
public void testPropertyMetadata() throws Exception {
|
public void testPropertyMetadata() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/delegatedProperty/provideDelegate/propertyMetadata.kt");
|
runTest("compiler/testData/codegen/box/delegatedProperty/provideDelegate/propertyMetadata.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("provideDelegateByExtensionFunction.kt")
|
||||||
|
public void testProvideDelegateByExtensionFunction() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/delegatedProperty/provideDelegate/provideDelegateByExtensionFunction.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
@@ -8383,6 +8383,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
public void testPropertyMetadata() throws Exception {
|
public void testPropertyMetadata() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/delegatedProperty/provideDelegate/propertyMetadata.kt");
|
runTest("compiler/testData/codegen/box/delegatedProperty/provideDelegate/propertyMetadata.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("provideDelegateByExtensionFunction.kt")
|
||||||
|
public void testProvideDelegateByExtensionFunction() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/delegatedProperty/provideDelegate/provideDelegateByExtensionFunction.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user