mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
new recvar design
This commit is contained in:
parent
1001a17649
commit
5fbcfe18d3
7 changed files with 69 additions and 28 deletions
|
@ -747,12 +747,20 @@ fn type_to_variable(
|
|||
};
|
||||
tag_vars.extend(ext_tag_vec.into_iter());
|
||||
|
||||
subs.set_content(*rec_var, Content::RecursionVar(None));
|
||||
|
||||
let content =
|
||||
Content::Structure(FlatType::RecursiveTagUnion(*rec_var, tag_vars, new_ext_var));
|
||||
|
||||
register(subs, rank, pools, content)
|
||||
let tag_union_var = register(subs, rank, pools, content);
|
||||
|
||||
subs.set_content(
|
||||
*rec_var,
|
||||
Content::RecursionVar {
|
||||
opt_name: None,
|
||||
structure: tag_union_var,
|
||||
},
|
||||
);
|
||||
|
||||
tag_union_var
|
||||
}
|
||||
Alias(Symbol::BOOL_BOOL, _, _) => Variable::BOOL,
|
||||
Alias(symbol, args, alias_type) => {
|
||||
|
@ -1116,7 +1124,7 @@ fn adjust_rank_content(
|
|||
use roc_types::subs::FlatType::*;
|
||||
|
||||
match content {
|
||||
FlexVar(_) | RigidVar(_) | RecursionVar(_) | Error => group_rank,
|
||||
FlexVar(_) | RigidVar(_) | RecursionVar { .. } | Error => group_rank,
|
||||
|
||||
Structure(flat_type) => {
|
||||
match flat_type {
|
||||
|
@ -1403,7 +1411,7 @@ fn instantiate_rigids_help(
|
|||
copy
|
||||
}
|
||||
|
||||
FlexVar(_) | RecursionVar(_) | Error => copy,
|
||||
FlexVar(_) | RecursionVar { .. } | Error => copy,
|
||||
|
||||
RigidVar(name) => {
|
||||
subs.set(copy, make_descriptor(FlexVar(Some(name))));
|
||||
|
@ -1578,7 +1586,7 @@ fn deep_copy_var_help(
|
|||
copy
|
||||
}
|
||||
|
||||
FlexVar(_) | RecursionVar(_) | Error => copy,
|
||||
FlexVar(_) | RecursionVar { .. } | Error => copy,
|
||||
|
||||
RigidVar(name) => {
|
||||
subs.set(copy, make_descriptor(FlexVar(Some(name))));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue