Fix nasty bug in w/w for absence analysis
authorSimon Peyton Jones <simonpj@microsoft.com>
Mon, 2 Oct 2017 14:25:02 +0000 (15:25 +0100)
committerSimon Peyton Jones <simonpj@microsoft.com>
Tue, 3 Oct 2017 08:52:39 +0000 (09:52 +0100)
commitdbbee1bacef1a8accc630908c31cf267a3cb98a9
tree8ad36f1ed3b80f4bdd9a081aa6cb2fd201eb8a8e
parentb1e0c65a1302f998917e6d33d6e1ebb84cd09fa8
Fix nasty bug in w/w for absence analysis

This dark corner was exposed by Trac #14285.  It involves the
interaction between absence analysis and INLINABLE pragmas.

There is a full explanation in Note [aBSENT_ERROR_ID] in MkCore,
which you can read there.  The changes in this patch are

* Make exprIsHNF return True for absentError, treating
  absentError like an honorary data constructor.

* Make absentError /not/ be diverging, unlike other error Ids.

This is all a bit horrible.

* While doing this I found that exprOkForSpeculation didn't
  have a case for value lambdas so I added one.  It's not
  really called on lifted types much, but it seems like the
  right thing
compiler/basicTypes/MkId.hs
compiler/coreSyn/CoreUtils.hs
compiler/coreSyn/MkCore.hs
compiler/simplCore/Simplify.hs
compiler/stranal/WwLib.hs
testsuite/tests/stranal/should_run/T14285.hs [new file with mode: 0644]
testsuite/tests/stranal/should_run/T14285.stdout [new file with mode: 0644]
testsuite/tests/stranal/should_run/T14285a.hs [new file with mode: 0644]
testsuite/tests/stranal/should_run/all.T