mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 14:54:47 +00:00
Correct instantiation of delayed opaques
I didn't realize that delayed instantiation of aliases instantiates their real var, not the whole alias type. So prior to this, we were wrapping all opaques in a structural `Alias(..)`. Which is okay from a typechecking perspective because Aliases are transparent, but is wasteful.
This commit is contained in:
parent
a47dc711f3
commit
154b17d9f0
1 changed files with 2 additions and 5 deletions
|
@ -17,8 +17,8 @@ use roc_types::subs::{
|
|||
};
|
||||
use roc_types::types::Type::{self, *};
|
||||
use roc_types::types::{
|
||||
gather_fields_unsorted_iter, AliasCommon, AliasKind, Category, ErrorType, LambdaSet,
|
||||
OptAbleType, OptAbleVar, PatternCategory, Reason, TypeExtension,
|
||||
gather_fields_unsorted_iter, AliasCommon, AliasKind, Category, ErrorType, OptAbleType,
|
||||
OptAbleVar, PatternCategory, Reason, TypeExtension,
|
||||
};
|
||||
use roc_unify::unify::{unify, Mode, Unified::*};
|
||||
|
||||
|
@ -327,9 +327,6 @@ impl Aliases {
|
|||
}
|
||||
|
||||
let old_type_variables = delayed_variables.type_variables(&mut self.variables);
|
||||
#[allow(clippy::needless_collect)] // otherwise we borrow self.variables immutably twice
|
||||
let variable_opt_abilities: Vec<_> =
|
||||
old_type_variables.iter().map(|ov| ov.opt_ability).collect();
|
||||
let new_type_variables = &subs.variables[alias_variables.type_variables().indices()];
|
||||
|
||||
for (old, new) in old_type_variables.iter_mut().zip(new_type_variables) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue