[FIR] Report type-aliased 'Nothing' as return type

This warning was issued in K1, but lost in K2

^KT-59420 Fixed
^KT-59429 Fixed
This commit is contained in:
Alejandro Serrano Mena
2023-10-02 14:11:52 +02:00
committed by Space Team
parent f6b2c642c2
commit 310e89f100
10 changed files with 70 additions and 6 deletions
@@ -2360,6 +2360,18 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
token,
)
}
add(FirErrors.ABBREVIATED_NOTHING_RETURN_TYPE) { firDiagnostic ->
AbbreviatedNothingReturnTypeImpl(
firDiagnostic as KtPsiDiagnostic,
token,
)
}
add(FirErrors.ABBREVIATED_NOTHING_PROPERTY_TYPE) { firDiagnostic ->
AbbreviatedNothingPropertyTypeImpl(
firDiagnostic as KtPsiDiagnostic,
token,
)
}
add(FirErrors.CYCLIC_GENERIC_UPPER_BOUND) { firDiagnostic ->
CyclicGenericUpperBoundImpl(
firDiagnostic as KtPsiDiagnostic,
@@ -1678,6 +1678,14 @@ sealed interface KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
override val diagnosticClass get() = ImplicitNothingPropertyType::class
}
interface AbbreviatedNothingReturnType : KtFirDiagnostic<PsiElement> {
override val diagnosticClass get() = AbbreviatedNothingReturnType::class
}
interface AbbreviatedNothingPropertyType : KtFirDiagnostic<PsiElement> {
override val diagnosticClass get() = AbbreviatedNothingPropertyType::class
}
interface CyclicGenericUpperBound : KtFirDiagnostic<PsiElement> {
override val diagnosticClass get() = CyclicGenericUpperBound::class
}
@@ -2017,6 +2017,16 @@ internal class ImplicitNothingPropertyTypeImpl(
token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KtFirDiagnostic.ImplicitNothingPropertyType
internal class AbbreviatedNothingReturnTypeImpl(
firDiagnostic: KtPsiDiagnostic,
token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KtFirDiagnostic.AbbreviatedNothingReturnType
internal class AbbreviatedNothingPropertyTypeImpl(
firDiagnostic: KtPsiDiagnostic,
token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KtFirDiagnostic.AbbreviatedNothingPropertyType
internal class CyclicGenericUpperBoundImpl(
firDiagnostic: KtPsiDiagnostic,
token: KtLifetimeToken,