mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
Permit able variables in aliases, and thread them through
This commit is contained in:
parent
01af970b49
commit
2e57bf0b6a
15 changed files with 399 additions and 123 deletions
|
@ -18,7 +18,7 @@ use roc_region::all::{Loc, Region};
|
|||
use roc_types::subs::Variable;
|
||||
use roc_types::types::Type::{self, *};
|
||||
use roc_types::types::{
|
||||
AliasKind, AnnotationSource, Category, PReason, Reason, RecordField, TypeExtension,
|
||||
AliasKind, AnnotationSource, Category, OptAbleType, PReason, Reason, RecordField, TypeExtension,
|
||||
};
|
||||
|
||||
/// This is for constraining Defs
|
||||
|
@ -998,7 +998,13 @@ pub fn constrain_expr(
|
|||
|
||||
let opaque_type = Type::Alias {
|
||||
symbol: *name,
|
||||
type_arguments: type_arguments.iter().copied().map(Type::Variable).collect(),
|
||||
type_arguments: type_arguments
|
||||
.iter()
|
||||
.map(|v| OptAbleType {
|
||||
typ: Type::Variable(v.var),
|
||||
opt_ability: v.opt_ability,
|
||||
})
|
||||
.collect(),
|
||||
lambda_set_variables: lambda_set_variables.clone(),
|
||||
actual: Box::new(arg_type.clone()),
|
||||
kind: AliasKind::Opaque,
|
||||
|
@ -1035,7 +1041,7 @@ pub fn constrain_expr(
|
|||
|
||||
let mut vars = vec![*arg_var, *opaque_var];
|
||||
// Also add the fresh variables we created for the type argument and lambda sets
|
||||
vars.extend(type_arguments);
|
||||
vars.extend(type_arguments.iter().map(|v| v.var));
|
||||
vars.extend(lambda_set_variables.iter().map(|v| {
|
||||
v.0.expect_variable("all lambda sets should be fresh variables here")
|
||||
}));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue