K2 Scripting: fix order of arguments processing
and base class handling: Since in K2 we do not distinguish between script arguments taken from the base class and provided properties, we need this extra functionality to preserve the argument order of K1 scripts. This is a temporary measure, since we're going to deprecate base class usage at some point (KT-60449), so the relevant constructor arguments should disappear too.
This commit is contained in:
committed by
Space Team
parent
96bde033e1
commit
020a590df7
+2
@@ -45,6 +45,7 @@ import org.jetbrains.kotlin.scripting.resolve.resolvedImportScripts
|
||||
import org.jetbrains.kotlin.utils.topologicalSort
|
||||
import kotlin.script.experimental.api.*
|
||||
import kotlin.script.experimental.host.ScriptingHostConfiguration
|
||||
import kotlin.script.experimental.impl._languageVersion
|
||||
import kotlin.script.experimental.jvm.JvmDependency
|
||||
import kotlin.script.experimental.jvm.JvmDependencyFromClassLoader
|
||||
import kotlin.script.experimental.jvm.compilationCache
|
||||
@@ -155,6 +156,7 @@ private fun compileImpl(
|
||||
dependenciesProvider?.getScriptConfigurationResult(ktFile, context.baseScriptCompilationConfiguration)
|
||||
?.valueOrNull()?.configuration ?: context.baseScriptCompilationConfiguration
|
||||
refinedConfiguration.with {
|
||||
_languageVersion(context.environment.configuration.languageVersionSettings.languageVersion.versionString)
|
||||
// Adjust definitions so all compiler dependencies are saved in the resulting compilation configuration, so evaluation
|
||||
// performed with the expected classpath
|
||||
// TODO: make this logic obsolete by injecting classpath earlier in the pipeline
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ class ScriptTemplateTest : TestCase() {
|
||||
assertEqualsTrimmed(NUM_4_LINE + FIB_SCRIPT_OUTPUT_TAIL, out)
|
||||
}
|
||||
|
||||
fun testScriptWithBaseClassWithParam() = expectTestToFailOnK2 {
|
||||
fun testScriptWithBaseClassWithParam() {
|
||||
val messageCollector = TestMessageCollector()
|
||||
val aClass =
|
||||
compileScript("fib_dsl.kts", ScriptWithBaseClass::class, null, runIsolated = false, messageCollector = messageCollector)
|
||||
|
||||
Reference in New Issue
Block a user