Merge pull request #4304 from roc-lang/i4259

Make sure type variables bound to abilities are instantiated in aliases
This commit is contained in:
Ayaz 2022-10-14 16:07:58 -05:00 committed by GitHub
commit c1c339dbdf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 440 additions and 66 deletions

View file

@ -553,7 +553,7 @@ fn can_annotation_help(
references,
);
args.push(arg_ann);
args.push(Loc::at(arg.region, arg_ann));
}
match scope.lookup_alias(symbol) {
@ -573,8 +573,14 @@ fn can_annotation_help(
let mut type_var_to_arg = Vec::new();
for (_, arg_ann) in alias.type_variables.iter().zip(args) {
type_var_to_arg.push(arg_ann);
for (alias_arg, arg_ann) in alias.type_variables.iter().zip(args) {
type_var_to_arg.push(Loc::at(
arg_ann.region,
OptAbleType {
typ: arg_ann.value,
opt_ability: alias_arg.value.opt_bound_ability,
},
));
}
let mut lambda_set_variables =

View file

@ -829,7 +829,15 @@ fn canonicalize_opaque<'a>(
type_arguments: alias
.type_variables
.iter()
.map(|_| Type::Variable(var_store.fresh()))
.map(|alias_var| {
Loc::at(
alias_var.region,
OptAbleType {
typ: Type::Variable(var_store.fresh()),
opt_ability: alias_var.value.opt_bound_ability,
},
)
})
.collect(),
lambda_set_variables: alias
.lambda_set_variables