Deal with noSpec in coreExprToPmLit

Tickets: #25926 (closed) #27124 (closed)

This MR makes two separate changes relating to GHC.HsToCore.Pmc.Solver.Types.coreExprAsPmLit:

  1. Commit 7124e4ad mistakenly marked deferred errors as non-canonical, which led to the introduction of nospec wrappers in the generated Core. This reverts that accident by declaring deferred errors as being canonical, avoiding spurious nospec wrapping.
  2. Look through magic identity-like Ids such as nospec, inline and lazy in coreExprAsPmLit, just like Core Prep does. There might genuinely be incoherent evidence, but that shouldn't obstruct the pattern match checker.

Only the change in (1) is strictly required to fix the reported bugs, but implementing (2) prevents similar bugs from occurring (see test case T27124a).

Edited by sheaf

Merge request reports

Loading