Skip to content

Treat coercions as arguments for floating and inlining (fixes #17787)

Alexis King requested to merge lexi.lambda/ghc:17787-share-gadt-closures into master

This MR makes the changes suggested by @simonpj in #17787 (closed). Specifically:

  1. It reverts the change in 8924224e and adds a Note describing the subtleties.

  2. It modifies SetLevels.notWorthFloating to allow floating out expressions applied to coercions.

It also adds a Note about STG-level coercion tokens that incorporates some of Simon’s explanations in that issue thread.

I’ve added the example from #17787 (closed) as a test case, but with 8924224e reverted, I haven’t managed to figure out how to provoke the situation that the change to notWorthFloating would address. Maybe Simon or someone else can suggest a test case for that, but if not, it doesn’t seem to affect any existing test cases, either, so it’s probably not that big a deal.

Merge request reports