diff options
author | Daniel Rogozin <daniel.rogozin@serokell.io> | 2021-04-26 18:33:06 +0300 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-04-27 21:58:32 -0400 |
commit | 9ead1b35e193b07e82af289cc85ab4b26cf89df6 (patch) | |
tree | 44c48619a52d6250291752495df455dcdcaa5d7a /compiler/GHC/Parser/PostProcess.hs | |
parent | 484a8b2dcc84d012621bdc24da8cb68ae07b159b (diff) | |
download | haskell-9ead1b35e193b07e82af289cc85ab4b26cf89df6.tar.gz |
fix #19736
Diffstat (limited to 'compiler/GHC/Parser/PostProcess.hs')
-rw-r--r-- | compiler/GHC/Parser/PostProcess.hs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/GHC/Parser/PostProcess.hs b/compiler/GHC/Parser/PostProcess.hs index 1de9f0cd53..6411df34d9 100644 --- a/compiler/GHC/Parser/PostProcess.hs +++ b/compiler/GHC/Parser/PostProcess.hs @@ -1629,6 +1629,11 @@ instance DisambECP (HsCmd GhcPs) where cmdFail :: SrcSpan -> SDoc -> PV a cmdFail loc e = addFatalError $ PsError (PsErrParseErrorInCmd e) [] loc +checkLamMatchGroup :: SrcSpan -> MatchGroup GhcPs (LHsExpr GhcPs) -> PV () +checkLamMatchGroup l (MG { mg_alts = (L _ (matches:_))}) = do + when (null (hsLMatchPats matches)) $ addError $ PsError PsErrEmptyLambda [] l +checkLamMatchGroup _ _ = return () + instance DisambECP (HsExpr GhcPs) where type Body (HsExpr GhcPs) = HsExpr ecpFromCmd' (L l c) = do @@ -1640,7 +1645,9 @@ instance DisambECP (HsExpr GhcPs) where return $ mkRdrProjUpdate (noAnnSrcSpan l) fields arg isPun (EpAnn (spanAsAnchor l) anns cs) mkHsLamPV l mg = do cs <- getCommentsFor l - return $ L (noAnnSrcSpan l) (HsLam NoExtField (mg cs)) + let mg' = mg cs + checkLamMatchGroup l mg' + return $ L (noAnnSrcSpan l) (HsLam NoExtField mg') mkHsLetPV l bs c anns = do cs <- getCommentsFor l return $ L (noAnnSrcSpan l) (HsLet (EpAnn (spanAsAnchor l) anns cs) bs c) |