diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-11-18 23:55:54 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-12-15 10:20:41 -0800 |
commit | 82177734ca98cfc67afe5d87be4edd3f86546231 (patch) | |
tree | 9d2823281500f4846e36cb379d387e4b6f5d21a1 /057static_dispatch.cc | |
parent | a5ab5b24e71fc93c58cb2d00fbde54d874a6263a (diff) | |
download | mu-82177734ca98cfc67afe5d87be4edd3f86546231.tar.gz |
layer 3 of edit/ now working
Now I complain before running if a call somewhere doesn't line up with its ingredients, or if no specialization can be made to match it.
Diffstat (limited to '057static_dispatch.cc')
-rw-r--r-- | 057static_dispatch.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/057static_dispatch.cc b/057static_dispatch.cc index 2d9af3d7..2aae9153 100644 --- a/057static_dispatch.cc +++ b/057static_dispatch.cc @@ -153,6 +153,9 @@ void replace_best_variant(instruction& inst, const recipe& caller_recipe) { } } // End Instruction Dispatch(inst, best_score) + if (best_score == -1 && get(Recipe_ordinal, inst.name) >= MAX_PRIMITIVE_RECIPES) { + raise_error << maybe(caller_recipe.name) << "failed to find a matching call for '" << inst.to_string() << "'\n" << end(); + } } long long int variant_score(const instruction& inst, recipe_ordinal variant) { @@ -200,6 +203,7 @@ long long int variant_score(const instruction& inst, recipe_ordinal variant) { } const vector<reagent>& header_products = get(Recipe, variant).products; for (long long int i = 0; i < SIZE(inst.products); ++i) { + if (is_dummy(inst.products.at(i))) continue; if (!types_match(header_products.at(i), inst.products.at(i))) { trace(9993, "transform") << "mismatch: product " << i << end(); //? cerr << "mismatch: product " << i << '\n'; @@ -267,6 +271,23 @@ recipe equal x:number, y:number -> z:boolean [ # comparing booleans continues to use primitive +mem: storing 1 in location 6 +:(scenario static_dispatch_works_with_dummy_results_for_containers) +% Hide_errors = true; +recipe main [ + _ <- test 3, 4 +] +recipe test a:number -> z:point [ + local-scope + load-ingredients + z <- merge a, 0 +] +recipe test a:number, b:number -> z:point [ + local-scope + load-ingredients + z <- merge a, b +] +$error: 0 + :(scenario static_dispatch_prefers_literals_to_be_numbers_rather_than_addresses) recipe main [ 1:number <- foo 0 |