Skip to content

Custom type errors don't trigger when matching on a GADT constructor with an error in the constraint

The following code fails to compile (as it should)

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:

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.

Trac metadata
Trac field Value
Version 8.0.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Windows
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information