mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 15:21:12 +00:00
Improve error message
This commit is contained in:
parent
02e1a98cac
commit
13a17f1858
2 changed files with 17 additions and 0 deletions
|
@ -615,6 +615,16 @@ pub fn can_problem<'b>(
|
||||||
alloc.reflow(":"),
|
alloc.reflow(":"),
|
||||||
]),
|
]),
|
||||||
alloc.region(lines.convert_region(region)),
|
alloc.region(lines.convert_region(region)),
|
||||||
|
alloc.concat(vec![
|
||||||
|
alloc.reflow("Abilities are not types, but you can add an ability constraint to a type variable "),
|
||||||
|
alloc.type_variable("a".into()),
|
||||||
|
alloc.reflow(" by writing"),
|
||||||
|
]),
|
||||||
|
alloc.type_block(alloc.concat(vec![
|
||||||
|
alloc.reflow("| a has "),
|
||||||
|
alloc.symbol_unqualified(ability),
|
||||||
|
])),
|
||||||
|
alloc.reflow(" at the end of the type."),
|
||||||
]);
|
]);
|
||||||
title = ALIAS_USES_ABILITY.to_string();
|
title = ALIAS_USES_ABILITY.to_string();
|
||||||
severity = Severity::RuntimeError;
|
severity = Severity::RuntimeError;
|
||||||
|
|
|
@ -9030,6 +9030,13 @@ I need all branches in an `if` to have the same type!
|
||||||
3│ Alias : Ability
|
3│ Alias : Ability
|
||||||
^^^^^
|
^^^^^
|
||||||
|
|
||||||
|
Abilities are not types, but you can add an ability constraint to a
|
||||||
|
type variable `a` by writing
|
||||||
|
|
||||||
|
| a has Ability
|
||||||
|
|
||||||
|
at the end of the type.
|
||||||
|
|
||||||
── UNUSED DEFINITION ───────────────────────────────────────────────────────────
|
── UNUSED DEFINITION ───────────────────────────────────────────────────────────
|
||||||
|
|
||||||
`ab` is not used anywhere in your code.
|
`ab` is not used anywhere in your code.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue