fb14b03824
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.
70 lines
1.4 KiB
Kotlin
Vendored
70 lines
1.4 KiB
Kotlin
Vendored
// !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
|
|
|
// ===== Case 1: LHS is a class
|
|
//
|
|
object A {
|
|
open class Base {
|
|
companion object {
|
|
class FromBaseCompanion {
|
|
fun foo() = 42
|
|
}
|
|
}
|
|
}
|
|
|
|
class Derived : Base() {
|
|
val a = <!UNRESOLVED_REFERENCE!>FromBaseCompanion<!>::foo
|
|
}
|
|
}
|
|
|
|
// ===== Case 2: LHS is a class with companion object, function comes from class
|
|
|
|
object B {
|
|
open class Base {
|
|
companion object {
|
|
class FromBaseCompanion {
|
|
fun foo() = 42
|
|
|
|
companion object {}
|
|
}
|
|
}
|
|
}
|
|
|
|
class Derived : Base() {
|
|
val a = <!UNRESOLVED_REFERENCE!>FromBaseCompanion<!>::foo
|
|
}
|
|
}
|
|
|
|
// ==== Case 3: LHS is a class with companion object, function comes from companion
|
|
|
|
object C {
|
|
open class Base {
|
|
companion object {
|
|
class FromBaseCompanion {
|
|
companion object {
|
|
fun foo() = 42
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
class Derived : Base() {
|
|
val a = <!UNRESOLVED_REFERENCE!>FromBaseCompanion<!>::foo
|
|
}
|
|
}
|
|
|
|
// ==== Case 4: LHS is an object
|
|
|
|
object D {
|
|
open class Base {
|
|
companion object {
|
|
object FromBaseCompanion {
|
|
fun foo() = 42
|
|
}
|
|
}
|
|
}
|
|
|
|
class Derived : Base() {
|
|
val a = <!UNRESOLVED_REFERENCE!>FromBaseCompanion<!>::foo
|
|
}
|
|
}
|