Skip to content

Treat DataCon wrappers as conlike (fix #18012)

As described in #18012 (closed), GHC 8.10 fails to apply case-of-known-constructor when the scrutinee is a local variable bound to a saturated application of a DataCon wrapper. Previous versions of GHC did not encounter this problem because DataCon wrappers were inlined much more aggressively, but as of b78cc64e, they are not inlined until phase 0.

Fortunately, the fix is quite simple: consider DataCon wrappers to be conlike. This seems like certainly the right thing to me, since they satisfy all the criteria one would consider when writing a user-defined CONLIKE pragma. For a slightly fuller explanation, see the new Note [DataCon wrappers are conlike] in the diff.

Merge request reports