[FE 1.0] Report errors or warnings for INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION depending on previously recorded kind of diagnostic

This commit is contained in:
Victor Petukhov
2022-05-20 13:22:20 +02:00
committed by teamcity
parent 1535ab8eed
commit 73d676d9de
@@ -607,12 +607,12 @@ class DiagnosticReporterByTrackingStrategy(
psiKotlinCall.psiCall.calleeExpression?.let {
val typeVariableText = (typeVariable as? TypeVariableFromCallableDescriptor)?.originalTypeParameter?.name?.asString()
?: typeVariable.toString()
val errorFactory = if (error is InferredEmptyIntersectionError)
INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION.errorFactory
else INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION.warningFactory
trace.reportDiagnosticOnce(
@Suppress("UNCHECKED_CAST")
INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION.on(
context.languageVersionSettings, it, typeVariableText,
error.incompatibleTypes as Collection<KotlinType>
)
errorFactory.on(it, typeVariableText, error.incompatibleTypes as Collection<KotlinType>)
)
}
}