Files
kotlin-fork/compiler/testData/diagnostics/tests/scopes/kt900.fir.kt
T
Tianyu Geng fb14b03824 FIR checker: skip error named reference if receiver is unresolved
Currently, FIR reports errors caused by previous resolution failure. For
example with unresolved `a` and `b` in code `a.b`, both `a` and `b` are
highlighted. FE1.0 only highlights `a` since it's the root cause. This
change applies this heuristics when reporting FirDiagnostics.
2021-03-29 12:45:27 +03:00

69 lines
1.0 KiB
Kotlin
Vendored

//FILE:a.kt
//KT-900 Inaccessible class should be unresolved
package a
fun foo() {
val b : <!UNRESOLVED_REFERENCE!>B<!> = <!UNRESOLVED_REFERENCE!>B<!>() //only B() is unresolved, but in ": B" and "B.foo()" B should also be unresolved
<!UNRESOLVED_REFERENCE!>B<!>.foo()
<!UNRESOLVED_REFERENCE!>P<!>.foo()
<!UNRESOLVED_REFERENCE!>M<!>.bar()
}
class A() {
companion object {
class B() {
companion object {
fun foo() {}
}
}
object P {
fun foo() {}
}
}
}
object N {
object M {
fun bar() {}
}
}
//FILE:b.kt
package b
import b.N.M
import b.A.Companion.P
import b.A.Companion.B
fun foo() {
val b : B = B()
B.foo()
P.foo()
M.bar()
}
class A() {
companion object {
class B() {
companion object {
fun foo() {}
}
}
object P {
fun foo() {}
}
}
}
object N {
object M {
fun bar() {}
}
}