[FIR] Forbid mixing supertypes with different functional kinds
^KT-61277 Fixed
This commit is contained in:
committed by
Space Team
parent
f674529558
commit
4958196c51
+9
@@ -4671,6 +4671,15 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirErrors.MIXING_FUNCTIONAL_KINDS_IN_SUPERTYPES) { firDiagnostic ->
|
||||
MixingFunctionalKindsInSupertypesImpl(
|
||||
firDiagnostic.a.map { functionTypeKind ->
|
||||
functionTypeKind
|
||||
},
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirErrors.REDUNDANT_LABEL_WARNING) { firDiagnostic ->
|
||||
RedundantLabelWarningImpl(
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
|
||||
+5
@@ -3260,6 +3260,11 @@ sealed interface KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
|
||||
override val diagnosticClass get() = MixingSuspendAndNonSuspendSupertypes::class
|
||||
}
|
||||
|
||||
interface MixingFunctionalKindsInSupertypes : KtFirDiagnostic<PsiElement> {
|
||||
override val diagnosticClass get() = MixingFunctionalKindsInSupertypes::class
|
||||
val kinds: List<FunctionTypeKind>
|
||||
}
|
||||
|
||||
interface RedundantLabelWarning : KtFirDiagnostic<KtLabelReferenceExpression> {
|
||||
override val diagnosticClass get() = RedundantLabelWarning::class
|
||||
}
|
||||
|
||||
+6
@@ -3933,6 +3933,12 @@ internal class MixingSuspendAndNonSuspendSupertypesImpl(
|
||||
token: KtLifetimeToken,
|
||||
) : KtAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KtFirDiagnostic.MixingSuspendAndNonSuspendSupertypes
|
||||
|
||||
internal class MixingFunctionalKindsInSupertypesImpl(
|
||||
override val kinds: List<FunctionTypeKind>,
|
||||
firDiagnostic: KtPsiDiagnostic,
|
||||
token: KtLifetimeToken,
|
||||
) : KtAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KtFirDiagnostic.MixingFunctionalKindsInSupertypes
|
||||
|
||||
internal class RedundantLabelWarningImpl(
|
||||
firDiagnostic: KtPsiDiagnostic,
|
||||
token: KtLifetimeToken,
|
||||
|
||||
Reference in New Issue
Block a user