summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Graf <sebastian.graf@kit.edu>2021-11-10 12:54:59 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-11-17 05:11:38 -0500
commit29086749b8d6bec162414fbec8921df0382d0627 (patch)
treeb21134cf637ad64032dc41f3578dc1ba3c783086
parent4cec6cf284d65449bbdaf015fadd7768770ec52b (diff)
downloadhaskell-29086749b8d6bec162414fbec8921df0382d0627.tar.gz
Pmc: Don't case split on wildcard matches (#20642)
Since 8.10, when formatting a pattern match warning, we'd case split on a wildcard match such as ```hs foo :: [a] -> [a] foo [] = [] foo xs = ys where (_, ys@(_:_)) = splitAt 0 xs -- Pattern match(es) are non-exhaustive -- In a pattern binding: -- Patterns not matched: -- ([], []) -- ((_:_), []) ``` But that's quite verbose and distracts from which part of the pattern was actually the inexhaustive one. We'd prefer a wildcard for the first pair component here, like it used to be in GHC 8.8. On the other hand, case splitting is pretty handy for `-XEmptyCase` to know the different constructors we could've matched on: ```hs f :: Bool -> () f x = case x of {} -- Pattern match(es) are non-exhaustive -- In a pattern binding: -- Patterns not matched: -- False -- True ``` The solution is to communicate that we want a top-level case split to `generateInhabitingPatterns` for `-XEmptyCase`, which is exactly what this patch arranges. Details in `Note [Case split inhabiting patterns]`. Fixes #20642.
-rw-r--r--compiler/GHC/HsToCore/Pmc.hs60
-rw-r--r--compiler/GHC/HsToCore/Pmc/Solver.hs93
-rw-r--r--testsuite/tests/dependent/should_compile/KindEqualities.stderr6
-rw-r--r--testsuite/tests/pmcheck/complete_sigs/T18960b.stderr8
-rw-r--r--testsuite/tests/pmcheck/complete_sigs/completesig06.stderr14
-rw-r--r--testsuite/tests/pmcheck/should_compile/EmptyCase001.stderr6
-rw-r--r--testsuite/tests/pmcheck/should_compile/EmptyCase002.stderr10
-rw-r--r--testsuite/tests/pmcheck/should_compile/EmptyCase004.stderr14
-rw-r--r--testsuite/tests/pmcheck/should_compile/EmptyCase005.stderr12
-rw-r--r--testsuite/tests/pmcheck/should_compile/EmptyCase006.stderr4
-rw-r--r--testsuite/tests/pmcheck/should_compile/EmptyCase007.stderr12
-rw-r--r--testsuite/tests/pmcheck/should_compile/EmptyCase008.stderr8
-rw-r--r--testsuite/tests/pmcheck/should_compile/EmptyCase009.stderr6
-rw-r--r--testsuite/tests/pmcheck/should_compile/EmptyCase010.stderr16
-rw-r--r--testsuite/tests/pmcheck/should_compile/T10746.stderr2
-rw-r--r--testsuite/tests/pmcheck/should_compile/T11336b.stderr3
-rw-r--r--testsuite/tests/pmcheck/should_compile/T11822.stderr20
-rw-r--r--testsuite/tests/pmcheck/should_compile/T15305.stderr2
-rw-r--r--testsuite/tests/pmcheck/should_compile/T15450.stderr4
-rw-r--r--testsuite/tests/pmcheck/should_compile/T17977.stderr11
-rw-r--r--testsuite/tests/pmcheck/should_compile/T18610.stderr2
-rw-r--r--testsuite/tests/pmcheck/should_compile/T18932.stderr13
-rw-r--r--testsuite/tests/pmcheck/should_compile/T20642.hs18
-rw-r--r--testsuite/tests/pmcheck/should_compile/T20642.stderr17
-rw-r--r--testsuite/tests/pmcheck/should_compile/T2204.stderr8
-rw-r--r--testsuite/tests/pmcheck/should_compile/T9951b.stderr6
-rw-r--r--testsuite/tests/pmcheck/should_compile/TooManyDeltas.stderr7
-rw-r--r--testsuite/tests/pmcheck/should_compile/all.T2
-rw-r--r--testsuite/tests/pmcheck/should_compile/pmc001.stderr4
-rw-r--r--testsuite/tests/pmcheck/should_compile/pmc007.stderr14
-rw-r--r--testsuite/tests/pmcheck/should_compile/pmc009.stderr3
-rw-r--r--testsuite/tests/th/T19709c.stderr4
-rw-r--r--testsuite/tests/th/T19709d.stderr4
33 files changed, 251 insertions, 162 deletions
diff --git a/compiler/GHC/HsToCore/Pmc.hs b/compiler/GHC/HsToCore/Pmc.hs
index ab6479f75b..0de7ab0a15 100644
--- a/compiler/GHC/HsToCore/Pmc.hs
+++ b/compiler/GHC/HsToCore/Pmc.hs
@@ -1,7 +1,8 @@
-{-# LANGUAGE FlexibleInstances #-}
-{-# LANGUAGE GADTs #-}
-{-# LANGUAGE LambdaCase #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GADTs #-}
+{-# LANGUAGE LambdaCase #-}
+{-# LANGUAGE StandaloneDeriving #-}
-- | This module coverage checks pattern matches. It finds
--
@@ -105,7 +106,7 @@ pmcPatBind ctxt@(DsMatchContext PatBindRhs loc) var p = do
tracePm "pmcPatBind {" (vcat [ppr ctxt, ppr var, ppr p, ppr pat_bind, ppr missing])
result <- unCA (checkPatBind pat_bind) missing
tracePm "}: " (ppr (cr_uncov result))
- formatReportWarnings cirbsPatBind ctxt [var] result
+ formatReportWarnings ReportPatBind ctxt [var] result
pmcPatBind _ _ _ = pure ()
-- | Exhaustive for guard matches, is used for guards in pattern bindings and
@@ -126,7 +127,7 @@ pmcGRHSs hs_ctxt guards@(GRHSs _ grhss _) = do
(pprGRHSs hs_ctxt guards $$ ppr missing))
result <- unCA (checkGRHSs matches) missing
tracePm "}: " (ppr (cr_uncov result))
- formatReportWarnings cirbsGRHSs ctxt [] result
+ formatReportWarnings ReportGRHSs ctxt [] result
return (ldiGRHSs (cr_ret result))
-- | Check a list of syntactic 'Match'es (part of case, functions, etc.), each
@@ -166,7 +167,7 @@ pmcMatches ctxt vars matches = {-# SCC "pmcMatches" #-} do
empty_case <- noCheckDs $ desugarEmptyCase var
result <- unCA (checkEmptyCase empty_case) missing
tracePm "}: " (ppr (cr_uncov result))
- formatReportWarnings cirbsEmptyCase ctxt vars result
+ formatReportWarnings ReportEmptyCase ctxt vars result
return []
Just matches -> do
matches <- {-# SCC "desugarMatches" #-}
@@ -174,7 +175,7 @@ pmcMatches ctxt vars matches = {-# SCC "pmcMatches" #-} do
result <- {-# SCC "checkMatchGroup" #-}
unCA (checkMatchGroup matches) missing
tracePm "}: " (ppr (cr_uncov result))
- {-# SCC "formatReportWarnings" #-} formatReportWarnings cirbsMatchGroup ctxt vars result
+ {-# SCC "formatReportWarnings" #-} formatReportWarnings ReportMatchGroup ctxt vars result
return (NE.toList (ldiMatchGroup (cr_ret result)))
{- Note [pmcPatBind only checks PatBindRhs]
@@ -317,25 +318,45 @@ We detect an inaccessible RHS simply by pretending it's redundant, until we see
-- * Formatting and reporting warnings
--
--- | Given a function that collects 'CIRB's, this function will emit warnings
+-- | A datatype to accomodate the different call sites of
+-- 'formatReportWarnings'. Used for extracting 'CIRB's from a concrete 'ann'
+-- through 'collectInMode'. Since this is only possible for a couple of
+-- well-known 'ann's, this is a GADT.
+data FormatReportWarningsMode ann where
+ ReportPatBind :: FormatReportWarningsMode (PmPatBind Post)
+ ReportGRHSs :: FormatReportWarningsMode (PmGRHSs Post)
+ ReportMatchGroup:: FormatReportWarningsMode (PmMatchGroup Post)
+ ReportEmptyCase:: FormatReportWarningsMode PmEmptyCase
+
+deriving instance Eq (FormatReportWarningsMode ann)
+
+-- | A function collecting 'CIRB's for each of the different
+-- 'FormatReportWarningsMode's.
+collectInMode :: FormatReportWarningsMode ann -> ann -> DsM CIRB
+collectInMode ReportPatBind = cirbsPatBind
+collectInMode ReportGRHSs = cirbsGRHSs
+collectInMode ReportMatchGroup = cirbsMatchGroup
+collectInMode ReportEmptyCase = cirbsEmptyCase
+
+-- | Given a 'FormatReportWarningsMode', this function will emit warnings
-- for a 'CheckResult'.
-formatReportWarnings :: (ann -> DsM CIRB) -> DsMatchContext -> [Id] -> CheckResult ann -> DsM ()
-formatReportWarnings collect ctx vars cr@CheckResult { cr_ret = ann } = do
- cov_info <- collect ann
+formatReportWarnings :: FormatReportWarningsMode ann -> DsMatchContext -> [Id] -> CheckResult ann -> DsM ()
+formatReportWarnings report_mode ctx vars cr@CheckResult { cr_ret = ann } = do
+ cov_info <- collectInMode report_mode ann
dflags <- getDynFlags
- reportWarnings dflags ctx vars cr{cr_ret=cov_info}
+ reportWarnings dflags report_mode ctx vars cr{cr_ret=cov_info}
-- | Issue all the warnings
-- (redundancy, inaccessibility, exhaustiveness, redundant bangs).
-reportWarnings :: DynFlags -> DsMatchContext -> [Id] -> CheckResult CIRB -> DsM ()
-reportWarnings dflags (DsMatchContext kind loc) vars
+reportWarnings :: DynFlags -> FormatReportWarningsMode ann -> DsMatchContext -> [Id] -> CheckResult CIRB -> DsM ()
+reportWarnings dflags report_mode (DsMatchContext kind loc) vars
CheckResult { cr_ret = CIRB { cirb_inacc = inaccessible_rhss
, cirb_red = redundant_rhss
, cirb_bangs = redundant_bangs }
, cr_uncov = uncovered
, cr_approx = precision }
= when (flag_i || flag_u || flag_b) $ do
- unc_examples <- getNFirstUncovered vars (maxPatterns + 1) uncovered
+ unc_examples <- getNFirstUncovered gen_mode vars (maxPatterns + 1) uncovered
let exists_r = flag_i && notNull redundant_rhss
exists_i = flag_i && notNull inaccessible_rhss
exists_u = flag_u && notNull unc_examples
@@ -360,16 +381,19 @@ reportWarnings dflags (DsMatchContext kind loc) vars
flag_u = exhaustive dflags kind
flag_b = redundantBang dflags
check_type = ExhaustivityCheckType (exhaustiveWarningFlag kind)
+ gen_mode = case report_mode of -- See Note [Case split inhabiting patterns]
+ ReportEmptyCase -> CaseSplitTopLevel
+ _ -> MinimalCover
maxPatterns = maxUncoveredPatterns dflags
-getNFirstUncovered :: [Id] -> Int -> Nablas -> DsM [Nabla]
-getNFirstUncovered vars n (MkNablas nablas) = go n (bagToList nablas)
+getNFirstUncovered :: GenerateInhabitingPatternsMode -> [Id] -> Int -> Nablas -> DsM [Nabla]
+getNFirstUncovered mode vars n (MkNablas nablas) = go n (bagToList nablas)
where
go 0 _ = pure []
go _ [] = pure []
go n (nabla:nablas) = do
- front <- generateInhabitingPatterns vars n nabla
+ front <- generateInhabitingPatterns mode vars n nabla
back <- go (n - length front) nablas
pure (front ++ back)
diff --git a/compiler/GHC/HsToCore/Pmc/Solver.hs b/compiler/GHC/HsToCore/Pmc/Solver.hs
index 41d6eb5ea2..7623c6e710 100644
--- a/compiler/GHC/HsToCore/Pmc/Solver.hs
+++ b/compiler/GHC/HsToCore/Pmc/Solver.hs
@@ -29,7 +29,7 @@ module GHC.HsToCore.Pmc.Solver (
addPhiCtsNablas,
isInhabited,
- generateInhabitingPatterns
+ generateInhabitingPatterns, GenerateInhabitingPatternsMode(..)
) where
@@ -1790,36 +1790,51 @@ compatible.
-- This is important for warnings. Roughly corresponds to G in Figure 6 of the
-- LYG paper, with a few tweaks for better warning messages.
+-- | See Note [Case split inhabiting patterns]
+data GenerateInhabitingPatternsMode
+ = CaseSplitTopLevel
+ | MinimalCover
+ deriving (Eq, Show)
+
+instance Outputable GenerateInhabitingPatternsMode where
+ ppr = text . show
+
-- | @generateInhabitingPatterns vs n nabla@ returns a list of at most @n@ (but
-- perhaps empty) refinements of @nabla@ that represent inhabited patterns.
-- Negative information is only retained if literals are involved or for
-- recursive GADTs.
-generateInhabitingPatterns :: [Id] -> Int -> Nabla -> DsM [Nabla]
+generateInhabitingPatterns :: GenerateInhabitingPatternsMode -> [Id] -> Int -> Nabla -> DsM [Nabla]
-- See Note [Why inhabitationTest doesn't call generateInhabitingPatterns]
-generateInhabitingPatterns _ 0 _ = pure []
-generateInhabitingPatterns [] _ nabla = pure [nabla]
-generateInhabitingPatterns (x:xs) n nabla = do
- tracePm "generateInhabitingPatterns" (ppr n <+> ppr (x:xs) $$ ppr nabla)
+generateInhabitingPatterns _ _ 0 _ = pure []
+generateInhabitingPatterns _ [] _ nabla = pure [nabla]
+generateInhabitingPatterns mode (x:xs) n nabla = do
+ tracePm "generateInhabitingPatterns" (ppr mode <+> ppr n <+> ppr (x:xs) $$ ppr nabla)
let VI _ pos neg _ _ = lookupVarInfo (nabla_tm_st nabla) x
case pos of
_:_ -> do
- -- All solutions must be valid at once. Try to find candidates for their
- -- fields. Example:
- -- f x@(Just _) True = case x of SomePatSyn _ -> ()
- -- after this clause, we want to report that
- -- * @f Nothing _@ is uncovered
- -- * @f x False@ is uncovered
- -- where @x@ will have two possibly compatible solutions, @Just y@ for
- -- some @y@ and @SomePatSyn z@ for some @z@. We must find evidence for @y@
- -- and @z@ that is valid at the same time. These constitute arg_vas below.
+ -- Example for multiple solutions (must involve a PatSyn):
+ -- f x@(Just _) True | SomePatSyn _ <- x = ...
+ -- within the RHS, we know that
+ -- * @x ~ Just y@ for some @y@
+ -- * @x ~ SomePatSyn z@ for some @z@
+ -- and both conditions have to hold /at the same time/. Hence we must
+ -- find evidence for @y@ and @z@ that is valid at the same time. These
+ -- constitute arg_vas below.
let arg_vas = concatMap paca_ids pos
- generateInhabitingPatterns (arg_vas ++ xs) n nabla
+ generateInhabitingPatterns mode (arg_vas ++ xs) n nabla
[]
-- When there are literals involved, just print negative info
-- instead of listing missed constructors
| notNull [ l | PmAltLit l <- pmAltConSetElems neg ]
- -> generateInhabitingPatterns xs n nabla
- [] -> try_instantiate x xs n nabla
+ -> generateInhabitingPatterns mode xs n nabla
+ -- When some constructors are impossible or when we don't care for a
+ -- minimal cover (Note [Case split inhabiting patterns]), do a case split.
+ | not (isEmptyPmAltConSet neg) || mode == CaseSplitTopLevel
+ -> try_instantiate x xs n nabla
+ -- Else don't do a case split on this var, just print a wildcard.
+ -- But try splitting for the remaining vars, of course
+ | otherwise
+ -> generateInhabitingPatterns mode xs n nabla
where
-- | Tries to instantiate a variable by possibly following the chain of
-- newtypes and then instantiating to all ConLikes of the wrapped type's
@@ -1843,14 +1858,14 @@ generateInhabitingPatterns (x:xs) n nabla = do
case NE.nonEmpty (uniqDSetToList . cmConLikes <$> clss) of
Nothing ->
-- No COMPLETE sets ==> inhabited
- generateInhabitingPatterns xs n newty_nabla
+ generateInhabitingPatterns mode xs n newty_nabla
Just clss -> do
-- Try each COMPLETE set, pick the one with the smallest number of
-- inhabitants
nablass' <- forM clss (instantiate_cons y rep_ty xs n newty_nabla)
let nablas' = minimumBy (comparing length) nablass'
if null nablas' && vi_bot vi /= IsNotBot
- then generateInhabitingPatterns xs n newty_nabla -- bot is still possible. Display a wildcard!
+ then generateInhabitingPatterns mode xs n newty_nabla -- bot is still possible. Display a wildcard!
else pure nablas'
-- | Instantiates a chain of newtypes, beginning at @x@.
@@ -1871,7 +1886,7 @@ generateInhabitingPatterns (x:xs) n nabla = do
instantiate_cons _ ty xs n nabla _
-- We don't want to expose users to GHC-specific constructors for Int etc.
| fmap (isTyConTriviallyInhabited . fst) (splitTyConApp_maybe ty) == Just True
- = generateInhabitingPatterns xs n nabla
+ = generateInhabitingPatterns mode xs n nabla
instantiate_cons x ty xs n nabla (cl:cls) = do
-- The following line is where we call out to the inhabitationTest!
mb_nabla <- runMaybeT $ instCon 4 nabla x cl
@@ -1886,7 +1901,7 @@ generateInhabitingPatterns (x:xs) n nabla = do
-- NB: We don't prepend arg_vars as we don't have any evidence on
-- them and we only want to split once on a data type. They are
-- inhabited, otherwise the inhabitation test would have refuted.
- Just nabla' -> generateInhabitingPatterns xs n nabla'
+ Just nabla' -> generateInhabitingPatterns mode xs n nabla'
other_cons_nablas <- instantiate_cons x ty xs (n - length con_nablas) nabla cls
pure (con_nablas ++ other_cons_nablas)
@@ -1912,7 +1927,7 @@ pickApplicableCompleteSets ty_st ty rcm = do
return applicable_cms
{- Note [Why inhabitationTest doesn't call generateInhabitingPatterns]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Why can't we define `inhabitationTest` (IT) in terms of
`generateInhabitingPatterns` (GIP) as
@@ -1932,4 +1947,36 @@ efficient IT on huge enumerations.
But we still need GIP to produce the Nablas as proxies for
uncovered patterns that we display warnings for. It's fine to pay this price
once at the end, but IT is called far more often than that.
+
+Note [Case split inhabiting patterns]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+When we have an -XEmptyCase,
+```hs
+f :: Maybe a -> ()
+f x = case x of {}
+```
+we want to show the different missing patterns {'Just _', 'Nothing'} to the user
+instead of an uninformative wildcard pattern '_'.
+
+But when we have a match as part of a function definition, such as
+```hs
+g :: (Bool, [a]) -> ()
+g (_, []) = ()
+```
+we established in #20642 that we *do not* want to report P1={'(False, (_:_))',
+'(True, (_:_))'} when we could just give the singleton set P2={'(_, (_:_))'}!
+The latter set M is a "minimal cover" of the space of missing patterns S, in
+that
+
+1. The union of M is *exactly* S
+2. The size of M is minimal under all such candidates.
+
+In terms of 'g', P2 satisfies both (1) and (2). While P1 satisfies (1), it does
+not satisfy (2). The set {'_'} satisfies (2), but it does not satisfy (1) as
+it also covers the pattern '(_,[])' which is not part of the space of missing
+patterns of 'g', so it would be a bad (too conservative) suggestion.
+
+Note that for -XEmptyCase, we don't want to emit a minimal cover. We arrange
+that by passing 'CaseSplitTopLevel' to 'generateInhabitingPatterns'. We detect
+the -XEmptyCase case in 'reportWarnings' by looking for 'ReportEmptyCase'.
-}
diff --git a/testsuite/tests/dependent/should_compile/KindEqualities.stderr b/testsuite/tests/dependent/should_compile/KindEqualities.stderr
index 2155dea765..c6987e29f3 100644
--- a/testsuite/tests/dependent/should_compile/KindEqualities.stderr
+++ b/testsuite/tests/dependent/should_compile/KindEqualities.stderr
@@ -2,8 +2,4 @@
KindEqualities.hs:25:1: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In an equation for ‘zero’:
- Patterns of type ‘TyRep a’ not matched:
- TyApp (TyApp _ _) TyInt
- TyApp (TyApp _ _) TyBool
- TyApp (TyApp _ _) TyMaybe
- TyApp (TyApp _ _) (TyApp _ _)
+ Patterns of type ‘TyRep a’ not matched: TyApp (TyApp _ _) _
diff --git a/testsuite/tests/pmcheck/complete_sigs/T18960b.stderr b/testsuite/tests/pmcheck/complete_sigs/T18960b.stderr
index fd27f0853e..6148f75a07 100644
--- a/testsuite/tests/pmcheck/complete_sigs/T18960b.stderr
+++ b/testsuite/tests/pmcheck/complete_sigs/T18960b.stderr
@@ -5,8 +5,8 @@ T18960b.hs:11:7: warning: [-Wincomplete-patterns (in -Wextra)]
Patterns of type ‘((), String)’ not matched:
(_, _)
P ((), [])
- P ((), [p]) where p is not one of {'h'}
- P ((), (p:_:_)) where p is not one of {'h'}
+ P ((), (p:_)) where p is not one of {'h'}
+ P ((), ['h'])
...
T18960b.hs:18:7: warning: [-Wincomplete-patterns (in -Wextra)]
@@ -15,6 +15,6 @@ T18960b.hs:18:7: warning: [-Wincomplete-patterns (in -Wextra)]
Patterns of type ‘((), String)’ not matched:
(_, _)
P ((), [])
- P ((), [p]) where p is not one of {'h'}
- P ((), (p:_:_)) where p is not one of {'h'}
+ P ((), (p:_)) where p is not one of {'h'}
+ P ((), ['h'])
...
diff --git a/testsuite/tests/pmcheck/complete_sigs/completesig06.stderr b/testsuite/tests/pmcheck/complete_sigs/completesig06.stderr
index b993966789..2d58080949 100644
--- a/testsuite/tests/pmcheck/complete_sigs/completesig06.stderr
+++ b/testsuite/tests/pmcheck/complete_sigs/completesig06.stderr
@@ -1,29 +1,29 @@
completesig06.hs:13:1: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
- In an equation for ‘m1’: Patterns of type ‘T’ not matched: B
+ In an equation for ‘m1’: Patterns of type ‘T’ not matched: B
completesig06.hs:16:1: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
- In an equation for ‘m2’: Patterns of type ‘T’ not matched: A
+ In an equation for ‘m2’: Patterns of type ‘T’ not matched: A
completesig06.hs:20:1: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In an equation for ‘m3’:
- Patterns of type ‘T’ not matched:
+ Patterns of type ‘T’ not matched:
A
B
completesig06.hs:23:1: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In an equation for ‘m4’:
- Patterns of type ‘T’, ‘S’ not matched:
+ Patterns of type ‘T’, ‘S’ not matched:
A D
B D
completesig06.hs:29:1: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In an equation for ‘m5’:
- Patterns of type ‘T’, ‘S’ not matched:
- A D
- B D
+ Patterns of type ‘T’, ‘S’ not matched:
+ A _
+ B _
diff --git a/testsuite/tests/pmcheck/should_compile/EmptyCase001.stderr b/testsuite/tests/pmcheck/should_compile/EmptyCase001.stderr
index e3794c0405..cd00f26f8b 100644
--- a/testsuite/tests/pmcheck/should_compile/EmptyCase001.stderr
+++ b/testsuite/tests/pmcheck/should_compile/EmptyCase001.stderr
@@ -1,15 +1,15 @@
EmptyCase001.hs:9:6: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
- In a case alternative: Patterns of type ‘Int’ not matched: _
+ In a case alternative: Patterns of type ‘Int’ not matched: _
EmptyCase001.hs:14:8: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘String’ not matched:
+ Patterns of type ‘String’ not matched:
[]
(_:_)
EmptyCase001.hs:18:8: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
- In a case alternative: Patterns of type ‘Char’ not matched: _
+ In a case alternative: Patterns of type ‘Char’ not matched: _
diff --git a/testsuite/tests/pmcheck/should_compile/EmptyCase002.stderr b/testsuite/tests/pmcheck/should_compile/EmptyCase002.stderr
index af9411c6a3..691c62b79d 100644
--- a/testsuite/tests/pmcheck/should_compile/EmptyCase002.stderr
+++ b/testsuite/tests/pmcheck/should_compile/EmptyCase002.stderr
@@ -1,25 +1,25 @@
EmptyCase002.hs:16:6: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
- In a case alternative: Patterns of type ‘T’ not matched: MkT _
+ In a case alternative: Patterns of type ‘T’ not matched: MkT _
EmptyCase002.hs:43:6: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘T1 B’ not matched:
+ Patterns of type ‘T1 B’ not matched:
MkT1 B1
MkT1 B2
EmptyCase002.hs:47:6: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘T1 (E Int)’ not matched:
+ Patterns of type ‘T1 (E Int)’ not matched:
MkT1 False
MkT1 True
EmptyCase002.hs:51:6: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘T1
- (T2 (T1 (D (E Int) (E (E Int)))))’ not matched:
+ Patterns of type ‘T1
+ (T2 (T1 (D (E Int) (E (E Int)))))’ not matched:
MkT1 (MkT2 (MkT1 D2))
diff --git a/testsuite/tests/pmcheck/should_compile/EmptyCase004.stderr b/testsuite/tests/pmcheck/should_compile/EmptyCase004.stderr
index c80a391d98..7dc717c934 100644
--- a/testsuite/tests/pmcheck/should_compile/EmptyCase004.stderr
+++ b/testsuite/tests/pmcheck/should_compile/EmptyCase004.stderr
@@ -1,37 +1,37 @@
EmptyCase004.hs:15:6: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
- In a case alternative: Patterns of type ‘A Bool’ not matched: A2
+ In a case alternative: Patterns of type ‘A Bool’ not matched: A2
EmptyCase004.hs:19:6: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘A a’ not matched:
+ Patterns of type ‘A a’ not matched:
A1
A2
EmptyCase004.hs:31:8: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
- In a case alternative: Patterns of type ‘B a a’ not matched: B1 _
+ In a case alternative: Patterns of type ‘B a a’ not matched: B1 _
EmptyCase004.hs:35:6: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘B a b’ not matched:
+ Patterns of type ‘B a b’ not matched:
B1 _
B2
EmptyCase004.hs:47:6: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘A a’ not matched:
+ Patterns of type ‘A a’ not matched:
A1
A2
EmptyCase004.hs:50:9: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
- In a case alternative: Patterns of type ‘B a b’ not matched: B2
+ In a case alternative: Patterns of type ‘B a b’ not matched: B2
EmptyCase004.hs:51:9: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
- In a case alternative: Patterns of type ‘B a b’ not matched: B1 _
+ In a case alternative: Patterns of type ‘B a b’ not matched: B1 _
diff --git a/testsuite/tests/pmcheck/should_compile/EmptyCase005.stderr b/testsuite/tests/pmcheck/should_compile/EmptyCase005.stderr
index 97514f67be..da479135f6 100644
--- a/testsuite/tests/pmcheck/should_compile/EmptyCase005.stderr
+++ b/testsuite/tests/pmcheck/should_compile/EmptyCase005.stderr
@@ -2,34 +2,34 @@
EmptyCase005.hs:24:8: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘Void3’ not matched: Void3 _
+ Patterns of type ‘Void3’ not matched: Void3 _
EmptyCase005.hs:67:8: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘T ()’ not matched:
+ Patterns of type ‘T ()’ not matched:
T1
T2
EmptyCase005.hs:73:8: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘T Bool’ not matched:
+ Patterns of type ‘T Bool’ not matched:
MkTBool False
MkTBool True
EmptyCase005.hs:79:8: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘T Int’ not matched: MkTInt _
+ Patterns of type ‘T Int’ not matched: MkTInt _
EmptyCase005.hs:91:8: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘G Int’ not matched:
+ Patterns of type ‘G Int’ not matched:
MkV False
MkV True
EmptyCase005.hs:101:8: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
- In a case alternative: Patterns of type ‘H Int’ not matched: _
+ In a case alternative: Patterns of type ‘H Int’ not matched: _
diff --git a/testsuite/tests/pmcheck/should_compile/EmptyCase006.stderr b/testsuite/tests/pmcheck/should_compile/EmptyCase006.stderr
index a34d0f5e5e..9062f1c40a 100644
--- a/testsuite/tests/pmcheck/should_compile/EmptyCase006.stderr
+++ b/testsuite/tests/pmcheck/should_compile/EmptyCase006.stderr
@@ -2,12 +2,12 @@
EmptyCase006.hs:18:7: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘Foo1 Int’ not matched: Foo1 MkGA1
+ Patterns of type ‘Foo1 Int’ not matched: Foo1 MkGA1
EmptyCase006.hs:26:7: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘Foo1 a’ not matched:
+ Patterns of type ‘Foo1 a’ not matched:
Foo1 MkGA1
Foo1 (MkGA2 _)
Foo1 MkGA3
diff --git a/testsuite/tests/pmcheck/should_compile/EmptyCase007.stderr b/testsuite/tests/pmcheck/should_compile/EmptyCase007.stderr
index 6b60fd76ad..7adef0854a 100644
--- a/testsuite/tests/pmcheck/should_compile/EmptyCase007.stderr
+++ b/testsuite/tests/pmcheck/should_compile/EmptyCase007.stderr
@@ -2,30 +2,30 @@
EmptyCase007.hs:21:7: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘Foo2 a’ not matched: Foo2 _
+ Patterns of type ‘Foo2 a’ not matched: Foo2 _
EmptyCase007.hs:25:7: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘Foo2 (a, a)’ not matched: Foo2 _
+ Patterns of type ‘Foo2 (a, a)’ not matched: Foo2 _
EmptyCase007.hs:33:7: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘Foo2 Int’ not matched: Foo2 (_, _)
+ Patterns of type ‘Foo2 Int’ not matched: Foo2 (_, _)
EmptyCase007.hs:37:7: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘Foo2 Char’ not matched: Foo2 _
+ Patterns of type ‘Foo2 Char’ not matched: Foo2 _
EmptyCase007.hs:44:17: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
- In a case alternative: Patterns of type ‘FA Char’ not matched: _
+ In a case alternative: Patterns of type ‘FA Char’ not matched: _
EmptyCase007.hs:48:7: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘Foo2 [Int]’ not matched:
+ Patterns of type ‘Foo2 [Int]’ not matched:
Foo2 []
Foo2 (_:_)
diff --git a/testsuite/tests/pmcheck/should_compile/EmptyCase008.stderr b/testsuite/tests/pmcheck/should_compile/EmptyCase008.stderr
index 5563a599b6..c826a05569 100644
--- a/testsuite/tests/pmcheck/should_compile/EmptyCase008.stderr
+++ b/testsuite/tests/pmcheck/should_compile/EmptyCase008.stderr
@@ -2,21 +2,21 @@
EmptyCase008.hs:17:7: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘Foo3 Int’ not matched:
+ Patterns of type ‘Foo3 Int’ not matched:
Foo3 (MkDA1 _)
Foo3 MkDA2
EmptyCase008.hs:21:7: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘Foo3 a’ not matched: Foo3 _
+ Patterns of type ‘Foo3 a’ not matched: Foo3 _
EmptyCase008.hs:40:7: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘Foo4 Int ()’ not matched: Foo4 MkDB1
+ Patterns of type ‘Foo4 Int ()’ not matched: Foo4 MkDB1
EmptyCase008.hs:48:7: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘Foo4 a b’ not matched: Foo4 _
+ Patterns of type ‘Foo4 a b’ not matched: Foo4 _
diff --git a/testsuite/tests/pmcheck/should_compile/EmptyCase009.stderr b/testsuite/tests/pmcheck/should_compile/EmptyCase009.stderr
index cd10631c6c..ca6ca03e9f 100644
--- a/testsuite/tests/pmcheck/should_compile/EmptyCase009.stderr
+++ b/testsuite/tests/pmcheck/should_compile/EmptyCase009.stderr
@@ -1,14 +1,14 @@
EmptyCase009.hs:21:9: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
- In a case alternative: Patterns of type ‘Bar f’ not matched: Bar _
+ In a case alternative: Patterns of type ‘Bar f’ not matched: Bar _
EmptyCase009.hs:33:7: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘Bar (DB ())’ not matched: Bar MkDB2_u
+ Patterns of type ‘Bar (DB ())’ not matched: Bar MkDB2_u
EmptyCase009.hs:42:7: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘Bar GB’ not matched: Bar MkGB3
+ Patterns of type ‘Bar GB’ not matched: Bar MkGB3
diff --git a/testsuite/tests/pmcheck/should_compile/EmptyCase010.stderr b/testsuite/tests/pmcheck/should_compile/EmptyCase010.stderr
index 9b4c65e4ac..8202c65a22 100644
--- a/testsuite/tests/pmcheck/should_compile/EmptyCase010.stderr
+++ b/testsuite/tests/pmcheck/should_compile/EmptyCase010.stderr
@@ -2,31 +2,31 @@
EmptyCase010.hs:24:7: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘Baz GC a’ not matched:
+ Patterns of type ‘Baz GC a’ not matched:
Baz MkGC1
Baz (MkGC2 _)
EmptyCase010.hs:28:7: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘Baz GC 'T1’ not matched: Baz MkGC1
+ Patterns of type ‘Baz GC 'T1’ not matched: Baz MkGC1
EmptyCase010.hs:37:7: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘Baz GD Maybe’ not matched:
+ Patterns of type ‘Baz GD Maybe’ not matched:
Baz MkGD1
Baz MkGD3
EmptyCase010.hs:41:9: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘Baz GD (Either Int)’ not matched: Baz MkGD3
+ Patterns of type ‘Baz GD (Either Int)’ not matched: Baz MkGD3
EmptyCase010.hs:45:7: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘Baz GD f’ not matched:
+ Patterns of type ‘Baz GD f’ not matched:
Baz MkGD1
Baz MkGD2
Baz MkGD3
@@ -34,14 +34,14 @@ EmptyCase010.hs:45:7: warning: [-Wincomplete-patterns (in -Wextra)]
EmptyCase010.hs:57:7: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘Baz (DC ()) a’ not matched: Baz _
+ Patterns of type ‘Baz (DC ()) a’ not matched: Baz _
EmptyCase010.hs:69:7: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘Baz (DC Bool) [Int]’ not matched: Baz MkDC2
+ Patterns of type ‘Baz (DC Bool) [Int]’ not matched: Baz MkDC2
EmptyCase010.hs:73:9: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘Baz f a’ not matched: Baz _
+ Patterns of type ‘Baz f a’ not matched: Baz _
diff --git a/testsuite/tests/pmcheck/should_compile/T10746.stderr b/testsuite/tests/pmcheck/should_compile/T10746.stderr
index fab96e5fde..a2229d3ec6 100644
--- a/testsuite/tests/pmcheck/should_compile/T10746.stderr
+++ b/testsuite/tests/pmcheck/should_compile/T10746.stderr
@@ -2,6 +2,6 @@
T10746.hs:9:10: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘Bool’ not matched:
+ Patterns of type ‘Bool’ not matched:
False
True
diff --git a/testsuite/tests/pmcheck/should_compile/T11336b.stderr b/testsuite/tests/pmcheck/should_compile/T11336b.stderr
index 4a6547d509..85dad6a81c 100644
--- a/testsuite/tests/pmcheck/should_compile/T11336b.stderr
+++ b/testsuite/tests/pmcheck/should_compile/T11336b.stderr
@@ -1,5 +1,4 @@
T11336b.hs:25:1: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
- In an equation for ‘fun’:
- Patterns of type ‘Proxy a’ not matched: Proxy
+ In an equation for ‘fun’: Patterns of type ‘Proxy a’ not matched: _
diff --git a/testsuite/tests/pmcheck/should_compile/T11822.stderr b/testsuite/tests/pmcheck/should_compile/T11822.stderr
index 212d300537..7f0aae9aec 100644
--- a/testsuite/tests/pmcheck/should_compile/T11822.stderr
+++ b/testsuite/tests/pmcheck/should_compile/T11822.stderr
@@ -2,16 +2,15 @@
T11822.hs:33:1: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In an equation for ‘mkTreeNode’:
- Patterns of type ‘prefix’, ‘Seq SiblingDependencies’,
- ‘Set prefix’, ‘Depth’ not matched:
- _ (Data.Sequence.Internal.Seq Data.Sequence.Internal.EmptyT)
- (Data.Set.Internal.Bin _ _ _ _) (Depth _)
- _ (Data.Sequence.Internal.Seq Data.Sequence.Internal.EmptyT)
- Data.Set.Internal.Tip (Depth _)
- _ (Data.Sequence.Internal.Seq (Data.Sequence.Internal.Single _))
- (Data.Set.Internal.Bin _ _ _ _) (Depth _)
- _ (Data.Sequence.Internal.Seq (Data.Sequence.Internal.Single _))
- Data.Set.Internal.Tip (Depth _)
+ Patterns of type ‘prefix’, ‘Seq SiblingDependencies’, ‘Set prefix’,
+ ‘Depth’ not matched:
+ _ (Data.Sequence.Internal.Seq Data.Sequence.Internal.EmptyT) _ _
+ _ (Data.Sequence.Internal.Seq (Data.Sequence.Internal.Single _)) _
+ _
+ _
+ (Data.Sequence.Internal.Seq (Data.Sequence.Internal.Deep _ _ _ _))
+ _ _
+ _ (Data.Sequence.Internal.Seq Data.Sequence.Internal.EmptyT) _ _
...
T11822.hs:33:1: warning:
@@ -21,4 +20,3 @@ T11822.hs:33:1: warning:
• Patterns reported as unmatched might actually be matched
Suggested fix:
Increase the limit or resolve the warnings to suppress this message.
-
diff --git a/testsuite/tests/pmcheck/should_compile/T15305.stderr b/testsuite/tests/pmcheck/should_compile/T15305.stderr
index de682464b7..61f47322a0 100644
--- a/testsuite/tests/pmcheck/should_compile/T15305.stderr
+++ b/testsuite/tests/pmcheck/should_compile/T15305.stderr
@@ -2,4 +2,4 @@
T15305.hs:48:23: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘Abyss’ not matched: MkAbyss _
+ Patterns of type ‘Abyss’ not matched: MkAbyss _
diff --git a/testsuite/tests/pmcheck/should_compile/T15450.stderr b/testsuite/tests/pmcheck/should_compile/T15450.stderr
index 2ef488970d..a9268100f1 100644
--- a/testsuite/tests/pmcheck/should_compile/T15450.stderr
+++ b/testsuite/tests/pmcheck/should_compile/T15450.stderr
@@ -2,10 +2,10 @@
T15450.hs:6:7: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘Bool’ not matched:
+ Patterns of type ‘Bool’ not matched:
False
True
T15450.hs:9:7: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
- In a case alternative: Patterns of type ‘Bool’ not matched: False
+ In a case alternative: Patterns of type ‘Bool’ not matched: False
diff --git a/testsuite/tests/pmcheck/should_compile/T17977.stderr b/testsuite/tests/pmcheck/should_compile/T17977.stderr
index f9cb656f42..9817638af6 100644
--- a/testsuite/tests/pmcheck/should_compile/T17977.stderr
+++ b/testsuite/tests/pmcheck/should_compile/T17977.stderr
@@ -2,10 +2,7 @@
T17977.hs:31:1: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In an equation for ‘f’:
- Patterns of type ‘SNat m’, ‘SNat n’, ‘SNat o’,
- ‘R m n o’ not matched:
- SZ SZ SZ _
- SZ SZ (SS _) _
- SZ (SS _) SZ _
- SZ (SS _) (SS _) _
- ...
+ Patterns of type ‘SNat m’, ‘SNat n’, ‘SNat o’,
+ ‘R m n o’ not matched:
+ SZ _ _ _
+ (SS _) _ SZ _
diff --git a/testsuite/tests/pmcheck/should_compile/T18610.stderr b/testsuite/tests/pmcheck/should_compile/T18610.stderr
index 7f6a2dfe67..cc2ddf2996 100644
--- a/testsuite/tests/pmcheck/should_compile/T18610.stderr
+++ b/testsuite/tests/pmcheck/should_compile/T18610.stderr
@@ -6,7 +6,7 @@ T18610.hs:15:3: warning: [-Woverlapping-patterns (in -Wdefault)]
T18610.hs:24:7: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘(Bool, Bool)’ not matched: (_, _)
+ Patterns of type ‘(Bool, Bool)’ not matched: _
T18610.hs:53:3: warning: [-Winaccessible-code (in -Wdefault)]
• Couldn't match type ‘Bool’ with ‘Int’
diff --git a/testsuite/tests/pmcheck/should_compile/T18932.stderr b/testsuite/tests/pmcheck/should_compile/T18932.stderr
index 7f6d813ada..1da153f795 100644
--- a/testsuite/tests/pmcheck/should_compile/T18932.stderr
+++ b/testsuite/tests/pmcheck/should_compile/T18932.stderr
@@ -5,15 +5,12 @@ T18932.hs:10:1: warning: [-Woverlapping-patterns (in -Wdefault)]
T18932.hs:12:1: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
- In an equation for ‘f'’:
- Patterns of type ‘T a’ not matched: MkT2 _
+ In an equation for ‘f'’: Patterns of type ‘T a’ not matched: MkT2 _
T18932.hs:14:1: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In an equation for ‘g’:
- Patterns of type ‘T a’, ‘T a’, ‘T a’ not matched:
- (MkT2 _) (MkT1 _) (MkT1 _)
- (MkT2 _) (MkT1 _) (MkT2 _)
- (MkT2 _) (MkT2 _) (MkT1 _)
- (MkT2 _) (MkT2 _) (MkT2 _)
- ...
+ Patterns of type ‘T a’, ‘T a’, ‘T a’ not matched:
+ (MkT2 _) _ _
+ (MkT1 _) (MkT2 _) _
+ (MkT1 _) (MkT1 _) (MkT2 _)
diff --git a/testsuite/tests/pmcheck/should_compile/T20642.hs b/testsuite/tests/pmcheck/should_compile/T20642.hs
new file mode 100644
index 0000000000..f7b1867b67
--- /dev/null
+++ b/testsuite/tests/pmcheck/should_compile/T20642.hs
@@ -0,0 +1,18 @@
+{-# LANGUAGE EmptyCase #-}
+{-# OPTIONS_GHC -Wincomplete-uni-patterns #-}
+
+module T20642 where
+
+foo :: [a] -> [a]
+foo [] = []
+foo xs = ys
+ where
+ (_, ys@(_:_)) = splitAt 0 xs
+
+-- Should case split on the Maybe
+f :: Maybe a -> ()
+f x = case x of {}
+
+-- Should *not* case split on the Bool
+g :: (Bool, [a]) -> ()
+g (_, []) = ()
diff --git a/testsuite/tests/pmcheck/should_compile/T20642.stderr b/testsuite/tests/pmcheck/should_compile/T20642.stderr
new file mode 100644
index 0000000000..3843b53045
--- /dev/null
+++ b/testsuite/tests/pmcheck/should_compile/T20642.stderr
@@ -0,0 +1,17 @@
+
+T20642.hs:10:3: warning: [-Wincomplete-uni-patterns (in -Wall)]
+ Pattern match(es) are non-exhaustive
+ In a pattern binding:
+ Patterns of type ‘([a], [a])’ not matched: (_, [])
+
+T20642.hs:14:7: warning: [-Wincomplete-patterns (in -Wextra)]
+ Pattern match(es) are non-exhaustive
+ In a case alternative:
+ Patterns of type ‘Maybe a’ not matched:
+ Nothing
+ Just _
+
+T20642.hs:18:1: warning: [-Wincomplete-patterns (in -Wextra)]
+ Pattern match(es) are non-exhaustive
+ In an equation for ‘g’:
+ Patterns of type ‘(Bool, [a])’ not matched: (_, (_:_))
diff --git a/testsuite/tests/pmcheck/should_compile/T2204.stderr b/testsuite/tests/pmcheck/should_compile/T2204.stderr
index 82988e669c..5bd3dba322 100644
--- a/testsuite/tests/pmcheck/should_compile/T2204.stderr
+++ b/testsuite/tests/pmcheck/should_compile/T2204.stderr
@@ -2,14 +2,14 @@
T2204.hs:6:1: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In an equation for ‘f’:
- Patterns of type ‘String’ not matched:
+ Patterns of type ‘String’ not matched:
[]
- [p] where p is not one of {'0'}
- (p:_:_) where p is not one of {'0'}
+ (p:_) where p is not one of {'0'}
['0']
+ ('0':p:_) where p is not one of {'1'}
...
T2204.hs:9:1: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In an equation for ‘g’:
- Patterns of type ‘Int’ not matched: p where p is not one of {0}
+ Patterns of type ‘Int’ not matched: p where p is not one of {0}
diff --git a/testsuite/tests/pmcheck/should_compile/T9951b.stderr b/testsuite/tests/pmcheck/should_compile/T9951b.stderr
index 65198db65f..c446661366 100644
--- a/testsuite/tests/pmcheck/should_compile/T9951b.stderr
+++ b/testsuite/tests/pmcheck/should_compile/T9951b.stderr
@@ -2,9 +2,9 @@
T9951b.hs:7:1: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In an equation for ‘f’:
- Patterns of type ‘String’ not matched:
+ Patterns of type ‘String’ not matched:
[]
- [p] where p is not one of {'a'}
- (p:_:_) where p is not one of {'a'}
+ (p:_) where p is not one of {'a'}
['a']
+ ('a':p:_) where p is not one of {'b'}
...
diff --git a/testsuite/tests/pmcheck/should_compile/TooManyDeltas.stderr b/testsuite/tests/pmcheck/should_compile/TooManyDeltas.stderr
index 9297e1b669..bd9ca3f0f0 100644
--- a/testsuite/tests/pmcheck/should_compile/TooManyDeltas.stderr
+++ b/testsuite/tests/pmcheck/should_compile/TooManyDeltas.stderr
@@ -1,12 +1,7 @@
TooManyDeltas.hs:14:1: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
- In an equation for ‘f’:
- Patterns of type ‘T’, ‘T’ not matched:
- A A
- A B
- B A
- B B
+ In an equation for ‘f’: Patterns of type ‘T’, ‘T’ not matched: _ _
TooManyDeltas.hs:14:1: warning:
Pattern match checker ran into -fmax-pmcheck-models=0 limit, so
diff --git a/testsuite/tests/pmcheck/should_compile/all.T b/testsuite/tests/pmcheck/should_compile/all.T
index f1cc928151..8df4d33d8a 100644
--- a/testsuite/tests/pmcheck/should_compile/all.T
+++ b/testsuite/tests/pmcheck/should_compile/all.T
@@ -170,6 +170,8 @@ test('T19622', normal, compile,
['-fwarn-incomplete-patterns -fwarn-overlapping-patterns'])
test('T20631', normal, compile,
['-fwarn-incomplete-patterns -fwarn-overlapping-patterns'])
+test('T20642', normal, compile,
+ ['-fwarn-incomplete-patterns -fwarn-overlapping-patterns'])
# Other tests
test('pmc001', [], compile,
diff --git a/testsuite/tests/pmcheck/should_compile/pmc001.stderr b/testsuite/tests/pmcheck/should_compile/pmc001.stderr
index 6f15444777..4e10c5bf0a 100644
--- a/testsuite/tests/pmcheck/should_compile/pmc001.stderr
+++ b/testsuite/tests/pmcheck/should_compile/pmc001.stderr
@@ -2,7 +2,7 @@
pmc001.hs:14:1: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In an equation for ‘f’:
- Patterns of type ‘T [a]’, ‘T [a]’ not matched:
+ Patterns of type ‘T [a]’, ‘T [a]’ not matched:
MkT1 MkT3
(MkT2 _) MkT3
MkT3 MkT1
@@ -11,7 +11,7 @@ pmc001.hs:14:1: warning: [-Wincomplete-patterns (in -Wextra)]
pmc001.hs:19:1: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In an equation for ‘g’:
- Patterns of type ‘T [a]’, ‘T [a]’ not matched:
+ Patterns of type ‘T [a]’, ‘T [a]’ not matched:
MkT1 MkT3
(MkT2 _) MkT3
MkT3 MkT1
diff --git a/testsuite/tests/pmcheck/should_compile/pmc007.stderr b/testsuite/tests/pmcheck/should_compile/pmc007.stderr
index 1593f85f7f..a68618d3f2 100644
--- a/testsuite/tests/pmcheck/should_compile/pmc007.stderr
+++ b/testsuite/tests/pmcheck/should_compile/pmc007.stderr
@@ -2,25 +2,25 @@
pmc007.hs:7:1: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In an equation for ‘f’:
- Patterns of type ‘a’ not matched:
+ Patterns of type ‘a’ not matched:
p where p is not one of {"ab", "ac"}
pmc007.hs:12:1: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In an equation for ‘g’:
- Patterns of type ‘String’ not matched:
+ Patterns of type ‘String’ not matched:
[]
- [p] where p is not one of {'a'}
- (p:_:_) where p is not one of {'a'}
+ (p:_) where p is not one of {'a'}
['a']
+ ('a':p:_) where p is not one of {'b', 'c'}
...
pmc007.hs:18:11: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In a case alternative:
- Patterns of type ‘String’ not matched:
+ Patterns of type ‘String’ not matched:
[]
- [p] where p is not one of {'a'}
- (p:_:_) where p is not one of {'a'}
+ (p:_) where p is not one of {'a'}
['a']
+ ('a':p:_) where p is not one of {'b', 'c'}
...
diff --git a/testsuite/tests/pmcheck/should_compile/pmc009.stderr b/testsuite/tests/pmcheck/should_compile/pmc009.stderr
index 6f1849a25f..21132abc08 100644
--- a/testsuite/tests/pmcheck/should_compile/pmc009.stderr
+++ b/testsuite/tests/pmcheck/should_compile/pmc009.stderr
@@ -2,5 +2,4 @@
pmc009.hs:6:1: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In an equation for ‘addPatSynSelector’:
- Patterns of type ‘GenLocated l (HsBindLR idL idR)’ not matched:
- L _ _
+ Patterns of type ‘GenLocated l (HsBindLR idL idR)’ not matched: _
diff --git a/testsuite/tests/th/T19709c.stderr b/testsuite/tests/th/T19709c.stderr
index 3bedc08dc9..37451d2023 100644
--- a/testsuite/tests/th/T19709c.stderr
+++ b/testsuite/tests/th/T19709c.stderr
@@ -4,7 +4,7 @@ T19709c.hs:9:7: error: [-Wincomplete-patterns (in -Wextra), -Werror=incomplete-p
In a case alternative:
Patterns of type ‘String’ not matched:
[]
- [p] where p is not one of {'h'}
- (p:_:_) where p is not one of {'h'}
+ (p:_) where p is not one of {'h'}
['h']
+ ('h':p:_) where p is not one of {'e'}
...
diff --git a/testsuite/tests/th/T19709d.stderr b/testsuite/tests/th/T19709d.stderr
index 3ee2ac8424..cacf6acb48 100644
--- a/testsuite/tests/th/T19709d.stderr
+++ b/testsuite/tests/th/T19709d.stderr
@@ -4,9 +4,9 @@ T19709d.hs:6:2: warning: [-Wincomplete-patterns (in -Wextra)]
In a case alternative:
Patterns of type ‘String’ not matched:
[]
- [p] where p is not one of {'h'}
- (p:_:_) where p is not one of {'h'}
+ (p:_) where p is not one of {'h'}
['h']
+ ('h':p:_) where p is not one of {'e'}
...
T19709d.hs:1:1: error: