Files
kotlin-fork/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/primaryConstructorParameter.fir.kt
T
Tianyu Geng fb14b03824 FIR checker: skip error named reference if receiver is unresolved
Currently, FIR reports errors caused by previous resolution failure. For
example with unresolved `a` and `b` in code `a.b`, both `a` and `b` are
highlighted. FE1.0 only highlights `a` since it's the root cause. This
change applies this heuristics when reporting FirDiagnostics.
2021-03-29 12:45:27 +03:00

24 lines
606 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)
val test4 get() { return <!UNRESOLVED_REFERENCE!>p<!> }
var test5
get() { return <!UNRESOLVED_REFERENCE!>p<!> }
set(nv) { <!UNRESOLVED_REFERENCE!>p<!>.let {} }
}