diff --git a/compiler/src/dotty/tools/repl/ParseResult.scala b/compiler/src/dotty/tools/repl/ParseResult.scala index d949f1f997d2..ae79438c594f 100644 --- a/compiler/src/dotty/tools/repl/ParseResult.scala +++ b/compiler/src/dotty/tools/repl/ParseResult.scala @@ -156,11 +156,13 @@ object ParseResult { case CommandExtract(_) | "" => false case _ => { val reporter = newStoreReporter + val source = SourceFile.virtual("", sourceCode) + val localCtx = ctx.fresh.setSource(source).setReporter(reporter) var needsMore = false reporter.withIncompleteHandler((_, _) => needsMore = true) { - parseStats(sourceCode)(ctx.fresh.setReporter(reporter)) - !reporter.hasErrors && needsMore + parseStats(sourceCode)(localCtx) } + !reporter.hasErrors && needsMore } } }