Simon Peyton Jones pushed to branch wip/T26831 at Glasgow Haskell Compiler / GHC
Commits:
-
c49c255a
by Simon Peyton Jones at 2026-02-13T11:03:20+00:00
1 changed file:
Changes:
| ... | ... | @@ -1584,8 +1584,11 @@ eta_would_wreck_join _ = False |
| 1584 | 1584 | maybeSaturate :: Id -> CpeApp -> Int -> [CoreTickish] -> UniqSM CpeRhs
|
| 1585 | 1585 | maybeSaturate fn expr n_args unsat_ticks
|
| 1586 | 1586 | | isJoinId fn -- Never eta-expand a call to a join point
|
| 1587 | + -- See Note [Do not eta-expand join points]
|
|
| 1587 | 1588 | = return expr
|
| 1588 | - | hasNoBinding fn || excess_arity > 0
|
|
| 1589 | + | hasNoBinding fn || (n_args > 0 && excess_arity > 0)
|
|
| 1590 | + -- n_args > 0: do not eta-expand a naked variable!
|
|
| 1591 | + -- excess_arity > 0: eta-expansion would be a no-op
|
|
| 1589 | 1592 | = return $ wrapLamBody (mkTicks unsat_ticks) sat_expr
|
| 1590 | 1593 | | otherwise
|
| 1591 | 1594 | = return expr
|