FIR: fix a bunch of issues after DiagnosticsReporter refactoring related to reporting diagnostic on null source

This commit is contained in:
Kirill Rakhman
2023-01-05 15:00:30 +01:00
committed by Space Team
parent a7edf5b83e
commit 69f2e8826a
27 changed files with 74 additions and 42 deletions
@@ -220,6 +220,12 @@ object FirJsExternalChecker : FirBasicDeclarationChecker() {
else -> null
}
// we shouldn't check such things as the
// copy() function of a data class
if (source?.kind !is KtRealSourceElementKind) {
return
}
val isWrong = body !is FirSingleExpressionBlock && !hasValidExternalBody()
|| initializer != null && !initializer.isDefinedExternallyExpression()
@@ -229,12 +235,6 @@ object FirJsExternalChecker : FirBasicDeclarationChecker() {
reporter.reportOn(initializer.source, FirJsErrors.WRONG_INITIALIZER_OF_EXTERNAL_DECLARATION, context)
}
// we shouldn't check such things as the
// copy() function of a data class
if (source?.kind !is KtRealSourceElementKind) {
return
}
if (this is FirFunction) {
for (defaultValue in valueParameters.mapNotNull { it.defaultValue }) {
if (!defaultValue.isDefinedExternallyExpression()) {