Pattern synonyms and higher rank types
authorSimon Peyton Jones <simonpj@microsoft.com>
Thu, 25 May 2017 08:59:29 +0000 (09:59 +0100)
committerSimon Peyton Jones <simonpj@microsoft.com>
Thu, 25 May 2017 09:09:41 +0000 (10:09 +0100)
commitc9977385dca9536f18374242f713b1048a38dec5
treeaaa94d742ea58060bf0b4f9fde713a896abaf735
parent10131947b212770c837035f042a11c024cf0ec67
Pattern synonyms and higher rank types

This patch fixes two separate bugs which contributed to making
Trac #13752 go wrong

1.  We need to use tcSubType, not tcUnify,
    in tcCheckPatSynDecl.tc_arg.

    Reason: Note [Pattern synonyms and higher rank types]

2.  TcUnify.tc_sub_type had a special case designed to improve error
    messages; see Note [Don't skolemise unnecessarily].  But the
    special case was too liberal, and ended up using unification
    (which led to rejecting the program) when it should instead taken
    the normal path (which accepts the program).

    I fixed this by making the test more conservative.
compiler/typecheck/TcPatSyn.hs
compiler/typecheck/TcUnify.hs
testsuite/tests/patsyn/should_compile/T13752.hs [new file with mode: 0644]
testsuite/tests/patsyn/should_compile/T13752a.hs [new file with mode: 0644]
testsuite/tests/patsyn/should_compile/all.T