From 15e432372ae6a53205d6b1c2bbdeb582b8043e1e Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Thu, 13 Aug 2026 09:10:25 -0700 Subject: [PATCH 1/4] Style tweaks --- repl/src/dotty/tools/repl/ReplCompiler.scala | 6 +- repl/src/dotty/tools/repl/ReplDriver.scala | 59 ++++++++++---------- repl/src/dotty/tools/repl/package.scala | 6 +- 3 files changed, 33 insertions(+), 38 deletions(-) diff --git a/repl/src/dotty/tools/repl/ReplCompiler.scala b/repl/src/dotty/tools/repl/ReplCompiler.scala index 6d8891bf24fa..1ac7ba99f182 100644 --- a/repl/src/dotty/tools/repl/ReplCompiler.scala +++ b/repl/src/dotty/tools/repl/ReplCompiler.scala @@ -48,7 +48,7 @@ class ReplCompiler extends Compiler: ) def newRun(initCtx: Context, state: State): Run = - val run = new Run(this, initCtx) { + new Run(this, initCtx): /** Import previous runs and user defined imports */ override protected def rootContext(using Context): Context = { def importContext(imp: tpd.Import)(using Context) = @@ -74,9 +74,7 @@ class ReplCompiler extends Compiler: (state.validObjectIndexes).foldLeft(rootCtx)((ctx, id) => importPreviousRun(id)(using ctx)) } - } - run.suppressions.initSuspendedMessages(state.context.run) - run + .tap(_.suppressions.initSuspendedMessages(state.context.run)) end newRun private def packaged(stats: List[untpd.Tree])(using Context): untpd.PackageDef = diff --git a/repl/src/dotty/tools/repl/ReplDriver.scala b/repl/src/dotty/tools/repl/ReplDriver.scala index 38f61a90a3a3..815c3d2dc788 100644 --- a/repl/src/dotty/tools/repl/ReplDriver.scala +++ b/repl/src/dotty/tools/repl/ReplDriver.scala @@ -454,42 +454,39 @@ class ReplDriver(settings: Array[String], displayErrors(errs, errState) istate.afterFailedCompilation(errState.objectIndex) , - { - case (unit: CompilationUnit, newState: State) => - val newestWrapper = extractNewestWrapper(unit.untpdTree) - val newImports = extractTopLevelImports(newState.context) - var allImports = newState.imports - if (newImports.nonEmpty) - allImports += (newState.objectIndex -> newImports) - val newStateWithImports = newState.copy( - imports = allImports, - context = contextWithNewImports(newState.context, newImports) - ) + (unit, newState) => + val newestWrapper = extractNewestWrapper(unit.untpdTree) + val newImports = extractTopLevelImports(newState.context) + var allImports = newState.imports + if (newImports.nonEmpty) + allImports += (newState.objectIndex -> newImports) + val newStateWithImports = newState.copy( + imports = allImports, + context = contextWithNewImports(newState.context, newImports) + ) - val warnings = newState.context.reporter - .removeBufferedMessages(using newState.context) + val warnings = newState.context.reporter + .removeBufferedMessages(using newState.context) - inContext(newState.context) { - val (updatedState, definitions) = - if (!ctx.settings.XreplDisableDisplay.value) - renderDefinitions(unit.tpdTree, newestWrapper)(using newStateWithImports) - else - (newStateWithImports, Seq.empty) + inContext(newState.context): + val (updatedState, definitions) = + if (!ctx.settings.XreplDisableDisplay.value) + renderDefinitions(unit.tpdTree, newestWrapper)(using newStateWithImports) + else + (newStateWithImports, Seq.empty) - // output is printed in the order it was put in. warnings should be - // shown before infos (eg. typedefs) for the same line. column - // ordering is mostly to make tests deterministic - given Ordering[Diagnostic] = - Ordering[(Int, Int, Int)].on(d => (d.pos.line, -d.level, d.pos.column)) + // output is printed in the order it was put in. warnings should be + // shown before infos (e.g. typedefs) for the same line. + // column ordering is mostly to make tests deterministic + given Ordering[Diagnostic] = + Ordering[(Int, Int, Int)].on(d => (d.pos.line, -d.level, d.pos.column)) - (if istate.quiet then warnings else definitions ++ warnings) - .sorted - .foreach(printDiagnostic) + (if istate.quiet then warnings else definitions ++ warnings) + .sorted + .foreach(printDiagnostic) - if updatedState.invalidObjectIndexes.contains(updatedState.objectIndex) then updatedState - else updatedState.recordInput(parsed.source.content().mkString) - } - } + if updatedState.invalidObjectIndexes.contains(updatedState.objectIndex) then updatedState + else updatedState.recordInput(parsed.source.content().mkString) ) } diff --git a/repl/src/dotty/tools/repl/package.scala b/repl/src/dotty/tools/repl/package.scala index c7ded08b0982..66f351015d20 100644 --- a/repl/src/dotty/tools/repl/package.scala +++ b/repl/src/dotty/tools/repl/package.scala @@ -4,6 +4,6 @@ package repl import dotc.reporting.{HideNonSensicalMessages, StoreReporter, UniqueMessagePositions} /** Create empty outer store reporter */ -private[repl] def newStoreReporter: StoreReporter = - new StoreReporter(null) - with UniqueMessagePositions with HideNonSensicalMessages +private[repl] def newStoreReporter: StoreReporter = ReplReporter() + +private[repl] class ReplReporter extends StoreReporter(null), UniqueMessagePositions, HideNonSensicalMessages From 06185ccb12e9348e4673f5b865f1f287faa8e9d8 Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Thu, 13 Aug 2026 09:12:00 -0700 Subject: [PATCH 2/4] Clear old REPL syntax warnings when syntax errors --- compiler/src/dotty/tools/dotc/Run.scala | 5 +++-- repl/src/dotty/tools/repl/ReplDriver.scala | 1 + repl/test-resources/repl/i25055 | 10 ++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 repl/test-resources/repl/i25055 diff --git a/compiler/src/dotty/tools/dotc/Run.scala b/compiler/src/dotty/tools/dotc/Run.scala index 771158eb8cd5..fe529415a117 100644 --- a/compiler/src/dotty/tools/dotc/Run.scala +++ b/compiler/src/dotty/tools/dotc/Run.scala @@ -82,9 +82,10 @@ extends ImplicitRunInfo, ConstraintRunInfo, cc.CaptureRunInfo { // When the REPL creates a new run (ReplDriver.compile), parsing is already done in the old context, with the // previous Run. Parser warnings were suspended in the old run and need to be copied over so they are not lost. // Same as scala/scala/commit/79ca1408c7. - def initSuspendedMessages(oldRun: Run | Null) = if oldRun != null then + def initSuspendedMessages(oldRun: Run | Null) = mySuspendedMessages.clear() - mySuspendedMessages ++= oldRun.mySuspendedMessages + if oldRun != null then + mySuspendedMessages ++= oldRun.mySuspendedMessages def suppressionsComplete(source: SourceFile) = source == NoSource || mySuppressionsComplete(source) diff --git a/repl/src/dotty/tools/repl/ReplDriver.scala b/repl/src/dotty/tools/repl/ReplDriver.scala index 815c3d2dc788..988a6d795b66 100644 --- a/repl/src/dotty/tools/repl/ReplDriver.scala +++ b/repl/src/dotty/tools/repl/ReplDriver.scala @@ -402,6 +402,7 @@ class ReplDriver(settings: Array[String], else state case SyntaxErrors(_, errs, _) => + state.context.run.suppressions.initSuspendedMessages(oldRun = null) displayErrors(errs, state) case CommandThenCode(cmd, code) => diff --git a/repl/test-resources/repl/i25055 b/repl/test-resources/repl/i25055 new file mode 100644 index 000000000000..bcbf266e21ff --- /dev/null +++ b/repl/test-resources/repl/i25055 @@ -0,0 +1,10 @@ +scala> try: +-- [E018] Syntax Error: -------------------------------------------------------- +1 |try: + | ^ + | expression expected but : found + | + | longer explanation available when compiling with `-explain` + +scala> 42 +val res0: Int = 42 From 568dfb2cdbe216581a79453d7e5a690f13cd52b0 Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Thu, 13 Aug 2026 10:12:47 -0700 Subject: [PATCH 3/4] Test may lack run --- repl/src/dotty/tools/repl/ReplDriver.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/repl/src/dotty/tools/repl/ReplDriver.scala b/repl/src/dotty/tools/repl/ReplDriver.scala index 988a6d795b66..3f1090624100 100644 --- a/repl/src/dotty/tools/repl/ReplDriver.scala +++ b/repl/src/dotty/tools/repl/ReplDriver.scala @@ -402,7 +402,9 @@ class ReplDriver(settings: Array[String], else state case SyntaxErrors(_, errs, _) => - state.context.run.suppressions.initSuspendedMessages(oldRun = null) + // if there is a Run that is tracking suspended parse warnings, ignore (drop) them when erroring + if state.context.run != null then + state.context.run.suppressions.initSuspendedMessages(oldRun = null) displayErrors(errs, state) case CommandThenCode(cmd, code) => From 4963cb0d0b7d074640ea3d6364167bcfcd36a4b8 Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Thu, 13 Aug 2026 10:13:26 -0700 Subject: [PATCH 4/4] Repl test is paste-identical to REPL --- repl/test-resources/repl/10886 | 2 +- repl/test-resources/repl/1379 | 6 +- repl/test-resources/repl/commandPrefixes | 6 +- repl/test-resources/repl/errmsgs | 84 +++++++++---------- repl/test-resources/repl/i13208.default.scala | 8 +- repl/test-resources/repl/i1370 | 4 +- repl/test-resources/repl/i18383 | 8 +- repl/test-resources/repl/i2063 | 14 ++-- repl/test-resources/repl/i21655 | 4 +- repl/test-resources/repl/i21657 | 4 +- repl/test-resources/repl/i2213 | 10 +-- repl/test-resources/repl/i2631 | 4 +- repl/test-resources/repl/i4184 | 6 +- repl/test-resources/repl/i4217 | 8 +- repl/test-resources/repl/i4566 | 4 +- repl/test-resources/repl/i5733 | 4 +- repl/test-resources/repl/i5890 | 2 +- repl/test-resources/repl/i6474 | 6 +- repl/test-resources/repl/i6643 | 2 +- repl/test-resources/repl/i6676 | 30 +++---- repl/test-resources/repl/i7644 | 12 +-- repl/test-resources/repl/i9227 | 4 +- repl/test-resources/repl/i9538 | 4 +- repl/test-resources/repl/importFromObj | 20 ++--- repl/test-resources/repl/init-script-flag | 2 +- repl/test-resources/repl/jar-command | 2 +- repl/test-resources/repl/jar-errors | 10 +-- repl/test-resources/repl/jar-multiple | 4 +- repl/test-resources/repl/notFound | 16 ++-- repl/test-resources/repl/nowarn.scala | 18 ++-- repl/test-resources/repl/overrides | 10 +-- repl/test-resources/repl/parsing | 6 +- repl/test-resources/repl/reset-command | 16 ++-- repl/test-resources/repl/rewrite-messages | 8 +- repl/test-resources/repl/settings-command | 8 +- repl/test-resources/repl/settings-outputDir | 2 +- .../repl/settings-repl-disable-display | 6 +- repl/test-resources/repl/silent | 20 ++--- .../test-resources/type-printer/type-mismatch | 8 +- repl/test/dotty/tools/repl/ReplTest.scala | 4 +- .../dotty/tools/repl/ShadowingTests.scala | 12 +-- 41 files changed, 203 insertions(+), 205 deletions(-) diff --git a/repl/test-resources/repl/10886 b/repl/test-resources/repl/10886 index 5d06f7995a13..836bee1b1b44 100644 --- a/repl/test-resources/repl/10886 +++ b/repl/test-resources/repl/10886 @@ -6,5 +6,5 @@ scala> type SelChannel[C <: Tuple] = C match { case x *: xs => x | SelChannel[xs scala> lazy val a: SelChannel[("A", "B", "C")] = "A" lazy val a: "A" | ("B" | ("C" | Nothing)) -scala>:type a +scala> :type a ("A" : String) | (("B" : String) | (("C" : String) | Nothing)) diff --git a/repl/test-resources/repl/1379 b/repl/test-resources/repl/1379 index 978aab344204..c39088536476 100644 --- a/repl/test-resources/repl/1379 +++ b/repl/test-resources/repl/1379 @@ -1,6 +1,6 @@ -scala> object Foo { val bar = new Object { def baz = 1 }; bar.baz } +scala> object Foo { val bar = new Object { def baz = 1 }; bar.baz } -- [E008] Not Found Error: ----------------------------------------------------- -1 | object Foo { val bar = new Object { def baz = 1 }; bar.baz } - | ^^^^^^^ +1 |object Foo { val bar = new Object { def baz = 1 }; bar.baz } + | ^^^^^^^ | value baz is not a member of Object 1 error found diff --git a/repl/test-resources/repl/commandPrefixes b/repl/test-resources/repl/commandPrefixes index bf59b5f30be2..74e9458f3cfb 100644 --- a/repl/test-resources/repl/commandPrefixes +++ b/repl/test-resources/repl/commandPrefixes @@ -1,6 +1,6 @@ -scala>:ty 123 +scala> :ty 123 Int -scala>:type 123 +scala> :type 123 Int -scala>:typee 123 +scala> :typee 123 Unknown command: ":typee", run ":help" for a list of commands diff --git a/repl/test-resources/repl/errmsgs b/repl/test-resources/repl/errmsgs index 9819c1cb089f..c8a6bb47b1aa 100644 --- a/repl/test-resources/repl/errmsgs +++ b/repl/test-resources/repl/errmsgs @@ -2,33 +2,33 @@ scala> class Inv[T](x: T) // defined class Inv scala> val x: List[String] = List(1) -- [E007] Type Mismatch Error: ------------------------------------------------- -1 | val x: List[String] = List(1) - | ^ - | Found: (1 : Int) - | Required: String +1 |val x: List[String] = List(1) + | ^ + | Found: (1 : Int) + | Required: String | | longer explanation available when compiling with `-explain` 1 error found scala> val y: List[List[String]] = List(List(1)) -- [E007] Type Mismatch Error: ------------------------------------------------- -1 | val y: List[List[String]] = List(List(1)) - | ^ - | Found: (1 : Int) - | Required: String +1 |val y: List[List[String]] = List(List(1)) + | ^ + | Found: (1 : Int) + | Required: String | | longer explanation available when compiling with `-explain` 1 error found scala> val z: (List[String], List[Int]) = (List(1), List("a")) -- [E007] Type Mismatch Error: ------------------------------------------------- -1 | val z: (List[String], List[Int]) = (List(1), List("a")) - | ^ - | Found: (1 : Int) - | Required: String +1 |val z: (List[String], List[Int]) = (List(1), List("a")) + | ^ + | Found: (1 : Int) + | Required: String | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: ------------------------------------------------- -1 | val z: (List[String], List[Int]) = (List(1), List("a")) - | ^^^ +1 |val z: (List[String], List[Int]) = (List(1), List("a")) + | ^^^ | Found: ("a" : String) | Required: Int | @@ -36,26 +36,26 @@ scala> val z: (List[String], List[Int]) = (List(1), List("a")) 2 errors found scala> val a: Inv[String] = new Inv(new Inv(1)) -- [E007] Type Mismatch Error: ------------------------------------------------- -1 | val a: Inv[String] = new Inv(new Inv(1)) - | ^^^^^^^^^^ - | Found: Inv[Int] - | Required: String +1 |val a: Inv[String] = new Inv(new Inv(1)) + | ^^^^^^^^^^ + | Found: Inv[Int] + | Required: String | | longer explanation available when compiling with `-explain` 1 error found scala> val b: Inv[String] = new Inv(1) -- [E007] Type Mismatch Error: ------------------------------------------------- -1 | val b: Inv[String] = new Inv(1) - | ^ - | Found: (1 : Int) - | Required: String +1 |val b: Inv[String] = new Inv(1) + | ^ + | Found: (1 : Int) + | Required: String | | longer explanation available when compiling with `-explain` 1 error found scala> abstract class C { type T; val x: T; val s: Unit = { type T = String; var y: T = x; locally { def f() = { type T = Int; val z: T = y }; f() } }; } -- [E007] Type Mismatch Error: ------------------------------------------------- -1 | abstract class C { type T; val x: T; val s: Unit = { type T = String; var y: T = x; locally { def f() = { type T = Int; val z: T = y }; f() } }; } - | ^ +1 |abstract class C { type T; val x: T; val s: Unit = { type T = String; var y: T = x; locally { def f() = { type T = Int; val z: T = y }; f() } }; } + | ^ |Found: (C.this.x : C.this.T) |Required: T² | @@ -64,8 +64,8 @@ scala> abstract class C { type T; val x: T; val s: Unit = { type T = String; var | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: ------------------------------------------------- -1 | abstract class C { type T; val x: T; val s: Unit = { type T = String; var y: T = x; locally { def f() = { type T = Int; val z: T = y }; f() } }; } - | ^ +1 |abstract class C { type T; val x: T; val s: Unit = { type T = String; var y: T = x; locally { def f() = { type T = Int; val z: T = y }; f() } }; } + | ^ |Found: (y : T) |Required: T² | @@ -76,47 +76,47 @@ scala> abstract class C { type T; val x: T; val s: Unit = { type T = String; var 2 errors found scala> class Foo() { def bar: Int = 1 }; val foo = new Foo(); foo.barr -- [E008] Not Found Error: ----------------------------------------------------- -1 | class Foo() { def bar: Int = 1 }; val foo = new Foo(); foo.barr - | ^^^^^^^^ +1 |class Foo() { def bar: Int = 1 }; val foo = new Foo(); foo.barr + | ^^^^^^^^ | value barr is not a member of Foo - did you mean foo.bar? 1 error found scala> val x: List[Int] = "foo" :: List(1) -- [E007] Type Mismatch Error: ------------------------------------------------- -1 | val x: List[Int] = "foo" :: List(1) - | ^^^^^ - | Found: ("foo" : String) - | Required: Int +1 |val x: List[Int] = "foo" :: List(1) + | ^^^^^ + | Found: ("foo" : String) + | Required: Int | | longer explanation available when compiling with `-explain` 1 error found scala> while ((( foo ))) {} -- [E006] Not Found Error: ----------------------------------------------------- -1 | while ((( foo ))) {} - | ^^^ - | Not found: foo +1 |while ((( foo ))) {} + | ^^^ + | Not found: foo | | longer explanation available when compiling with `-explain` 1 error found scala> val a: iDontExist = 1 -- [E006] Not Found Error: ----------------------------------------------------- -1 | val a: iDontExist = 1 - | ^^^^^^^^^^ - | Not found: type iDontExist +1 |val a: iDontExist = 1 + | ^^^^^^^^^^ + | Not found: type iDontExist | | longer explanation available when compiling with `-explain` 1 error found scala> def foo1(x: => Int) = x _ -- [E099] Syntax Error: -------------------------------------------------------- -1 | def foo1(x: => Int) = x _ - | ^^^ +1 |def foo1(x: => Int) = x _ + | ^^^ |Only function types can be followed by _ but the current expression has type Int | | longer explanation available when compiling with `-explain` 1 error found scala> def foo2(x: => Int): () => Int = x _ -- [E099] Syntax Error: -------------------------------------------------------- -1 | def foo2(x: => Int): () => Int = x _ - | ^^^ +1 |def foo2(x: => Int): () => Int = x _ + | ^^^ |Only function types can be followed by _ but the current expression has type Int | | longer explanation available when compiling with `-explain` diff --git a/repl/test-resources/repl/i13208.default.scala b/repl/test-resources/repl/i13208.default.scala index 048ca522421f..0837f029d101 100644 --- a/repl/test-resources/repl/i13208.default.scala +++ b/repl/test-resources/repl/i13208.default.scala @@ -1,10 +1,10 @@ scala> try 1 1 warning found -- [E002] Syntax Warning: ------------------------------------------------------ -1 | try 1 - | ^^^^^ - | A try without catch or finally is equivalent to putting - | its body in a block; no exceptions are handled. +1 |try 1 + |^^^^^ + |A try without catch or finally is equivalent to putting + |its body in a block; no exceptions are handled. | | longer explanation available when compiling with `-explain` val res0: Int = 1 diff --git a/repl/test-resources/repl/i1370 b/repl/test-resources/repl/i1370 index e10020bf4891..ef1fd9759a17 100644 --- a/repl/test-resources/repl/i1370 +++ b/repl/test-resources/repl/i1370 @@ -1,7 +1,7 @@ scala> object Lives { class Private { def foo1: Any = new Private.C1; def foo2: Any = new Private.C2 }; object Private { class C1 private {}; private class C2 {} } } -- [E173] Reference Error: ----------------------------------------------------- -1 | object Lives { class Private { def foo1: Any = new Private.C1; def foo2: Any = new Private.C2 }; object Private { class C1 private {}; private class C2 {} } } - | ^^^^^^^^^^ +1 |object Lives { class Private { def foo1: Any = new Private.C1; def foo2: Any = new Private.C2 }; object Private { class C1 private {}; private class C2 {} } } + | ^^^^^^^^^^ |constructor C1 cannot be accessed as a member of Lives.Private.C1 from class Private. | private constructor C1 can only be accessed from class C1 in object Private. 1 error found diff --git a/repl/test-resources/repl/i18383 b/repl/test-resources/repl/i18383 index b7e1c8d261a1..146e24f26628 100644 --- a/repl/test-resources/repl/i18383 +++ b/repl/test-resources/repl/i18383 @@ -1,13 +1,13 @@ -scala>:settings -Wunused:all +scala> :settings -Wunused:all scala> import scala.collection.* scala> class Foo { import scala.util.*; println("foo") } 1 warning found -- [E198] Unused Symbol Warning: ----------------------------------------------- -1 | class Foo { import scala.util.*; println("foo") } - | ^ - | unused import +1 |class Foo { import scala.util.*; println("foo") } + | ^ + | unused import // defined class Foo scala> { import scala.util.*; "foo" } diff --git a/repl/test-resources/repl/i2063 b/repl/test-resources/repl/i2063 index 7245f677bfe6..11917e024f05 100644 --- a/repl/test-resources/repl/i2063 +++ b/repl/test-resources/repl/i2063 @@ -1,23 +1,23 @@ scala> class Foo extends Bar // with one tab -- [E006] Not Found Error: ----------------------------------------------------- -1 | class Foo extends Bar // with one tab - | ^^^ - | Not found: type Bar +1 | class Foo extends Bar // with one tab + | ^^^ + | Not found: type Bar | | longer explanation available when compiling with `-explain` 1 error found scala> class Foo extends Bar // with spaces -- [E006] Not Found Error: ----------------------------------------------------- -1 | class Foo extends Bar // with spaces - | ^^^ +1 | class Foo extends Bar // with spaces + | ^^^ | Not found: type Bar | | longer explanation available when compiling with `-explain` 1 error found scala> class Foo extends Bar // with tabs -- [E006] Not Found Error: ----------------------------------------------------- -1 | class Foo extends Bar // with tabs - | ^^^ +1 | class Foo extends Bar // with tabs + | ^^^ | Not found: type Bar | | longer explanation available when compiling with `-explain` diff --git a/repl/test-resources/repl/i21655 b/repl/test-resources/repl/i21655 index 57b09bfad32d..ee5678bf898b 100644 --- a/repl/test-resources/repl/i21655 +++ b/repl/test-resources/repl/i21655 @@ -1,2 +1,2 @@ -scala>:kind -The :kind command is not currently supported. \ No newline at end of file +scala> :kind +The :kind command is not currently supported. diff --git a/repl/test-resources/repl/i21657 b/repl/test-resources/repl/i21657 index fa2eec3ac891..20d638af89e0 100644 --- a/repl/test-resources/repl/i21657 +++ b/repl/test-resources/repl/i21657 @@ -1,2 +1,2 @@ -scala>:sh -The :sh command is deprecated. Use `import scala.sys.process._` and `"command".!` instead. \ No newline at end of file +scala> :sh +The :sh command is deprecated. Use `import scala.sys.process._` and `"command".!` instead. diff --git a/repl/test-resources/repl/i2213 b/repl/test-resources/repl/i2213 index b75b2056c959..a6e41622889e 100644 --- a/repl/test-resources/repl/i2213 +++ b/repl/test-resources/repl/i2213 @@ -1,13 +1,13 @@ scala> def x -- [E019] Syntax Error: -------------------------------------------------------- -1 | def x - | ^ - | Missing return type +1 |def x + | ^ + | Missing return type | | longer explanation available when compiling with `-explain` scala> def x: Int -- [E067] Syntax Error: -------------------------------------------------------- -1 | def x: Int - | ^ +1 |def x: Int + | ^ |Declaration of method x not allowed here: only classes can have declared but undefined members 1 error found diff --git a/repl/test-resources/repl/i2631 b/repl/test-resources/repl/i2631 index a04e2cb15bc6..6bed4fefbc3b 100644 --- a/repl/test-resources/repl/i2631 +++ b/repl/test-resources/repl/i2631 @@ -1,6 +1,6 @@ scala> class Foo(x : Any) { val foo : Integer = 0; def this() = { this(foo) } } -- Error: ---------------------------------------------------------------------- -1 | class Foo(x : Any) { val foo : Integer = 0; def this() = { this(foo) } } - | ^^^ +1 |class Foo(x : Any) { val foo : Integer = 0; def this() = { this(foo) } } + | ^^^ | foo is not accessible from constructor arguments 1 error found diff --git a/repl/test-resources/repl/i4184 b/repl/test-resources/repl/i4184 index 06b2c81ece21..4a54538de5c1 100644 --- a/repl/test-resources/repl/i4184 +++ b/repl/test-resources/repl/i4184 @@ -6,10 +6,10 @@ scala> implicit def eqFoo: CanEqual[foo.Foo, foo.Foo] = CanEqual.derived def eqFoo: CanEqual[foo.Foo, foo.Foo] scala> object Bar { new foo.Foo == new bar.Foo } -- [E172] Type Error: ---------------------------------------------------------- -1 | object Bar { new foo.Foo == new bar.Foo } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 |object Bar { new foo.Foo == new bar.Foo } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | Values of types foo.Foo and bar.Foo² cannot be compared with == or != | | where: Foo is a class in object foo | Foo² is a class in object bar -1 error found \ No newline at end of file +1 error found diff --git a/repl/test-resources/repl/i4217 b/repl/test-resources/repl/i4217 index d4e113271073..e3de82ea848b 100644 --- a/repl/test-resources/repl/i4217 +++ b/repl/test-resources/repl/i4217 @@ -1,11 +1,11 @@ scala> def foo(x: Option[Int]) = x match { case None => } 1 warning found -- [E029] Pattern Match Exhaustivity Warning: ---------------------------------- -1 | def foo(x: Option[Int]) = x match { case None => } - | ^ - | match may not be exhaustive. +1 |def foo(x: Option[Int]) = x match { case None => } + | ^ + | match may not be exhaustive. | - | It would fail on pattern case: Some(_) + | It would fail on pattern case: Some(_) | | longer explanation available when compiling with `-explain` def foo(x: Option[Int]): Unit diff --git a/repl/test-resources/repl/i4566 b/repl/test-resources/repl/i4566 index 32d84a6403d4..c866779b26bc 100644 --- a/repl/test-resources/repl/i4566 +++ b/repl/test-resources/repl/i4566 @@ -1,7 +1,7 @@ scala> object test { type ::[A, B]; def a: Int :: Int = ???; def b: Int = a } -- [E007] Type Mismatch Error: ------------------------------------------------- -1 | object test { type ::[A, B]; def a: Int :: Int = ???; def b: Int = a } - | ^ +1 |object test { type ::[A, B]; def a: Int :: Int = ???; def b: Int = a } + | ^ | Found: Int :: Int | Required: Int | diff --git a/repl/test-resources/repl/i5733 b/repl/test-resources/repl/i5733 index ef578f24522f..c94332c41df7 100644 --- a/repl/test-resources/repl/i5733 +++ b/repl/test-resources/repl/i5733 @@ -3,7 +3,7 @@ scala> abstract class F { def f(arg: Any): Unit; override def toString = "F" } scala> val f: F = println 1 warning found -- Warning: -------------------------------------------------------------------- -1 | val f: F = println - | ^^^^^^^ +1 |val f: F = println + | ^^^^^^^ |method println is eta-expanded even though F does not have the @FunctionalInterface annotation. val f: F = F diff --git a/repl/test-resources/repl/i5890 b/repl/test-resources/repl/i5890 index 6e3c38d5b287..6dee350896fe 100644 --- a/repl/test-resources/repl/i5890 +++ b/repl/test-resources/repl/i5890 @@ -1,4 +1,4 @@ -scala> +scala> scala> {} diff --git a/repl/test-resources/repl/i6474 b/repl/test-resources/repl/i6474 index 39065a694f32..4c470dc4d261 100644 --- a/repl/test-resources/repl/i6474 +++ b/repl/test-resources/repl/i6474 @@ -10,9 +10,9 @@ scala> ((1, 2): Foo2.T[Int][Int]): Foo2.T[Any][Int] val res1: Foo2.T[Any][Int] = (1, 2) scala> (1, 2): Foo3.T[Int][Int] -- [E056] Syntax Error: -------------------------------------------------------- -1 | (1, 2): Foo3.T[Int][Int] - | ^^^^^^^^^^^^^^^^ - | Missing type parameter for Foo3.T[Int][Int] +1 |(1, 2): Foo3.T[Int][Int] + | ^^^^^^^^^^^^^^^^ + | Missing type parameter for Foo3.T[Int][Int] 1 error found scala> ((1, 2): Foo3.T[Int][Int][Int]): Foo3.T[Any][Int][Int] val res2: Foo3.T[Any][Int][Int] = (1, 2) diff --git a/repl/test-resources/repl/i6643 b/repl/test-resources/repl/i6643 index 793206f52590..2fc335619142 100644 --- a/repl/test-resources/repl/i6643 +++ b/repl/test-resources/repl/i6643 @@ -1,5 +1,5 @@ scala> import scala.collection._ -scala>:type 1 +scala> :type 1 Int scala> object IterableTest { def g[CC[_] <: Iterable[?] & IterableOps[?, ?, ?]](from: CC[Int]): IterableFactory[CC] = ??? } // defined object IterableTest diff --git a/repl/test-resources/repl/i6676 b/repl/test-resources/repl/i6676 index e60023000b1d..b10eff6d6721 100644 --- a/repl/test-resources/repl/i6676 +++ b/repl/test-resources/repl/i6676 @@ -1,25 +1,25 @@ scala> xml" -- Error: ---------------------------------------------------------------------- -1 | xml" - | ^ - | unclosed string literal +1 |xml" + | ^ + | unclosed string literal scala> xml"" -- [E008] Not Found Error: ----------------------------------------------------- -1 | xml"" - | ^^^^^ - | value xml is not a member of StringContext +1 |xml"" + |^^^^^ + |value xml is not a member of StringContext 1 error found scala> xml""" -- Error: ---------------------------------------------------------------------- -1 | xml""" - | ^ - | unclosed multi-line string literal +1 |xml""" + | ^ + | unclosed multi-line string literal -- Error: ---------------------------------------------------------------------- -1 | xml""" - | ^ - | unclosed multi-line string literal +1 |xml""" + | ^ + | unclosed multi-line string literal scala> s" -- Error: ---------------------------------------------------------------------- -1 | s" - | ^ - | unclosed string literal +1 |s" + | ^ + | unclosed string literal diff --git a/repl/test-resources/repl/i7644 b/repl/test-resources/repl/i7644 index 786823073470..d2b1cb69959b 100644 --- a/repl/test-resources/repl/i7644 +++ b/repl/test-resources/repl/i7644 @@ -1,16 +1,16 @@ scala> class T extends CanEqual -- [E112] Syntax Error: -------------------------------------------------------- -1 | class T extends CanEqual - | ^ - | Cannot extend sealed trait CanEqual in a different source file +1 |class T extends CanEqual + | ^ + | Cannot extend sealed trait CanEqual in a different source file | | longer explanation available when compiling with `-explain` 1 error found scala> class T extends CanEqual -- [E112] Syntax Error: -------------------------------------------------------- -1 | class T extends CanEqual - | ^ - | Cannot extend sealed trait CanEqual in a different source file +1 |class T extends CanEqual + | ^ + | Cannot extend sealed trait CanEqual in a different source file | | longer explanation available when compiling with `-explain` 1 error found diff --git a/repl/test-resources/repl/i9227 b/repl/test-resources/repl/i9227 index 40f9248898a2..c054abe5f2b1 100644 --- a/repl/test-resources/repl/i9227 +++ b/repl/test-resources/repl/i9227 @@ -1,6 +1,6 @@ scala> import scala.quoted._; inline def myMacro[T]: Unit = ${ myMacroImpl[T] }; def myMacroImpl[T](using Quotes): Expr[Unit] = '{}; println(myMacro[Int]) -- Error: ---------------------------------------------------------------------- -1 | import scala.quoted._; inline def myMacro[T]: Unit = ${ myMacroImpl[T] }; def myMacroImpl[T](using Quotes): Expr[Unit] = '{}; println(myMacro[Int]) - | ^^^^^^^^^^^^ +1 |import scala.quoted._; inline def myMacro[T]: Unit = ${ myMacroImpl[T] }; def myMacroImpl[T](using Quotes): Expr[Unit] = '{}; println(myMacro[Int]) + | ^^^^^^^^^^^^ | Cannot call macro method myMacroImpl defined in the same source file 1 error found diff --git a/repl/test-resources/repl/i9538 b/repl/test-resources/repl/i9538 index 6a9bdacf0baf..12b75c945b80 100644 --- a/repl/test-resources/repl/i9538 +++ b/repl/test-resources/repl/i9538 @@ -1,5 +1,5 @@ -scala>:type +scala> :type :type -scala>:doc +scala> :doc :doc diff --git a/repl/test-resources/repl/importFromObj b/repl/test-resources/repl/importFromObj index 128268e019b8..69edec76a849 100644 --- a/repl/test-resources/repl/importFromObj +++ b/repl/test-resources/repl/importFromObj @@ -6,10 +6,10 @@ scala> object o { val xs = List(1, 2, 3) } scala> import o._ scala> buf += xs -- [E007] Type Mismatch Error: ------------------------------------------------- -1 | buf += xs - | ^^ - | Found: (o.xs : List[Int]) - | Required: Int +1 |buf += xs + | ^^ + | Found: (o.xs : List[Int]) + | Required: Int | | longer explanation available when compiling with `-explain` 1 error found @@ -17,13 +17,13 @@ scala> buf ++= xs val res0: mutable.ListBuffer[Int] = ListBuffer(1, 2, 3) scala> import util.foobar -- [E008] Not Found Error: ----------------------------------------------------- -1 | import util.foobar - | ^^^^^^ - | value foobar is not a member of util +1 |import util.foobar + | ^^^^^^ + | value foobar is not a member of util 1 error found scala> import util.foobar.bar -- [E008] Not Found Error: ----------------------------------------------------- -1 | import util.foobar.bar - | ^^^^^^^^^^^ - | value foobar is not a member of util +1 |import util.foobar.bar + | ^^^^^^^^^^^ + | value foobar is not a member of util 1 error found diff --git a/repl/test-resources/repl/init-script-flag b/repl/test-resources/repl/init-script-flag index 373f21e15e93..49a031239017 100644 --- a/repl/test-resources/repl/init-script-flag +++ b/repl/test-resources/repl/init-script-flag @@ -1,4 +1,4 @@ -scala>:reset --repl-init-script:'println("Hello from init script!")' +scala> :reset --repl-init-script:'println("Hello from init script!")' Resetting REPL state with the following settings: --repl-init-script:println("Hello from init script!") diff --git a/repl/test-resources/repl/jar-command b/repl/test-resources/repl/jar-command index 25b1e72b71df..cf8f7a5ec16e 100644 --- a/repl/test-resources/repl/jar-command +++ b/repl/test-resources/repl/jar-command @@ -1,7 +1,7 @@ scala> val z = 1 val z: Int = 1 -scala>:jar ../sbt-test/source-dependencies/canon/actual/a.jar +scala> :jar ../sbt-test/source-dependencies/canon/actual/a.jar Added '../sbt-test/source-dependencies/canon/actual/a.jar' to classpath. scala> import A.x diff --git a/repl/test-resources/repl/jar-errors b/repl/test-resources/repl/jar-errors index ff6284fc60ce..20221dbb6114 100644 --- a/repl/test-resources/repl/jar-errors +++ b/repl/test-resources/repl/jar-errors @@ -1,11 +1,11 @@ -scala>:jar path/does/not/exist +scala> :jar path/does/not/exist Cannot add "path/does/not/exist" to classpath. -scala>:jar ../sbt-test/source-dependencies/canon/actual/a.jar +scala> :jar ../sbt-test/source-dependencies/canon/actual/a.jar Added '../sbt-test/source-dependencies/canon/actual/a.jar' to classpath. -scala>:jar ../sbt-test/source-dependencies/canon/actual/a.jar +scala> :jar ../sbt-test/source-dependencies/canon/actual/a.jar The path '../sbt-test/source-dependencies/canon/actual/a.jar' cannot be loaded, it contains a classfile that already exists on the classpath: ../sbt-test/source-dependencies/canon/actual/a.jar(A.class) -scala>:require ../sbt-test/source-dependencies/canon/actual/a.jar -:require is no longer supported, but has been replaced with :jar. Please use :jar \ No newline at end of file +scala> :require ../sbt-test/source-dependencies/canon/actual/a.jar +:require is no longer supported, but has been replaced with :jar. Please use :jar diff --git a/repl/test-resources/repl/jar-multiple b/repl/test-resources/repl/jar-multiple index 17e3aa255f72..637f522faa11 100644 --- a/repl/test-resources/repl/jar-multiple +++ b/repl/test-resources/repl/jar-multiple @@ -1,7 +1,7 @@ scala> val z = 1 val z: Int = 1 -scala>:jar ../compiler/test-resources/jars/mylibrary.jar +scala> :jar ../compiler/test-resources/jars/mylibrary.jar Added '../compiler/test-resources/jars/mylibrary.jar' to classpath. scala> import mylibrary.Utils @@ -9,7 +9,7 @@ scala> import mylibrary.Utils scala> Utils.greet("Alice") val res0: String = "Hello, Alice!" -scala>:jar ../compiler/test-resources/jars/mylibrary2.jar +scala> :jar ../compiler/test-resources/jars/mylibrary2.jar Added '../compiler/test-resources/jars/mylibrary2.jar' to classpath. scala> import mylibrary2.Utils2 diff --git a/repl/test-resources/repl/notFound b/repl/test-resources/repl/notFound index 689854ef2700..0bd1b261f59e 100644 --- a/repl/test-resources/repl/notFound +++ b/repl/test-resources/repl/notFound @@ -1,16 +1,16 @@ -scala> Foo +scala> Foo -- [E006] Not Found Error: ----------------------------------------------------- -1 | Foo - | ^^^ - | Not found: Foo +1 |Foo + |^^^ + |Not found: Foo | | longer explanation available when compiling with `-explain` 1 error found -scala> Bar +scala> Bar -- [E006] Not Found Error: ----------------------------------------------------- -1 | Bar - | ^^^ - | Not found: Bar +1 |Bar + |^^^ + |Not found: Bar | | longer explanation available when compiling with `-explain` 1 error found diff --git a/repl/test-resources/repl/nowarn.scala b/repl/test-resources/repl/nowarn.scala index 975f9c72a809..b88d8c4d4f70 100644 --- a/repl/test-resources/repl/nowarn.scala +++ b/repl/test-resources/repl/nowarn.scala @@ -1,8 +1,8 @@ scala> @annotation.nowarn def f = try 1 // @nowarn doesn't work on first line, ctx.run is null in issueIfNotSuppressed 1 warning found -- [E002] Syntax Warning: ------------------------------------------------------ -1 | @annotation.nowarn def f = try 1 // @nowarn doesn't work on first line, ctx.run is null in issueIfNotSuppressed - | ^^^^^ +1 |@annotation.nowarn def f = try 1 // @nowarn doesn't work on first line, ctx.run is null in issueIfNotSuppressed + | ^^^^^ | A try without catch or finally is equivalent to putting | its body in a block; no exceptions are handled. | @@ -13,10 +13,10 @@ def f: Int scala> def f = try 1 1 warning found -- [E002] Syntax Warning: ------------------------------------------------------ -1 | def f = try 1 - | ^^^^^ - | A try without catch or finally is equivalent to putting - | its body in a block; no exceptions are handled. +1 |def f = try 1 + | ^^^^^ + | A try without catch or finally is equivalent to putting + | its body in a block; no exceptions are handled. | | longer explanation available when compiling with `-explain` def f: Int @@ -25,9 +25,9 @@ def f: Int scala> def f = { 1; 2 } 1 warning found -- [E129] Potential Issue Warning: --------------------------------------------- -1 | def f = { 1; 2 } - | ^ - | A pure expression does nothing in statement position +1 |def f = { 1; 2 } + | ^ + | A pure expression does nothing in statement position | | longer explanation available when compiling with `-explain` def f: Int diff --git a/repl/test-resources/repl/overrides b/repl/test-resources/repl/overrides index 5bad603801a4..bb4f5f43aca5 100644 --- a/repl/test-resources/repl/overrides +++ b/repl/test-resources/repl/overrides @@ -1,8 +1,8 @@ scala> class B { override def foo(i: Int): Unit = {}; } -- [E037] Declaration Error: --------------------------------------------------- -1 | class B { override def foo(i: Int): Unit = {}; } - | ^ - | method foo overrides nothing +1 |class B { override def foo(i: Int): Unit = {}; } + | ^ + | method foo overrides nothing | | longer explanation available when compiling with `-explain` 1 error found @@ -10,8 +10,8 @@ scala> class A { def foo: Unit = {}; } // defined class A scala> class B extends A { override def foo(i: Int): Unit = {}; } -- [E038] Declaration Error: --------------------------------------------------- -1 | class B extends A { override def foo(i: Int): Unit = {}; } - | ^ +1 |class B extends A { override def foo(i: Int): Unit = {}; } + | ^ | method foo has a different signature than the overridden declaration | | longer explanation available when compiling with `-explain` diff --git a/repl/test-resources/repl/parsing b/repl/test-resources/repl/parsing index 76cdd488ca36..a6f67d3859d3 100644 --- a/repl/test-resources/repl/parsing +++ b/repl/test-resources/repl/parsing @@ -10,6 +10,6 @@ val res3: Int = 1 val res4: Int = 2 scala> } -- [E040] Syntax Error: -------------------------------------------------------- -1 | } - | ^ - | eof expected, but '}' found +1 |} + |^ + |eof expected, but '}' found diff --git a/repl/test-resources/repl/reset-command b/repl/test-resources/repl/reset-command index da6da30b5182..0796e38a5488 100644 --- a/repl/test-resources/repl/reset-command +++ b/repl/test-resources/repl/reset-command @@ -1,12 +1,12 @@ scala> def f(thread: Thread) = thread.stop() 1 warning found -- Deprecation Warning: -------------------------------------------------------- -1 | def f(thread: Thread) = thread.stop() - | ^^^^^^^^^^^ +1 |def f(thread: Thread) = thread.stop() + | ^^^^^^^^^^^ |method stop in class Thread is deprecated: see corresponding Javadoc for more information. def f(thread: Thread): Unit -scala>:reset -deprecation:false +scala> :reset -deprecation:false Resetting REPL state with the following settings: -deprecation:false @@ -18,16 +18,16 @@ def f(thread: Thread): Unit scala> def resetNoArgsStillWorks = 1 def resetNoArgsStillWorks: Int -scala>:reset +scala> :reset Resetting REPL state. scala> resetNoArgsStillWorks -- [E006] Not Found Error: ----------------------------------------------------- -1 | resetNoArgsStillWorks - | ^^^^^^^^^^^^^^^^^^^^^ - | Not found: resetNoArgsStillWorks +1 |resetNoArgsStillWorks + |^^^^^^^^^^^^^^^^^^^^^ + |Not found: resetNoArgsStillWorks | | longer explanation available when compiling with `-explain` 1 error found -scala>:settings "-Dfoo=bar baz" +scala> :settings "-Dfoo=bar baz" diff --git a/repl/test-resources/repl/rewrite-messages b/repl/test-resources/repl/rewrite-messages index 2f78486782c6..de67f4a69eb8 100644 --- a/repl/test-resources/repl/rewrite-messages +++ b/repl/test-resources/repl/rewrite-messages @@ -1,8 +1,8 @@ //> using options -source:future-migration -deprecation -Werror scala> import scala.util._ -- Migration Warning: ---------------------------------------------------------- -1 | import scala.util._ - | ^ +1 |import scala.util._ + | ^ | `_` is no longer supported for a wildcard import; use `*` instead No warnings can be incurred under -Werror 1 warning found @@ -11,8 +11,8 @@ scala> extension (x: Int) def foo(y: Int) = x + y def foo(x: Int)(y: Int): Int scala> 2 foo 4 -- Migration Warning: ---------------------------------------------------------- -1 | 2 foo 4 - | ^^^ +1 |2 foo 4 + | ^^^ |Alphanumeric method foo is not declared infix; it should not be used as infix operator. |Instead, use method syntax .foo(...) or backticked identifier `foo`. No warnings can be incurred under -Werror diff --git a/repl/test-resources/repl/settings-command b/repl/test-resources/repl/settings-command index 4cd5fa4e5fed..9e979b421957 100644 --- a/repl/test-resources/repl/settings-command +++ b/repl/test-resources/repl/settings-command @@ -1,17 +1,15 @@ scala> def f(thread: Thread) = thread.stop() 1 warning found -- Deprecation Warning: -------------------------------------------------------- -1 | def f(thread: Thread) = thread.stop() - | ^^^^^^^^^^^ +1 |def f(thread: Thread) = thread.stop() + | ^^^^^^^^^^^ |method stop in class Thread is deprecated: see corresponding Javadoc for more information. def f(thread: Thread): Unit -scala>:settings -deprecation:false foo.scala +scala> :settings -deprecation:false foo.scala Ignoring spurious arguments: foo.scala scala> def f(thread: Thread) = thread.stop() there was 1 deprecation warning; re-run with -deprecation for details 1 warning found def f(thread: Thread): Unit - -scala> diff --git a/repl/test-resources/repl/settings-outputDir b/repl/test-resources/repl/settings-outputDir index 8f0460a30cfe..996e0f372ae1 100644 --- a/repl/test-resources/repl/settings-outputDir +++ b/repl/test-resources/repl/settings-outputDir @@ -4,7 +4,7 @@ val res0: Boolean = true scala> val x = 1 val x: Int = 1 -scala>:settings -d target/test-repl-settings-outDir +scala> :settings -d target/test-repl-settings-outDir scala> val y = 2 val y: Int = 2 diff --git a/repl/test-resources/repl/settings-repl-disable-display b/repl/test-resources/repl/settings-repl-disable-display index ba2c1c64574b..3a0a0322698c 100644 --- a/repl/test-resources/repl/settings-repl-disable-display +++ b/repl/test-resources/repl/settings-repl-disable-display @@ -1,12 +1,12 @@ scala> 1 val res0: Int = 1 -scala>:settings -Xrepl-disable-display +scala> :settings -Xrepl-disable-display scala> 2 -scala>:reset +scala> :reset Resetting REPL state. scala> 3 -val res0: Int = 3 \ No newline at end of file +val res0: Int = 3 diff --git a/repl/test-resources/repl/silent b/repl/test-resources/repl/silent index 9e851e8adb01..52aa04746703 100644 --- a/repl/test-resources/repl/silent +++ b/repl/test-resources/repl/silent @@ -1,25 +1,25 @@ -scala>:silent +scala> :silent scala> 1+1 scala> case class A(x: Int) scala> A("string") -- [E007] Type Mismatch Error: ------------------------------------------------- -1 | A("string") - | ^^^^^^^^ - | Found: ("string" : String) - | Required: Int +1 |A("string") + | ^^^^^^^^ + | Found: ("string" : String) + | Required: Int | | longer explanation available when compiling with `-explain` 1 error found scala> Option[Int](2) match { case Some(x) => x } 1 warning found -- [E029] Pattern Match Exhaustivity Warning: ---------------------------------- -1 | Option[Int](2) match { case Some(x) => x } - | ^^^^^^^^^^^^^^ - | match may not be exhaustive. +1 |Option[Int](2) match { case Some(x) => x } + |^^^^^^^^^^^^^^ + |match may not be exhaustive. | - | It would fail on pattern case: None + |It would fail on pattern case: None | | longer explanation available when compiling with `-explain` -scala>:silent +scala> :silent scala> 1 + 2 val res2: Int = 3 diff --git a/repl/test-resources/type-printer/type-mismatch b/repl/test-resources/type-printer/type-mismatch index d139f9dff74b..6759eccf984d 100644 --- a/repl/test-resources/type-printer/type-mismatch +++ b/repl/test-resources/type-printer/type-mismatch @@ -4,10 +4,10 @@ scala> Foo(1) val res0: Foo[Int] = Foo(1) scala> val x: Foo[String] = res0 -- [E007] Type Mismatch Error: ------------------------------------------------- -1 | val x: Foo[String] = res0 - | ^^^^ - | Found: (res0 : Foo[Int]) - | Required: Foo[String] +1 |val x: Foo[String] = res0 + | ^^^^ + | Found: (res0 : Foo[Int]) + | Required: Foo[String] | | longer explanation available when compiling with `-explain` 1 error found diff --git a/repl/test/dotty/tools/repl/ReplTest.scala b/repl/test/dotty/tools/repl/ReplTest.scala index 99edb638136c..f56e1813e84d 100644 --- a/repl/test/dotty/tools/repl/ReplTest.scala +++ b/repl/test/dotty/tools/repl/ReplTest.scala @@ -63,7 +63,7 @@ extends ReplDriver(options, new PrintStream(out, true, StandardCharsets.UTF_8.na /** Returns failures: None if all is well, Some for an error */ private def testScript(name: => String, lines: List[String], scriptFile: Option[JFile] = None): Option[String] = { - val prompt = "scala>" + val prompt = "scala> " def evaluate(state: State, input: String) = try { @@ -91,7 +91,7 @@ extends ReplDriver(options, new PrintStream(out, true, StandardCharsets.UTF_8.na resetToInitial(opts) assert(inputLines.head.startsWith(prompt), - s"""Each script must start with the prompt: "$prompt"""") + s"""[$name]: Each script must start with the prompt: "$prompt"""") val inputRes = inputLines.filter(_.startsWith(prompt)) val buf = new ArrayBuffer[String] diff --git a/repl/test/dotty/tools/repl/ShadowingTests.scala b/repl/test/dotty/tools/repl/ShadowingTests.scala index 20208798fec2..f149d009f1dc 100644 --- a/repl/test/dotty/tools/repl/ShadowingTests.scala +++ b/repl/test/dotty/tools/repl/ShadowingTests.scala @@ -92,9 +92,9 @@ class ShadowingTests extends ReplTest(options = ShadowingTests.options): script = """|scala> new C().c |-- [E171] Type Error: ---------------------------------------------------------- - |1 | new C().c - | | ^^^^^^^ - | | missing argument for parameter c of constructor C in class C: (c: Int): C + |1 |new C().c + | |^^^^^^^ + | |missing argument for parameter c of constructor C in class C: (c: Int): C |1 error found | |scala> new C(13).c @@ -141,9 +141,9 @@ class ShadowingTests extends ReplTest(options = ShadowingTests.options): testScript(name = "", """|scala> import util.Try |-- [E008] Not Found Error: ----------------------------------------------------- - |1 | import util.Try - | | ^^^ - | | value Try is not a member of util + |1 |import util.Try + | | ^^^ + | | value Try is not a member of util |1 error found | |scala> object util { class Try { override def toString = "you've gotta try!" } }