]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
(refs #7346) Give a proper error message about unresolved relations 70/670/1
authorHannu Niemistö <hannu.niemisto@semantum.fi>
Mon, 3 Jul 2017 08:35:12 +0000 (11:35 +0300)
committerHannu Niemistö <hannu.niemisto@semantum.fi>
Mon, 3 Jul 2017 08:35:12 +0000 (11:35 +0300)
Change-Id: I0819c0cbc1c58e1090ac79f8457bcf308796cd23

bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/CHRLiteral.java

index 7b4a5bc26b1c7afb59addb97fa91d93985d7cc39..f44609e6c1b13552b9311025f2872c740a10978c 100644 (file)
@@ -47,6 +47,10 @@ public class CHRLiteral extends Symbol {
     }
 
     public void resolve(TranslationContext context) {
+        if(parameters != null) {
+            for(int i=0;i<parameters.length;++i)
+                parameters[i] = parameters[i].resolve(context);
+        }
         if(relation instanceof UnresolvedCHRRelation) {
             UnresolvedCHRRelation unresolved = (UnresolvedCHRRelation)relation;
             CHRConstraint constraint = context.resolveCHRConstraint(unresolved.name);
@@ -59,6 +63,10 @@ public class CHRLiteral extends Symbol {
                 if(sclRelation != null)
                     relation = new ExternalCHRRelation(sclRelation);
                 else {
+                    if(unresolved.name.contains(".")) {
+                        context.getErrorLog().log(unresolved.location, "Couldn't resolve relation " + unresolved.name + ".");
+                        return;
+                    }   
                     if(parameters == null) {
                         context.getErrorLog().log(location, "Relation must be declared if record syntax is used.");
                         return;
@@ -98,10 +106,6 @@ public class CHRLiteral extends Symbol {
             }
             fields = null;
         }
-        else {
-            for(int i=0;i<parameters.length;++i)
-                parameters[i] = parameters[i].resolve(context);
-        }
     }
 
     public void collectRefs(TObjectIntHashMap<Object> allRefs, TIntHashSet refs) {