FIR checkers: report SMARTCAST_IMPOSSIBLE

This commit is contained in:
Tianyu Geng
2021-05-08 20:51:02 -07:00
committed by TeamCityServer
parent 2bb7ef9747
commit ce767046eb
58 changed files with 347 additions and 268 deletions
@@ -1,15 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
interface Ctx
class CtxImpl : Ctx {
fun doJob(a: Int) {}
fun doJob(s: String) {}
}
open class Test(open val ctx: Ctx) {
fun test() {
when (ctx) {
is CtxImpl -> ctx.<!UNRESOLVED_REFERENCE!>doJob<!>(2)
}
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
interface Ctx
@@ -1,14 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class A
class B
fun A.foo(a: A) {}
fun A.foo(b: B) {}
var a: A? = null
fun smartCastInterference(b: B) {
if (a != null) {
a<!UNSAFE_CALL!>.<!>foo(b)
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
class A