diff options
author | George Karachalias <george.karachalias@gmail.com> | 2015-12-03 12:57:19 +0100 |
---|---|---|
committer | George Karachalias <george.karachalias@gmail.com> | 2015-12-03 12:57:19 +0100 |
commit | 8a506104d5b5b71d5640afc69c992e0af40f2213 (patch) | |
tree | 7c2c35faab5a2a7e41d74da227d77156d383d370 /testsuite/tests/pmcheck/should_compile/T3927b.stderr | |
parent | d25f3c076e6c47bc7c8d0d27e724a3ad2b7d7399 (diff) | |
download | haskell-8a506104d5b5b71d5640afc69c992e0af40f2213.tar.gz |
Major Overhaul of Pattern Match Checking (Fixes #595)
This patch adresses several problems concerned with exhaustiveness and
redundancy checking of pattern matching. The list of improvements includes:
* Making the check type-aware (handles GADTs, Type Families, DataKinds, etc.).
This fixes #4139, #3927, #8970 and other related tickets.
* Making the check laziness-aware. Cases that are overlapped but affect
evaluation are issued now with "Patterns have inaccessible right hand side".
Additionally, "Patterns are overlapped" is now replaced by "Patterns are
redundant".
* Improved messages for literals. This addresses tickets #5724, #2204, etc.
* Improved reasoning concerning cases where simple and overloaded
patterns are matched (See #322).
* Substantially improved reasoning for pattern guards. Addresses #3078.
* OverloadedLists extension does not break exhaustiveness checking anymore
(addresses #9951). Note that in general this cannot be handled but if we know
that an argument has type '[a]', we treat it as a list since, the instance of
'IsList' gives the identity for both 'fromList' and 'toList'. If the type is
not clear or is not the list type, then the check cannot do much still. I am
a bit concerned about OverlappingInstances though, since one may override the
'[a]' instance with e.g. an '[Int]' instance that is not the identity.
* Improved reasoning for nested pattern matching (partial solution). Now we
propagate type and (some) term constraints deeper when checking, so we can
detect more inconsistencies. For example, this is needed for #4139.
I am still not satisfied with several things but I would like to address at
least the following before the next release:
Term constraints are too many and not printed for non-exhaustive matches
(with the exception of literals). This sometimes results in two identical (in
appearance) uncovered warnings. Unless we actually show their difference, I
would like to have a single warning.
Diffstat (limited to 'testsuite/tests/pmcheck/should_compile/T3927b.stderr')
-rw-r--r-- | testsuite/tests/pmcheck/should_compile/T3927b.stderr | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/testsuite/tests/pmcheck/should_compile/T3927b.stderr b/testsuite/tests/pmcheck/should_compile/T3927b.stderr new file mode 100644 index 0000000000..fb4449ced9 --- /dev/null +++ b/testsuite/tests/pmcheck/should_compile/T3927b.stderr @@ -0,0 +1,39 @@ +T3927b.hs:58:5: warning: + • Redundant constraint: Restrict op (Implements 'Dealer) + • In the type signature for: + f :: Restrict op (Implements 'Dealer) => + SockOp 'Dealer op -> Operation op + In an equation for ‘dealer’: + dealer + = Socket (Proxy :: Proxy Dealer) f + where + f :: + Restrict op (Implements Dealer) => SockOp Dealer op -> Operation op + f SRead = undefined + f SWrite = undefined + +T3927b.hs:65:5: warning: + • Redundant constraint: Restrict op (Implements 'Push) + • In the type signature for: + f :: Restrict op (Implements 'Push) => + SockOp 'Push op -> Operation op + In an equation for ‘push’: + push + = Socket (Proxy :: Proxy Push) f + where + f :: + Restrict op (Implements Push) => SockOp Push op -> Operation op + f SWrite = undefined + +T3927b.hs:71:5: warning: + • Redundant constraint: Restrict op (Implements 'Pull) + • In the type signature for: + f :: Restrict op (Implements 'Pull) => + SockOp 'Pull op -> Operation op + In an equation for ‘pull’: + pull + = Socket (Proxy :: Proxy Pull) f + where + f :: + Restrict op (Implements Pull) => SockOp Pull op -> Operation op + f SRead = undefined |