]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Show imports of nonexistent modules as errors 92/1692/1
authorHannu Niemistö <hannu.niemisto@semantum.fi>
Thu, 5 Apr 2018 10:28:31 +0000 (13:28 +0300)
committerHannu Niemistö <hannu.niemisto@semantum.fi>
Thu, 5 Apr 2018 10:28:31 +0000 (13:28 +0300)
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

bundles/org.simantics.modeling/src/org/simantics/modeling/ComponentTypeScriptRequest.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/compilation/Elaboration.java

index e5ae639355b1087ff16aa48fdfe095a99f408ad7..676aa2d18a246beaaba7ca3ef3b60bb5f2780361 100644 (file)
@@ -48,7 +48,8 @@ public class ComponentTypeScriptRequest implements Read<ComponentTypeScriptResul
                 // at the very start of the editor
                 List<CompilationError> errors = new ArrayList<CompilationError>();
                 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);
             }
index abdabf5ac7e3cc55b0fb875e71dfc038d1a1f9b5..c59df828d93a852cf6c5b03d848f8cad9b3f3792 100644 (file)
@@ -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)