diff options
-rw-r--r-- | 072recipe.cc | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/072recipe.cc b/072recipe.cc index f77949e1..34b49b3f 100644 --- a/072recipe.cc +++ b/072recipe.cc @@ -15,18 +15,6 @@ def f x:num -> y:num [ ] +mem: storing 34 in location 1 -:(scenario call_variable) -def main [ - {1: (recipe number -> number)} <- copy f - 2:num <- call {1: (recipe number -> number)}, 34 -] -def f x:num -> y:num [ - local-scope - load-ingredients - y <- copy x -] -+mem: storing 34 in location 2 - :(before "End Mu Types Initialization") put(Type_ordinal, "recipe-literal", 0); // 'recipe' variables can store recipe-literal @@ -130,6 +118,29 @@ case CALL: { break; } +:(scenario call_variable) +def main [ + {1: (recipe number -> number)} <- copy f + 2:num <- call {1: (recipe number -> number)}, 34 +] +def f x:num -> y:num [ + local-scope + load-ingredients + y <- copy x +] ++mem: storing 34 in location 2 + +:(scenario call_shape_shifting_recipe) +def main [ + 1:num <- call f, 34 +] +def f x:_elem -> y:_elem [ + local-scope + load-ingredients + y <- copy x +] ++mem: storing 34 in location 1 + //:: check types for 'call' instructions :(scenario call_check_literal_recipe) @@ -159,17 +170,6 @@ def f x:point -> y:point [ +error: main: ingredient 0 has the wrong type at '2:num <- call {1: (recipe point -> point)}, 34' +error: main: product 0 has the wrong type at '2:num <- call {1: (recipe point -> point)}, 34' -:(scenario call_check_shape_shifting_recipe) -def main [ - 1:num <- call f, 34 -] -def f x:_elem -> y:_elem [ - local-scope - load-ingredients - y <- copy x -] -+mem: storing 34 in location 1 - :(before "End resolve_ambiguous_call(r, index, inst, caller_recipe) Special-cases") if (inst.name == "call" && !inst.ingredients.empty() && inst.ingredients.at(0).type && inst.ingredients.at(0).type->atom && inst.ingredients.at(0).type->name == "recipe-literal") { instruction inst2; |