diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-10-23 23:15:12 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-10-23 23:15:12 -0700 |
commit | 2e4f0bbd12231a51ae08df4fe0f8847111fde405 (patch) | |
tree | 581166406a4749ac2dcd87c8555cc95dbb1bbd52 /html/053recipe_header.cc.html | |
parent | 2225b945ad5ba9310081b371bf32a9f575646e1b (diff) | |
download | mu-2e4f0bbd12231a51ae08df4fe0f8847111fde405.tar.gz |
3578
Diffstat (limited to 'html/053recipe_header.cc.html')
-rw-r--r-- | html/053recipe_header.cc.html | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/html/053recipe_header.cc.html b/html/053recipe_header.cc.html index d379b46a..021db5f4 100644 --- a/html/053recipe_header.cc.html +++ b/html/053recipe_header.cc.html @@ -258,6 +258,34 @@ put<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> +<span class="Comment">//: more useful error messages if someone forgets 'load-ingredients'</span> + +<span class="Delimiter">:(scenario load_ingredients_missing_error)</span> +<span class="Special">% Hide_errors = true;</span> +<span class="muRecipe">def</span> foo a:num [ + local-scope + <span class="Normal">b</span>:num<span class="Special"> <- </span>add a:num<span class="Delimiter">,</span> <span class="Constant">1</span> +] +<span class="traceContains">+error: foo: use before set: 'a'</span> +<span class="traceContains">+error: did you forget 'load-ingredients'?</span> + +<span class="Delimiter">:(after "use-before-set Error")</span> +<span class="Normal">if</span> <span class="Delimiter">(</span>is_present_in_ingredients<span class="Delimiter">(</span>caller<span class="Delimiter">,</span> ingredient<span class="Delimiter">.</span>name<span class="Delimiter">))</span> + raise << <span class="Constant">" did you forget 'load-ingredients'?</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> + +<span class="Delimiter">:(scenario load_ingredients_missing_error_2)</span> +<span class="Special">% Hide_errors = true;</span> +<span class="muRecipe">def</span> foo a:num [ + local-scope + <span class="Normal">b</span>:num<span class="Special"> <- </span>add a<span class="Delimiter">,</span> <span class="Constant">1</span> +] +<span class="traceContains">+error: foo: missing type for 'a' in 'b:num <- add a, 1'</span> +<span class="traceContains">+error: did you forget 'load-ingredients'?</span> + +<span class="Delimiter">:(after "missing-type Error 1")</span> +<span class="Normal">if</span> <span class="Delimiter">(</span>is_present_in_ingredients<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> recipe_name<span class="Delimiter">)),</span> x<span class="Delimiter">.</span>name<span class="Delimiter">))</span> + raise << <span class="Constant">" did you forget 'load-ingredients'?</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> + <span class="SalientComment">//:: Check all calls against headers.</span> <span class="Delimiter">:(scenario show_clear_error_on_bad_call)</span> |