Files
kotlin-fork/compiler/testData/diagnostics/tests/objects/kt21515/callableReferencesOldComplexCases.fir.kt
T
Denis Zharkov a5545b96cb FIR: Fix ambiguity between current Companion and one from supertypes
Companion as qualifier should be found at static scope not a member one
2020-11-10 14:26:54 +03:00

70 lines
1.5 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!><!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!><!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!><!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!><!UNRESOLVED_REFERENCE!>FromBaseCompanion<!>::foo<!>
}
}