mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 23:31:12 +00:00
Improve error reporting for patterns not matching opaques
This commit is contained in:
parent
4e27cdd21d
commit
07b1829732
7 changed files with 26 additions and 23 deletions
|
@ -420,18 +420,21 @@ pub fn constrain_pattern(
|
|||
constrain_pattern(env, &loc_pattern.value, loc_pattern.region, expected, state);
|
||||
}
|
||||
|
||||
let pat_category = PatternCategory::Ctor(tag_name.clone());
|
||||
|
||||
let whole_con = Constraint::Present(
|
||||
expected.clone().get_type(),
|
||||
PresenceConstraint::IncludesTag(tag_name.clone(), argument_types.clone()),
|
||||
PresenceConstraint::IncludesTag(
|
||||
tag_name.clone(),
|
||||
argument_types.clone(),
|
||||
region,
|
||||
pat_category.clone(),
|
||||
),
|
||||
);
|
||||
|
||||
let tag_con = Constraint::Present(
|
||||
Type::Variable(*whole_var),
|
||||
PresenceConstraint::Pattern(
|
||||
region,
|
||||
PatternCategory::Ctor(tag_name.clone()),
|
||||
expected,
|
||||
),
|
||||
PresenceConstraint::Pattern(region, pat_category, expected),
|
||||
);
|
||||
|
||||
state.vars.push(*whole_var);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue