mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
update instantiate rigid
This commit is contained in:
parent
22ca51c881
commit
f2deb37a30
1 changed files with 16 additions and 8 deletions
|
@ -2899,17 +2899,25 @@ fn instantiate_rigids_help(subs: &mut Subs, max_rank: Rank, initial: Variable) {
|
||||||
// NOTE: we must write to the mutually borrowed `desc` value here
|
// NOTE: we must write to the mutually borrowed `desc` value here
|
||||||
// using `subs.set` does not work (unclear why, really)
|
// using `subs.set` does not work (unclear why, really)
|
||||||
// but get_ref_mut approach saves a lookup, so the weirdness is worth it
|
// but get_ref_mut approach saves a lookup, so the weirdness is worth it
|
||||||
desc.content = FlexVar(Some(name));
|
subs.modify(var, |d| {
|
||||||
desc.rank = max_rank;
|
*d = Descriptor {
|
||||||
desc.mark = Mark::NONE;
|
content: FlexVar(Some(name)),
|
||||||
desc.copy = OptVariable::NONE;
|
rank: max_rank,
|
||||||
|
mark: Mark::NONE,
|
||||||
|
copy: OptVariable::NONE,
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
&RigidAbleVar(name, ability) => {
|
&RigidAbleVar(name, ability) => {
|
||||||
// Same as `RigidVar` above
|
// Same as `RigidVar` above
|
||||||
desc.content = FlexAbleVar(Some(name), ability);
|
subs.modify(var, |d| {
|
||||||
desc.rank = max_rank;
|
*d = Descriptor {
|
||||||
desc.mark = Mark::NONE;
|
content: FlexAbleVar(Some(name), ability),
|
||||||
desc.copy = OptVariable::NONE;
|
rank: max_rank,
|
||||||
|
mark: Mark::NONE,
|
||||||
|
copy: OptVariable::NONE,
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
FlexVar(_) | FlexAbleVar(_, _) | Error => (),
|
FlexVar(_) | FlexAbleVar(_, _) | Error => (),
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue