Restore original accessor signature as deprecated
The deprecated function is not operator because it covers cases where it was used in explicit form. #KT-18789
This commit is contained in:
@@ -29,6 +29,13 @@ 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
|
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("UNCHECKED_CAST") (getOrImplicitDefault(property.name) as V1)
|
||||||
|
|
||||||
|
@Deprecated("Use getValue() with two type parameters instead")
|
||||||
|
@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.
|
* 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).
|
* @param thisRef the object for which the value is requested (not used).
|
||||||
|
|||||||
@@ -63,4 +63,15 @@ class VarByMapExtensionsTest {
|
|||||||
map["d"] = null
|
map["d"] = null
|
||||||
assertEquals(null, d)
|
assertEquals(null, d)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test fun deprecatedAccessors() {
|
||||||
|
assertEquals<Int>(
|
||||||
|
expected = map.getValue(this, VarByMapExtensionsTest::c),
|
||||||
|
actual = map.getValue<Int>(this, VarByMapExtensionsTest::c)
|
||||||
|
)
|
||||||
|
assertEquals<String>(
|
||||||
|
expected = map2.getValue<CharSequence, String>(this, VarByMapExtensionsTest::a2),
|
||||||
|
actual = map2.getValue<String>(this, VarByMapExtensionsTest::a2)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user