Implement FirProvider consistency checker
This commit is contained in:
committed by
Mikhail Glukhikh
parent
1dae135840
commit
5f0fe4785d
@@ -7,6 +7,8 @@ package org.jetbrains.kotlin.fir
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.fir.declarations.FirFile
|
||||
import org.jetbrains.kotlin.fir.resolve.FirProvider
|
||||
import org.jetbrains.kotlin.fir.resolve.impl.FirProviderImpl
|
||||
import org.jetbrains.kotlin.fir.types.ConeClassErrorType
|
||||
import org.jetbrains.kotlin.fir.types.ConeKotlinErrorType
|
||||
import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef
|
||||
@@ -19,6 +21,14 @@ import kotlin.math.max
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.system.measureNanoTime
|
||||
|
||||
|
||||
fun checkFirProvidersConsistency(firFiles: List<FirFile>) {
|
||||
for ((session, files) in firFiles.groupBy { it.session }) {
|
||||
val provider = session.service<FirProvider>() as FirProviderImpl
|
||||
provider.ensureConsistent(files)
|
||||
}
|
||||
}
|
||||
|
||||
fun doFirResolveTestBench(
|
||||
firFiles: List<FirFile>,
|
||||
transformers: List<FirTransformer<Nothing?>>,
|
||||
@@ -62,6 +72,7 @@ fun doFirResolveTestBench(
|
||||
}
|
||||
//totalLength += StringBuilder().apply { FirRenderer(this).visitFile(firFile) }.length
|
||||
}
|
||||
checkFirProvidersConsistency(firFiles)
|
||||
}
|
||||
|
||||
if (fails.none()) {
|
||||
|
||||
Reference in New Issue
Block a user