3657 - better error message
Thanks Ella Couch for reporting this.
This commit is contained in:
parent
f116818c7c
commit
c8f2ff1392
|
@ -392,7 +392,7 @@ def test1 [
|
|||
// ```
|
||||
if (curr.name == "return-if" || curr.name == "reply-if") {
|
||||
if (curr.products.empty()) {
|
||||
emit_return_block(result, "break-unless", curr.ingredients);
|
||||
emit_return_block(result, "break-unless", curr);
|
||||
curr.clear();
|
||||
}
|
||||
else {
|
||||
|
@ -408,7 +408,7 @@ if (curr.name == "return-if" || curr.name == "reply-if") {
|
|||
// ```
|
||||
if (curr.name == "return-unless" || curr.name == "reply-unless") {
|
||||
if (curr.products.empty()) {
|
||||
emit_return_block(result, "break-if", curr.ingredients);
|
||||
emit_return_block(result, "break-if", curr);
|
||||
curr.clear();
|
||||
}
|
||||
else {
|
||||
|
@ -417,7 +417,8 @@ if (curr.name == "return-unless" || curr.name == "reply-unless") {
|
|||
}
|
||||
|
||||
:(code)
|
||||
void emit_return_block(recipe& out, const string& break_command, const vector<reagent>& ingredients) {
|
||||
void emit_return_block(recipe& out, const string& break_command, const instruction& inst) {
|
||||
const vector<reagent>& ingredients = inst.ingredients;
|
||||
reagent/*copy*/ condition = ingredients.at(0);
|
||||
vector<reagent> return_ingredients;
|
||||
copy(++ingredients.begin(), ingredients.end(), inserter(return_ingredients, return_ingredients.end()));
|
||||
|
@ -438,6 +439,7 @@ void emit_return_block(recipe& out, const string& break_command, const vector<re
|
|||
return_inst.operation = get(Recipe_ordinal, "return");
|
||||
return_inst.name = "return";
|
||||
return_inst.ingredients.swap(return_ingredients);
|
||||
return_inst.original_string = inst.original_string;
|
||||
out.steps.push_back(return_inst);
|
||||
|
||||
// }
|
||||
|
|
|
@ -353,6 +353,16 @@ def add2 x:num, y:num [
|
|||
]
|
||||
+error: add2: replied with the wrong number of products at 'return z'
|
||||
|
||||
:(scenario recipe_headers_are_checked_against_transformed_instructions)
|
||||
% Hide_errors = true;
|
||||
def foo -> x:num [
|
||||
local-scope
|
||||
x:num <- copy 0
|
||||
z:bool <- copy 0/false
|
||||
return-if z, z
|
||||
]
|
||||
+error: foo: replied with the wrong type at 'return-if z, z'
|
||||
|
||||
:(scenario recipe_headers_check_for_duplicate_names)
|
||||
% Hide_errors = true;
|
||||
def add2 x:num, x:num -> z:num [
|
||||
|
|
Loading…
Reference in New Issue
Block a user