From 3a982057f8b8c8fbca6a95e0f7043f9f0decb5f3 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 14 Nov 2015 23:12:03 -0800 Subject: 2439 - bugfix: commandline ingredients --- 035call_ingredient.cc | 15 ++++++++++----- 1 file 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)); -- cgit 1.4.1-2-gfad0