Commit bb7f2e33 authored by Georgios Karachalias's avatar Georgios Karachalias Committed by Ben Gamari

Address #11245: Ensure the non-matched list is always non-empty

When there is an uncovered vector of length 0 (which in turn means that
it represents a guard failure) print "(incomplete guards)" instead of an
empty list of non-covered vectors.

Test Plan: validate

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1717

GHC Trac Issues: #11245
parent 947c8a53
......@@ -1420,9 +1420,11 @@ dsPmWarn dflags ctx@(DsMatchContext kind loc) mPmResult
vcat (map (ppr_eqn f kind) (take maximum_output qs)) $$ dots qs
pprEqnsU qs = pp_context ctx (ptext (sLit "are non-exhaustive")) $ \_ ->
let us = map ppr_uncovered qs
in hang (ptext (sLit "Patterns not matched:")) 4
(vcat (take maximum_output us) $$ dots us)
case qs of -- See #11245
[([],_)] -> ptext (sLit "Guards do not cover entire pattern space")
_missing -> let us = map ppr_uncovered qs
in hang (ptext (sLit "Patterns not matched:")) 4
(vcat (take maximum_output us) $$ dots us)
dots :: [a] -> SDoc
dots qs | qs `lengthExceeds` maximum_output = ptext (sLit "...")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment