Reified 'as?' produces nullable result
Previously, this was treated as a regular CHECKCAST, causing KT-22410. #Fixed KT-22410 Target versions 1.2.30
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
fun box(): String {
|
||||
defineFunc<String>()
|
||||
|
||||
func(1)
|
||||
|
||||
return if (testedEquals) "OK" else "Fail"
|
||||
}
|
||||
|
||||
var func: (Any) -> Unit = {}
|
||||
|
||||
var testedEquals = false
|
||||
|
||||
inline fun <reified T> defineFunc() {
|
||||
func = {
|
||||
val nullable = it as? T
|
||||
|
||||
if (nullable == null)
|
||||
testedEquals = true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user