From 234ec878aa8c709dd61fb90f2556ff49da745ce0 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sun, 3 Jul 2016 11:07:48 -0700 Subject: 3095 - start type-checking 'deep-copy' instructions --- 073deep_copy.cc | 8 ++++++++ 1 file changed, 8 insertions(+) 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") -- cgit 1.4.1-2-gfad0