Files
kotlin-fork/compiler/testData/diagnostics/tests/callableReference/memberExtensionsImportedFromObjectsUnsupported.kt
T
Alexander Udalov 04c190231a Support bound references to objects and companion objects
Tweak member extension detection a little bit to prohibit extensions imported
from objects (they don't have one of the receiver parameters)
2016-06-07 12:41:30 +03:00

27 lines
613 B
Kotlin
Vendored

// !DIAGNOSTICS: -UNUSED_EXPRESSION
import Obj.ext
import A.Companion.ext2
object Obj {
val String.ext: String get() = this
}
class A {
companion object {
val String.ext2: String get() = this
}
}
fun test() {
String::<!EXTENSION_IN_CLASS_REFERENCE_NOT_ALLOWED!>ext<!>
Obj::<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>ext<!>
String::<!EXTENSION_IN_CLASS_REFERENCE_NOT_ALLOWED!>ext2<!>
A.Companion::<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>ext2<!>
A::<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>ext2<!>
A::<!UNRESOLVED_REFERENCE!>foo<!>
A::<!UNRESOLVED_REFERENCE!>bar<!>
}