Invalid newtype causes GHC to panic rather than fail to compile
This code:
{-# LANGUAGE TypeFamilies #-}
newtype Zero = Zero
newtype Succ a = Succ a
type family Add n m :: * where
Add Zero m = m
Add (Succ n) m = Succ (Add n m)
causes the following GHC error:
$ ghc foo.hs
[1 of 1] Compiling Main ( foo.hs, foo.o )
ghc: panic! (the 'impossible' happened)
(GHC version 8.0.2 for x86_64-unknown-linux):
isInjectiveTyCon sees a TcTyCon Zero
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 | |
Architecture |