[FIR] Remove way to create FirSession using Module
The problem is that Module may not contain some default dependencies in classpath roots, so it's incorrect to take them from it
This commit is contained in:
committed by
TeamCityServer
parent
b2ef854aa1
commit
2ee54c2201
+6
-1
@@ -66,6 +66,7 @@ import org.jetbrains.kotlin.load.kotlin.incremental.IncrementalPackagePartProvid
|
||||
import org.jetbrains.kotlin.modules.Module
|
||||
import org.jetbrains.kotlin.modules.TargetId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
import org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStatus
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
@@ -339,7 +340,7 @@ object KotlinToJVMBytecodeCompiler {
|
||||
|
||||
val languageVersionSettings = moduleConfiguration.languageVersionSettings
|
||||
val session = createSessionWithDependencies(
|
||||
module,
|
||||
Name.identifier(module.getModuleName()),
|
||||
JvmPlatforms.unspecifiedJvmPlatform,
|
||||
JvmPlatformAnalyzerServices,
|
||||
externalSessionProvider = null,
|
||||
@@ -357,6 +358,10 @@ object KotlinToJVMBytecodeCompiler {
|
||||
)
|
||||
FirSessionFactory.ProviderAndScopeForIncrementalCompilation(packagePartProvider, librariesScope)
|
||||
},
|
||||
dependenciesConfigurator = {
|
||||
dependencies(moduleConfiguration.jvmClasspathRoots.map { it.toPath() })
|
||||
friendDependencies(moduleConfiguration[JVMConfigurationKeys.FRIEND_PATHS] ?: emptyList())
|
||||
},
|
||||
sessionConfigurator = {
|
||||
if (extendedAnalysisMode) {
|
||||
registerExtendedCommonCheckers()
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
$TESTDATA_DIR$/firStdlibDependency.kt
|
||||
-Xuse-fir
|
||||
-cp
|
||||
.
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
@@ -0,0 +1 @@
|
||||
fun main() = println("hello")
|
||||
@@ -0,0 +1,4 @@
|
||||
warning: ATTENTION!
|
||||
This build uses in-dev FIR:
|
||||
-Xuse-fir
|
||||
OK
|
||||
@@ -316,6 +316,11 @@ public class CliTestGenerated extends AbstractCliTest {
|
||||
runTest("compiler/testData/cli/jvm/firHello.args");
|
||||
}
|
||||
|
||||
@TestMetadata("firStdlibDependency.args")
|
||||
public void testFirStdlibDependency() throws Exception {
|
||||
runTest("compiler/testData/cli/jvm/firStdlibDependency.args");
|
||||
}
|
||||
|
||||
@TestMetadata("flagAllowingResultAsReturnType.args")
|
||||
public void testFlagAllowingResultAsReturnType() throws Exception {
|
||||
runTest("compiler/testData/cli/jvm/flagAllowingResultAsReturnType.args");
|
||||
|
||||
Reference in New Issue
Block a user