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
@@ -21,7 +21,7 @@ fun box(): String {
val a = C()
if (!a.add("")) return "Fail 1"
if (!(a as Addable).add("")) return "Fail 2"
if (!(a as MutableList<String>).add("")) return "Fail 3"
if (!(a as java.util.List<String>).add("")) return "Fail 3"
return "OK"
} catch (e: UnsupportedOperationException) {
return "Fail: no stub method should be generated"