Fix for KT-7999: Wrong result when use nullable types as reified parameter, KT-8043: Unsafe cast to reified parameter throws NPE instead of TypeCastException
#KT-7999 Fixed #KT-8043 Fixed ~
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
if (null.foo<Any>() != true) return "fail 1"
|
||||
if (null.foo<Any?>() != true) return "fail 2"
|
||||
|
||||
if (null.foo<A>() != true) return "fail 3"
|
||||
if (null.foo<A?>() != true) return "fail 4"
|
||||
|
||||
val a = A()
|
||||
|
||||
if (a.foo<Any>() != true) return "fail 5"
|
||||
if (a.foo<Any?>() != true) return "fail 6"
|
||||
|
||||
if (a.foo<A>() != true) return "fail 7"
|
||||
if (a.foo<A?>() != true) return "fail 8"
|
||||
|
||||
val b = B()
|
||||
|
||||
if (b.foo<A>() != false) return "fail 9"
|
||||
if (b.foo<A?>() != false) return "fail 10"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user