mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
use equal_types_with_storage in opaque type constraining
This commit is contained in:
parent
80af910c4f
commit
f7ba9918fa
1 changed files with 4 additions and 14 deletions
|
@ -999,11 +999,12 @@ pub fn constrain_expr(
|
||||||
|
|
||||||
// Link the entire wrapped opaque type (with the now-constrained argument) to the
|
// Link the entire wrapped opaque type (with the now-constrained argument) to the
|
||||||
// expected type
|
// expected type
|
||||||
let opaque_con = constraints.equal_types(
|
let opaque_con = constraints.equal_types_with_storage(
|
||||||
opaque_type,
|
opaque_type,
|
||||||
expected.clone(),
|
expected,
|
||||||
Category::OpaqueWrap(*name),
|
Category::OpaqueWrap(*name),
|
||||||
region,
|
region,
|
||||||
|
*opaque_var,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Link the entire wrapped opaque type (with the now-constrained argument) to the type
|
// Link the entire wrapped opaque type (with the now-constrained argument) to the type
|
||||||
|
@ -1016,14 +1017,6 @@ pub fn constrain_expr(
|
||||||
arg_loc_expr.region,
|
arg_loc_expr.region,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Store the entire wrapped opaque type in `opaque_var`
|
|
||||||
let storage_con = constraints.equal_types_var(
|
|
||||||
*opaque_var,
|
|
||||||
expected,
|
|
||||||
Category::Storage(std::file!(), std::line!()),
|
|
||||||
region,
|
|
||||||
);
|
|
||||||
|
|
||||||
let mut vars = vec![*arg_var, *opaque_var];
|
let mut vars = vec![*arg_var, *opaque_var];
|
||||||
// Also add the fresh variables we created for the type argument and lambda sets
|
// Also add the fresh variables we created for the type argument and lambda sets
|
||||||
vars.extend(type_arguments.iter().map(|(_, t)| {
|
vars.extend(type_arguments.iter().map(|(_, t)| {
|
||||||
|
@ -1033,10 +1026,7 @@ pub fn constrain_expr(
|
||||||
v.0.expect_variable("all lambda sets should be fresh variables here")
|
v.0.expect_variable("all lambda sets should be fresh variables here")
|
||||||
}));
|
}));
|
||||||
|
|
||||||
constraints.exists_many(
|
constraints.exists_many(vars, [arg_con, opaque_con, link_type_variables_con])
|
||||||
vars,
|
|
||||||
[arg_con, opaque_con, link_type_variables_con, storage_con],
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RunLowLevel { args, ret_var, op } => {
|
RunLowLevel { args, ret_var, op } => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue