conditionally use a DelayedAlias

This commit is contained in:
Folkert 2022-03-16 18:29:40 +01:00
parent f24bfeea99
commit 48b6cd09c7
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C

View file

@ -339,6 +339,25 @@ fn can_annotation_help(
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) =
instantiate_and_freshen_alias_type(
var_store,
@ -357,6 +376,7 @@ fn can_annotation_help(
kind: alias.kind,
}
}
}
None => Type::Apply(symbol, args, region),
}
}