mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
prevent frequent expectation cloning
This commit is contained in:
parent
dc8a077fff
commit
6392e42166
1 changed files with 10 additions and 3 deletions
|
@ -1363,7 +1363,7 @@ fn constrain_def(
|
|||
|
||||
def_pattern_state.constraints.push(constraints.equal_types(
|
||||
expr_type,
|
||||
annotation_expected.clone(),
|
||||
annotation_expected,
|
||||
Category::Storage(std::file!(), std::line!()),
|
||||
Region::span_across(&annotation.region, &def.loc_expr.region),
|
||||
));
|
||||
|
@ -1528,14 +1528,21 @@ fn constrain_def(
|
|||
}
|
||||
|
||||
_ => {
|
||||
let expected = annotation_expected;
|
||||
let annotation_expected = FromAnnotation(
|
||||
def.loc_pattern.clone(),
|
||||
arity,
|
||||
AnnotationSource::TypedBody {
|
||||
region: annotation.region,
|
||||
},
|
||||
signature.clone(),
|
||||
);
|
||||
|
||||
let ret_constraint = constrain_expr(
|
||||
constraints,
|
||||
env,
|
||||
def.loc_expr.region,
|
||||
&def.loc_expr.value,
|
||||
expected,
|
||||
annotation_expected,
|
||||
);
|
||||
|
||||
let cons = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue