Files
kotlin-fork/compiler/testData/diagnostics/testsWithStdLib/callableReference/property/topLevelFromTopLevel.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

34 lines
752 B
Kotlin

import kotlin.reflect.*
var x: Int = 42
val y: String get() = "y"
fun testX() {
val xx = ::x
xx : KMutableTopLevelProperty<Int>
xx : KMutableTopLevelVariable<Int>
xx : KTopLevelProperty<Int>
xx : KTopLevelVariable<Int>
xx : KMutableProperty<Int>
xx : KMutableVariable<Int>
xx : KProperty<Int>
xx : KCallable<Int>
xx.name : String
xx.get() : Int
xx.set(239)
}
fun testY() {
val yy = ::y
<!TYPE_MISMATCH!>yy<!> : KMutableTopLevelProperty<String>
yy : KTopLevelVariable<String>
<!TYPE_MISMATCH!>yy<!> : KMutableProperty<String>
yy : KProperty<String>
yy : KCallable<String>
yy.name : String
yy.get() : String
yy.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>set<!>("yy")
}