[scripting] Move earlierScripts to the frontend descriptor

^KT-20488 fixed
This commit is contained in:
Ilya Muradyan
2021-11-13 00:28:06 +03:00
parent 4149b91c0d
commit 6917ff7d2a
15 changed files with 94 additions and 65 deletions
@@ -28,6 +28,7 @@ dependencies {
testImplementation(commonDep("org.jetbrains.kotlinx", "kotlinx-coroutines-core"))
testImplementation(commonDep("org.jetbrains.kotlinx", "kotlinx-coroutines-core-jvm"))
testImplementation(project(":kotlin-reflect"))
testRuntimeOnly(project(":kotlin-compiler"))
testRuntimeOnly(commonDep("org.jetbrains.intellij.deps", "trove4j"))
testRuntimeOnly(project(":kotlin-scripting-ide-common")) { isTransitive = false }
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.config.Services
import org.jetbrains.kotlin.scripting.ide_services.test_util.*
import java.io.File
import kotlin.io.path.*
import kotlin.reflect.full.isSubclassOf
import kotlin.script.experimental.api.*
import kotlin.script.experimental.jvm.impl.KJvmCompiledScript
import kotlin.script.experimental.jvm.jvm
@@ -325,6 +326,20 @@ class JvmIdeServicesTest : TestCase() {
}
}
fun testAnonymousObjectReflection() {
JvmTestRepl()
.use { repl ->
assertEvalResult(repl, "42", 42)
assertEvalUnit(repl, "val sim = object : ArrayList<String>() {}")
val compiledSnippet = checkCompile(repl, "sim")
val evalResult = repl.eval(compiledSnippet!!)
val a = (evalResult.valueOrThrow().get().result as ResultValue.Value).value!!
assertTrue(a::class.isSubclassOf(List::class))
}
}
@OptIn(ExperimentalPathApi::class)
companion object {
private const val MODULE_PATH = "plugins/scripting/scripting-ide-services-test"