[GHC] #13768: Incorrect warnings generated by exhaustiveness checker with pattern synonyms / GADT combination

GHC ghc-devs at haskell.org
Tue May 30 11:19:11 UTC 2017


#13768: Incorrect warnings generated by exhaustiveness checker with pattern
synonyms / GADT combination
-------------------------------------+-------------------------------------
        Reporter:  kosmikus          |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:
       Component:  Compiler          |              Version:  8.2.1-rc2
      Resolution:                    |             Keywords:
                                     |  PatternSynonyms
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by mpickering):

 * priority:  normal => high
 * keywords:   => PatternSynonyms


Comment:

 I think the problem here is in `mkOneConFull` which makes a substitution
 by zipping together the `univ_tvs` and `tc_args`.

 If I print out what these values are in this example I find that..

 {{{
 univ_tvs [k_a133, xs'_aSi, f_aSj]
 tc_args [k_a27Q, f_a27S, ys_a27R]
 }}}

 which then generates equalities like..

 {{{
 theta_cs [(f_a27S :: [k_a27Q]) ~ ((x_d2kG : xs_d2kH) :: [k_a27Q])]
 }}}

 and the constraint solver reports as unsatisfiable.

 If I insert a hack to swap these type variables into the "right" order
 then the program compiles without warning as expected.

 {{{
 univ_tvs [k_a133, xs'_aSi, f_aSj]
 tc_args [k_a27Q, f_a27S, ys_a27R]
 theta_cs [(ys_a27R :: [k_a27Q]) ~ ((x_d2ky : xs_d2kz) :: [k_a27Q])]
 }}}

 I don't know what the right solution is here as in general there seems no
 reason for these two lists to appear in the right order.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13768#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list