diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/simpleDelegatedToMap.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/simpleDelegatedToMap.kt index 80e82863ad2..09535d63d34 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/simpleDelegatedToMap.kt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/simpleDelegatedToMap.kt @@ -1,6 +1,5 @@ class C(val map: MutableMap) { - // NB: this does not work because of @LowPriorityInOverloadResolution not deserialized (KT-37228) - var foo by map + var foo by map } -var bar by hashMapOf() \ No newline at end of file +var bar by hashMapOf() \ No newline at end of file diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/simpleDelegatedToMap.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/simpleDelegatedToMap.txt index 51c37cff0e6..fa5999da2ab 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/simpleDelegatedToMap.txt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/simpleDelegatedToMap.txt @@ -7,19 +7,19 @@ FILE: simpleDelegatedToMap.kt public final val map: R|kotlin/collections/MutableMap| = R|/map| public get(): R|kotlin/collections/MutableMap| - public final var foo: R|ERROR CLASS: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]|by R|/map| - public get(): R|ERROR CLASS: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]| { - ^ this@R|/C|.D|/C.foo|.#(this@R|/C|, ::R|/C.foo|) + public final var foo: R|kotlin/Any|by R|/map| + public get(): R|kotlin/Any| { + ^ this@R|/C|.D|/C.foo|.R|kotlin/collections/getValue|(this@R|/C|, ::R|/C.foo|) } - public set(: R|ERROR CLASS: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]|): R|kotlin/Unit| { - this@R|/C|.D|/C.foo|.#(this@R|/C|, ::R|/C.foo|, R|/foo|) + public set(: R|kotlin/Any|): R|kotlin/Unit| { + this@R|/C|.D|/C.foo|.R|kotlin/collections/setValue|(this@R|/C|, ::R|/C.foo|, R|/foo|) } } - public final var bar: R|ERROR CLASS: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]|by R|kotlin/collections/hashMapOf|() - public get(): R|ERROR CLASS: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]| { - ^ D|/bar|.#(Null(null), ::R|/bar|) + public final var bar: R|ft!|by R|kotlin/collections/hashMapOf|() + public get(): R|ft!| { + ^ D|/bar|.R|kotlin/collections/getValue|!|, R|ft!|>(Null(null), ::R|/bar|) } - public set(: R|ERROR CLASS: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]|): R|kotlin/Unit| { - D|/bar|.#(Null(null), ::R|/bar|, R|/bar|) + public set(: R|ft!|): R|kotlin/Unit| { + D|/bar|.R|kotlin/collections/setValue|!|>(Null(null), ::R|/bar|, R|/bar|) } diff --git a/compiler/testData/codegen/box/delegatedProperty/valByMapDelegatedProperty.kt b/compiler/testData/codegen/box/delegatedProperty/valByMapDelegatedProperty.kt index 32ffed3c25c..35ded0d9078 100644 --- a/compiler/testData/codegen/box/delegatedProperty/valByMapDelegatedProperty.kt +++ b/compiler/testData/codegen/box/delegatedProperty/valByMapDelegatedProperty.kt @@ -1,6 +1,5 @@ // WITH_RUNTIME // KJS_WITH_FULL_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR import kotlin.test.* diff --git a/compiler/testData/ir/irText/declarations/localDelegatedProperties.fir.txt b/compiler/testData/ir/irText/declarations/localDelegatedProperties.fir.txt index 3a63739afda..3799cf02ee5 100644 --- a/compiler/testData/ir/irText/declarations/localDelegatedProperties.fir.txt +++ b/compiler/testData/ir/irText/declarations/localDelegatedProperties.fir.txt @@ -6,18 +6,18 @@ FILE fqName: fileName:/localDelegatedProperties.kt message: GET_VAR 'val x: kotlin.Int [val] declared in .test1' type=kotlin.Int origin=null FUN name:test2 visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY - VAR name:x type:IrErrorType [var] - SET_VAR 'var x: IrErrorType [var] declared in .test2' type=kotlin.Unit origin=EQ + VAR name:x type:kotlin.Int? [var] + SET_VAR 'var x: kotlin.Int? [var] declared in .test2' type=kotlin.Unit origin=EQ CONST Int type=kotlin.Int value=0 VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int [val] TYPE_OP type=kotlin.Int origin=IMPLICIT_CAST typeOperand=kotlin.Int - GET_VAR 'var x: IrErrorType [var] declared in .test2' type=IrErrorType origin=null - SET_VAR 'var x: IrErrorType [var] declared in .test2' type=kotlin.Unit origin=EQ + GET_VAR 'var x: kotlin.Int? [var] declared in .test2' type=kotlin.Int? origin=null + SET_VAR 'var x: kotlin.Int? [var] declared in .test2' type=kotlin.Unit origin=EQ CALL 'public final fun inc (): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null $this: GET_VAR 'val tmp_0: kotlin.Int [val] declared in .test2' type=kotlin.Int origin=null GET_VAR 'val tmp_0: kotlin.Int [val] declared in .test2' type=kotlin.Int origin=null - SET_VAR 'var x: IrErrorType [var] declared in .test2' type=kotlin.Unit origin=EQ + SET_VAR 'var x: kotlin.Int? [var] declared in .test2' type=kotlin.Unit origin=EQ CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null $this: TYPE_OP type=kotlin.Int origin=IMPLICIT_CAST typeOperand=kotlin.Int - GET_VAR 'var x: IrErrorType [var] declared in .test2' type=IrErrorType origin=null + GET_VAR 'var x: kotlin.Int? [var] declared in .test2' type=kotlin.Int? origin=null other: CONST Int type=kotlin.Int value=1 diff --git a/libraries/stdlib/src/kotlin/collections/MapAccessors.kt b/libraries/stdlib/src/kotlin/collections/MapAccessors.kt index cecf88cd94a..ad8f6347168 100644 --- a/libraries/stdlib/src/kotlin/collections/MapAccessors.kt +++ b/libraries/stdlib/src/kotlin/collections/MapAccessors.kt @@ -35,14 +35,6 @@ public inline operator fun Map.getValue(thisRef public inline operator fun MutableMap.getValue(thisRef: Any?, property: KProperty<*>): V1 = @Suppress("UNCHECKED_CAST") (getOrImplicitDefault(property.name) as V1) -@Suppress("UNUSED_PARAMETER") -@Deprecated("Use getValue() with two type parameters instead", level = DeprecationLevel.ERROR) -@kotlin.jvm.JvmName("getVarContravariant") -@kotlin.internal.LowPriorityInOverloadResolution -@kotlin.internal.InlineOnly -public inline fun MutableMap.getValue(thisRef: Any?, property: KProperty<*>): V = - @Suppress("UNCHECKED_CAST") (getOrImplicitDefault(property.name) as V) - /** * Stores the value of the property for the given object in this mutable map. * @param thisRef the object for which the value is requested (not used). diff --git a/libraries/stdlib/test/properties/delegation/MapAccessorsTest.kt b/libraries/stdlib/test/properties/delegation/MapAccessorsTest.kt index 7b9642a39ea..0258e41e629 100644 --- a/libraries/stdlib/test/properties/delegation/MapAccessorsTest.kt +++ b/libraries/stdlib/test/properties/delegation/MapAccessorsTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -68,15 +68,4 @@ class VarByMapExtensionsTest { map["d"] = null assertEquals(null, d) } - - @Test fun deprecatedAccessors() { - assertEquals( - expected = map.getValue(this, VarByMapExtensionsTest::c), - actual = @Suppress("DEPRECATION_ERROR") map.getValue(this, VarByMapExtensionsTest::c) - ) - assertEquals( - expected = map2.getValue(this, VarByMapExtensionsTest::a2), - actual = @Suppress("DEPRECATION_ERROR") map2.getValue(this, VarByMapExtensionsTest::a2) - ) - } } \ No newline at end of file