diff options
| author | Ryan Scott <ryan.gl.scott@gmail.com> | 2018-07-30 08:47:39 -0400 |
|---|---|---|
| committer | Ryan Scott <ryan.gl.scott@gmail.com> | 2018-07-30 08:47:39 -0400 |
| commit | 9d388eb83e797fd28e14868009c4786f3f1a8aa6 (patch) | |
| tree | 6f0bcc4637c6b9cb565f093b43c88dede3e29acb /compiler/deSugar/Check.hs | |
| parent | 11de4380c2f16f374c6e8fbacf8dce00376e7efb (diff) | |
| download | haskell-9d388eb83e797fd28e14868009c4786f3f1a8aa6.tar.gz | |
Fix #15385 by using addDictsDs in matchGuards
Summary:
When coverage checking pattern-matches, we rely on the call
sites in the desugarer to populate the local dictionaries and term
evidence in scope using `addDictsDs` and `addTmCsDs`. But it turns
out that only the call site for desugaring `case` expressions was
actually doing this properly. In another part of the desugarer,
`matchGuards` (which handles pattern guards), it did not update the
local dictionaries in scope at all, leading to #15385.
Fixing this is relatively straightforward: just augment the
`BindStmt` case of `matchGuards` to use `addDictsDs` and `addTmCsDs`.
Accomplishing this took a little bit of import/export tweaking:
* We now need to export `collectEvVarsPat` from `HsPat.hs`.
* To avoid an import cycle with `Check.hs`, I moved `isTrueLHsExpr`
from `DsGRHSs.hs` to `DsUtils.hs`, which resides lower on the
import chain.
Test Plan: make test TEST=T15385
Reviewers: simonpj, bgamari
Reviewed By: simonpj
Subscribers: rwbarton, thomie, carter
GHC Trac Issues: #15385
Differential Revision: https://phabricator.haskell.org/D4968
Diffstat (limited to 'compiler/deSugar/Check.hs')
| -rw-r--r-- | compiler/deSugar/Check.hs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/deSugar/Check.hs b/compiler/deSugar/Check.hs index 201ed12571..8acb38b8d4 100644 --- a/compiler/deSugar/Check.hs +++ b/compiler/deSugar/Check.hs @@ -51,7 +51,7 @@ import Var (EvVar) import TyCoRep import Type import UniqSupply -import DsGRHSs (isTrueLHsExpr) +import DsUtils (isTrueLHsExpr) import Maybes (expectJust) import qualified GHC.LanguageExtensions as LangExt |
