Revise conditional error wording.

This commit is contained in:
Richard Feldman 2020-04-03 01:05:55 -04:00
parent 67b7be9786
commit dc3e2d307c
2 changed files with 8 additions and 7 deletions

View file

@ -124,9 +124,9 @@ fn to_expr_report(
let problem = Concat(vec![
plain_text("This "),
code_text("if"),
plain_text(" condition should be a "),
plain_text(" condition needs to be a "),
ReportText::Type(Content::Alias(Symbol::BOOL_BOOL, vec![], Variable::BOOL)),
plain_text(", but it isnt."),
plain_text("."),
]);
report_bad_type(
@ -137,10 +137,11 @@ fn to_expr_report(
region,
Some(expr_region),
problem,
"Instead its",
"Right now its",
Concat(vec![
plain_text("I need every "),
code_text("if"),
plain_text(" conditions must evaluate to a "),
plain_text(" condition to evaluate to a "),
ReportText::Type(Content::Alias(
Symbol::BOOL_BOOL,
vec![],

View file

@ -766,16 +766,16 @@ mod test_reporting {
),
indoc!(
r#"
This `if` condition should be a Bool, but it isnt.
This `if` condition needs to be a Bool.
1 if "foo" then 2 else 3
^^^^^
Instead its a string of type:
Right now its a string of type:
Str
`if` conditions must evaluate to a Booleither `True` or `False`.
I need every `if` condition to evaluate to a Booleither `True` or `False`.
"#
),