Files
kotlin-fork/compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethodInGenericClass.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

29 lines
737 B
Kotlin
Vendored

// !WITH_NEW_INFERENCE
// !DIAGNOSTICS: -UNUSED_PARAMETER
import kotlin.reflect.KProperty
class A<R>() {
operator fun <T> getValue(t: Any?, p: KProperty<*>): T = null!!
operator fun <T> setValue(t: Any?, p: KProperty<*>, x: T) = Unit
}
var a1: Int by A()
var a2: Int by A<String>()
class B<R>() {
operator fun <T> getValue(t: Any?, p: KProperty<*>): T = null!!
operator fun setValue(t: Any?, p: KProperty<*>, x: R) = Unit
}
var b1: Int by B()
var b2: Int by B<Number>()
class C<R>() {
operator fun getValue(t: Any?, p: KProperty<*>): R = null!!
operator fun <T> setValue(t: Any?, p: KProperty<*>, x: T) = Unit
}
var c1: Int by C()
var c2: Int by <!DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE!>C<Number>()<!>