mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-21 15:59:20 +03:00
Report list element pattern type mismatches
This commit is contained in:
parent
283f6e8e1e
commit
f9cb71fcf7
@ -1945,7 +1945,34 @@ fn to_pattern_report<'b>(
|
||||
severity: Severity::RuntimeError,
|
||||
}
|
||||
}
|
||||
PReason::TagArg { .. } | PReason::PatternGuard | PReason::ListElem => {
|
||||
PReason::ListElem => {
|
||||
let doc = alloc.stack([
|
||||
alloc.concat([alloc.reflow("This list element doesn't match the types of other elements in the pattern:")]),
|
||||
alloc.region(lines.convert_region(region)),
|
||||
pattern_type_comparison(
|
||||
alloc,
|
||||
found,
|
||||
expected_type,
|
||||
add_pattern_category(
|
||||
alloc,
|
||||
alloc.text("It matches"),
|
||||
&category,
|
||||
),
|
||||
alloc.concat([
|
||||
alloc.text("But the other elements in this list pattern match")
|
||||
]),
|
||||
vec![],
|
||||
),
|
||||
]);
|
||||
|
||||
Report {
|
||||
filename,
|
||||
title: "TYPE MISMATCH".to_string(),
|
||||
doc,
|
||||
severity: Severity::RuntimeError,
|
||||
}
|
||||
}
|
||||
PReason::TagArg { .. } | PReason::PatternGuard => {
|
||||
internal_error!("We didn't think this could trigger. Please tell us about it on Zulip if it does!")
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user