[GHC] #14141: Custom type errors don't trigger when matching on a GADT constructor with an error in the constraint

GHC ghc-devs at haskell.org
Mon Aug 21 10:42:33 UTC 2017


#14141: Custom type errors don't trigger when matching on a GADT constructor with
an error in the constraint
-------------------------------------+-------------------------------------
           Reporter:  Darwin226      |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.2
           Keywords:                 |  Operating System:  Windows
       Architecture:  x86_64         |   Type of failure:  GHC accepts
  (amd64)                            |  invalid program
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 The following code fails to compile (as it should)

 {{{#!hs
 data D where
     A :: C => D

 type family C :: Constraint where
     C = 'True ~ 'False

 f :: D -> ()
 f A = ()
 }}}

 with the error "Couldn't match type 'True with 'False".

 This code, however, does compile without an issue:

 {{{#!hs
 data D where
     A :: C => D

 type family C :: Constraint where
     C = TypeError ('Text "error")

 f :: D -> ()
 f A = ()
 }}}

 I feel that this is a bug.

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


More information about the ghc-tickets mailing list