From 8ede4cc47cef9f74682972f88bcf7730a64e7fcd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Hannu=20Niemist=C3=B6?= Date: Thu, 5 Apr 2018 13:28:31 +0300 Subject: [PATCH] Show imports of nonexistent modules as errors Previously there was a separate error category IMPORT_ERROR for all import errors that was sorted with WARNINGS. Now IMPORT_ERROR category is also used for import failures whose reason is compilation problem in the upstream module (although this is fatal for compilation, the problem is not located in the current module). refs #7857 Change-Id: Id9227a69d045b68a3e94c1562eb6d24f70d7aaa1 --- .../src/org/simantics/modeling/ComponentTypeScriptRequest.java | 3 ++- .../org/simantics/scl/compiler/compilation/Elaboration.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/ComponentTypeScriptRequest.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/ComponentTypeScriptRequest.java index e5ae63935..676aa2d18 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/ComponentTypeScriptRequest.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/ComponentTypeScriptRequest.java @@ -48,7 +48,8 @@ public class ComponentTypeScriptRequest implements Read errors = new ArrayList(); for (ImportFailure failure : cause.failures) { - errors.add(new CompilationError(0, failure.toString(), ErrorSeverity.IMPORT_ERROR)); + errors.add(new CompilationError(0, failure.toString(), + failure.reason == ImportFailure.MODULE_DOES_NOT_EXIST_REASON ? ErrorSeverity.ERROR : ErrorSeverity.IMPORT_ERROR)); } return new ComponentTypeScriptResult(errors, null); } diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/compilation/Elaboration.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/compilation/Elaboration.java index abdabf5ac..c59df828d 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/compilation/Elaboration.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/compilation/Elaboration.java @@ -194,7 +194,8 @@ public class Elaboration { compilationContext.environment = new EnvironmentOfModule(importedEnvironment, module); } catch (ImportFailureException e) { for(ImportFailure failure : e.failures) - errorLog.log(new CompilationError(failure.location, failure.toString(), ErrorSeverity.IMPORT_ERROR)); + errorLog.log(new CompilationError(failure.location, failure.toString(), + failure.reason == ImportFailure.MODULE_DOES_NOT_EXIST_REASON ? ErrorSeverity.ERROR : ErrorSeverity.IMPORT_ERROR)); return; } for(ImportDeclaration importAst : importsAst) -- 2.47.1