FIR checkers: report SMARTCAST_IMPOSSIBLE
This commit is contained in:
committed by
TeamCityServer
parent
2bb7ef9747
commit
ce767046eb
@@ -1,11 +0,0 @@
|
||||
class A<E> {
|
||||
fun foo(): E = TODO()
|
||||
}
|
||||
|
||||
class B(var a: A<*>?) {
|
||||
fun bar() {
|
||||
if (a != null) {
|
||||
a<!UNSAFE_CALL!>.<!>foo()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
class A<E> {
|
||||
fun foo(): E = TODO()
|
||||
}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
open class A<E> {
|
||||
}
|
||||
|
||||
class B : A<String>() {
|
||||
fun foo() {}
|
||||
}
|
||||
|
||||
interface KI {
|
||||
val a: A<*>
|
||||
}
|
||||
|
||||
fun KI.bar() {
|
||||
if (a is B) {
|
||||
a.<!UNRESOLVED_REFERENCE!>foo<!>()
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
open class A<E> {
|
||||
}
|
||||
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// FIR_IDENTICAL
|
||||
class Test<E>(var c: Collection<E>) {
|
||||
fun test() {
|
||||
if (c is List<*>) {
|
||||
c.size // smartcast is unstable, but `size` is also available from `Collection`, so there should not be any error
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user