mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-21 07:49:17 +03:00
Explain why opaque wrap functions need not be weakened behind lets
This commit is contained in:
parent
6dca92e420
commit
354765afca
@ -3826,9 +3826,13 @@ fn is_generalizable_expr(mut expr: &Expr) -> bool {
|
||||
Num(..) | Int(..) | Float(..) => return true,
|
||||
Closure(_) => return true,
|
||||
Accessor(_) => {
|
||||
// Accessor functions `.field` are equivalent to closures, no need to weaken them.
|
||||
// Accessor functions `.field` are equivalent to closures `\r -> r.field`, no need to weaken them.
|
||||
return true
|
||||
},
|
||||
OpaqueWrapFunction(_) => {
|
||||
// Opaque wrapper functions `@Q` are equivalent to closures `\x -> @Q x`, no need to weaken them.
|
||||
return true
|
||||
}
|
||||
OpaqueRef { argument, .. } => expr = &argument.1.value,
|
||||
Str(_) | List { .. } | SingleQuote(_, _, _, _) | When { .. } | If { .. }
|
||||
| LetRec(_, _, _)
|
||||
@ -3849,7 +3853,6 @@ fn is_generalizable_expr(mut expr: &Expr) -> bool {
|
||||
| AbilityMember(_, _, _)
|
||||
| Tag { .. }
|
||||
| ZeroArgumentTag { .. }
|
||||
| OpaqueWrapFunction(_)
|
||||
| Expect { .. }
|
||||
| ExpectFx { .. }
|
||||
| Dbg { .. }
|
||||
|
Loading…
Reference in New Issue
Block a user