mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
Redundant and exhaustive marks in mono
This commit is contained in:
parent
98869b557d
commit
2f1306afd1
10 changed files with 152 additions and 86 deletions
|
@ -15,7 +15,7 @@ use roc_collections::all::{HumanIndex, MutMap, SendMap};
|
|||
use roc_module::ident::{Lowercase, TagName};
|
||||
use roc_module::symbol::{ModuleId, Symbol};
|
||||
use roc_region::all::{Loc, Region};
|
||||
use roc_types::subs::{ExhaustiveMark, Variable};
|
||||
use roc_types::subs::{ExhaustiveMark, RedundantMark, Variable};
|
||||
use roc_types::types::Type::{self, *};
|
||||
use roc_types::types::{
|
||||
AliasKind, AnnotationSource, Category, PReason, Reason, RecordField, TypeExtension,
|
||||
|
@ -1177,11 +1177,20 @@ fn constrain_when_branch_help(
|
|||
|
||||
let mut state = PatternState {
|
||||
headers: SendMap::default(),
|
||||
vars: Vec::with_capacity(1),
|
||||
constraints: Vec::with_capacity(1),
|
||||
vars: Vec::with_capacity(2),
|
||||
constraints: Vec::with_capacity(2),
|
||||
delayed_is_open_constraints: Vec::new(),
|
||||
};
|
||||
|
||||
// Mark the branch as non-redundant initially. We'll refine this during solving.
|
||||
state.vars.push(when_branch.redundant.0);
|
||||
state.constraints.push(constraints.store(
|
||||
RedundantMark::NON_REDUNDANT_TYPE,
|
||||
when_branch.redundant.0,
|
||||
file!(),
|
||||
line!(),
|
||||
));
|
||||
|
||||
// TODO investigate for error messages, is it better to unify all branches with a variable,
|
||||
// then unify that variable with the expectation?
|
||||
for (i, loc_pattern) in when_branch.patterns.iter().enumerate() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue