FIR: Remove duplicated diagnostics on annotations on types.

This commit is contained in:
Mark Punzalan
2021-04-20 08:29:14 +00:00
committed by TeamCityServer
parent edb6b337dc
commit 1835185b16
18 changed files with 26 additions and 53 deletions
@@ -5,7 +5,7 @@ interface I {
}
class A {
fun too(): <!NOT_AN_ANNOTATION_CLASS, NOT_AN_ANNOTATION_CLASS!>@Annotation<!> Unit {}
fun too(): <!NOT_AN_ANNOTATION_CLASS!>@Annotation<!> Unit {}
fun foo(): <!REDUNDANT_RETURN_UNIT_TYPE!>Unit<!>
{
@@ -162,7 +162,12 @@ abstract class AbstractDiagnosticCollectorVisitor(
}
override fun visitResolvedTypeRef(resolvedTypeRef: FirResolvedTypeRef, data: Nothing?) {
super.visitResolvedTypeRef(resolvedTypeRef, data)
// Assuming no errors, the children of FirResolvedTypeRef (currently this can be FirAnnotationCalls) will also be present
// as children in delegatedTypeRef. We should make sure those elements are only visited once, otherwise diagnostics will be
// collected twice: once through resolvedTypeRef's children and another through resolvedTypeRef.delegatedTypeRef's children.
if (resolvedTypeRef.type is ConeClassErrorType) {
super.visitResolvedTypeRef(resolvedTypeRef, data)
}
resolvedTypeRef.delegatedTypeRef?.accept(this, data)
}