record alias data in Annotation

This commit is contained in:
Folkert 2020-11-04 20:06:57 +01:00
parent 2acbfa91f1
commit 33820dd82e
2 changed files with 38 additions and 17 deletions

View file

@ -831,15 +831,24 @@ fn type_to_variable(
}
let alias_var = type_to_variable(subs, rank, pools, cached, alias_type);
let content = Content::Alias(*symbol, arg_vars, alias_var);
let result = register(subs, rank, pools, content);
// unify the actual_var with the result var
// this can be used to access the type of the actual_var
// to determine its layout later
let descriptor = subs.get(result);
subs.union(*actual_var, result, descriptor);
// subs.set_content(*actual_var, descriptor.content);
//subs.set(*actual_var, descriptor.clone());
let content = Content::Alias(*symbol, arg_vars, alias_var);
let result = register(subs, rank, pools, content);
// We only want to unify the actual_var with the alias once
// if it's already redirected (and therefore, redundant)
// don't do it again
if !subs.redundant(*actual_var) {
let descriptor = subs.get(result);
subs.union(result, *actual_var, descriptor);
}
result
}