From: Hannu Niemistö Date: Thu, 5 Apr 2018 10:28:31 +0000 (+0300) Subject: Show imports of nonexistent modules as errors X-Git-Tag: v1.43.0~136^2~505 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F92%2F1692%2F1;p=simantics%2Fplatform.git 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 --- 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)