Skip to content

Commit 1490cc2

Browse files
committed
Correctly redirect errors #12
1.7.1+ does not correctly capture errors (not shown in red) if earlier execution was without error.
1 parent 51f660e commit 1490cc2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

scala-console/src/main/scala-3/dotty/tools/repl/SCIMain.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ class SCIMain(out: PrintStream, loader: ClassLoader) {
4949
// Interpret script execution result
5050
result match
5151
case Success(_) =>
52-
SCResults.Success
52+
// Check if the states indicate that there errors during parsing
53+
if state.context.reporter.hasErrors then
54+
SCResults.Error
55+
else
56+
SCResults.Success
5357
case Failure(ex) =>
5458
if wasCausedByImageJMacroAbort(ex) then
5559
out.println(s"WARNING: Detected ImageJ's \"$IMAGEJ_MACRO_CANCELED\" request. Stopping script execution.")
@@ -58,7 +62,6 @@ class SCIMain(out: PrintStream, loader: ClassLoader) {
5862
// ex.printStackTrace()
5963
// ex.printStackTrace(out)
6064
SCResults.Error
61-
6265
}
6366

6467
private def evalToMethod(script: String): Option[Method] = {

0 commit comments

Comments
 (0)