[REPL] Fix unresolved imports caching
Before this fix, if some imports were not resolved during compilation, this result had been saved in caches, and this import couldn't been resolved during following compilations even if it was added to the module dependencies. This commit adds special handling of resolution caches for the REPL compiler.
This commit is contained in:
+17
@@ -296,6 +296,12 @@ class JvmIdeServicesTest : TestCase() {
|
||||
val (exitCode, outputJarPath) = compileFile("stringTo.kt", outputJarName)
|
||||
assertEquals(ExitCode.OK, exitCode)
|
||||
|
||||
assertCompileFails(
|
||||
repl, """
|
||||
import example.dependency.*
|
||||
""".trimIndent()
|
||||
)
|
||||
|
||||
assertEvalUnit(
|
||||
repl, """
|
||||
@file:DependsOn("$outputJarPath")
|
||||
@@ -412,6 +418,17 @@ private fun JvmTestRepl.compileAndEval(codeLine: SourceCode): Pair<ResultWithDia
|
||||
return compRes to evalRes?.valueOrNull().get()
|
||||
}
|
||||
|
||||
private fun assertCompileFails(
|
||||
repl: JvmTestRepl,
|
||||
@Suppress("SameParameterValue")
|
||||
line: String
|
||||
) {
|
||||
val compiledSnippet =
|
||||
checkCompile(repl, line)
|
||||
|
||||
TestCase.assertNull(compiledSnippet)
|
||||
}
|
||||
|
||||
private fun assertEvalUnit(
|
||||
repl: JvmTestRepl,
|
||||
@Suppress("SameParameterValue")
|
||||
|
||||
Reference in New Issue
Block a user