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:
Dmitry Petrov
2018-01-24 14:24:56 +03:00
parent bd25bf14df
commit 5e34f290ce
7 changed files with 61 additions and 5 deletions
@@ -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
}
}