Prohibit check for instance of a non-reified, non-subtype type parameter

#KT-12683 Fixed
 #KT-9986 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2017-03-30 03:55:56 +03:00
parent 9fdd5fe5e8
commit 0d6b7bb6a1
8 changed files with 59 additions and 7 deletions
@@ -0,0 +1,27 @@
fun <T, S : T> test(x: T?, y: S, z: T) {
x is <!CANNOT_CHECK_FOR_ERASED!>T<!>
x is T?
y is T
y is S
y is T<!USELESS_NULLABLE_CHECK!>?<!>
y is S<!USELESS_NULLABLE_CHECK!>?<!>
z is T
z is T<!USELESS_NULLABLE_CHECK!>?<!>
<!UNCHECKED_CAST!>null as T<!>
null <!USELESS_CAST!>as T?<!>
<!UNCHECKED_CAST!>null as S<!>
}
inline fun <reified T> test(x: T?) {
x is T
null as T
null <!USELESS_CAST!>as T?<!>
}
fun <T> foo(x: List<T>, y: List<T>?) {
x is List<T>
y is List<T>
}