Register accessor closures when they are bound

Previously we only registered record accessor closures in anonymous
contexts, where we assume they must already be specialized based on the
surrounding contexts. This is not true in general since one might bind
an accessor to a name.

Closes #2567
This commit is contained in:
ayazhafiz 2022-03-06 10:53:12 -05:00
parent d7c8c8de42
commit 3bff99b0a2
5 changed files with 154 additions and 26 deletions

View file

@ -5529,4 +5529,18 @@ mod solve_expr {
r#"a -> Effect a"#,
)
}
#[test]
fn generalized_accessor_function_applied() {
infer_eq_without_problem(
indoc!(
r#"
returnFoo = .foo
returnFoo { foo: "foo" }
"#
),
"Str",
)
}
}