Skip to content

Fix double execution in JSR223 Implementation #7010

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compiler/src/dotty/tools/dotc/config/ScalaSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class ScalaSettings extends Settings.SettingGroup {
val Xprompt: Setting[Boolean] = BooleanSetting("-Xprompt", "Display a prompt after each error (debugging option).")
val XnoValueClasses: Setting[Boolean] = BooleanSetting("-Xno-value-classes", "Do not use value classes. Helps debugging.")
val XreplLineWidth: Setting[Int] = IntSetting("-Xrepl-line-width", "Maximal number of columns per line for REPL output", 390)
val XreplDisableDisplay: Setting[Boolean] = BooleanSetting("-Xrepl-disable-display", "Do not display definitions in REPL.")
val XfatalWarnings: Setting[Boolean] = BooleanSetting("-Xfatal-warnings", "Fail the compilation if there are any warnings.")
val XverifySignatures: Setting[Boolean] = BooleanSetting("-Xverify-signatures", "Verify generic signatures in generated bytecode.")
val XignoreScala2Macros: Setting[Boolean] = BooleanSetting("-Xignore-scala2-macros", "Ignore errors when compiling code that calls Scala2 macros, these will fail at runtime.")
Expand Down
10 changes: 8 additions & 2 deletions compiler/src/dotty/tools/repl/ReplDriver.scala
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,9 @@ class ReplDriver(settings: Array[String],
case _ => // new line, empty tree
state
}
out.println()
implicit val ctx: Context = newState.context
if (!ctx.settings.XreplDisableDisplay.value)
out.println()
newState
}

Expand Down Expand Up @@ -238,7 +240,11 @@ class ReplDriver(settings: Array[String],

val warnings = newState.context.reporter.removeBufferedMessages(newState.context)
displayErrors(warnings)(newState) // display warnings
displayDefinitions(unit.tpdTree, newestWrapper)(newStateWithImports)
implicit val ctx = newState.context
if (!ctx.settings.XreplDisableDisplay.value)
displayDefinitions(unit.tpdTree, newestWrapper)(newStateWithImports)
else
newStateWithImports
}
)
}
Expand Down
3 changes: 2 additions & 1 deletion compiler/src/dotty/tools/repl/ScriptEngine.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ class ScriptEngine extends AbstractScriptEngine {
Array(
"-classpath", "", // Avoid the default "."
"-usejavacp",
"-color:never"
"-color:never",
"-Xrepl-disable-display"
), Console.out, None)
private val rendering = new Rendering
private var state: State = driver.initialState
Expand Down
2 changes: 0 additions & 2 deletions tests/run-with-compiler/scripting.check
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
val res0: Int = 42

42
1 change: 0 additions & 1 deletion tests/run-with-compiler/scripting.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ object Test {
println(e.eval("42"))
}
}