one more case of KT-445 Don't allow deep instanceof for erased parameters

===
(a : List<out Any>) is List<out Int>
===
This commit is contained in:
Stepan Koltsov
2011-12-01 17:41:13 +04:00
parent a003e6d2e4
commit 52c1e9a950
4 changed files with 56 additions and 27 deletions
@@ -0,0 +1,5 @@
// +JDK
import java.util.List
fun f(a : List<out Any>) = a is <!CANNOT_CHECK_FOR_ERASED!>List<out Int><!>
@@ -4,5 +4,5 @@
class IdUnavailableException() : Exception() {}
fun <T : Any> T.getJavaClass() : Class<T> {
return ((this <!CAST_NEVER_SUCCEEDS!>as<!> Object).getClass()) as Class<T> // Some error here, because of Exception() used above. ?!!!
return <!UNCHECKED_CAST!>((this <!CAST_NEVER_SUCCEEDS!>as<!> Object).getClass()) as Class<T><!> // Some error here, because of Exception() used above. ?!!!
}