From 2e4f0bbd12231a51ae08df4fe0f8847111fde405 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sun, 23 Oct 2016 23:15:12 -0700 Subject: 3578 --- html/053recipe_header.cc.html | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'html/053recipe_header.cc.html') 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(Recipe_ordinal,break; } +//: more useful error messages if someone forgets 'load-ingredients' + +:(scenario load_ingredients_missing_error) +% Hide_errors = true; +def foo a:num [ + local-scope + b:num <- add a:num, 1 +] ++error: foo: use before set: 'a' ++error: did you forget 'load-ingredients'? + +:(after "use-before-set Error") +if (is_present_in_ingredients(caller, ingredient.name)) + raise << " did you forget 'load-ingredients'?\n" << end(); + +:(scenario load_ingredients_missing_error_2) +% Hide_errors = true; +def foo a:num [ + local-scope + b:num <- add a, 1 +] ++error: foo: missing type for 'a' in 'b:num <- add a, 1' ++error: did you forget 'load-ingredients'? + +:(after "missing-type Error 1") +if (is_present_in_ingredients(get(Recipe, get(Recipe_ordinal, recipe_name)), x.name)) + raise << " did you forget 'load-ingredients'?\n" << end(); + //:: Check all calls against headers. :(scenario show_clear_error_on_bad_call) -- cgit 1.4.1-2-gfad0