mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 16:21:11 +00:00
conditionally use a DelayedAlias
This commit is contained in:
parent
f24bfeea99
commit
48b6cd09c7
1 changed files with 35 additions and 15 deletions
|
@ -339,6 +339,25 @@ fn can_annotation_help(
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For now, aliases of function types cannot be delayed.
|
||||||
|
// This is a limitation of the current implementation,
|
||||||
|
// and this totally should be possible in the future.
|
||||||
|
let is_import = !symbol.is_builtin() && (env.home != symbol.module_id());
|
||||||
|
if !is_import && alias.lambda_set_variables.is_empty() {
|
||||||
|
let mut type_var_to_arg = Vec::new();
|
||||||
|
|
||||||
|
for (loc_var, arg_ann) in alias.type_variables.iter().zip(args) {
|
||||||
|
let name = loc_var.value.0.clone();
|
||||||
|
|
||||||
|
type_var_to_arg.push((name, arg_ann));
|
||||||
|
}
|
||||||
|
|
||||||
|
Type::DelayedAlias(AliasCommon {
|
||||||
|
symbol,
|
||||||
|
type_arguments: type_var_to_arg,
|
||||||
|
lambda_set_variables: alias.lambda_set_variables.clone(),
|
||||||
|
})
|
||||||
|
} else {
|
||||||
let (type_arguments, lambda_set_variables, actual) =
|
let (type_arguments, lambda_set_variables, actual) =
|
||||||
instantiate_and_freshen_alias_type(
|
instantiate_and_freshen_alias_type(
|
||||||
var_store,
|
var_store,
|
||||||
|
@ -357,6 +376,7 @@ fn can_annotation_help(
|
||||||
kind: alias.kind,
|
kind: alias.kind,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
None => Type::Apply(symbol, args, region),
|
None => Type::Apply(symbol, args, region),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue