diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-01-18 16:46:07 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-01-18 16:46:07 -0800 |
commit | 4f32f024b9daafa0e1e0d48244c7f75f49f38db8 (patch) | |
tree | 88d070d293ef7178f884c093e9e036a591168890 | |
parent | d5f89e0facc8bdfd93d6e487c90cd450ee21a2e8 (diff) | |
download | mu-4f32f024b9daafa0e1e0d48244c7f75f49f38db8.tar.gz |
2569
-rw-r--r-- | 010vm.cc | 2 | ||||
-rw-r--r-- | 030container.cc | 5 | ||||
-rw-r--r-- | 054dilated_reagent.cc | 2 | ||||
-rw-r--r-- | 061recipe.cc | 14 |
4 files changed, 17 insertions, 6 deletions
diff --git a/010vm.cc b/010vm.cc index 9806511e..e772e811 100644 --- a/010vm.cc +++ b/010vm.cc @@ -277,7 +277,7 @@ type_tree* new_type_tree(const string_tree* properties) { result->value = get(Type_ordinal, type_name); else if (is_integer(type_name)) // sometimes types will contain non-type tags, like numbers for the size of an array result->value = 0; - else + else if (properties->value != "->") // used in recipe types result->value = -1; // should never happen; will trigger errors later } result->left = new_type_tree(properties->left); diff --git a/030container.cc b/030container.cc index 042b1df3..373b3590 100644 --- a/030container.cc +++ b/030container.cc @@ -553,10 +553,7 @@ void check_or_set_invalid_types(type_tree* type, const string_tree* type_name, c // can't assert that type_name is non-null, even at the top of a recursive call tree if (!type) return; // will throw a more precise error elsewhere // End Container Type Checks - if (type->value == 0) { - assert(!type->left && !type->right); - return; - } + if (type->value == 0) return; if (!contains_key(Type, type->value)) { if (type_name && contains_key(Type_ordinal, type_name->value)) type->value = get(Type_ordinal, type_name->value); diff --git a/054dilated_reagent.cc b/054dilated_reagent.cc index 76de7157..cab72cfb 100644 --- a/054dilated_reagent.cc +++ b/054dilated_reagent.cc @@ -112,7 +112,7 @@ if (s.at(0) == '{') { // this type can't be an integer literal put(Type_ordinal, type_name, Next_type_ordinal++); } - type = new type_tree(get(Type_ordinal, type_name)); + type = new_type_tree(properties.at(0).second); return; } diff --git a/061recipe.cc b/061recipe.cc index 09908e1a..2fb9ee13 100644 --- a/061recipe.cc +++ b/061recipe.cc @@ -150,3 +150,17 @@ bool is_mu_recipe(reagent r) { // End is_mu_recipe Cases return false; } + +:(scenario copy_typecheck_recipe_variable) +% Hide_errors = true; +recipe main [ + 3:number <- copy 34 # abc def + {1: (recipe number -> number)} <- copy f # store literal in a matching variable + {2: (recipe boolean -> boolean)} <- copy {1: (recipe number -> number)} # mismatch between recipe variables +] +recipe f x:number -> y:number [ + local-scope + load-ingredients + y <- copy x +] ++error: main: can't copy {1: (recipe number -> number)} to {2: (recipe boolean -> boolean)}; types don't match |