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:
+31
@@ -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<!>
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package
|
||||
|
||||
public fun test(): kotlin.Unit
|
||||
|
||||
public final class A {
|
||||
public constructor A()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public companion object Companion {
|
||||
private constructor Companion()
|
||||
public final val bar: kotlin.Int = 2
|
||||
public final val kotlin.String.ext2: kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
public object Obj {
|
||||
private constructor Obj()
|
||||
public final val bar: kotlin.Int = 2
|
||||
public final val kotlin.String.ext: kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Reference in New Issue
Block a user