Fix #14135 by validity checking matches
authorCarlos Tomé <carlostome1990@gmail.com>
Mon, 11 Dec 2017 20:38:03 +0000 (15:38 -0500)
committerBen Gamari <ben@smart-cactus.org>
Thu, 14 Dec 2017 21:45:20 +0000 (16:45 -0500)
commitcc034b35a6890bd67739e59319f50dc020f04da7
tree272932c113ea2fa225789ca5f475e5b4a6bf56a1
parentc01e413f9f3cad4b85b5dec73ea9f2e6a574f213
Fix #14135 by validity checking matches

We filter the complete patterns given in a COMPLETE set to only those that
subsume the type we are matching. Otherwise we end up introducing an ill-typed
equation into the overlap checking, provoking a crash. This was the cause of
Trac #14135.

Reviewers: austin, bgamari, mpickering, gkaracha, simonpj, RyanGlScott,
carlostome

Reviewed By: bgamari

Subscribers: carter, dfeuer, RyanGlScott, goldfire, rwbarton, thomie

GHC Trac Issues: #14135

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

(cherry picked from commit 16c7d9dc9ea7505256e0792c958cab8ae7c8a5c4)
compiler/deSugar/Check.hs
testsuite/tests/deSugar/should_compile/T14135.hs [new file with mode: 0644]
testsuite/tests/deSugar/should_compile/T14135.stderr [new file with mode: 0644]
testsuite/tests/deSugar/should_compile/all.T