about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-11-14 23:12:03 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-11-14 23:12:03 -0800
commit3a982057f8b8c8fbca6a95e0f7043f9f0decb5f3 (patch)
treed309683cca65db04439b60822027cdbf15a0b736
parent5bbd91a06eb2e315682a77fb4845c3321a0b3920 (diff)
downloadmu-3a982057f8b8c8fbca6a95e0f7043f9f0decb5f3.tar.gz
2439 - bugfix: commandline ingredients
-rw-r--r--035call_ingredient.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/035call_ingredient.cc b/035call_ingredient.cc
index 6bba2b23..919320ea 100644
--- a/035call_ingredient.cc
+++ b/035call_ingredient.cc
@@ -58,11 +58,16 @@ case NEXT_INGREDIENT: {
   if (current_call().next_ingredient_to_process < SIZE(current_call().ingredient_atoms)) {
     reagent product = current_instruction().products.at(0);
     canonize_type(product);
-    if (!types_match(product,
-                     current_call().ingredient_types.at(current_call().next_ingredient_to_process),
-                     current_call().ingredient_atoms.at(current_call().next_ingredient_to_process)
-                     )) {
-      raise_error << maybe(current_recipe_name()) << "wrong type for ingredient " << current_instruction().products.at(0).original_string << '\n' << end();
+    if (current_recipe_name() == "main") {
+      // no ingredient types since the call might be implicit; assume ingredients are always strings
+      // todo: how to test this?
+      if (!is_mu_string(product))
+        raise_error << "main: wrong type for ingredient " << product.original_string << '\n' << end();
+    }
+    else if (!types_match(product,
+                          current_call().ingredient_types.at(current_call().next_ingredient_to_process),
+                          current_call().ingredient_atoms.at(current_call().next_ingredient_to_process))) {
+      raise_error << maybe(current_recipe_name()) << "wrong type for ingredient " << product.original_string << '\n' << end();
     }
     products.push_back(
         current_call().ingredient_atoms.at(current_call().next_ingredient_to_process));