[FIR] Don't report duplicated errors in component calls typeRefs

This commit is contained in:
Nick
2020-07-29 15:38:41 +03:00
committed by Mikhail Glukhikh
parent 4ceae8dc5e
commit 7086b0cbf3
3 changed files with 20 additions and 16 deletions
@@ -89,6 +89,25 @@ abstract class AbstractDiagnosticCollector(
functionCall.calleeReference.accept(visitor)
}
override fun visitComponentCall(componentCall: FirComponentCall) {
componentCall.runComponents()
// same as FirFunctionCall.typeRef that
// you can see above
componentCall.annotations.forEach { it.accept(visitor) }
componentCall.typeArguments.forEach { it.accept(visitor) }
componentCall.argumentList.accept(visitor)
componentCall.calleeReference.accept(visitor)
componentCall.explicitReceiver.accept(visitor)
if (componentCall.dispatchReceiver !== componentCall.explicitReceiver) {
componentCall.dispatchReceiver.accept(visitor)
}
if (componentCall.extensionReceiver !== componentCall.explicitReceiver &&
componentCall.extensionReceiver !== componentCall.dispatchReceiver
) {
componentCall.extensionReceiver.accept(visitor)
}
}
private fun visitJump(loopJump: FirLoopJump) {
loopJump.runComponents()
loopJump.acceptChildren(this)
@@ -1,16 +0,0 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE
data class A(val i: Int, val j: <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>G<!>)
data class B(val i: <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>G<!>, val j: <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>G<!>)
fun fa(a: A) {
val (i, j) = a
val i2 = a.component1()
val j2 = a.component2()
}
fun fb(b: B) {
val (i, j) = b
val i2 = b.component1()
val j2 = b.component2()
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_VARIABLE
data class A(val i: Int, val j: <!UNRESOLVED_REFERENCE!>G<!>)
data class B(val i: <!UNRESOLVED_REFERENCE!>G<!>, val j: <!UNRESOLVED_REFERENCE!>G<!>)