[FIR] Move type parameter scope above member and static scopes in tower

This fixes a false positive TYPE_PARAMETER_IS_NOT_AN_EXPRESSION when
a type parameter and some member, static or companion declaration have
the same name and referred to inside a class.

#KT-58028 Fixed
This commit is contained in:
Kirill Rakhman
2023-04-27 12:55:58 +02:00
committed by Space Team
parent 7958a9debd
commit bd9f36ad01
9 changed files with 140 additions and 25 deletions
@@ -0,0 +1,54 @@
// FIR_IDENTICAL
// DIAGNOSTICS: -UNUSED_VARIABLE
open class Base(any: Any) {
companion object {
val test = 42L
}
}
class C1<test> : Base(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>test<!>) {
companion object {
val test = 12
val some: Int = test
}
val test = ""
val some: String = test
fun f() {
val test = 1.0
val some: Double = test
}
}
class C2<test> : Base(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>test<!>) {
companion object {
val test = 12
val some: Int = test
}
val some: Int = test
fun f() {
val test = 1.0
val some: Double = test
}
}
class C3<test> : Base(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Long")!>test<!>) {
val some: Long = test
fun f() {
val test = 1.0
val some: Double = test
}
}
class C4<test> {
val some = <!TYPE_PARAMETER_IS_NOT_AN_EXPRESSION!>test<!>
fun f() {
val some = <!TYPE_PARAMETER_IS_NOT_AN_EXPRESSION!>test<!>
}
}