mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
code gen Accessor
This commit is contained in:
parent
bb6f36ad28
commit
c8e5acf142
6 changed files with 96 additions and 27 deletions
|
@ -675,6 +675,7 @@ pub fn constrain_expr(
|
|||
)
|
||||
}
|
||||
Accessor {
|
||||
function_var,
|
||||
field,
|
||||
record_var,
|
||||
closure_var,
|
||||
|
@ -701,16 +702,19 @@ pub fn constrain_expr(
|
|||
region,
|
||||
);
|
||||
|
||||
let function_type = Type::Function(
|
||||
vec![record_type],
|
||||
Box::new(Type::Variable(*closure_var)),
|
||||
Box::new(field_type),
|
||||
);
|
||||
|
||||
exists(
|
||||
vec![*record_var, *closure_var, field_var, ext_var],
|
||||
vec![*record_var, *function_var, *closure_var, field_var, ext_var],
|
||||
And(vec![
|
||||
Eq(function_type.clone(), expected, category.clone(), region),
|
||||
Eq(
|
||||
Type::Function(
|
||||
vec![record_type],
|
||||
Box::new(Type::Variable(*closure_var)),
|
||||
Box::new(field_type),
|
||||
),
|
||||
expected,
|
||||
function_type,
|
||||
NoExpectation(Variable(*function_var)),
|
||||
category,
|
||||
region,
|
||||
),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue