Explorar o código

Add exception when adding multiple entries to the same dictionary using
the primitive

Yentl Van Tendeloo %!s(int64=9) %!d(string=hai) anos
pai
achega
3dd3459abe
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      kernel/modelverse_kernel/primitives.py

+ 3 - 1
kernel/modelverse_kernel/primitives.py

@@ -339,7 +339,9 @@ def list_len(a, **remainder):
     raise PrimitiveFinished(result)
 
 def dict_add(a, b, c, **remainder):
-    new_edge = yield [("CE", [a, c])]
+    is_here, new_edge = yield [("RD", [a, b]), ("CE", [a, c])]
+    if is_here is not None:
+        raise Exception("dict_add on existing value!")
     yield [("CE", [new_edge, b])]
     raise PrimitiveFinished(a)