bc2228d434
If a type paramter is not reified or nullable, different errors will be reported by FirGetClassCallChecker. When determining whether type parameter wrapped in qualified access is a standalone expression or not, we examine whether the checker context has other qualified accesses in stack. Class literals (::class) is desugared to FirGetClassCall, and thus not stacked as qualified access. Since class literals are a special type of callable reference (a subtype of qualified access), we should keep track of FirGetClassCall in a similar way.
21 lines
575 B
Kotlin
Vendored
21 lines
575 B
Kotlin
Vendored
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
|
|
|
class A
|
|
|
|
val a1 = <!NULLABLE_TYPE_IN_CLASS_LITERAL_LHS!>A?::class<!>
|
|
val a2 = <!NULLABLE_TYPE_IN_CLASS_LITERAL_LHS!>A??::class<!>
|
|
|
|
val l1 = <!NULLABLE_TYPE_IN_CLASS_LITERAL_LHS!>List<String>?::class<!>
|
|
val l2 = <!NULLABLE_TYPE_IN_CLASS_LITERAL_LHS!>List?::class<!>
|
|
|
|
fun <T : Any> foo() {
|
|
val t1 = <!TYPE_PARAMETER_AS_REIFIED!>T::class<!>
|
|
val t2 = <!NULLABLE_TYPE_IN_CLASS_LITERAL_LHS!>T?::class<!>
|
|
}
|
|
|
|
inline fun <reified T : Any> bar() {
|
|
val t3 = <!NULLABLE_TYPE_IN_CLASS_LITERAL_LHS!>T?::class<!>
|
|
}
|
|
|
|
val m = Map<String>::class
|