From 78ec4b52484406a51de1ec049b717ee81a752ade Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Tue, 27 Apr 2021 13:26:54 +0300 Subject: [PATCH] FIR: Mute property-delegation-inference related tests They started failing once we began reporting diagnostics from completion The main reason is that we resolve `delegate()` call from `delegate().getValue()` in the independent context, while in FE 1.0 it's being resolved within the same system as getValue ^KT-46420 Relates --- .../genericDelegateWithNoAdditionalInfo.kt | 3 ++- .../provideDelegateByExtensionFunction.kt | 1 + .../provideDelegate/hostAndReceiver2.fir.kt | 2 +- .../provideDelegate/hostAndReceiver3.fir.kt | 12 ++++++++++++ .../provideDelegate/hostAndReceiver3.kt | 1 - .../delegatedProperty/provideDelegate/kt38714.fir.kt | 2 +- .../noOperatorModifierOnProvideDelegate.fir.kt | 3 +-- .../provideDelegateResolutionWithStubTypes.fir.kt | 9 +++++++++ .../provideDelegateResolutionWithStubTypes.kt | 4 +--- 9 files changed, 28 insertions(+), 9 deletions(-) create mode 100644 compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/hostAndReceiver3.fir.kt create mode 100644 compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/provideDelegateResolutionWithStubTypes.fir.kt diff --git a/compiler/testData/codegen/box/delegatedProperty/provideDelegate/genericDelegateWithNoAdditionalInfo.kt b/compiler/testData/codegen/box/delegatedProperty/provideDelegate/genericDelegateWithNoAdditionalInfo.kt index cb593164c27..600c438216d 100644 --- a/compiler/testData/codegen/box/delegatedProperty/provideDelegate/genericDelegateWithNoAdditionalInfo.kt +++ b/compiler/testData/codegen/box/delegatedProperty/provideDelegate/genericDelegateWithNoAdditionalInfo.kt @@ -1,3 +1,4 @@ +// IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME import kotlin.reflect.KProperty @@ -14,4 +15,4 @@ fun delegate(): DelegateProvider = object : DelegateProvide fun box(): String { val value: String by delegate() return value -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/delegatedProperty/provideDelegate/provideDelegateByExtensionFunction.kt b/compiler/testData/codegen/box/delegatedProperty/provideDelegate/provideDelegateByExtensionFunction.kt index 9b5938014a1..3d792c0e713 100644 --- a/compiler/testData/codegen/box/delegatedProperty/provideDelegate/provideDelegateByExtensionFunction.kt +++ b/compiler/testData/codegen/box/delegatedProperty/provideDelegate/provideDelegateByExtensionFunction.kt @@ -1,3 +1,4 @@ +// IGNORE_BACKEND_FIR: JVM_IR import kotlin.reflect.KProperty class TypeInference { diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/hostAndReceiver2.fir.kt b/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/hostAndReceiver2.fir.kt index 9643cdaf112..9e8b0bbc136 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/hostAndReceiver2.fir.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/hostAndReceiver2.fir.kt @@ -9,6 +9,6 @@ object T2 { operator fun Foo.provideDelegate(host: T2, p: Any?): Foo = TODO() operator fun Foo.getValue(receiver: String, p: Any?): T = TODO() - val String.test1: String by delegate() + val String.test1: String by delegate() val test2: String by delegate() } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/hostAndReceiver3.fir.kt b/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/hostAndReceiver3.fir.kt new file mode 100644 index 00000000000..6dadf66c16c --- /dev/null +++ b/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/hostAndReceiver3.fir.kt @@ -0,0 +1,12 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +object T3 { + interface Foo + + fun delegate(): Foo = TODO() + + operator fun Foo.provideDelegate(host: T3, p: Any?): Foo = TODO() + operator fun Foo.getValue(receiver: T3, p: Any?): T = TODO() + + val test1: String by delegate() +} diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/hostAndReceiver3.kt b/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/hostAndReceiver3.kt index b3672a1d18d..724f8ffddad 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/hostAndReceiver3.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/hostAndReceiver3.kt @@ -1,4 +1,3 @@ -// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER object T3 { diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/kt38714.fir.kt b/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/kt38714.fir.kt index b510186161b..4aad782b7b8 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/kt38714.fir.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/kt38714.fir.kt @@ -4,7 +4,7 @@ import kotlin.reflect.KProperty abstract class MainActivity : DIAware1() { - val bar: Bar by instance1() + val bar: Bar by instance1() } class Bar diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/noOperatorModifierOnProvideDelegate.fir.kt b/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/noOperatorModifierOnProvideDelegate.fir.kt index 6cc2b6c2221..4623cf23593 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/noOperatorModifierOnProvideDelegate.fir.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/noOperatorModifierOnProvideDelegate.fir.kt @@ -13,6 +13,5 @@ fun String.provideDelegate(a: Any?, p: KProperty<*>) = StringDelegate(this) operator fun String.getValue(a: Any?, p: KProperty<*>) = this val test1: String by "OK" -val test2: Int by "OK" +val test2: Int by "OK" val test3 by "OK" - diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/provideDelegateResolutionWithStubTypes.fir.kt b/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/provideDelegateResolutionWithStubTypes.fir.kt new file mode 100644 index 00000000000..3470a652725 --- /dev/null +++ b/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/provideDelegateResolutionWithStubTypes.fir.kt @@ -0,0 +1,9 @@ +val test: String by materializeDelegate() + +fun materializeDelegate(): Delegate = Delegate() + +operator fun K.provideDelegate(receiver: Any?, property: kotlin.reflect.KProperty<*>): K = this + +class Delegate { + operator fun getValue(thisRef: Any?, property: kotlin.reflect.KProperty<*>): V = TODO() +} diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/provideDelegateResolutionWithStubTypes.kt b/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/provideDelegateResolutionWithStubTypes.kt index 8c100d1a814..255377a047b 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/provideDelegateResolutionWithStubTypes.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/provideDelegateResolutionWithStubTypes.kt @@ -1,5 +1,3 @@ -// FIR_IDENTICAL - val test: String by materializeDelegate() fun materializeDelegate(): Delegate = Delegate() @@ -8,4 +6,4 @@ operator fun K.provideDelegate(receiver: Any?, property: kotlin.reflect.KPro class Delegate { operator fun getValue(thisRef: Any?, property: kotlin.reflect.KProperty<*>): V = TODO() -} \ No newline at end of file +}