about summary refs log tree commit diff stats
path: root/html/056shape_shifting_recipe.cc.html
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-09-17 15:01:51 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-09-17 15:01:51 -0700
commitf344b250f6f062a1a1902bf69b23ebf9b565de0e (patch)
tree199bd32a9aee198d5028b1c21b83d2cf0944b2b6 /html/056shape_shifting_recipe.cc.html
parent897ae8c1855f830d8819759ea327d147f28a09bf (diff)
downloadmu-f344b250f6f062a1a1902bf69b23ebf9b565de0e.tar.gz
3395
Diffstat (limited to 'html/056shape_shifting_recipe.cc.html')
-rw-r--r--html/056shape_shifting_recipe.cc.html195
1 files changed, 108 insertions, 87 deletions
diff --git a/html/056shape_shifting_recipe.cc.html b/html/056shape_shifting_recipe.cc.html
index 347be81a..2b120069 100644
--- a/html/056shape_shifting_recipe.cc.html
+++ b/html/056shape_shifting_recipe.cc.html
@@ -43,7 +43,7 @@ def main [
   <span class="Constant">11</span>:point<span class="Special"> &lt;- </span>foo <span class="Constant">10</span>:point
 ]
 <span class="Comment"># non-matching variant</span>
-def foo a:number <span class="Delimiter">-&gt;</span> result:number [
+def foo a:num <span class="Delimiter">-&gt;</span> result:num [
   local-scope
   load-ingredients
   result<span class="Special"> &lt;- </span>copy <span class="Constant">34</span>
@@ -286,7 +286,9 @@ recipe_ordinal new_variant<span class="Delimiter">(</span>recipe_ordinal exempla
   <span class="Comment">// a) perform tangle *before* replacing type ingredients, just in case</span>
   <span class="Comment">// inserted code involves type ingredients</span>
   insert_fragments<span class="Delimiter">(</span>new_recipe<span class="Delimiter">);</span>
-  <span class="Comment">// b) do the work of check_types_by_name while supporting type-ingredients</span>
+  <span class="Comment">// b) do the work of check_or_set_types_by_name (and its prerequisites)</span>
+  <span class="Comment">// while supporting type-ingredients</span>
+  expand_type_abbreviations<span class="Delimiter">(</span>new_recipe<span class="Delimiter">);</span>
   compute_type_names<span class="Delimiter">(</span>new_recipe<span class="Delimiter">);</span>
   <span class="Comment">// that gives enough information to replace type-ingredients with concrete types</span>
   <span class="Delimiter">{</span>
@@ -305,7 +307,7 @@ recipe_ordinal new_variant<span class="Delimiter">(</span>recipe_ordinal exempla
 <span class="Delimiter">}</span>
 
 <span class="Normal">void</span> compute_type_names<span class="Delimiter">(</span>recipe&amp; variant<span class="Delimiter">)</span> <span class="Delimiter">{</span>
-  trace<span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">&quot;transform&quot;</span><span class="Delimiter">)</span> &lt;&lt; <span class="Constant">&quot;compute type names: &quot;</span> &lt;&lt; variant<span class="Delimiter">.</span>name &lt;&lt; end<span class="Delimiter">();</span>
+  trace<span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">&quot;transform&quot;</span><span class="Delimiter">)</span> &lt;&lt; <span class="Constant">&quot;-- compute type names: &quot;</span> &lt;&lt; variant<span class="Delimiter">.</span>name &lt;&lt; end<span class="Delimiter">();</span>
   map&lt;string<span class="Delimiter">,</span> type_tree*&gt; type_names<span class="Delimiter">;</span>
   <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i &lt; SIZE<span class="Delimiter">(</span>variant<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span>
     save_or_deduce_type_name<span class="Delimiter">(</span>variant<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">),</span> type_names<span class="Delimiter">,</span> variant<span class="Delimiter">,</span> <span class="Constant">&quot;&quot;</span><span class="Delimiter">);</span>
@@ -516,6 +518,7 @@ string inspect<span class="Delimiter">(</span><span class="Normal">const</span>
 <span class="Delimiter">}</span>
 
 <span class="Normal">void</span> ensure_all_concrete_types<span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment">const</span><span class="Comment">*/</span> recipe&amp; new_recipe<span class="Delimiter">,</span> <span class="Normal">const</span> recipe&amp; exemplar<span class="Delimiter">)</span> <span class="Delimiter">{</span>
+  trace<span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">&quot;transform&quot;</span><span class="Delimiter">)</span> &lt;&lt; <span class="Constant">&quot;-- ensure all concrete types in recipe &quot;</span> &lt;&lt; new_recipe<span class="Delimiter">.</span>name &lt;&lt; end<span class="Delimiter">();</span>
   <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i &lt; SIZE<span class="Delimiter">(</span>new_recipe<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span>
     ensure_all_concrete_types<span class="Delimiter">(</span>new_recipe<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">),</span> exemplar<span class="Delimiter">);</span>
   <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i &lt; SIZE<span class="Delimiter">(</span>new_recipe<span class="Delimiter">.</span>products<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span>
@@ -547,7 +550,7 @@ def main [
   <span class="Constant">11</span>:point<span class="Special"> &lt;- </span>foo <span class="Constant">10</span>:point
 ]
 <span class="Comment"># non-matching shape-shifting variant</span>
-def foo a:_t<span class="Delimiter">,</span> b:_t <span class="Delimiter">-&gt;</span> result:number [
+def foo a:_t<span class="Delimiter">,</span> b:_t <span class="Delimiter">-&gt;</span> result:num [
   local-scope
   load-ingredients
   result<span class="Special"> &lt;- </span>copy <span class="Constant">34</span>
@@ -574,7 +577,7 @@ def bar a:foo:_t <span class="Delimiter">-&gt;</span> result:_t [
 ]
 container foo:_t [
   <span class="Normal">x</span>:_t
-  <span class="Normal">y</span>:number
+  <span class="Normal">y</span>:num
 ]
 <span class="traceContains">+mem: storing 14 in location 20</span>
 <span class="traceContains">+mem: storing 15 in location 21</span>
@@ -585,7 +588,7 @@ container c:_a:_b [
   <span class="Normal">b</span>:_b
 ]
 def main [
-  <span class="Normal">s</span>:address:array:character<span class="Special"> &lt;- </span><span class="Normal">new</span> [abc]
+  <span class="Normal">s</span>:text<span class="Special"> &lt;- </span><span class="Normal">new</span> [abc]
   <span class="Delimiter">{</span>x: <span class="Delimiter">(</span>c <span class="Delimiter">(</span>address array character<span class="Delimiter">)</span> number<span class="Delimiter">)}</span><span class="Special"> &lt;- </span>merge s<span class="Delimiter">,</span> <span class="Constant">34</span>
   foo x
 ]
@@ -603,12 +606,12 @@ def main [
 def bar a:foo:_t <span class="Delimiter">-&gt;</span> result:_t [
   local-scope
   load-ingredients
-  <span class="Normal">x</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">1</span>
+  <span class="Normal">x</span>:num<span class="Special"> &lt;- </span>copy <span class="Constant">1</span>
   result<span class="Special"> &lt;- </span>get a<span class="Delimiter">,</span> x:offset  <span class="Comment"># shouldn't collide with other variable</span>
 ]
 container foo:_t [
   <span class="Normal">x</span>:_t
-  <span class="Normal">y</span>:number
+  <span class="Normal">y</span>:num
 ]
 <span class="traceContains">+mem: storing 14 in location 20</span>
 <span class="traceContains">+mem: storing 15 in location 21</span>
@@ -624,14 +627,14 @@ def foo a:_t [
 
 <span class="Delimiter">:(scenario shape_shifting_recipe_handles_shape_shifting_new_ingredient)</span>
 def main [
-  <span class="Constant">1</span>:address:foo:point<span class="Special"> &lt;- </span>bar <span class="Constant">3</span>
-  <span class="Constant">11</span>:foo:point<span class="Special"> &lt;- </span>copy *<span class="Constant">1</span>:address:foo:point
+  <span class="Constant">1</span>:&amp;:foo:point<span class="Special"> &lt;- </span>bar <span class="Constant">3</span>
+  <span class="Constant">11</span>:foo:point<span class="Special"> &lt;- </span>copy *<span class="Constant">1</span>:&amp;:foo:point
 ]
 container foo:_t [
   <span class="Normal">x</span>:_t
-  <span class="Normal">y</span>:number
+  <span class="Normal">y</span>:num
 ]
-def bar x:number <span class="Delimiter">-&gt;</span> result:address:foo:_t [
+def bar x:num <span class="Delimiter">-&gt;</span> result:&amp;:foo:_t [
   local-scope
   load-ingredients
   <span class="Comment"># new refers to _t in its ingredient *value*</span>
@@ -643,10 +646,10 @@ def bar x:number <span class="Delimiter">-&gt;</span> result:address:foo:_t [
 
 <span class="Delimiter">:(scenario shape_shifting_recipe_handles_shape_shifting_new_ingredient_2)</span>
 def main [
-  <span class="Constant">1</span>:address:foo:point<span class="Special"> &lt;- </span>bar <span class="Constant">3</span>
-  <span class="Constant">11</span>:foo:point<span class="Special"> &lt;- </span>copy *<span class="Constant">1</span>:address:foo:point
+  <span class="Constant">1</span>:&amp;:foo:point<span class="Special"> &lt;- </span>bar <span class="Constant">3</span>
+  <span class="Constant">11</span>:foo:point<span class="Special"> &lt;- </span>copy *<span class="Constant">1</span>:&amp;:foo:point
 ]
-def bar x:number <span class="Delimiter">-&gt;</span> result:address:foo:_t [
+def bar x:num <span class="Delimiter">-&gt;</span> result:&amp;:foo:_t [
   local-scope
   load-ingredients
   <span class="Comment"># new refers to _t in its ingredient *value*</span>
@@ -655,7 +658,7 @@ def bar x:number <span class="Delimiter">-&gt;</span> result:address:foo:_t [
 <span class="Comment"># container defined after use</span>
 container foo:_t [
   <span class="Normal">x</span>:_t
-  <span class="Normal">y</span>:number
+  <span class="Normal">y</span>:num
 ]
 <span class="traceContains">+mem: storing 0 in location 11</span>
 <span class="traceContains">+mem: storing 0 in location 12</span>
@@ -665,7 +668,7 @@ container foo:_t [
 def main [
   _<span class="Special"> &lt;- </span>bar <span class="Constant">34</span>
 ]
-def bar x:_t <span class="Delimiter">-&gt;</span> result:address:_t [
+def bar x:_t <span class="Delimiter">-&gt;</span> result:&amp;:_t [
   local-scope
   load-ingredients
   result<span class="Special"> &lt;- </span>copy <span class="Constant">0</span>
@@ -679,7 +682,7 @@ $error: <span class="Constant">0</span>
   transform<span class="Delimiter">(</span><span class="Constant">&quot;def barz x:_elem [</span><span class="cSpecial">\n</span><span class="Constant">&quot;</span>
             <span class="Constant">&quot;  local-scope</span><span class="cSpecial">\n</span><span class="Constant">&quot;</span>
             <span class="Constant">&quot;  load-ingredients</span><span class="cSpecial">\n</span><span class="Constant">&quot;</span>
-            <span class="Constant">&quot;  y:address:number &lt;- new _elem:type</span><span class="cSpecial">\n</span><span class="Constant">&quot;</span>
+            <span class="Constant">&quot;  y:&amp;:num &lt;- new _elem:type</span><span class="cSpecial">\n</span><span class="Constant">&quot;</span>
             <span class="Constant">&quot;]</span><span class="cSpecial">\n</span><span class="Constant">&quot;</span>
             <span class="Constant">&quot;def fooz [</span><span class="cSpecial">\n</span><span class="Constant">&quot;</span>
             <span class="Constant">&quot;  local-scope</span><span class="cSpecial">\n</span><span class="Constant">&quot;</span>
@@ -689,7 +692,7 @@ $error: <span class="Constant">0</span>
   <span class="Comment">// type-ingredient</span>
   run<span class="Delimiter">(</span><span class="Constant">&quot;container foo:_elem [</span><span class="cSpecial">\n</span><span class="Constant">&quot;</span>
       <span class="Constant">&quot;  x:_elem</span><span class="cSpecial">\n</span><span class="Constant">&quot;</span>
-      <span class="Constant">&quot;  y:number</span><span class="cSpecial">\n</span><span class="Constant">&quot;</span>
+      <span class="Constant">&quot;  y:num</span><span class="cSpecial">\n</span><span class="Constant">&quot;</span>
       <span class="Constant">&quot;]</span><span class="cSpecial">\n</span><span class="Constant">&quot;</span><span class="Delimiter">);</span>
   <span class="Comment">// then it should work as usual</span>
   reagent callsite<span class="Delimiter">(</span><span class="Constant">&quot;x:foo:point&quot;</span><span class="Delimiter">);</span>
@@ -701,10 +704,10 @@ $error: <span class="Constant">0</span>
 
 <span class="Delimiter">:(scenario shape_shifting_recipe_supports_compound_types)</span>
 def main [
-  <span class="Constant">1</span>:address:point<span class="Special"> &lt;- </span><span class="Normal">new</span> point:type
-  *<span class="Constant">1</span>:address:point<span class="Special"> &lt;- </span>put *<span class="Constant">1</span>:address:point<span class="Delimiter">,</span> y:offset<span class="Delimiter">,</span> <span class="Constant">34</span>
-  <span class="Constant">3</span>:address:point<span class="Special"> &lt;- </span>bar <span class="Constant">1</span>:address:point  <span class="Comment"># specialize _t to address:point</span>
-  <span class="Constant">4</span>:point<span class="Special"> &lt;- </span>copy *<span class="Constant">3</span>:address:point
+  <span class="Constant">1</span>:&amp;:point<span class="Special"> &lt;- </span><span class="Normal">new</span> point:type
+  *<span class="Constant">1</span>:&amp;:point<span class="Special"> &lt;- </span>put *<span class="Constant">1</span>:&amp;:point<span class="Delimiter">,</span> y:offset<span class="Delimiter">,</span> <span class="Constant">34</span>
+  <span class="Constant">3</span>:&amp;:point<span class="Special"> &lt;- </span>bar <span class="Constant">1</span>:&amp;:point  <span class="Comment"># specialize _t to address:point</span>
+  <span class="Constant">4</span>:point<span class="Special"> &lt;- </span>copy *<span class="Constant">3</span>:&amp;:point
 ]
 def bar a:_t <span class="Delimiter">-&gt;</span> result:_t [
   local-scope
@@ -716,14 +719,14 @@ def bar a:_t <span class="Delimiter">-&gt;</span> result:_t [
 <span class="Delimiter">:(scenario shape_shifting_recipe_error)</span>
 <span class="Special">% Hide_errors = true;</span>
 def main [
-  <span class="Normal">a</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">3</span>
-  <span class="Normal">b</span>:address:number<span class="Special"> &lt;- </span>foo a
+  <span class="Normal">a</span>:num<span class="Special"> &lt;- </span>copy <span class="Constant">3</span>
+  <span class="Normal">b</span>:&amp;:num<span class="Special"> &lt;- </span>foo a
 ]
 def foo a:_t <span class="Delimiter">-&gt;</span> b:_t [
   load-ingredients
   b<span class="Special"> &lt;- </span>copy a
 ]
-<span class="traceContains">+error: main: no call found for 'b:address:number &lt;- foo a'</span>
+<span class="traceContains">+error: main: no call found for 'b:&amp;:num &lt;- foo a'</span>
 
 <span class="Delimiter">:(scenario specialize_inside_recipe_without_header)</span>
 def main [
@@ -731,8 +734,8 @@ def main [
 ]
 def foo [
   local-scope
-  <span class="Normal">x</span>:number<span class="Special"> &lt;- </span>next-ingredient  <span class="Comment"># ensure no header</span>
-  <span class="Constant">1</span>:number/<span class="Special">raw &lt;- </span>bar x  <span class="Comment"># call a shape-shifting recipe</span>
+  <span class="Normal">x</span>:num<span class="Special"> &lt;- </span>next-ingredient  <span class="Comment"># ensure no header</span>
+  <span class="Constant">1</span>:num/<span class="Special">raw &lt;- </span>bar x  <span class="Comment"># call a shape-shifting recipe</span>
 ]
 def bar x:_elem <span class="Delimiter">-&gt;</span> y:_elem [
   local-scope
@@ -745,7 +748,7 @@ def bar x:_elem <span class="Delimiter">-&gt;</span> y:_elem [
 def main [
   local-scope
   <span class="Comment"># permit literal to map to number</span>
-  <span class="Constant">1</span>:number/<span class="Special">raw &lt;- </span>foo <span class="Constant">3</span>
+  <span class="Constant">1</span>:num/<span class="Special">raw &lt;- </span>foo <span class="Constant">3</span>
 ]
 def foo x:_elem <span class="Delimiter">-&gt;</span> y:_elem [
   local-scope
@@ -758,7 +761,7 @@ def foo x:_elem <span class="Delimiter">-&gt;</span> y:_elem [
 def main [
   local-scope
   <span class="Comment"># permit literal to map to character</span>
-  <span class="Constant">1</span>:character/<span class="Special">raw &lt;- </span>foo <span class="Constant">3</span>
+  <span class="Constant">1</span>:<span class="Normal">char</span>/<span class="Special">raw &lt;- </span>foo <span class="Constant">3</span>
 ]
 def foo x:_elem <span class="Delimiter">-&gt;</span> y:_elem [
   local-scope
@@ -771,9 +774,9 @@ def foo x:_elem <span class="Delimiter">-&gt;</span> y:_elem [
 def main [
   local-scope
   <span class="Comment"># permit '0' to map to address to shape-shifting type-ingredient</span>
-  <span class="Constant">1</span>:address:character/<span class="Special">raw &lt;- </span>foo <span class="Constant">0</span>
+  <span class="Constant">1</span>:&amp;:<span class="Normal">char</span>/<span class="Special">raw &lt;- </span>foo <span class="Constant">0</span>
 ]
-def foo x:address:_elem <span class="Delimiter">-&gt;</span> y:address:_elem [
+def foo x:&amp;:_elem <span class="Delimiter">-&gt;</span> y:&amp;:_elem [
   local-scope
   load-ingredients
   y<span class="Special"> &lt;- </span>copy x
@@ -788,7 +791,7 @@ def main [
   <span class="Comment"># ambiguous call: what's the type of its ingredient?!</span>
   foo <span class="Constant">0</span>
 ]
-def foo x:address:_elem <span class="Delimiter">-&gt;</span> y:address:_elem [
+def foo x:&amp;:_elem <span class="Delimiter">-&gt;</span> y:&amp;:_elem [
   local-scope
   load-ingredients
   y<span class="Special"> &lt;- </span>copy x
@@ -802,25 +805,25 @@ def main [
 def foo x:_elem<span class="Delimiter">,</span> y:_elem [
   local-scope
   load-ingredients
-  <span class="Constant">1</span>:number/<span class="Special">raw &lt;- </span>add x<span class="Delimiter">,</span> y
+  <span class="Constant">1</span>:num/<span class="Special">raw &lt;- </span>add x<span class="Delimiter">,</span> y
 ]
 <span class="traceContains">+mem: storing 7 in location 1</span>
 
 <span class="Delimiter">:(scenario multiple_shape_shifting_variants)</span>
 <span class="Comment"># try to call two different shape-shifting recipes with the same name</span>
 def main [
-  <span class="Normal">e1</span>:d1:number<span class="Special"> &lt;- </span>merge <span class="Constant">3</span>
-  <span class="Normal">e2</span>:d2:number<span class="Special"> &lt;- </span>merge <span class="Constant">4</span><span class="Delimiter">,</span> <span class="Constant">5</span>
-  <span class="Constant">1</span>:number/<span class="Special">raw &lt;- </span>foo e1
-  <span class="Constant">2</span>:number/<span class="Special">raw &lt;- </span>foo e2
+  <span class="Normal">e1</span>:d1:num<span class="Special"> &lt;- </span>merge <span class="Constant">3</span>
+  <span class="Normal">e2</span>:d2:num<span class="Special"> &lt;- </span>merge <span class="Constant">4</span><span class="Delimiter">,</span> <span class="Constant">5</span>
+  <span class="Constant">1</span>:num/<span class="Special">raw &lt;- </span>foo e1
+  <span class="Constant">2</span>:num/<span class="Special">raw &lt;- </span>foo e2
 ]
 <span class="Comment"># the two shape-shifting definitions</span>
-def foo a:d1:_elem <span class="Delimiter">-&gt;</span> b:number [
+def foo a:d1:_elem <span class="Delimiter">-&gt;</span> b:num [
   local-scope
   load-ingredients
   <span class="Identifier">return</span> <span class="Constant">34</span>
 ]
-def foo a:d2:_elem <span class="Delimiter">-&gt;</span> b:number [
+def foo a:d2:_elem <span class="Delimiter">-&gt;</span> b:num [
   local-scope
   load-ingredients
   <span class="Identifier">return</span> <span class="Constant">35</span>
@@ -830,7 +833,7 @@ container d1:_elem [
   <span class="Normal">x</span>:_elem
 ]
 container d2:_elem [
-  <span class="Normal">x</span>:number
+  <span class="Normal">x</span>:num
   <span class="Normal">y</span>:_elem
 ]
 <span class="traceContains">+mem: storing 34 in location 1</span>
@@ -839,17 +842,17 @@ container d2:_elem [
 <span class="Delimiter">:(scenario multiple_shape_shifting_variants_2)</span>
 <span class="Comment"># static dispatch between shape-shifting variants, _including pointer lookups_</span>
 def main [
-  <span class="Normal">e1</span>:d1:number<span class="Special"> &lt;- </span>merge <span class="Constant">3</span>
-  <span class="Normal">e2</span>:address:d2:number<span class="Special"> &lt;- </span><span class="Normal">new</span> <span class="Delimiter">{(</span>d2 number<span class="Delimiter">)</span>: type<span class="Delimiter">}</span>
-  <span class="Constant">1</span>:number/<span class="Special">raw &lt;- </span>foo e1
-  <span class="Constant">2</span>:number/<span class="Special">raw &lt;- </span>foo *e2  <span class="Comment"># different from previous scenario</span>
+  <span class="Normal">e1</span>:d1:num<span class="Special"> &lt;- </span>merge <span class="Constant">3</span>
+  <span class="Normal">e2</span>:&amp;:d2:num<span class="Special"> &lt;- </span><span class="Normal">new</span> <span class="Delimiter">{(</span>d2 number<span class="Delimiter">)</span>: type<span class="Delimiter">}</span>
+  <span class="Constant">1</span>:num/<span class="Special">raw &lt;- </span>foo e1
+  <span class="Constant">2</span>:num/<span class="Special">raw &lt;- </span>foo *e2  <span class="Comment"># different from previous scenario</span>
 ]
-def foo a:d1:_elem <span class="Delimiter">-&gt;</span> b:number [
+def foo a:d1:_elem <span class="Delimiter">-&gt;</span> b:num [
   local-scope
   load-ingredients
   <span class="Identifier">return</span> <span class="Constant">34</span>
 ]
-def foo a:d2:_elem <span class="Delimiter">-&gt;</span> b:number [
+def foo a:d2:_elem <span class="Delimiter">-&gt;</span> b:num [
   local-scope
   load-ingredients
   <span class="Identifier">return</span> <span class="Constant">35</span>
@@ -858,7 +861,7 @@ container d1:_elem [
   <span class="Normal">x</span>:_elem
 ]
 container d2:_elem [
-  <span class="Normal">x</span>:number
+  <span class="Normal">x</span>:num
   <span class="Normal">y</span>:_elem
 ]
 <span class="traceContains">+mem: storing 34 in location 1</span>
@@ -867,10 +870,10 @@ container d2:_elem [
 <span class="Delimiter">:(scenario missing_type_in_shape_shifting_recipe)</span>
 <span class="Special">% Hide_errors = true;</span>
 def main [
-  <span class="Normal">a</span>:d1:number<span class="Special"> &lt;- </span>merge <span class="Constant">3</span>
+  <span class="Normal">a</span>:d1:num<span class="Special"> &lt;- </span>merge <span class="Constant">3</span>
   foo a
 ]
-def foo a:d1:_elem <span class="Delimiter">-&gt;</span> b:number [
+def foo a:d1:_elem <span class="Delimiter">-&gt;</span> b:num [
   local-scope
   load-ingredients
   copy e  <span class="Comment"># no such variable</span>
@@ -886,10 +889,10 @@ container d1:_elem [
 <span class="Delimiter">:(scenario missing_type_in_shape_shifting_recipe_2)</span>
 <span class="Special">% Hide_errors = true;</span>
 def main [
-  <span class="Normal">a</span>:d1:number<span class="Special"> &lt;- </span>merge <span class="Constant">3</span>
+  <span class="Normal">a</span>:d1:num<span class="Special"> &lt;- </span>merge <span class="Constant">3</span>
   foo a
 ]
-def foo a:d1:_elem <span class="Delimiter">-&gt;</span> b:number [
+def foo a:d1:_elem <span class="Delimiter">-&gt;</span> b:num [
   local-scope
   load-ingredients
   get e<span class="Delimiter">,</span> x:offset  <span class="Comment"># unknown variable in a 'get', which does some extra checking</span>
@@ -905,15 +908,15 @@ container d1:_elem [
 <span class="Delimiter">:(scenarios transform)</span>
 <span class="Delimiter">:(scenario specialize_recursive_shape_shifting_recipe)</span>
 def main [
-  <span class="Constant">1</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">34</span>
-  <span class="Constant">2</span>:number<span class="Special"> &lt;- </span>foo <span class="Constant">1</span>:number
+  <span class="Constant">1</span>:num<span class="Special"> &lt;- </span>copy <span class="Constant">34</span>
+  <span class="Constant">2</span>:num<span class="Special"> &lt;- </span>foo <span class="Constant">1</span>:num
 ]
-def foo x:_elem <span class="Delimiter">-&gt;</span> y:number [
+def foo x:_elem <span class="Delimiter">-&gt;</span> y:num [
   local-scope
   load-ingredients
   <span class="Delimiter">{</span>
     <span class="Identifier">break</span>
-    <span class="Normal">y</span>:number<span class="Special"> &lt;- </span>foo x
+    <span class="Normal">y</span>:num<span class="Special"> &lt;- </span>foo x
   <span class="Delimiter">}</span>
   <span class="Identifier">return</span> y
 ]
@@ -923,15 +926,15 @@ def foo x:_elem <span class="Delimiter">-&gt;</span> y:number [
 <span class="Delimiter">:(scenarios run)</span>
 <span class="Delimiter">:(scenario specialize_most_similar_variant)</span>
 def main [
-  <span class="Constant">1</span>:address:number<span class="Special"> &lt;- </span><span class="Normal">new</span> number:type
-  <span class="Constant">2</span>:number<span class="Special"> &lt;- </span>foo <span class="Constant">1</span>:address:number
+  <span class="Constant">1</span>:&amp;:num<span class="Special"> &lt;- </span><span class="Normal">new</span> number:type
+  <span class="Constant">2</span>:num<span class="Special"> &lt;- </span>foo <span class="Constant">1</span>:&amp;:num
 ]
-def foo x:_elem <span class="Delimiter">-&gt;</span> y:number [
+def foo x:_elem <span class="Delimiter">-&gt;</span> y:num [
   local-scope
   load-ingredients
   <span class="Identifier">return</span> <span class="Constant">34</span>
 ]
-def foo x:address:_elem <span class="Delimiter">-&gt;</span> y:number [
+def foo x:&amp;:_elem <span class="Delimiter">-&gt;</span> y:num [
   local-scope
   load-ingredients
   <span class="Identifier">return</span> <span class="Constant">35</span>
@@ -941,18 +944,18 @@ def foo x:address:_elem <span class="Delimiter">-&gt;</span> y:number [
 <span class="Delimiter">:(scenario specialize_most_similar_variant_2)</span>
 <span class="Comment"># version with headers padded with lots of unrelated concrete types</span>
 def main [
-  <span class="Constant">1</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">23</span>
-  <span class="Constant">2</span>:address:array:number<span class="Special"> &lt;- </span>copy <span class="Constant">0</span>
-  <span class="Constant">3</span>:number<span class="Special"> &lt;- </span>foo <span class="Constant">2</span>:address:array:number<span class="Delimiter">,</span> <span class="Constant">1</span>:number
+  <span class="Constant">1</span>:num<span class="Special"> &lt;- </span>copy <span class="Constant">23</span>
+  <span class="Constant">2</span>:&amp;:@:num<span class="Special"> &lt;- </span>copy <span class="Constant">0</span>
+  <span class="Constant">3</span>:num<span class="Special"> &lt;- </span>foo <span class="Constant">2</span>:&amp;:@:num<span class="Delimiter">,</span> <span class="Constant">1</span>:num
 ]
 <span class="Comment"># variant with concrete type</span>
-def foo dummy:address:array:number<span class="Delimiter">,</span> x:number <span class="Delimiter">-&gt;</span> y:number<span class="Delimiter">,</span> dummy:address:array:number [
+def foo dummy:&amp;:@:num<span class="Delimiter">,</span> x:num <span class="Delimiter">-&gt;</span> y:num<span class="Delimiter">,</span> dummy:&amp;:@:num [
   local-scope
   load-ingredients
   <span class="Identifier">return</span> <span class="Constant">34</span>
 ]
 <span class="Comment"># shape-shifting variant</span>
-def foo dummy:address:array:number<span class="Delimiter">,</span> x:_elem <span class="Delimiter">-&gt;</span> y:number<span class="Delimiter">,</span> dummy:address:array:number [
+def foo dummy:&amp;:@:num<span class="Delimiter">,</span> x:_elem <span class="Delimiter">-&gt;</span> y:num<span class="Delimiter">,</span> dummy:&amp;:@:num [
   local-scope
   load-ingredients
   <span class="Identifier">return</span> <span class="Constant">35</span>
@@ -962,28 +965,28 @@ def foo dummy:address:array:number<span class="Delimiter">,</span> x:_elem <span
 
 <span class="Delimiter">:(scenario specialize_most_similar_variant_3)</span>
 def main [
-  <span class="Constant">1</span>:address:array:character<span class="Special"> &lt;- </span><span class="Normal">new</span> [abc]
-  foo <span class="Constant">1</span>:address:array:character
+  <span class="Constant">1</span>:text<span class="Special"> &lt;- </span><span class="Normal">new</span> [abc]
+  foo <span class="Constant">1</span>:text
 ]
-def foo x:address:array:character [
-  <span class="Constant">2</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">34</span>
+def foo x:text [
+  <span class="Constant">2</span>:num<span class="Special"> &lt;- </span>copy <span class="Constant">34</span>
 ]
-def foo x:address:_elem [
-  <span class="Constant">2</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">35</span>
+def foo x:&amp;:_elem [
+  <span class="Constant">2</span>:num<span class="Special"> &lt;- </span>copy <span class="Constant">35</span>
 ]
 <span class="Comment"># make sure the more precise version was used</span>
 <span class="traceContains">+mem: storing 34 in location 2</span>
 
 <span class="Delimiter">:(scenario specialize_literal_as_number)</span>
 def main [
-  <span class="Constant">1</span>:number<span class="Special"> &lt;- </span>foo <span class="Constant">23</span>
+  <span class="Constant">1</span>:num<span class="Special"> &lt;- </span>foo <span class="Constant">23</span>
 ]
-def foo x:_elem <span class="Delimiter">-&gt;</span> y:number [
+def foo x:_elem <span class="Delimiter">-&gt;</span> y:num [
   local-scope
   load-ingredients
   <span class="Identifier">return</span> <span class="Constant">34</span>
 ]
-def foo x:character <span class="Delimiter">-&gt;</span> y:number [
+def foo x:<span class="Normal">char</span> <span class="Delimiter">-&gt;</span> y:num [
   local-scope
   load-ingredients
   <span class="Identifier">return</span> <span class="Constant">35</span>
@@ -993,16 +996,16 @@ def foo x:character <span class="Delimiter">-&gt;</span> y:number [
 <span class="Delimiter">:(scenario specialize_literal_as_number_2)</span>
 <span class="Comment"># version calling with literal</span>
 def main [
-  <span class="Constant">1</span>:number<span class="Special"> &lt;- </span>foo <span class="Constant">0</span>
+  <span class="Constant">1</span>:num<span class="Special"> &lt;- </span>foo <span class="Constant">0</span>
 ]
 <span class="Comment"># variant with concrete type</span>
-def foo x:number <span class="Delimiter">-&gt;</span> y:number [
+def foo x:num <span class="Delimiter">-&gt;</span> y:num [
   local-scope
   load-ingredients
   <span class="Identifier">return</span> <span class="Constant">34</span>
 ]
 <span class="Comment"># shape-shifting variant</span>
-def foo x:address:_elem <span class="Delimiter">-&gt;</span> y:number [
+def foo x:&amp;:_elem <span class="Delimiter">-&gt;</span> y:num [
   local-scope
   load-ingredients
   <span class="Identifier">return</span> <span class="Constant">35</span>
@@ -1012,16 +1015,16 @@ def foo x:address:_elem <span class="Delimiter">-&gt;</span> y:number [
 
 <span class="Delimiter">:(scenario specialize_literal_as_address)</span>
 def main [
-  <span class="Constant">1</span>:number<span class="Special"> &lt;- </span>foo <span class="Constant">0</span>
+  <span class="Constant">1</span>:num<span class="Special"> &lt;- </span>foo <span class="Constant">0</span>
 ]
 <span class="Comment"># variant with concrete address type</span>
-def foo x:address:number <span class="Delimiter">-&gt;</span> y:number [
+def foo x:&amp;:num <span class="Delimiter">-&gt;</span> y:num [
   local-scope
   load-ingredients
   <span class="Identifier">return</span> <span class="Constant">34</span>
 ]
 <span class="Comment"># shape-shifting variant</span>
-def foo x:address:_elem <span class="Delimiter">-&gt;</span> y:number [
+def foo x:&amp;:_elem <span class="Delimiter">-&gt;</span> y:num [
   local-scope
   load-ingredients
   <span class="Identifier">return</span> <span class="Constant">35</span>
@@ -1036,14 +1039,14 @@ def foo a:_elem [
 ]
 <span class="Comment"># define a container with field 'z'</span>
 container foo2 [
-  <span class="Normal">z</span>:number
+  <span class="Normal">z</span>:num
 ]
 def main [
   local-scope
   <span class="Normal">x</span>:foo2<span class="Special"> &lt;- </span>merge <span class="Constant">34</span>
-  <span class="Normal">y</span>:number<span class="Special"> &lt;- </span>get x<span class="Delimiter">,</span> z:offse  <span class="Comment"># typo in 'offset'</span>
+  <span class="Normal">y</span>:num<span class="Special"> &lt;- </span>get x<span class="Delimiter">,</span> z:offse  <span class="Comment"># typo in 'offset'</span>
 <span class="PreProc">  </span><span class="Comment"># define a variable with the same name 'z'</span>
-  <span class="Normal">z</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">34</span>
+  <span class="Normal">z</span>:num<span class="Special"> &lt;- </span>copy <span class="Constant">34</span>
   <span class="Comment"># trigger specialization of the shape-shifting recipe</span>
   foo z
 ]
@@ -1056,14 +1059,14 @@ def foo a:_elem [
 ]
 <span class="Comment"># define a container with field 'z'</span>
 container foo2 [
-  <span class="Normal">z</span>:number
+  <span class="Normal">z</span>:num
 ]
 def main [
   local-scope
   <span class="Normal">x</span>:foo2<span class="Special"> &lt;- </span>merge <span class="Constant">34</span>
-  <span class="Normal">y</span>:number<span class="Special"> &lt;- </span>get x<span class="Delimiter">,</span> z:offse  <span class="Comment"># typo in 'offset'</span>
+  <span class="Normal">y</span>:num<span class="Special"> &lt;- </span>get x<span class="Delimiter">,</span> z:offse  <span class="Comment"># typo in 'offset'</span>
 <span class="PreProc">  </span><span class="Comment"># define a variable with the same name 'z'</span>
-  <span class="Normal">z</span>:address:number<span class="Special"> &lt;- </span>copy <span class="Constant">34</span>
+  <span class="Normal">z</span>:&amp;:num<span class="Special"> &lt;- </span>copy <span class="Constant">34</span>
   <span class="Comment"># trigger specialization of the shape-shifting recipe</span>
   foo *z
 ]
@@ -1087,9 +1090,27 @@ def main [
 ]
 $error: <span class="Constant">0</span>
 
+<span class="Delimiter">:(scenario tangle_shape_shifting_recipe_with_type_abbreviation)</span>
+<span class="Comment"># shape-shifting recipe</span>
+def foo a:_elem [
+  local-scope
+  load-ingredients
+  &lt;label1&gt;
+]
+<span class="Comment"># tangle some code that refers to the type ingredient</span>
+after &lt;label1&gt; [
+  <span class="Normal">b</span>:<span class="Normal">bool</span><span class="Special"> &lt;- </span>copy <span class="Constant">0</span>  <span class="Comment"># type abbreviation</span>
+]
+<span class="Comment"># trigger specialization</span>
+def main [
+  local-scope
+  foo <span class="Constant">34</span>
+]
+$error: <span class="Constant">0</span>
+
 <span class="Delimiter">:(scenario shape_shifting_recipe_coexists_with_primitive)</span>
 <span class="Comment"># recipe overloading a primitive with a generic type</span>
-def add a:address:foo:_elem [
+def add a:&amp;:foo:_elem [
   assert <span class="Constant">0</span><span class="Delimiter">,</span> [should <span class="Normal">not</span> get here]
 ]
 def main [