about summary refs log tree commit diff stats
path: root/056shape_shifting_recipe.cc
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-06-17 00:05:38 -0700
committerKartik Agaram <vc@akkartik.com>2018-06-17 00:29:22 -0700
commitdd66068298b0a11f2a1f195376cba98e0c8570b5 (patch)
tree06696728fd65cdf38a2ac571943e130e9d60c333 /056shape_shifting_recipe.cc
parentb89b822439f47a490a1b764e14a1ed1b73059cba (diff)
downloadmu-dd66068298b0a11f2a1f195376cba98e0c8570b5.tar.gz
4261 - start using literals for 'true' and 'false'
They uncovered one bug: in edit/003-shortcuts.mu
  <scroll-down> was returning 0 for an address in one place where I
  thought it was returning 0 for a boolean.

Now we've eliminated this bad interaction between tangling and punning
literals.
Diffstat (limited to '056shape_shifting_recipe.cc')
-rw-r--r--056shape_shifting_recipe.cc8
1 files changed, 2 insertions, 6 deletions
diff --git a/056shape_shifting_recipe.cc b/056shape_shifting_recipe.cc
index 29d443c2..f1145803 100644
--- a/056shape_shifting_recipe.cc
+++ b/056shape_shifting_recipe.cc
@@ -46,7 +46,7 @@ if (Current_routine->calls.front().running_step_index == 0
 :(before "End Matching Types For Literal(to)")
 if (contains_type_ingredient_name(to)) return false;
 
-:(after "Static Dispatch Phase 3")
+:(after "Static Dispatch Phase 2")
 candidates = strictly_matching_shape_shifting_variants(inst, variants);
 if (!candidates.empty()) {
   recipe_ordinal exemplar = best_shape_shifting_variant(inst, candidates);
@@ -68,10 +68,6 @@ if (contains_key(Recipe, inst.operation) && !is_primitive(inst.operation)
   return;
 }
 
-:(replace{} "Match Literal Zero Against Address")
-if (is_literal(from) && is_mu_address(to))
-  return from.name == "0" && !contains_type_ingredient_name(to);
-
 :(code)
 // phase 3 of static dispatch
 vector<recipe_ordinal> strictly_matching_shape_shifting_variants(const instruction& inst, const vector<recipe_ordinal>& variants) {
@@ -1111,7 +1107,7 @@ def foo a:_elem [
 ]
 # tangle some code that refers to the type ingredient
 after <label1> [
-  b:bool <- copy 0  # type abbreviation
+  b:bool <- copy false  # type abbreviation
 ]
 # trigger specialization
 def main [