Files
kotlin-fork/compiler/testData/diagnostics/testsWithStdLib/callableReference/property/extensionFromTopLevel.kt
T
Alexander Udalov a38a396a43 Remove default import "kotlin.reflect"
Basic reflection is usable without any imports (with :: literals)

This reverts commit 9503056dd5.
2014-07-02 01:55:53 +04:00

28 lines
676 B
Kotlin

import kotlin.reflect.*
val String.countCharacters: Int
get() = length
var Int.meaning: Long
get() = 42L
set(value) {}
fun test() {
val f = String::countCharacters
f : KTopLevelExtensionProperty<String, Int>
f : KExtensionProperty<String, Int>
<!TYPE_MISMATCH!>f<!> : KMutableExtensionProperty<String, Int>
f.get("abc") : Int
f.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>set<!>("abc", 0)
val g = Int::meaning
g : KTopLevelExtensionProperty<Int, Long>
g : KExtensionProperty<Int, Long>
g : KMutableTopLevelExtensionProperty<Int, Long>
g : KMutableExtensionProperty<Int, Long>
g.get(0) : Long
g.set(1, 0L)
}