Prohibit callable references to object members

To be able to make them more useful in the future, i.e. bound to the object
instance
This commit is contained in:
Alexander Udalov
2015-10-14 16:39:43 +03:00
parent 63dfe13c43
commit ced1edcf98
26 changed files with 122 additions and 218 deletions
@@ -0,0 +1,31 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION
import Obj.ext
import A.Companion.ext2
object Obj {
fun foo() {}
val bar = 2
val String.ext: String get() = this
}
class A {
companion object {
fun foo() {}
val bar = 2
val String.ext2: String get() = this
}
}
fun test() {
Obj::<!CALLABLE_REFERENCE_TO_OBJECT_MEMBER!>foo<!>
Obj::<!CALLABLE_REFERENCE_TO_OBJECT_MEMBER!>bar<!>
String::<!CALLABLE_REFERENCE_TO_OBJECT_MEMBER!>ext<!>
A.Companion::<!CALLABLE_REFERENCE_TO_OBJECT_MEMBER!>foo<!>
A.Companion::<!CALLABLE_REFERENCE_TO_OBJECT_MEMBER!>bar<!>
String::<!CALLABLE_REFERENCE_TO_OBJECT_MEMBER!>ext2<!>
A::<!UNRESOLVED_REFERENCE!>foo<!>
A::<!UNRESOLVED_REFERENCE!>bar<!>
}