From f8beb3816b24b50500bbe88d226ffb10cb15d316 Mon Sep 17 00:00:00 2001 From: Allan Renucci Date: Sun, 10 Feb 2019 18:54:53 +0100 Subject: [PATCH] Fix #5769: Add missing source to context --- compiler/src/dotty/tools/repl/ParseResult.scala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 } } }