[FIR] Prohibit constructor and supertype on typealias with type projection

Introduce `CONSTRUCTOR_OR_SUPERTYPE_ON_TYPEALIAS_WITH_TYPE_PROJECTION`

^KT-60305 Fixed
This commit is contained in:
Ivan Kochurkin
2024-02-14 23:03:59 +01:00
committed by Space Team
parent 2b2c685827
commit 04ead1716a
15 changed files with 114 additions and 19 deletions
@@ -4553,6 +4553,18 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
token,
)
}
add(FirErrors.CONSTRUCTOR_OR_SUPERTYPE_ON_TYPEALIAS_WITH_TYPE_PROJECTION.errorFactory) { firDiagnostic ->
ConstructorOrSupertypeOnTypealiasWithTypeProjectionErrorImpl(
firDiagnostic as KtPsiDiagnostic,
token,
)
}
add(FirErrors.CONSTRUCTOR_OR_SUPERTYPE_ON_TYPEALIAS_WITH_TYPE_PROJECTION.warningFactory) { firDiagnostic ->
ConstructorOrSupertypeOnTypealiasWithTypeProjectionWarningImpl(
firDiagnostic as KtPsiDiagnostic,
token,
)
}
add(FirErrors.REDUNDANT_VISIBILITY_MODIFIER) { firDiagnostic ->
RedundantVisibilityModifierImpl(
firDiagnostic as KtPsiDiagnostic,
@@ -3174,6 +3174,14 @@ sealed interface KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
val expandedType: KtType
}
interface ConstructorOrSupertypeOnTypealiasWithTypeProjectionError : KtFirDiagnostic<KtElement> {
override val diagnosticClass get() = ConstructorOrSupertypeOnTypealiasWithTypeProjectionError::class
}
interface ConstructorOrSupertypeOnTypealiasWithTypeProjectionWarning : KtFirDiagnostic<KtElement> {
override val diagnosticClass get() = ConstructorOrSupertypeOnTypealiasWithTypeProjectionWarning::class
}
interface RedundantVisibilityModifier : KtFirDiagnostic<KtModifierListOwner> {
override val diagnosticClass get() = RedundantVisibilityModifier::class
}
@@ -3822,6 +3822,16 @@ internal class TypealiasShouldExpandToClassImpl(
token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<KtElement>(firDiagnostic, token), KtFirDiagnostic.TypealiasShouldExpandToClass
internal class ConstructorOrSupertypeOnTypealiasWithTypeProjectionErrorImpl(
firDiagnostic: KtPsiDiagnostic,
token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<KtElement>(firDiagnostic, token), KtFirDiagnostic.ConstructorOrSupertypeOnTypealiasWithTypeProjectionError
internal class ConstructorOrSupertypeOnTypealiasWithTypeProjectionWarningImpl(
firDiagnostic: KtPsiDiagnostic,
token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<KtElement>(firDiagnostic, token), KtFirDiagnostic.ConstructorOrSupertypeOnTypealiasWithTypeProjectionWarning
internal class RedundantVisibilityModifierImpl(
firDiagnostic: KtPsiDiagnostic,
token: KtLifetimeToken,