summaryrefslogtreecommitdiff
path: root/docs/users_guide
diff options
context:
space:
mode:
authorHE, Tao <sighingnow@gmail.com>2018-03-02 14:16:24 -0500
committerBen Gamari <ben@smart-cactus.org>2018-03-02 14:52:10 -0500
commite8e9f6a7a6d857efe6e3b2aec0c4964f9a8fa09a (patch)
tree2ce712a6b9c00bf2d1e969bbb1db28a8858a14c7 /docs/users_guide
parent8c7a1551fcd004c37f4ccd99c7c10395179519f1 (diff)
downloadhaskell-e8e9f6a7a6d857efe6e3b2aec0c4964f9a8fa09a.tar.gz
Improve exhaustive checking for guards in pattern bindings and MultiIf.
Previously we didn't do exhaustive checking on MultiIf expressions and guards in pattern bindings. We can construct the `LMatch` directly from GRHSs or [LHsExpr] (MultiIf's alts) then feed it to checkMatches, without construct the MatchGroup and using function `matchWrapper`. Signed-off-by: HE, Tao <sighingnow@gmail.com> Test Plan: make test TEST="T14773a T14773b" Reviewers: bgamari, RyanGlScott, simonpj Reviewed By: bgamari, simonpj Subscribers: rwbarton, thomie, carter GHC Trac Issues: #14773 Differential Revision: https://phabricator.haskell.org/D4400
Diffstat (limited to 'docs/users_guide')
-rw-r--r--docs/users_guide/8.6.1-notes.rst16
1 files changed, 16 insertions, 0 deletions
diff --git a/docs/users_guide/8.6.1-notes.rst b/docs/users_guide/8.6.1-notes.rst
index 70c3b0c10d..f5f2a5a341 100644
--- a/docs/users_guide/8.6.1-notes.rst
+++ b/docs/users_guide/8.6.1-notes.rst
@@ -31,6 +31,22 @@ Language
The grammar is invalid in Haskell2010. Previously it could be compiled successfully
without ``GADTs``. As of GHC 8.6.1, this is a parse error.
+- Incomplete patterns warning :ghc-flag:`-Wincomplete-patterns` is extended to
+ guards in pattern bindings and ``if`` alternatives of :extension:`MultiWayIf`.
+ For instance, consider the following, ::
+
+ foo :: Bool -> Int
+ foo b = if | b -> 1
+
+ In GHC 8.6.1, it will raise the warning: ::
+
+ <interactive>:2:12: warning: [-Wincomplete-patterns]
+ Pattern match(es) are non-exhaustive
+ In a multi-way if alternative:
+ Guards do not cover entire pattern space
+
+ See :ghc-ticket:`14773`.
+
Compiler
~~~~~~~~