summaryrefslogtreecommitdiff
path: root/compiler/deSugar/DsMonad.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/deSugar/DsMonad.hs')
-rw-r--r--compiler/deSugar/DsMonad.hs26
1 files changed, 20 insertions, 6 deletions
diff --git a/compiler/deSugar/DsMonad.hs b/compiler/deSugar/DsMonad.hs
index 5d597912e5..7742f8cd76 100644
--- a/compiler/deSugar/DsMonad.hs
+++ b/compiler/deSugar/DsMonad.hs
@@ -66,6 +66,7 @@ import PrelNames
import RdrName
import HscTypes
import Bag
+import BasicTypes ( Origin )
import DataCon
import ConLike
import TyCon
@@ -104,14 +105,27 @@ instance Outputable DsMatchContext where
ppr (DsMatchContext hs_match ss) = ppr ss <+> pprMatchContext hs_match
data EquationInfo
- = EqnInfo { eqn_pats :: [Pat GhcTc], -- The patterns for an eqn
- -- NB: We have /already/ applied decideBangHood to
- -- these patterns. See Note [decideBangHood] in DsUtils
-
- eqn_rhs :: MatchResult } -- What to do after match
+ = EqnInfo { eqn_pats :: [Pat GhcTc]
+ -- ^ The patterns for an equation
+ --
+ -- NB: We have /already/ applied 'decideBangHood' to
+ -- these patterns. See Note [decideBangHood] in "DsUtils"
+
+ , eqn_orig :: Origin
+ -- ^ Was this equation present in the user source?
+ --
+ -- This helps us avoid warnings on patterns that GHC elaborated.
+ --
+ -- For instance, the pattern @-1 :: Word@ gets desugared into
+ -- @W# -1## :: Word@, but we shouldn't warn about an overflowed
+ -- literal for /both/ of these cases.
+
+ , eqn_rhs :: MatchResult
+ -- ^ What to do after match
+ }
instance Outputable EquationInfo where
- ppr (EqnInfo pats _) = ppr pats
+ ppr (EqnInfo pats _ _) = ppr pats
type DsWrapper = CoreExpr -> CoreExpr
idDsWrapper :: DsWrapper