[NI] Add support ExpectedTypeFromCast to new inference. #KT-30405 Fixed

This commit is contained in:
Dmitriy Novozhilov
2019-03-14 14:14:28 +03:00
parent 9062811231
commit 1c92c22dee
12 changed files with 123 additions and 48 deletions
@@ -0,0 +1,16 @@
// !WITH_NEW_INFERENCE
// !LANGUAGE: +ExpectedTypeFromCast
// !CHECK_TYPE
// Issue: KT-30405
inline fun <reified T> foo(): T {
TODO()
}
fun test() {
val fooCall = foo() as String // T in foo should be inferred to String
fooCall checkType { _<String>() }
val safeFooCall = foo() as? String
safeFooCall checkType { _<String?>() }
}