about summary refs log tree commit diff stats
path: root/html/apps/ex4.subx.html
blob: 297576bb07029c3fa5801dad68797fed9a0988d8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Mu - apps/ex4.subx</title>
<meta name="Generator" content="Vim/8.1">
<meta name="plugin-version" content="vim8.1_v1">
<meta name="syntax" content="none">
<meta name="settings" content="number_lines,use_css,no_foldcolumn,expand_tabs,line_ids,prevent_copy=">
<meta name="colorscheme" content="minimal-light">
<style type="text/css">
<!--
pre { font-family: monospace; color: #000000; background-color: #c6c6c6; }
body { font-size:12pt; font-family: monospace; color: #000000; background-color: #c6c6c6; }
a { color:inherit; }
* { font-size:12pt; font-size: 1em; }
.subxComment { color: #005faf; }
.subxS2Comment { color: #8a8a8a; }
.LineNr { }
.subxS1Comment { color: #0000af; }
.SpecialChar { color: #d70000; }
-->
</style>

<script type='text/javascript'>
<!--

/* function to open any folds containing a jumped-to line before jumping to it */
function JumpToLine()
{
  var lineNum;
  lineNum = window.location.hash;
  lineNum = lineNum.substr(1); /* strip off '#' */

  if (lineNum.indexOf('L') == -1) {
    lineNum = 'L'+lineNum;
  }
  var lineElem = document.getElementById(lineNum);
  /* Always jump to new location even if the line was hidden inside a fold, or
   * we corrected the raw number to a line ID.
   */
  if (lineElem) {
    lineElem.scrollIntoView(true);
  }
  return true;
}
if ('onhashchange' in window) {
  window.onhashchange = JumpToLine;
}

-->
</script>
</head>
<body onload='JumpToLine();'>
<a href='https://github.com/akkartik/mu/blob/master/apps/ex4.subx'>https://github.com/akkartik/mu/blob/master/apps/ex4.subx</a>
<pre id='vimCodeElement'>
<span id="L1" class="LineNr"> 1 </span><span class="subxComment"># Read a character from stdin, save it to a global, write it to stdout.</span>
<span id="L2" class="LineNr"> 2 </span><span class="subxComment">#</span>
<span id="L3" class="LineNr"> 3 </span><span class="subxComment"># To run:</span>
<span id="L4" class="LineNr"> 4 </span><span class="subxComment">#   $ ./bootstrap translate init.linux apps/ex4.subx -o apps/ex4</span>
<span id="L5" class="LineNr"> 5 </span><span class="subxComment">#   $ ./bootstrap run apps/ex4</span>
<span id="L6" class="LineNr"> 6 </span>
<span id="L7" class="LineNr"> 7 </span>== data
<span id="L8" class="LineNr"> 8 </span>
<span id="L9" class="LineNr"> 9 </span><span class="subxComment"># the global variable we save to</span>
<span id="L10" class="LineNr">10 </span><span class="SpecialChar">X</span>:
<span id="L11" class="LineNr">11 </span>    0/imm32  <span class="subxComment"># space for read() to write to</span>
<span id="L12" class="LineNr">12 </span>
<span id="L13" class="LineNr">13 </span>== code
<span id="L14" class="LineNr">14 </span>
<span id="L15" class="LineNr">15 </span><span class="SpecialChar">Entry</span>:
<span id="L16" class="LineNr">16 </span><span class="subxComment"># read(stdin, X, 1)</span>
<span id="L17" class="LineNr">17 </span><span class="subxS1Comment"># . fd = 0 (stdin)</span>
<span id="L18" class="LineNr">18 </span>bb/copy-to-ebx  0/imm32
<span id="L19" class="LineNr">19 </span><span class="subxS1Comment"># . data = X (location to write result to)</span>
<span id="L20" class="LineNr">20 </span>b9/copy-to-ecx  <span class="SpecialChar"><a href='ex4.subx.html#L10'>X</a></span>/imm32
<span id="L21" class="LineNr">21 </span><span class="subxS1Comment"># . size = 1 character</span>
<span id="L22" class="LineNr">22 </span>ba/copy-to-edx  1/imm32
<span id="L23" class="LineNr">23 </span><span class="subxS1Comment"># . syscall</span>
<span id="L24" class="LineNr">24 </span>e8/call  syscall_read/disp32
<span id="L25" class="LineNr">25 </span>
<span id="L26" class="LineNr">26 </span><span class="subxComment"># write(stdout, X, 1)</span>
<span id="L27" class="LineNr">27 </span><span class="subxS1Comment"># . fd = 1 (stdout)</span>
<span id="L28" class="LineNr">28 </span>bb/copy-to-ebx  1/imm32
<span id="L29" class="LineNr">29 </span><span class="subxS1Comment"># . initialize X (location to read from)</span>
<span id="L30" class="LineNr">30 </span>b9/copy-to-ecx  <span class="SpecialChar"><a href='ex4.subx.html#L10'>X</a></span>/imm32
<span id="L31" class="LineNr">31 </span><span class="subxS1Comment"># . size = 1 character</span>
<span id="L32" class="LineNr">32 </span>ba/copy-to-edx  1/imm32
<span id="L33" class="LineNr">33 </span><span class="subxS1Comment"># . syscall</span>
<span id="L34" class="LineNr">34 </span>e8/call  syscall_write/disp32
<span id="L35" class="LineNr">35 </span>
<span id="L36" class="LineNr">36 </span><span class="subxComment"># exit(ebx)</span>
<span id="L37" class="LineNr">37 </span>e8/call  syscall_exit/disp32
<span id="L38" class="LineNr">38 </span>
<span id="L39" class="LineNr">39 </span><span class="subxS2Comment"># . . vim&#0058;nowrap:textwidth=0</span>
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->
ss="n">recipe_ordinal>& variants = get_or_insert(Recipe_variants, rr.name); for (int i = 0; i < SIZE(variants); ++i) { if (!contains_key(Recipe, variants.at(i))) continue; const recipe& candidate = get(Recipe, variants.at(i)); if (!all_reagents_match(rr, candidate)) continue; return candidate.name; } return ""; } bool all_reagents_match(const recipe& r1, const recipe& r2) { if (SIZE(r1.ingredients) != SIZE(r2.ingredients)) return false; if (SIZE(r1.products) != SIZE(r2.products)) return false; for (int i = 0; i < SIZE(r1.ingredients); ++i) { expand_type_abbreviations(r1.ingredients.at(i).type); expand_type_abbreviations(r2.ingredients.at(i).type); if (!deeply_equal_type_names(r1.ingredients.at(i), r2.ingredients.at(i))) return false; } for (int i = 0; i < SIZE(r1.products); ++i) { expand_type_abbreviations(r1.products.at(i).type); expand_type_abbreviations(r2.products.at(i).type); if (!deeply_equal_type_names(r1.products.at(i), r2.products.at(i))) return false; } return true; } :(before "End Globals") set<string> Literal_type_names; :(before "End One-time Setup") Literal_type_names.insert("number"); Literal_type_names.insert("character"); :(code) bool deeply_equal_type_names(const reagent& a, const reagent& b) { return deeply_equal_type_names(a.type, b.type); } bool deeply_equal_type_names(const type_tree* a, const type_tree* b) { if (!a) return !b; if (!b) return !a; if (a->atom != b->atom) return false; if (a->atom) { if (a->name == "literal" && b->name == "literal") return true; if (a->name == "literal") return Literal_type_names.find(b->name) != Literal_type_names.end(); if (b->name == "literal") return Literal_type_names.find(a->name) != Literal_type_names.end(); return a->name == b->name; } return deeply_equal_type_names(a->left, b->left) && deeply_equal_type_names(a->right, b->right); } string next_unused_recipe_name(const string& recipe_name) { for (int i = 2; /*forever*/; ++i) { ostringstream out; out << recipe_name << '_' << i; if (!contains_key(Recipe_ordinal, out.str())) return out.str(); } } //: Once all the recipes are loaded, transform their bodies to replace each //: call with the most suitable variant. :(scenario static_dispatch_picks_most_similar_variant) def main [ 7:num/raw <- test 3, 4, 5 ] def test a:num -> z:num [ z <- copy 1 ] def test a:num, b:num -> z:num [ z <- copy 2 ] +mem: storing 2 in location 7 //: support recipe headers in a previous transform to fill in missing types :(before "End check_or_set_invalid_types") for (int i = 0; i < SIZE(caller.ingredients); ++i) check_or_set_invalid_types(caller.ingredients.at(i).type, maybe(caller.name), "recipe header ingredient"); for (int i = 0; i < SIZE(caller.products); ++i) check_or_set_invalid_types(caller.products.at(i).type, maybe(caller.name), "recipe header product"); //: save original name of recipes before renaming them :(before "End recipe Fields") string original_name; //: original name is only set during load :(before "End Load Recipe Name") result.original_name = result.name; //: after filling in all missing types (because we'll be introducing 'blank' types in this transform in a later layer, for shape-shifting recipes) :(after "Transform.push_back(transform_names)") Transform.push_back(resolve_ambiguous_calls); // idempotent //: In a later layer we'll introduce recursion in resolve_ambiguous_calls, by //: having it generate code for shape-shifting recipes and then transform such //: code. This data structure will help error messages be more useful. //: //: We're punning the 'call' data structure just because it has slots for //: calling recipe and calling instruction. :(before "End Globals") list<call> Resolve_stack; :(code) void resolve_ambiguous_calls(const recipe_ordinal r) { recipe& caller_recipe = get(Recipe, r); trace(9991, "transform") << "--- resolve ambiguous calls for recipe " << caller_recipe.name << end(); for (int index = 0; index < SIZE(caller_recipe.steps); ++index) { instruction& inst = caller_recipe.steps.at(index); if (inst.is_label) continue; if (non_ghost_size(get_or_insert(Recipe_variants, inst.name)) == 0) continue; trace(9992, "transform") << "instruction " << to_original_string(inst) << end(); Resolve_stack.push_front(call(r)); Resolve_stack.front().running_step_index = index; string new_name = best_variant(inst, caller_recipe); if (!new_name.empty()) inst.name = new_name; assert(Resolve_stack.front().running_recipe == r); assert(Resolve_stack.front().running_step_index == index); Resolve_stack.pop_front(); } } string best_variant(instruction& inst, const recipe& caller_recipe) { vector<recipe_ordinal>& variants = get(Recipe_variants, inst.name); vector<recipe_ordinal> candidates; // Static Dispatch Phase 1 candidates = strictly_matching_variants(inst, variants); if (!candidates.empty()) return best_variant(inst, candidates).name; // Static Dispatch Phase 2 candidates = strictly_matching_variants_except_literal_against_address_or_boolean(inst, variants); if (!candidates.empty()) return best_variant(inst, candidates).name; // Static Dispatch Phase 3 //: (shape-shifting recipes in a later layer) // End Static Dispatch Phase 3 // Static Dispatch Phase 4 candidates = matching_variants(inst, variants); if (!candidates.empty()) return best_variant(inst, candidates).name; // error messages if (get(Recipe_ordinal, inst.name) >= MAX_PRIMITIVE_RECIPES) { // we currently don't check types for primitive variants if (SIZE(variants) == 1) { raise << maybe(caller_recipe.name) << "types don't match in call for '" << to_original_string(inst) << "'\n" << end(); raise << " which tries to call '" << original_header_label(get(Recipe, variants.at(0))) << "'\n" << end(); } else { raise << maybe(caller_recipe.name) << "failed to find a matching call for '" << to_original_string(inst) << "'\n" << end(); raise << " available variants are:\n" << end(); for (int i = 0; i < SIZE(variants); ++i) raise << " " << original_header_label(get(Recipe, variants.at(i))) << '\n' << end(); } for (list<call>::iterator p = /*skip*/++Resolve_stack.begin(); p != Resolve_stack.end(); ++p) { const recipe& specializer_recipe = get(Recipe, p->running_recipe); const instruction& specializer_inst = specializer_recipe.steps.at(p->running_step_index); if (specializer_recipe.name != "interactive") raise << " (from '" << to_original_string(specializer_inst) << "' in " << specializer_recipe.name << ")\n" << end(); else raise << " (from '" << to_original_string(specializer_inst) << "')\n" << end(); // One special-case to help with the rewrite_stash transform. (cross-layer) if (specializer_inst.products.at(0).name.find("stash_") == 0) { instruction stash_inst; if (next_stash(*p, &stash_inst)) { if (specializer_recipe.name != "interactive") raise << " (part of '" << to_original_string(stash_inst) << "' in " << specializer_recipe.name << ")\n" << end(); else raise << " (part of '" << to_original_string(stash_inst) << "')\n" << end(); } } } } return ""; } // phase 1 vector<recipe_ordinal> strictly_matching_variants(const instruction& inst, vector<recipe_ordinal>& variants) { vector<recipe_ordinal> result; for (int i = 0; i < SIZE(variants); ++i) { if (variants.at(i) == -1) continue; trace(9992, "transform") << "checking variant (strict) " << i << ": " << header_label(variants.at(i)) << end(); if (all_header_reagents_strictly_match(inst, get(Recipe, variants.at(i)))) result.push_back(variants.at(i)); } return result; } bool all_header_reagents_strictly_match(const instruction& inst, const recipe& variant) { for (int i = 0; i < min(SIZE(inst.ingredients), SIZE(variant.ingredients)); ++i) { if (!types_strictly_match(variant.ingredients.at(i), inst.ingredients.at(i))) { trace(9993, "transform") << "strict match failed: ingredient " << i << end(); return false; } } for (int i = 0; i < min(SIZE(inst.products), SIZE(variant.products)); ++i) { if (is_dummy(inst.products.at(i))) continue; if (!types_strictly_match(variant.products.at(i), inst.products.at(i))) { trace(9993, "transform") << "strict match failed: product " << i << end(); return false; } } return true; } // phase 2 vector<recipe_ordinal> strictly_matching_variants_except_literal_against_address_or_boolean(const instruction& inst, vector<recipe_ordinal>& variants) { vector<recipe_ordinal> result; for (int i = 0; i < SIZE(variants); ++i) { if (variants.at(i) == -1) continue; trace(9992, "transform") << "checking variant (strict except literal-against-boolean) " << i << ": " << header_label(variants.at(i)) << end(); if (all_header_reagents_strictly_match_except_literal_against_address_or_boolean(inst, get(Recipe, variants.at(i)))) result.push_back(variants.at(i)); } return result; } bool all_header_reagents_strictly_match_except_literal_against_address_or_boolean(const instruction& inst, const recipe& variant) { for (int i = 0; i < min(SIZE(inst.ingredients), SIZE(variant.ingredients)); ++i) { if (!types_strictly_match_except_literal_against_address_or_boolean(variant.ingredients.at(i), inst.ingredients.at(i))) { trace(9993, "transform") << "match failed: ingredient " << i << end(); return false; } } for (int i = 0; i < min(SIZE(variant.products), SIZE(inst.products)); ++i) { if (is_dummy(inst.products.at(i))) continue; if (!types_strictly_match_except_literal_against_address_or_boolean(variant.products.at(i), inst.products.at(i))) { trace(9993, "transform") << "match failed: product " << i << end(); return false; } } return true; } bool types_strictly_match_except_literal_against_address_or_boolean(const reagent& to, const reagent& from) { if (is_literal(from) && is_mu_boolean(to)) return from.name == "0" || from.name == "1"; // Match Literal Zero Against Address { if (is_literal(from) && is_mu_address(to)) return from.name == "0"; // } return types_strictly_match(to, from); } // phase 4 vector<recipe_ordinal> matching_variants(const instruction& inst, vector<recipe_ordinal>& variants) { vector<recipe_ordinal> result; for (int i = 0; i < SIZE(variants); ++i) { if (variants.at(i) == -1) continue; trace(9992, "transform") << "checking variant " << i << ": " << header_label(variants.at(i)) << end(); if (all_header_reagents_match(inst, get(Recipe, variants.at(i)))) result.push_back(variants.at(i)); } return result; } bool all_header_reagents_match(const instruction& inst, const recipe& variant) { for (int i = 0; i < min(SIZE(inst.ingredients), SIZE(variant.ingredients)); ++i) { if (!types_match(variant.ingredients.at(i), inst.ingredients.at(i))) { trace(9993, "transform") << "match failed: ingredient " << i << end(); return false; } } for (int i = 0; i < min(SIZE(variant.products), SIZE(inst.products)); ++i) { if (is_dummy(inst.products.at(i))) continue; if (!types_match(variant.products.at(i), inst.products.at(i))) { trace(9993, "transform") << "match failed: product " << i << end(); return false; } } return true; } // tie-breaker for each phase const recipe& best_variant(const instruction& inst, vector<recipe_ordinal>& candidates) { assert(!candidates.empty()); int min_score = 999; int min_index = 0; for (int i = 0; i < SIZE(candidates); ++i) { const recipe& candidate = get(Recipe, candidates.at(i)); // prefer functions without extra or missing ingredients or products int score = abs(SIZE(candidate.products)-SIZE(inst.products)) + abs(SIZE(candidate.ingredients)-SIZE(inst.ingredients)); // prefer functions with non-address ingredients or products for (int j = 0; j < SIZE(candidate.ingredients); ++j) { if (is_mu_address(candidate.ingredients.at(j))) ++score; } for (int j = 0; j < SIZE(candidate.products); ++j) { if (is_mu_address(candidate.products.at(j))) ++score; } assert(score < 999); if (score < min_score) { min_score = score; min_index = i; } } return get(Recipe, candidates.at(min_index)); } int non_ghost_size(vector<recipe_ordinal>& variants) { int result = 0; for (int i = 0; i < SIZE(variants); ++i) if (variants.at(i) != -1) ++result; return result; } bool next_stash(const call& c, instruction* stash_inst) { const recipe& specializer_recipe = get(Recipe, c.running_recipe); int index = c.running_step_index; for (++index; index < SIZE(specializer_recipe.steps); ++index) { const instruction& inst = specializer_recipe.steps.at(index); if (inst.name == "stash") { *stash_inst = inst; return true; } } return false; } :(scenario static_dispatch_disabled_in_recipe_without_variants) def main [ 1:num <- test 3 ] def test [ 2:num <- next-ingredient # ensure no header return 34 ] +mem: storing 34 in location 1 :(scenario static_dispatch_disabled_on_headerless_definition) % Hide_errors = true; def test a:num -> z:num [ z <- copy 1 ] def test [ return 34 ] +error: redefining recipe test :(scenario static_dispatch_disabled_on_headerless_definition_2) % Hide_errors = true; def test [ return 34 ] def test a:num -> z:num [ z <- copy 1 ] +error: redefining recipe test :(scenario static_dispatch_on_primitive_names) def main [ 1:num <- copy 34 2:num <- copy 34 3:bool <- equal 1:num, 2:num 4:bool <- copy 0/false 5:bool <- copy 0/false 6:bool <- equal 4:bool, 5:bool ] # temporarily hardcode number equality to always fail def equal x:num, y:num -> z:bool [ local-scope load-ingredients z <- copy 0/false ] # comparing numbers used overload +mem: storing 0 in location 3 # comparing booleans continues to use primitive +mem: storing 1 in location 6 :(scenario static_dispatch_works_with_dummy_results_for_containers) def main [ _ <- test 3, 4 ] def test a:num -> z:point [ local-scope load-ingredients z <- merge a, 0 ] def test a:num, b:num -> z:point [ local-scope load-ingredients z <- merge a, b ] $error: 0 :(scenario static_dispatch_works_with_compound_type_containing_container_defined_after_first_use) def main [ x:&:foo <- new foo:type test x ] container foo [ x:num ] def test a:&:foo -> z:num [ local-scope load-ingredients z:num <- get *a, x:offset ] $error: 0 :(scenario static_dispatch_works_with_compound_type_containing_container_defined_after_second_use) def main [ x:&:foo <- new foo:type test x ] def test a:&:foo -> z:num [ local-scope load-ingredients z:num <- get *a, x:offset ] container foo [ x:num ] $error: 0 :(scenario static_dispatch_prefers_literals_to_be_numbers_rather_than_addresses) def main [ 1:num <- foo 0 ] def foo x:&:num -> y:num [ return 34 ] def foo x:num -> y:num [ return 35 ] +mem: storing 35 in location 1 :(scenario static_dispatch_prefers_literals_to_be_numbers_rather_than_addresses_2) def main [ 1:num <- foo 0 0 ] # Both variants need to bind 0 to address in first ingredient. # We still want to prefer the variant with a number rather than address for # _subsequent_ ingredients. def foo x:&:num y:&:num -> z:num [ # put the bad match before the good one return 34 ] def foo x:&:num y:num -> z:num [ return 35 ] +mem: storing 35 in location 1 :(scenario static_dispatch_on_non_literal_character_ignores_variant_with_numbers) % Hide_errors = true; def main [ local-scope x:char <- copy 10/newline 1:num/raw <- foo x ] def foo x:num -> y:num [ load-ingredients return 34 ] +error: main: ingredient 0 has the wrong type at '1:num/raw <- foo x' -mem: storing 34 in location 1 :(scenario static_dispatch_dispatches_literal_to_boolean_before_character) def main [ 1:num/raw <- foo 0 # valid literal for boolean ] def foo x:char -> y:num [ local-scope load-ingredients return 34 ] def foo x:bool -> y:num [ local-scope load-ingredients return 35 ] # boolean variant is preferred +mem: storing 35 in location 1 :(scenario static_dispatch_dispatches_literal_to_character_when_out_of_boolean_range) def main [ 1:num/raw <- foo 97 # not a valid literal for boolean ] def foo x:char -> y:num [ local-scope load-ingredients return 34 ] def foo x:bool -> y:num [ local-scope load-ingredients return 35 ] # character variant is preferred +mem: storing 34 in location 1 :(scenario static_dispatch_dispatches_literal_to_number_if_at_all_possible) def main [ 1:num/raw <- foo 97 ] def foo x:char -> y:num [ local-scope load-ingredients return 34 ] def foo x:num -> y:num [ local-scope load-ingredients return 35 ] # number variant is preferred +mem: storing 35 in location 1 :(replace{} "string header_label(const recipe_ordinal r)") string header_label(const recipe_ordinal r) { return header_label(get(Recipe, r)); } :(code) string header_label(const recipe& caller) { ostringstream out; out << "recipe " << caller.name; for (int i = 0; i < SIZE(caller.ingredients); ++i) out << ' ' << to_string(caller.ingredients.at(i)); if (!caller.products.empty()) out << " ->"; for (int i = 0; i < SIZE(caller.products); ++i) out << ' ' << to_string(caller.products.at(i)); return out.str(); } string original_header_label(const recipe& caller) { ostringstream out; out << "recipe " << caller.original_name; for (int i = 0; i < SIZE(caller.ingredients); ++i) out << ' ' << caller.ingredients.at(i).original_string; if (!caller.products.empty()) out << " ->"; for (int i = 0; i < SIZE(caller.products); ++i) out << ' ' << caller.products.at(i).original_string; return out.str(); } :(scenario reload_variant_retains_other_variants) def main [ 1:num <- copy 34 2:num <- foo 1:num ] def foo x:num -> y:num [ local-scope load-ingredients return 34 ] def foo x:&:num -> y:num [ local-scope load-ingredients return 35 ] def! foo x:&:num -> y:num [ local-scope load-ingredients return 36 ] +mem: storing 34 in location 2 $error: 0 :(scenario dispatch_errors_come_after_unknown_name_errors) % Hide_errors = true; def main [ y:num <- foo x ] def foo a:num -> b:num [ local-scope load-ingredients return 34 ] def foo a:bool -> b:num [ local-scope load-ingredients return 35 ] +error: main: missing type for 'x' in 'y:num <- foo x' +error: main: failed to find a matching call for 'y:num <- foo x' :(scenario override_methods_with_type_abbreviations) def main [ local-scope s:text <- new [abc] 1:num/raw <- foo s ] def foo a:address:array:character -> result:number [ return 34 ] # identical to previous variant once you take type abbreviations into account def! foo a:text -> result:num [ return 35 ] +mem: storing 35 in location 1 :(scenario ignore_static_dispatch_in_type_errors_without_overloading) % Hide_errors = true; def main [ local-scope x:&:num <- copy 0 foo x ] def foo x:&:char [ local-scope load-ingredients ] +error: main: types don't match in call for 'foo x' +error: which tries to call 'recipe foo x:&:char' :(scenario show_available_variants_in_dispatch_errors) % Hide_errors = true; def main [ local-scope x:&:num <- copy 0 foo x ] def foo x:&:char [ local-scope load-ingredients ] def foo x:&:bool [ local-scope load-ingredients ] +error: main: failed to find a matching call for 'foo x' +error: available variants are: +error: recipe foo x:&:char +error: recipe foo x:&:bool :(before "End Includes") using std::abs;