mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 16:21:11 +00:00
insert type aliases instead of relying on scope check
This commit is contained in:
parent
91e4a0636f
commit
0f245ba778
1 changed files with 7 additions and 3 deletions
|
@ -321,6 +321,9 @@ pub(crate) fn canonicalize_defs<'a>(
|
|||
}
|
||||
}
|
||||
|
||||
// Determine which idents we introduced in the course of this process.
|
||||
let mut symbols_introduced = MutMap::default();
|
||||
|
||||
let sorted = sort_type_defs_before_introduction(referenced_type_symbols);
|
||||
let mut aliases = SendMap::default();
|
||||
let mut abilities = MutMap::default();
|
||||
|
@ -328,6 +331,8 @@ pub(crate) fn canonicalize_defs<'a>(
|
|||
for type_name in sorted {
|
||||
match type_defs.remove(&type_name).unwrap() {
|
||||
TypeDef::AliasLike(name, vars, ann, kind) => {
|
||||
symbols_introduced.insert(name.value, name.region);
|
||||
|
||||
let symbol = name.value;
|
||||
let can_ann = canonicalize_annotation(
|
||||
env,
|
||||
|
@ -428,6 +433,8 @@ pub(crate) fn canonicalize_defs<'a>(
|
|||
}
|
||||
|
||||
TypeDef::Ability(name, members) => {
|
||||
symbols_introduced.insert(name.value, name.region);
|
||||
|
||||
// For now we enforce that aliases cannot reference abilities, so let's wait to
|
||||
// resolve ability definitions until aliases are resolved and in scope below.
|
||||
abilities.insert(name.value, (name, members));
|
||||
|
@ -488,9 +495,6 @@ pub(crate) fn canonicalize_defs<'a>(
|
|||
}
|
||||
}
|
||||
|
||||
// Determine which idents we introduced in the course of this process.
|
||||
let mut symbols_introduced = MutMap::default();
|
||||
|
||||
let mut symbol_to_index: Vec<(IdentId, u32)> = Vec::with_capacity(pending_value_defs.len());
|
||||
|
||||
for (def_index, pending_def) in pending_value_defs.iter().enumerate() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue