Drop deprecated MutableMap property delegation operator
This commit is contained in:
+2
-3
@@ -1,6 +1,5 @@
|
||||
class C(val map: MutableMap<String, Any>) {
|
||||
// NB: this does not work because of @LowPriorityInOverloadResolution not deserialized (KT-37228)
|
||||
var foo by <!AMBIGUITY!>map<!>
|
||||
var foo by map
|
||||
}
|
||||
|
||||
var bar by <!AMBIGUITY!>hashMapOf<String, Any>()<!>
|
||||
var bar by hashMapOf<String, Any>()
|
||||
+10
-10
@@ -7,19 +7,19 @@ FILE: simpleDelegatedToMap.kt
|
||||
public final val map: R|kotlin/collections/MutableMap<kotlin/String, kotlin/Any>| = R|<local>/map|
|
||||
public get(): R|kotlin/collections/MutableMap<kotlin/String, kotlin/Any>|
|
||||
|
||||
public final var foo: R|ERROR CLASS: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]|by R|<local>/map|
|
||||
public get(): R|ERROR CLASS: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]| {
|
||||
^ this@R|/C|.D|/C.foo|.<Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>#(this@R|/C|, ::R|/C.foo|)
|
||||
public final var foo: R|kotlin/Any|by R|<local>/map|
|
||||
public get(): R|kotlin/Any| {
|
||||
^ this@R|/C|.D|/C.foo|.R|kotlin/collections/getValue|<R|kotlin/Any|, R|kotlin/Any|>(this@R|/C|, ::R|/C.foo|)
|
||||
}
|
||||
public set(<set-?>: R|ERROR CLASS: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]|): R|kotlin/Unit| {
|
||||
this@R|/C|.D|/C.foo|.<Inapplicable(INAPPLICABLE): [kotlin/collections/setValue]>#(this@R|/C|, ::R|/C.foo|, R|<local>/foo|)
|
||||
public set(<set-?>: R|kotlin/Any|): R|kotlin/Unit| {
|
||||
this@R|/C|.D|/C.foo|.R|kotlin/collections/setValue|<R|kotlin/Any|>(this@R|/C|, ::R|/C.foo|, R|<local>/foo|)
|
||||
}
|
||||
|
||||
}
|
||||
public final var bar: R|ERROR CLASS: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]|by R|kotlin/collections/hashMapOf|<R|kotlin/String|, R|kotlin/Any|>()
|
||||
public get(): R|ERROR CLASS: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]| {
|
||||
^ D|/bar|.<Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>#(Null(null), ::R|/bar|)
|
||||
public final var bar: R|ft<kotlin/Any, kotlin/Any?>!|by R|kotlin/collections/hashMapOf|<R|kotlin/String|, R|kotlin/Any|>()
|
||||
public get(): R|ft<kotlin/Any, kotlin/Any?>!| {
|
||||
^ D|/bar|.R|kotlin/collections/getValue|<R|ft<kotlin/Any, kotlin/Any?>!|, R|ft<kotlin/Any, kotlin/Any?>!|>(Null(null), ::R|/bar|)
|
||||
}
|
||||
public set(<set-?>: R|ERROR CLASS: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]|): R|kotlin/Unit| {
|
||||
D|/bar|.<Inapplicable(INAPPLICABLE): [kotlin/collections/setValue]>#(Null(null), ::R|/bar|, R|<local>/bar|)
|
||||
public set(<set-?>: R|ft<kotlin/Any, kotlin/Any?>!|): R|kotlin/Unit| {
|
||||
D|/bar|.R|kotlin/collections/setValue|<R|ft<kotlin/Any, kotlin/Any?>!|>(Null(null), ::R|/bar|, R|<local>/bar|)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
|
||||
@@ -6,18 +6,18 @@ FILE fqName:<root> fileName:/localDelegatedProperties.kt
|
||||
message: GET_VAR 'val x: kotlin.Int [val] declared in <root>.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 <root>.test2' type=kotlin.Unit origin=EQ
|
||||
VAR name:x type:kotlin.Int? [var]
|
||||
SET_VAR 'var x: kotlin.Int? [var] declared in <root>.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 <root>.test2' type=IrErrorType origin=null
|
||||
SET_VAR 'var x: IrErrorType [var] declared in <root>.test2' type=kotlin.Unit origin=EQ
|
||||
GET_VAR 'var x: kotlin.Int? [var] declared in <root>.test2' type=kotlin.Int? origin=null
|
||||
SET_VAR 'var x: kotlin.Int? [var] declared in <root>.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 <root>.test2' type=kotlin.Int origin=null
|
||||
GET_VAR 'val tmp_0: kotlin.Int [val] declared in <root>.test2' type=kotlin.Int origin=null
|
||||
SET_VAR 'var x: IrErrorType [var] declared in <root>.test2' type=kotlin.Unit origin=EQ
|
||||
SET_VAR 'var x: kotlin.Int? [var] declared in <root>.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 <root>.test2' type=IrErrorType origin=null
|
||||
GET_VAR 'var x: kotlin.Int? [var] declared in <root>.test2' type=kotlin.Int? origin=null
|
||||
other: CONST Int type=kotlin.Int value=1
|
||||
|
||||
@@ -35,14 +35,6 @@ public inline operator fun <V, V1 : V> Map<in String, @Exact V>.getValue(thisRef
|
||||
public inline operator fun <V, V1 : V> MutableMap<in String, out @Exact V>.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 <V> MutableMap<in String, in V>.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).
|
||||
|
||||
@@ -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<Int>(
|
||||
expected = map.getValue(this, VarByMapExtensionsTest::c),
|
||||
actual = @Suppress("DEPRECATION_ERROR") map.getValue<Int>(this, VarByMapExtensionsTest::c)
|
||||
)
|
||||
assertEquals<String>(
|
||||
expected = map2.getValue<CharSequence, String>(this, VarByMapExtensionsTest::a2),
|
||||
actual = @Suppress("DEPRECATION_ERROR") map2.getValue<String>(this, VarByMapExtensionsTest::a2)
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user