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

View File

@@ -1,17 +0,0 @@
import A.foo
import A.bar
object A {
fun foo() = "O"
fun String.foo() = "K"
@JvmStatic
fun bar(s: Int) = "OK"
}
fun box(): String {
val static = (::bar)(0)
if (static != "OK") return "1"
return (::foo)() + (String::foo)("")
}

View File

@@ -1,13 +0,0 @@
object A {
var result = "Fail"
fun foo() {
result = "OK"
}
}
fun box(): String {
val x = A::foo
x(A)
return A.result
}

View File

@@ -1,13 +0,0 @@
object A {
var result = "Fail"
fun foo(newResult: String) {
result = newResult
}
}
fun box(): String {
val x = A::foo
x(A, "OK")
return A.result
}