Avoid generating guards for CoPats if possible (Addresses #11276)
authorGeorge Karachalias <george.karachalias@gmail.com>
Mon, 4 Jan 2016 20:02:26 +0000 (21:02 +0100)
committerBen Gamari <ben@smart-cactus.org>
Mon, 4 Jan 2016 20:02:27 +0000 (21:02 +0100)
commit0acdcf2482d24903b504e6b34fa745ef855ff00d
tree43d58294bc8b062a74dbc0ee504526e4e6089d78
parent4c56ad36ee0d1f8b6f1b2bc0d8fff1c9acd1a389
Avoid generating guards for CoPats if possible (Addresses #11276)

When translating a `CoPat` to `PmPat` check whether the wrapper
is just a hole or a cast with refl. In these cases we can safely
drop the wrapper and generate less guard patterns. Fixes T11276.

Test Plan: validate

Reviewers: bgamari, austin

Subscribers: thomie

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

GHC Trac Issues: #11276
compiler/deSugar/Check.hs
testsuite/tests/pmcheck/should_compile/T11276.hs [new file with mode: 0644]
testsuite/tests/pmcheck/should_compile/T11276.stderr [new file with mode: 0644]
testsuite/tests/pmcheck/should_compile/all.T