[NI] Remove hack for special functions

Treating special functions for `if`, `when`, `try`, `?:` as not accepting `Nothing` result type is incorrect.
Making so leads to cases with uninferred `Nothing` result type for inner calls and lost data flow info.
This commit is contained in:
Pavel Kirpichenkov
2019-12-26 14:57:47 +03:00
parent 9a12641fde
commit 2d21b82501
18 changed files with 87 additions and 66 deletions
+2 -1
View File
@@ -1,4 +1,5 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !WITH_NEW_INFERENCE
inline fun <reified T> parse(json: String): T? = TODO()
@@ -6,7 +7,7 @@ class MyType
fun parseMyData(json: String): MyType =
try {
parse(json) // error with new inf only: Cannot use 'Nothing?' as reified type parameter
<!NI;REIFIED_TYPE_FORBIDDEN_SUBSTITUTION, NI;REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>parse<!>(json) // error with new inf only: Cannot use 'Nothing?' as reified type parameter
?: throw IllegalArgumentException("Can't parse")
} catch (e: Exception) {
throw IllegalArgumentException("Can't parse")