[FIR] Support @OnlyInputTypes annotation

^KT-54807 Fixed
This commit is contained in:
Dmitriy Novozhilov
2022-11-08 12:17:20 +02:00
committed by Space Team
parent 5cc08fb314
commit 1b27d60307
48 changed files with 98 additions and 484 deletions
@@ -1419,6 +1419,13 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
token,
)
}
add(FirErrors.TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR) { firDiagnostic ->
TypeInferenceOnlyInputTypesErrorImpl(
firSymbolBuilder.classifierBuilder.buildTypeParameterSymbol(firDiagnostic.a),
firDiagnostic as KtPsiDiagnostic,
token,
)
}
add(FirErrors.THROWABLE_TYPE_MISMATCH) { firDiagnostic ->
ThrowableTypeMismatchImpl(
firSymbolBuilder.typeBuilder.buildKtType(firDiagnostic.a),
@@ -1021,6 +1021,11 @@ sealed class KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
abstract val isMismatchDueToNullability: Boolean
}
abstract class TypeInferenceOnlyInputTypesError : KtFirDiagnostic<PsiElement>() {
override val diagnosticClass get() = TypeInferenceOnlyInputTypesError::class
abstract val typeParameter: KtTypeParameterSymbol
}
abstract class ThrowableTypeMismatch : KtFirDiagnostic<PsiElement>() {
override val diagnosticClass get() = ThrowableTypeMismatch::class
abstract val actualType: KtType
@@ -1224,6 +1224,12 @@ internal class TypeMismatchImpl(
override val token: KtLifetimeToken,
) : KtFirDiagnostic.TypeMismatch(), KtAbstractFirDiagnostic<PsiElement>
internal class TypeInferenceOnlyInputTypesErrorImpl(
override val typeParameter: KtTypeParameterSymbol,
override val firDiagnostic: KtPsiDiagnostic,
override val token: KtLifetimeToken,
) : KtFirDiagnostic.TypeInferenceOnlyInputTypesError(), KtAbstractFirDiagnostic<PsiElement>
internal class ThrowableTypeMismatchImpl(
override val actualType: KtType,
override val isMismatchDueToNullability: Boolean,