[FIR] Add CAST_NEVER_SUCCEEDS

This commit is contained in:
Ivan Kochurkin
2021-09-16 20:58:52 +03:00
committed by TeamCityServer
parent 4ca757446a
commit 2b5524b18f
42 changed files with 206 additions and 273 deletions
@@ -9,4 +9,4 @@ fun <T> foo2(): T = TODO()
val test = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo2<!>().plus("") <!USELESS_CAST!>as String<!>
fun <T> T.bar() = this
val barTest = "".bar() as Number
val barTest = "".bar() <!CAST_NEVER_SUCCEEDS!>as<!> Number
@@ -1,11 +0,0 @@
fun <R> runCatching(block: () -> R) = null as Result<R>
class Result<out T> {
fun getOrNull(): T? = null
}
fun main() {
runCatching {
null
}.getOrNull() // don't report IMPLICIT_NOTHING_TYPE_ARGUMENT_IN_RETURN_POSITION
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
fun <R> runCatching(block: () -> R) = null <!CAST_NEVER_SUCCEEDS!>as<!> Result<R>
class Result<out T> {
@@ -52,7 +52,7 @@ fun test() {
if (<!USELESS_IS_CHECK!>x11 is Foo<<!UNRESOLVED_REFERENCE!>_<!>><!>) { }
x10 as <!UNRESOLVED_REFERENCE!>_<!>
x10 as Foo<<!UNRESOLVED_REFERENCE!>_<!>>
x10 <!CAST_NEVER_SUCCEEDS!>as<!> Foo<<!UNRESOLVED_REFERENCE!>_<!>>
val x12: Foo<@<!UNDERSCORE_USAGE_WITHOUT_BACKTICKS, UNRESOLVED_REFERENCE!>_<!> Int>? = null
val x13: Foo<@<!UNDERSCORE_USAGE_WITHOUT_BACKTICKS, UNRESOLVED_REFERENCE!>_<!>() Int>? = null