CAST_NEVER_SUCCEED: replace subtyping check with subclassing check #KT-13206 Fixed
(cherry picked from commit 5fc797a)
This commit is contained in:
committed by
Mikhail Glukhikh
parent
17c824f7f2
commit
a902c4901a
@@ -12,7 +12,7 @@ fun use() {
|
||||
|
||||
fun checkArrays(): Array<Any> {
|
||||
val someArray = arrayOfNulls<Any>(5)
|
||||
someArray <!CAST_NEVER_SUCCEEDS!>as<!> Array<Int>
|
||||
<!UNCHECKED_CAST!>someArray as Array<Int><!>
|
||||
return <!UNCHECKED_CAST!>someArray as Array<Any><!>
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,6 @@ package h
|
||||
public class MyClass<S, T>(<!UNUSED_PARAMETER!>param<!>: MyClass<S, T>) {
|
||||
fun test() {
|
||||
val result: MyClass<Any, Any>? = null
|
||||
MyClass<S, Any>(result <!CAST_NEVER_SUCCEEDS!>as<!> MyClass<S, Any>)
|
||||
MyClass<S, Any>(<!UNCHECKED_CAST!>result as MyClass<S, Any><!>)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user