From 63d069bd4f059baad76b7b421c4a1330ea5ffea5 Mon Sep 17 00:00:00 2001 From: Dmitry Bushev Date: Thu, 3 Feb 2022 14:43:55 +0300 Subject: [PATCH] feat: suppress compilation errors from Builtins --- .../instrument/job/EnsureCompiledJob.scala | 43 +++++++++++-------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/engine/runtime/src/main/scala/org/enso/interpreter/instrument/job/EnsureCompiledJob.scala b/engine/runtime/src/main/scala/org/enso/interpreter/instrument/job/EnsureCompiledJob.scala index 540e2200e094..d5acd4a18030 100644 --- a/engine/runtime/src/main/scala/org/enso/interpreter/instrument/job/EnsureCompiledJob.scala +++ b/engine/runtime/src/main/scala/org/enso/interpreter/instrument/job/EnsureCompiledJob.scala @@ -23,6 +23,7 @@ import org.enso.interpreter.instrument.execution.{ RuntimeContext } import org.enso.interpreter.runtime.Module +import org.enso.interpreter.runtime.builtin.Builtins import org.enso.interpreter.runtime.scope.ModuleScope import org.enso.pkg.QualifiedName import org.enso.polyglot.{ModuleExports, Suggestion} @@ -249,27 +250,31 @@ class EnsureCompiledJob(protected val files: Iterable[File]) private def runCompilationDiagnostics(module: Module)(implicit ctx: RuntimeContext ): CompilationStatus = { - val pass = GatherDiagnostics - .runModule( - module.getIr, - ModuleContext( - module, - compilerConfig = ctx.executionService.getContext.getCompilerConfig + if (module.getName.toString == Builtins.MODULE_NAME) { + CompilationStatus.Success + } else { + val pass = GatherDiagnostics + .runModule( + module.getIr, + ModuleContext( + module, + compilerConfig = ctx.executionService.getContext.getCompilerConfig + ) ) - ) - .unsafeGetMetadata( - GatherDiagnostics, - "No diagnostics metadata right after the gathering pass." - ) - .diagnostics - val diagnostics = pass.collect { - case warn: IR.Warning => - createDiagnostic(Api.DiagnosticType.Warning(), module, warn) - case error: IR.Error => - createDiagnostic(Api.DiagnosticType.Error(), module, error) + .unsafeGetMetadata( + GatherDiagnostics, + "No diagnostics metadata right after the gathering pass." + ) + .diagnostics + val diagnostics = pass.collect { + case warn: IR.Warning => + createDiagnostic(Api.DiagnosticType.Warning(), module, warn) + case error: IR.Error => + createDiagnostic(Api.DiagnosticType.Error(), module, error) + } + sendDiagnosticUpdates(diagnostics) + getCompilationStatus(diagnostics) } - sendDiagnosticUpdates(diagnostics) - getCompilationStatus(diagnostics) } /** Create Api diagnostic message from the `IR` node.