diff options
author | HE, Tao <sighingnow@gmail.com> | 2018-03-02 14:16:24 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-03-02 14:52:10 -0500 |
commit | e8e9f6a7a6d857efe6e3b2aec0c4964f9a8fa09a (patch) | |
tree | 2ce712a6b9c00bf2d1e969bbb1db28a8858a14c7 /compiler/deSugar/DsGRHSs.hs | |
parent | 8c7a1551fcd004c37f4ccd99c7c10395179519f1 (diff) | |
download | haskell-e8e9f6a7a6d857efe6e3b2aec0c4964f9a8fa09a.tar.gz |
Improve exhaustive checking for guards in pattern bindings and MultiIf.
Previously we didn't do exhaustive checking on MultiIf expressions
and guards in pattern bindings.
We can construct the `LMatch` directly from GRHSs or [LHsExpr]
(MultiIf's alts) then feed it to checkMatches, without construct the
MatchGroup and using function `matchWrapper`.
Signed-off-by: HE, Tao <sighingnow@gmail.com>
Test Plan: make test TEST="T14773a T14773b"
Reviewers: bgamari, RyanGlScott, simonpj
Reviewed By: bgamari, simonpj
Subscribers: rwbarton, thomie, carter
GHC Trac Issues: #14773
Differential Revision: https://phabricator.haskell.org/D4400
Diffstat (limited to 'compiler/deSugar/DsGRHSs.hs')
-rw-r--r-- | compiler/deSugar/DsGRHSs.hs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/compiler/deSugar/DsGRHSs.hs b/compiler/deSugar/DsGRHSs.hs index d521f537e5..e4127ad97f 100644 --- a/compiler/deSugar/DsGRHSs.hs +++ b/compiler/deSugar/DsGRHSs.hs @@ -33,7 +33,7 @@ import SrcLoc import Outputable {- -@dsGuarded@ is used for both @case@ expressions and pattern bindings. +@dsGuarded@ is used for pattern bindings. It desugars: \begin{verbatim} | g1 -> e1 @@ -46,7 +46,6 @@ necessary. The type argument gives the type of the @ei@. -} dsGuarded :: GRHSs GhcTc (LHsExpr GhcTc) -> Type -> DsM CoreExpr - dsGuarded grhss rhs_ty = do match_result <- dsGRHSs PatBindRhs grhss rhs_ty error_expr <- mkErrorAppDs nON_EXHAUSTIVE_GUARDS_ERROR_ID rhs_ty empty |