mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 05:49:08 +00:00
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:
parent
d7c8c8de42
commit
3bff99b0a2
5 changed files with 154 additions and 26 deletions
|
@ -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",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue