GHC HEAD regression: tyConAppArgs
The following program compiles (with -O
) on GHC 7.0.4 through 8.6.3, but panics on HEAD:
{-# LANGUAGE DeriveFunctor #-}
module Bug where
data V2 a = V2 !a !a deriving Functor
(*^) :: (Functor f, Num a) => a -> f a -> f a
(*^) a = fmap (a*)
(*!!) :: (Functor m, Functor r, Num a) => a -> m (r a) -> m (r a)
s *!! m = fmap (s *^) m
type M22 a = V2 (V2 a)
det22 :: Num a => M22 a -> a
det22 (V2 (V2 a b) (V2 c d)) = a * d - b * c
inv22 :: Fractional a => M22 a -> M22 a
inv22 m@(V2 (V2 a b) (V2 c d)) = (1 / det) *!! V2 (V2 d (-b)) (V2 (-c) a)
where det = det22 m
$ ~/Software/ghc4/inplace/bin/ghc-stage2 -fforce-recomp Bug.hs -O
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.7.20190219 for x86_64-unknown-linux):
tyConAppArgs
a_a1FK
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1159:37 in ghc:Outputable
pprPanic, called at compiler/types/Type.hs:1183:50 in ghc:Type
Note that this panic does not occur if V2
is defined without !
s.
Trac metadata
Trac field | Value |
---|---|
Version | 8.7 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |