Skip to content
This repository was archived by the owner on Sep 1, 2020. It is now read-only.

Commit 8d119e6

Browse files
committed
Merge pull request scala#4600 from adriaanm/fixup-4564-checkinit
Correct init order between Pasted and ILoop#pasted
2 parents 4fe9fdc + 8ec12f6 commit 8d119e6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/repl/scala/tools/nsc/interpreter/Pasted.scala

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@ abstract class Pasted {
2121
def PromptString: String
2222
def AltPromptString: String = "scala> "
2323

24-
private val testBoth = PromptString != AltPromptString
24+
/* `testBoth` cannot be a val, as `Pasted` is inherited by `object paste` in ILoop,
25+
which would cause `val testBoth` to be initialized before `val PromptString` was.
26+
27+
object paste extends Pasted {
28+
val PromptString = prompt.lines.toList.last
29+
*/
30+
private def testBoth = PromptString != AltPromptString
2531
private val spacey = " \t".toSet
2632

2733
def matchesPrompt(line: String) = matchesString(line, PromptString) || testBoth && matchesString(line, AltPromptString)

0 commit comments

Comments
 (0)