Forbid dynamic on the RHS of is and as

This commit is contained in:
Andrey Breslav
2014-11-13 04:21:27 +02:00
parent 645d931a9e
commit c8029307fa
8 changed files with 62 additions and 6 deletions
@@ -0,0 +1,32 @@
// !DIAGNOSTICS: -REDUNDANT_NULLABLE
// MODULE[js]: m1
// FILE: k.kt
fun test(d: Any, dl: Collection<dynamic>) {
d as <!DYNAMIC_NOT_ALLOWED!>dynamic<!>
d as <!DYNAMIC_NOT_ALLOWED!>dynamic?<!>
d as? <!DYNAMIC_NOT_ALLOWED!>dynamic<!>
d as? <!DYNAMIC_NOT_ALLOWED!>dynamic?<!>
d is <!DYNAMIC_NOT_ALLOWED!>dynamic<!>
d is <!DYNAMIC_NOT_ALLOWED!>dynamic?<!>
d !is <!DYNAMIC_NOT_ALLOWED!>dynamic<!>
d !is <!DYNAMIC_NOT_ALLOWED!>dynamic?<!>
when (d) {
is <!DYNAMIC_NOT_ALLOWED!>dynamic<!> -> {}
is <!DYNAMIC_NOT_ALLOWED!>dynamic?<!> -> {}
!is <!DYNAMIC_NOT_ALLOWED!>dynamic<!> -> {}
!is <!DYNAMIC_NOT_ALLOWED!>dynamic?<!> -> {}
}
dl as List<dynamic>
dl is List<dynamic>
when (dl) {
is List<dynamic> -> {}
}
}
@@ -0,0 +1,3 @@
package
internal fun test(/*0*/ d: kotlin.Any, /*1*/ dl: kotlin.Collection<dynamic>): kotlin.Unit