diff options
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/deSugar/DsExpr.hs | 9 | ||||
-rw-r--r-- | compiler/deSugar/MatchLit.hs | 5 |
2 files changed, 12 insertions, 2 deletions
diff --git a/compiler/deSugar/DsExpr.hs b/compiler/deSugar/DsExpr.hs index 28254c93b4..faf562e428 100644 --- a/compiler/deSugar/DsExpr.hs +++ b/compiler/deSugar/DsExpr.hs @@ -271,6 +271,15 @@ dsExpr (HsWrap co_fn e) ; warnAboutIdentities dflags e' (exprType wrapped_e) ; return wrapped_e } +dsExpr (NegApp (L loc (HsOverLit lit@(OverLit { ol_val = HsIntegral src i }))) + neg_expr) + = do { expr' <- putSrcSpanDs loc $ do + { dflags <- getDynFlags + ; warnAboutOverflowedLiterals dflags + (lit { ol_val = HsIntegral src (-i) }) + ; dsOverLit' dflags lit } + ; dsSyntaxExpr neg_expr [expr'] } + dsExpr (NegApp expr neg_expr) = do { expr' <- dsLExpr expr ; dsSyntaxExpr neg_expr [expr'] } diff --git a/compiler/deSugar/MatchLit.hs b/compiler/deSugar/MatchLit.hs index 2e9a5235bf..6ed34f42db 100644 --- a/compiler/deSugar/MatchLit.hs +++ b/compiler/deSugar/MatchLit.hs @@ -8,10 +8,11 @@ Pattern-matching literal patterns {-# LANGUAGE CPP, ScopedTypeVariables #-} -module MatchLit ( dsLit, dsOverLit, hsLitKey +module MatchLit ( dsLit, dsOverLit, dsOverLit', hsLitKey , tidyLitPat, tidyNPat , matchLiterals, matchNPlusKPats, matchNPats - , warnAboutIdentities, warnAboutEmptyEnumerations + , warnAboutIdentities, warnAboutOverflowedLiterals + , warnAboutEmptyEnumerations ) where #include "HsVersions.h" |