diff options
Diffstat (limited to 'compiler/GHC/HsToCore/Pmc/Desugar.hs')
-rw-r--r-- | compiler/GHC/HsToCore/Pmc/Desugar.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/GHC/HsToCore/Pmc/Desugar.hs b/compiler/GHC/HsToCore/Pmc/Desugar.hs index 3b30660b90..c95ef577cc 100644 --- a/compiler/GHC/HsToCore/Pmc/Desugar.hs +++ b/compiler/GHC/HsToCore/Pmc/Desugar.hs @@ -26,6 +26,8 @@ import GHC.Hs import GHC.Tc.Utils.Zonk (shortCutLit) import GHC.Types.Id import GHC.Core.ConLike +import GHC.Core.Make (mkWildValBinder) +import GHC.Core.Utils (exprType) import GHC.Types.Name import GHC.Builtin.Types import GHC.Builtin.Names (rationalTyConName) @@ -231,7 +233,9 @@ desugarPat x pat = case pat of let tuple_con = tupleDataCon boxity (length vars) pure $ vanillaConGrd x tuple_con vars `consGrdDag` sequenceGrdDags grdss - OrPat _tys [] -> error "lol" -- pure failGrd + OrPat _tys [] -> do + let true = mkWildValBinder OneTy (exprType (Var trueDataConId)) + return $ vanillaConGrd true falseDataCon [] `consGrdDag` mkPmLetVar true trueDataConId OrPat _tys (pat:pats) -> alternativesGrdDags <$> traverse (desugarLPat x) (pat:|pats) SumPat _ty p alt arity -> do @@ -243,8 +247,6 @@ desugarPat x pat = case pat of SplicePat {} -> panic "Check.desugarPat: SplicePat" --- failGrd = mkPmLetVar trueId trueDataConId `consGrdDag` vanillaConGrd trueId falseDataCon [] - -- | 'desugarPat', but also select and return a new match var. desugarPatV :: Pat GhcTc -> DsM (Id, GrdDag) desugarPatV pat = do |