Files
Denis.Zharkov e359db4111 K2: Set proper source for implicit it/receiver parameter
Previously, error types on those implicit parameters were being lost.

Changed test data is only partly here
(only parts that are considered to be correct).

Other ones (new green-to-red changes) should belong to the next commit
and will be fixed soon (as a part of PCLA).
2024-01-11 10:32:12 +00:00

26 lines
793 B
Kotlin
Vendored

// !DIAGNOSTICS: -UNUSED_PARAMETER
object Delegate {
operator fun getValue(x: Any?, y: Any?): String = ""
}
fun <T> delegateFactory(p: Any) = Delegate
class C(p: Any, val v: Any) {
val test1 get() = <!UNRESOLVED_REFERENCE!>p<!>
val test2 get() = v
// NB here we can use both 'T' (property type parameter) and 'p' (primary constructor parameter)
val <T> List<T>.test3 by delegateFactory<T>(p)
<!PROPERTY_WITH_NO_TYPE_NO_INITIALIZER!>val test4<!> get() { return <!UNRESOLVED_REFERENCE!>p<!> }
<!PROPERTY_WITH_NO_TYPE_NO_INITIALIZER!>var test5<!>
get() { return <!UNRESOLVED_REFERENCE!>p<!> }
set(nv) { <!UNRESOLVED_REFERENCE!>p<!>.let <!CANNOT_INFER_PARAMETER_TYPE!>{}<!> }
<!PROPERTY_WITH_NO_TYPE_NO_INITIALIZER!>lateinit var test6<!>
}