about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--073deep_copy.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/073deep_copy.cc b/073deep_copy.cc
index 02da9e68..277459e1 100644
--- a/073deep_copy.cc
+++ b/073deep_copy.cc
@@ -198,6 +198,14 @@ case DEEP_COPY: {
     raise << maybe(get(Recipe, r).name) << "'deep-copy' takes exactly one ingredient rather than '" << to_original_string(inst) << "'\n" << end();
     break;
   }
+  if (SIZE(inst.products) != 1) {
+    raise << maybe(get(Recipe, r).name) << "'deep-copy' takes exactly one ingredient rather than '" << to_original_string(inst) << "'\n" << end();
+    break;
+  }
+  if (!types_strictly_match(inst.ingredients.at(0), inst.products.at(0))) {
+    raise << maybe(get(Recipe, r).name) << "'deep-copy' requires its ingredient and product to be the same type, but got '" << to_original_string(inst) << "'\n" << end();
+    break;
+  }
   break;
 }
 :(before "End Primitive Recipe Implementations")