KT-9377 Support is-checks for read-only collections

Intrinsics for is/as/as? with mutable Kotlin collections and related types.
This commit is contained in:
Dmitry Petrov
2015-09-30 18:23:26 +03:00
parent 35881198c3
commit 6cb0e5151c
32 changed files with 1291 additions and 50 deletions
@@ -13,7 +13,7 @@ fun expectUoe(block: () -> Any) {
}
fun box(): String {
val a = A<String>() as MutableList<String>
val a = A<String>() as java.util.List<String>
expectUoe { a.add("") }
expectUoe { a.remove("") }
expectUoe { a.addAll(a) }
@@ -28,7 +28,7 @@ fun box(): String {
a.listIterator(0)
a.subList(0, 0)
val b = B() as MutableList<String>
val b = B() as java.util.List<String>
expectUoe { b.add("") }
expectUoe { b.remove("") }
expectUoe { b.addAll(b) }