FIR checker: report unresolved reference in imports

Compared to FE1.0, instead of using UNRESOLVED_REFERENCE, a new
UNRESOLVED_IMPORT diagnostic is introduced. This is so that we can use a
different positioning strategy to highlight the last part of the import
if the entire import is passed.

Also, this change fixed some incorrectly rejected imports in FIR. Such
cases are covered the newly added test file staticFunAndPropertyImport.kt
This commit is contained in:
Tianyu Geng
2021-10-25 17:37:38 -07:00
committed by teamcityserver
parent f51b108821
commit 18f7a760bb
33 changed files with 470 additions and 95 deletions
@@ -196,6 +196,6 @@ fun ImplicitReceiverValue<*>.asTowerDataElement(): FirTowerDataElement =
fun FirScope.asTowerDataElement(isLocal: Boolean): FirTowerDataElement =
FirTowerDataElement(this, implicitReceiver = null, isLocal)
private fun FirClass.staticScope(sessionHolder: SessionHolder) =
fun FirClass.staticScope(sessionHolder: SessionHolder) =
scopeProvider.getStaticScope(this, sessionHolder.session, sessionHolder.scopeSession)
typealias FirLocalScopes = PersistentList<FirLocalScope>
@@ -198,6 +198,11 @@ class ConeImportFromSingleton(val name: Name) : ConeDiagnostic {
open class ConeUnsupported(override val reason: String, val source: KtSourceElement? = null) : ConeDiagnostic
class ConeUnresolvedParentInImport(val parentClassId: ClassId) : ConeDiagnostic {
override val reason: String
get() = "unresolved import"
}
class ConeUnsupportedDynamicType : ConeUnsupported("Dynamic types are not supported in this context")
class ConeDeprecated(