[Git][ghc/ghc][wip/T18341] 2 commits: PmCheck: Big refactor using guard tree variants more closely following source syntax (#18565)

Sebastian Graf gitlab at gitlab.haskell.org
Mon Aug 31 17:01:36 UTC 2020



Sebastian Graf pushed to branch wip/T18341 at Glasgow Haskell Compiler / GHC


Commits:
fc8ab7c9 by Sebastian Graf at 2020-08-31T14:57:03+02:00
PmCheck: Big refactor using guard tree variants more closely following source syntax (#18565)

Previously, we desugared and coverage checked plain guard trees as
described in Lower Your Guards. That caused (in !3849) quite a bit of
pain when we need to partially recover tree structure of the input
syntax to return covered sets for long-distance information, for
example.

In this refactor, I introduced a guard tree variant for each relevant
source syntax component of a pattern-match (mainly match groups, match,
GRHS, empty case, pattern binding). I made sure to share as much
coverage checking code as possible, so that the syntax-specific checking
functions are just wrappers around the more substantial checking
functions for the LYG primitives (`checkSequence`, `checkGrds`).

The refactoring payed off in clearer code and elimination of all panics
related to assumed guard tree structure and thus fixes #18565.

I also took the liberty to rename and re-arrange the order of functions
and comments in the module, deleted some dead and irrelevant Notes,
wrote some new ones and gave an overview module haddock.

- - - - -
b047af87 by Sebastian Graf at 2020-08-31T19:01:02+02:00
PmCheck: Handle ⊥ and strict fields correctly (#18341)

In #18341, we discovered an incorrect digression from Lower Your Guards.
This MR changes what's necessary to support properly fixing #18341.

In particular, bottomness constraints are now properly tracked in the
oracle/inhabitation testing, as an additional field
`vi_bot :: Maybe Bool` in `VarInfo`. That in turn allows us to
model newtypes as advertised in the Appendix of LYG and fix #17725.

For some reason I couldn't follow, this also fixes #18273.

I also added a couple of regression tests that were missing. Most of
them were already fixed before.

In summary, this patch fixes #18341, #17725, #18273.

- - - - -


10 changed files:

- .gitignore
- compiler/GHC/Core/DataCon.hs
- compiler/GHC/Data/Bag.hs
- compiler/GHC/Data/OrdList.hs
- compiler/GHC/HsToCore/Binds.hs
- compiler/GHC/HsToCore/Expr.hs
- compiler/GHC/HsToCore/GuardedRHSs.hs
- compiler/GHC/HsToCore/Match.hs
- compiler/GHC/HsToCore/Monad.hs
- compiler/GHC/HsToCore/PmCheck.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d399d072b03a8bb5055d194983b83fdfdf3adf9b...b047af87d47c50091f664b6c133a38e8aa4c0bdb

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d399d072b03a8bb5055d194983b83fdfdf3adf9b...b047af87d47c50091f664b6c133a38e8aa4c0bdb
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200831/27c7ee13/attachment.html>


More information about the ghc-commits mailing list