mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 19:58:18 +00:00
Don't weaken accessor functions
Accessor functions are equivalent to closures and hence obey function semantics, no need to weaken them
This commit is contained in:
parent
0a9155d9d8
commit
2e36e2f418
1 changed files with 4 additions and 1 deletions
|
@ -3825,6 +3825,10 @@ fn is_generalizable_expr(mut expr: &Expr) -> bool {
|
|||
match expr {
|
||||
Num(..) | Int(..) | Float(..) => return true,
|
||||
Closure(_) => return true,
|
||||
Accessor(_) => {
|
||||
// Accessor functions `.field` are equivalent to closures, no need to weaken them.
|
||||
return true
|
||||
},
|
||||
OpaqueRef { argument, .. } => expr = &argument.1.value,
|
||||
Str(_) | List { .. } | SingleQuote(_, _, _, _) | When { .. } | If { .. }
|
||||
| LetRec(_, _, _)
|
||||
|
@ -3842,7 +3846,6 @@ fn is_generalizable_expr(mut expr: &Expr) -> bool {
|
|||
// TODO(weakening)
|
||||
Var(_, _)
|
||||
| AbilityMember(_, _, _)
|
||||
| Accessor(_)
|
||||
| Update { .. }
|
||||
| Tag { .. }
|
||||
| ZeroArgumentTag { .. }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue