Introduce FirFunctionReturnTypeMismatchChecker
This commit is contained in:
@@ -4,7 +4,7 @@ fun <T> f1(): KClass<Array<T>> = <!CLASS_LITERAL_LHS_NOT_A_CLASS!>Array<T>::clas
|
||||
fun <T> f2(): KClass<Array<Array<T>>> = <!CLASS_LITERAL_LHS_NOT_A_CLASS!>Array<Array<T>>::class<!>
|
||||
inline fun <reified T> f3() = Array<T>::class
|
||||
inline fun <reified T> f4() = Array<Array<T>>::class
|
||||
fun f5(): KClass<Array<Any>> = <!CLASS_LITERAL_LHS_NOT_A_CLASS!>Array<*>::class<!>
|
||||
fun f5(): KClass<Array<Any>> = <!CLASS_LITERAL_LHS_NOT_A_CLASS, RETURN_TYPE_MISMATCH!>Array<*>::class<!>
|
||||
fun f6(): KClass<Array<Int?>> = Array<Int?>::class
|
||||
fun f7() = <!CLASS_LITERAL_LHS_NOT_A_CLASS!>Array<List<String>>::class<!>
|
||||
fun f8() = <!CLASS_LITERAL_LHS_NOT_A_CLASS!>Array<List<String>?>::class<!>
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
// KT-16291 Smart cast doesn't work when getting class of instance
|
||||
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
class Foo {
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other === null || other::class != this::class) return false
|
||||
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
fun test(f: Foo?): KClass<out Foo>? = if (f != null) f::class else null
|
||||
|
||||
fun test2(): KClass<out Foo>? {
|
||||
var f: Foo? = null
|
||||
if (f != null) {
|
||||
run { f = null }
|
||||
return <!RETURN_TYPE_MISMATCH!><!EXPRESSION_OF_NULLABLE_TYPE_IN_CLASS_LITERAL_LHS!>f<!>::class<!>
|
||||
}
|
||||
return null
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
// KT-16291 Smart cast doesn't work when getting class of instance
|
||||
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
Reference in New Issue
Block a user