[Tests] Do not add .java-files of whole project to contentScope in K2

Previously, the code was calling into
TopDownAnalyzerFacadeForJVM.newModuleSearchScope, which includes
AllJavaSourcesInProjectScope.

This lead to .java-sources being incorrectly attributed to wrong
modules in tests, which, in turn, could've introduced undesired
behaviour around module-dependent checks (e.g. whether a variable
is from the other module and thus can't be smartcasted)
This commit is contained in:
Dmitry Savvinov
2024-01-18 16:17:23 +01:00
committed by Space Team
parent d03ee3150b
commit f19859db4e
@@ -125,7 +125,7 @@ class KtSourceModuleByCompilerConfiguration(
override val ktModule: KtModule get() = this
override val contentScope: GlobalSearchScope =
TopDownAnalyzerFacadeForJVM.newModuleSearchScope(project, psiFiles.filterIsInstance<KtFile>())
GlobalSearchScope.filesScope(project, psiFiles.map { it.virtualFile })
}
class KtScriptModuleByCompilerConfiguration(