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/hsSyn | |
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/hsSyn')
-rw-r--r-- | compiler/hsSyn/HsPat.hs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/hsSyn/HsPat.hs b/compiler/hsSyn/HsPat.hs index faefb84203..6f65487411 100644 --- a/compiler/hsSyn/HsPat.hs +++ b/compiler/hsSyn/HsPat.hs @@ -34,7 +34,7 @@ module HsPat ( patNeedsParens, parenthesizePat, isIrrefutableHsPat, - collectEvVarsPats, + collectEvVarsPat, collectEvVarsPats, pprParendLPat, pprConArgs ) where |