mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
collect and instantiate hidden variables
This commit is contained in:
parent
2c55fa5ec5
commit
f13c28fe7f
5 changed files with 59 additions and 19 deletions
|
@ -1,4 +1,4 @@
|
|||
use roc_collections::all::ImMap;
|
||||
use roc_collections::all::{ImMap, MutSet};
|
||||
use roc_module::ident::{Ident, Lowercase};
|
||||
use roc_module::symbol::{IdentIds, ModuleId, Symbol};
|
||||
use roc_problem::can::RuntimeError;
|
||||
|
@ -146,14 +146,21 @@ impl Scope {
|
|||
vars: Vec<Located<(Lowercase, Variable)>>,
|
||||
typ: Type,
|
||||
) {
|
||||
self.aliases.insert(
|
||||
name,
|
||||
Alias {
|
||||
region,
|
||||
vars,
|
||||
uniqueness: None,
|
||||
typ,
|
||||
},
|
||||
);
|
||||
let mut hidden_variables = MutSet::default();
|
||||
hidden_variables.extend(typ.variables());
|
||||
|
||||
for loc_var in vars.iter() {
|
||||
hidden_variables.remove(&loc_var.value.1);
|
||||
}
|
||||
|
||||
let alias = Alias {
|
||||
region,
|
||||
vars,
|
||||
hidden_variables,
|
||||
uniqueness: None,
|
||||
typ,
|
||||
};
|
||||
|
||||
self.aliases.insert(name, alias);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue