Files
kotlin-fork/compiler/testData/diagnostics/tests/objects/kt21515/callableReferencesOldComplexCases.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

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
}
}