]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/CHRLiteral.java
(refs #7346) Give a proper error message about unresolved relations
[simantics/platform.git] / 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) {