Files
kotlin-fork/compiler/testData/diagnostics/tests/targetedBuiltIns/mutableMapRemove.kt
T
Dmitry Savvinov 816d89e393 [NI] Improved testdata after changes in applicabilities
This commits introduces testdata changes, where NI behaviour strictly
improved, after several previous fixes.

For some tests, just WITH_NEW_INFERENCE directive was added. It
indicates, that some of previous commits first introduced error in that
test, and then some other commit fixed it (netting no overall testdata
change). It is preferrably to keep those annotations until we will
migrate to NI completely, to prevent unexpected regressions.
2017-12-07 12:49:56 +03:00

32 lines
998 B
Kotlin
Vendored

// !DIAGNOSTICS: -UNUSED_PARAMETER -PARAMETER_NAME_CHANGED_ON_OVERRIDE
// !WITH_NEW_INFERENCE
// FULL_JDK
class KotlinMap1<K, V> : java.util.AbstractMap<K, V>() {
override val entries: MutableSet<MutableMap.MutableEntry<K, V>>
get() = throw UnsupportedOperationException()
override fun remove(x: K, y: V) = true
}
class KotlinMap2 : java.util.AbstractMap<String, Int>() {
override val entries: MutableSet<MutableMap.MutableEntry<String, Int>>
get() = throw UnsupportedOperationException()
override fun remove(x: String, y: Int) = true
}
fun foo(x: MutableMap<String, Int>, y: java.util.HashMap<String, Int>, z: java.util.AbstractMap<String, Int>) {
x.remove("", 1)
x.remove("", <!TYPE_MISMATCH!>""<!>)
x.remove("", <!NULL_FOR_NONNULL_TYPE!>null<!>)
y.remove("", 1)
y.remove("", <!TYPE_MISMATCH!>""<!>)
y.remove("", <!NULL_FOR_NONNULL_TYPE!>null<!>)
z.remove("", 1)
z.remove("", <!TYPE_MISMATCH!>""<!>)
z.remove("", null)
}