[MPP][Test] Implement Diagnostics with mpp composite analysis tests
Using the 'MULTIPLATFORM_COMPOSITE_ANALYSIS_MODE' test directive will add support for testing "cli metadata compilation" and "ide analysis" _like_ configurations. In this configuration, dependsOn modules will not be analyzed together with dependents in the same ModuleDescriptor, but will be passed as separate 'expectedBy' dependency descriptor. Used to cover ^KT-50120 inside kotlin.git
This commit is contained in:
committed by
Space
parent
7771e5914d
commit
3598ba1d45
+7
-4
@@ -27,13 +27,15 @@ object FakeTopDownAnalyzerFacadeForNative {
|
||||
files: Collection<KtFile>,
|
||||
trace: BindingTrace,
|
||||
moduleContext: ModuleContext,
|
||||
languageVersionSettings: LanguageVersionSettings
|
||||
languageVersionSettings: LanguageVersionSettings,
|
||||
compilerEnvironment: TargetEnvironment = CompilerEnvironment
|
||||
): AnalysisResult {
|
||||
|
||||
val analyzerForNative = createFakeTopDownAnalyzerForNative(
|
||||
moduleContext, trace,
|
||||
FileBasedDeclarationProviderFactory(moduleContext.storageManager, files),
|
||||
languageVersionSettings
|
||||
languageVersionSettings,
|
||||
compilerEnvironment
|
||||
)
|
||||
|
||||
analyzerForNative.analyzeDeclarations(TopDownAnalysisMode.TopLevelDeclarations, files as Collection<com.intellij.psi.PsiElement>)
|
||||
@@ -45,7 +47,8 @@ private fun createFakeTopDownAnalyzerForNative(
|
||||
moduleContext: ModuleContext,
|
||||
bindingTrace: BindingTrace,
|
||||
declarationProviderFactory: DeclarationProviderFactory,
|
||||
languageVersionSettings: LanguageVersionSettings
|
||||
languageVersionSettings: LanguageVersionSettings,
|
||||
compilerEnvironment: TargetEnvironment = CompilerEnvironment
|
||||
): LazyTopDownAnalyzer = createContainer("FakeTopDownAnalyzerForNative", NativePlatformAnalyzerServices) {
|
||||
configureModule(
|
||||
moduleContext,
|
||||
@@ -59,7 +62,7 @@ private fun createFakeTopDownAnalyzerForNative(
|
||||
|
||||
useInstance(declarationProviderFactory)
|
||||
useInstance(InlineConstTracker.DoNothing)
|
||||
CompilerEnvironment.configure(this)
|
||||
compilerEnvironment.configure(this)
|
||||
}.apply {
|
||||
val moduleDescriptor = get<ModuleDescriptorImpl>()
|
||||
moduleDescriptor.initialize(get<KotlinCodeAnalyzer>().packageFragmentProvider)
|
||||
|
||||
Reference in New Issue
Block a user