[FIR] Implement UNRESOLVED_REFERENCE_WRONG_RECEIVER

This commit is contained in:
Ivan Kochurkin
2021-08-10 16:40:51 +03:00
committed by Space
parent 34cc7e5199
commit 84c5f58cab
129 changed files with 322 additions and 481 deletions
@@ -141,9 +141,9 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
}
@Test
@TestMetadata("checkType.kt")
public void testCheckType() throws Exception {
runTest("compiler/testData/diagnostics/tests/checkType.kt");
@TestMetadata("checkTypeTest.kt")
public void testCheckTypeTest() throws Exception {
runTest("compiler/testData/diagnostics/tests/checkTypeTest.kt");
}
@Test
@@ -304,6 +304,15 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
token,
)
}
add(FirErrors.UNRESOLVED_REFERENCE_WRONG_RECEIVER) { firDiagnostic ->
UnresolvedReferenceWrongReceiverImpl(
firDiagnostic.a.map { firBasedSymbol ->
firSymbolBuilder.buildSymbol(firBasedSymbol.fir)
},
firDiagnostic as FirPsiDiagnostic,
token,
)
}
add(FirErrors.CREATING_AN_INSTANCE_OF_ABSTRACT_CLASS) { firDiagnostic ->
CreatingAnInstanceOfAbstractClassImpl(
firDiagnostic as FirPsiDiagnostic,
@@ -241,6 +241,11 @@ sealed class KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
abstract val message: String
}
abstract class UnresolvedReferenceWrongReceiver : KtFirDiagnostic<PsiElement>() {
override val diagnosticClass get() = UnresolvedReferenceWrongReceiver::class
abstract val candidates: List<KtSymbol>
}
abstract class CreatingAnInstanceOfAbstractClass : KtFirDiagnostic<KtExpression>() {
override val diagnosticClass get() = CreatingAnInstanceOfAbstractClass::class
}
@@ -353,6 +353,14 @@ internal class DeprecationImpl(
override val firDiagnostic: FirPsiDiagnostic by weakRef(firDiagnostic)
}
internal class UnresolvedReferenceWrongReceiverImpl(
override val candidates: List<KtSymbol>,
firDiagnostic: FirPsiDiagnostic,
override val token: ValidityToken,
) : KtFirDiagnostic.UnresolvedReferenceWrongReceiver(), KtAbstractFirDiagnostic<PsiElement> {
override val firDiagnostic: FirPsiDiagnostic by weakRef(firDiagnostic)
}
internal class CreatingAnInstanceOfAbstractClassImpl(
firDiagnostic: FirPsiDiagnostic,
override val token: ValidityToken,