Check REPL snippet syntax before calling analysis

restores the behaviour of the GenericRepl implementation and fixes
issues then invalid code is being compiled
#KT-34888 fixed
This commit is contained in:
Ilya Chernikov
2020-01-10 09:30:59 +01:00
parent 8e07482862
commit d15d62a338
4 changed files with 80 additions and 40 deletions
@@ -96,6 +96,9 @@ class KJvmReplCompilerImpl(val hostConfiguration: ScriptingHostConfiguration) :
)
.valueOr { return it }
val syntaxErrorReport = AnalyzerWithCompilerReport.reportSyntaxErrors(snippetKtFile, errorHolder)
if (syntaxErrorReport.isHasErrors) return failure(messageCollector)
val (sourceFiles, sourceDependencies) = collectRefinedSourcesAndUpdateEnvironment(
context,
snippetKtFile,