use equal_types_with_storage in Lambda constraining

This commit is contained in:
Folkert 2022-03-13 22:47:25 +01:00
parent f23945ad94
commit 7df4465a6e
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C

View file

@ -403,14 +403,12 @@ pub fn constrain_expr(
pattern_state_constraints,
ret_constraint,
),
// "the closure's type is equal to expected type"
constraints.equal_types(function_type.clone(), expected, Category::Lambda, region),
// "fn_var is equal to the closure's type" - fn_var is used in code gen
constraints.equal_types_var(
*fn_var,
NoExpectation(function_type),
Category::Storage(std::file!(), std::line!()),
constraints.equal_types_with_storage(
function_type,
expected,
Category::Lambda,
region,
*fn_var,
),
closure_constraint,
];