[FIR] Report missing UNRESOLVED_IMPORT

#KT-54781 Fixed
This commit is contained in:
Kirill Rakhman
2023-03-29 13:52:44 +02:00
committed by Space Team
parent f18591ffef
commit 7dde3603b5
12 changed files with 47 additions and 17 deletions
@@ -5,6 +5,7 @@
package org.jetbrains.kotlin.fir.analysis.checkers.syntax
import com.intellij.psi.tree.TokenSet
import org.jetbrains.kotlin.KtNodeTypes
import org.jetbrains.kotlin.KtSourceElement
import org.jetbrains.kotlin.diagnostics.DiagnosticReporter
@@ -90,6 +91,11 @@ object FirUnresolvedInMiddleOfImportChecker : FirDeclarationSyntaxChecker<FirFil
return enumClass.collectEnumEntries().any { it.callableId.callableName == classId.shortClassName }
}
private fun KtSourceElement.dotQualifiedExpression() = getChild(KtNodeTypes.DOT_QUALIFIED_EXPRESSION, depth = 1)
private fun KtSourceElement.selectorExpression() = getChild(KtNodeTypes.REFERENCE_EXPRESSION, depth = 1, reverse = true)
private val IMPORT_PARENT_TOKEN_TYPES = TokenSet.create(KtNodeTypes.DOT_QUALIFIED_EXPRESSION, KtNodeTypes.REFERENCE_EXPRESSION)
private fun KtSourceElement.dotQualifiedExpression(): KtSourceElement? = getChild(IMPORT_PARENT_TOKEN_TYPES, depth = 1)
private fun KtSourceElement.selectorExpression(): KtSourceElement? =
takeIf { it.elementType == KtNodeTypes.REFERENCE_EXPRESSION }
?: getChild(KtNodeTypes.REFERENCE_EXPRESSION, depth = 1, reverse = true)
}