Files
kotlin-fork/compiler/testData/diagnostics/tests/sourceCompatibility/noLocalDelegatedProperty.fir.kt
T
Tianyu Geng b5caa658d6 FIR: introduce delegate diagnostics
This commit adds diagnostics for the following

* DELEGATE_SPECIAL_FUNCTION_MISSING
* DELEGATE_SPECIAL_FUNCTION_AMBIGUITY
* DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE
2021-04-19 15:11:16 +03:00

22 lines
436 B
Kotlin
Vendored

// !LANGUAGE: -LocalDelegatedProperties
import kotlin.reflect.KProperty
class Delegate {
operator fun getValue(t: Any?, p: KProperty<*>): Int = 1
}
fun foo(): Int {
val prop: Int by Delegate()
val prop2: Int by <!DELEGATE_SPECIAL_FUNCTION_MISSING!>123<!>
val obj = object {
fun v(): Int {
val prop3: Int by Delegate()
return prop3
}
}
return prop + prop2 + obj.v()
}