浏览代码

More informative error messages

Yentl Van Tendeloo 9 年之前
父节点
当前提交
582ab75f72

+ 1 - 1
bootstrap/modelling.alc

@@ -172,7 +172,7 @@ Void function instantiate_attribute(model : Element, element : String, attribute
 		log("Could not find attribute!")
 		return
 		
-	attr_name = model_add_value(model, "", value)
+	attr_name = model_add_value(model, (element + ".") + attribute_name, value)
 	retype(model, attr_name, reverseKeyLookup(model["metamodel"]["model"], read_edge_dst(model["metamodel"]["model"][attr_type])))
 	instantiate_link(model, attr_type, "", element, attr_name)
 

+ 3 - 3
integration/code/several_petrinets.mvc

@@ -5,9 +5,9 @@ SCD PetriNets{
     Class Natural {
         $
             if (bool_not(is_physical_int(self))):
-                return "Natural has no integer value"
+                return "Natural has no integer value at " + element
             elif (integer_lt(self, 0)):
-                return "Natural does not have a positive or zero value"
+                return "Natural does not have a positive or zero value at " + element
             else:
                 return "OK"
          $
@@ -64,7 +64,7 @@ PetriNets invalid_petrinet_2 {
         tokens = 3
     }
     Transition t1 {}
-    P2T (p1, t1) {
+    P2T p2t(p1, t1) {
         weight = -1
     }
     T2P (t1, p2) {

+ 1 - 3
integration/test_constructors_models_compiled.py

@@ -86,8 +86,6 @@ class TestConstructorsModelsCompiled(unittest.TestCase):
                    conformance_check("models/invalid_petrinet_2") + \
                    conformance_check("models/invalid_petrinet_3") + \
                    conformance_check("models/invalid_petrinet_4") + \
-                   conformance_check("models/invalid_petrinet_5") + \
-                   conformance_check("models/invalid_petrinet_6") + \
                    conformance_check("models/invalid_petrinet_7") + \
                    ['"return"', 'false']
-        self.assertTrue(run_barebone(commands, ["OK", "Natural does not have a positive or zero value", "Natural does not have a positive or zero value", "Destination of model edge not typed by source of type: wrong_p2t", "Source of model edge not typed by source of type: wrong_t2p", "Minimum cardinality violation: Place_tokens", "Minimum cardinality violation: P2T_weight", "Natural has no integer value"], 1))
+        self.assertTrue(run_barebone(commands, ["OK", "Natural does not have a positive or zero value at p1.tokens", "Natural does not have a positive or zero value at p2t.weight", "Destination of model edge not typed by source of type: wrong_p2t", "Source of model edge not typed by source of type: wrong_t2p", "Natural has no integer value at p1.tokens"], 1))