Ticket #3901: compbug.hs

File compbug.hs, 436 bytes (added by amthrax, 4 years ago)

Test case

Line 
1{-# LANGUAGE TransformListComp, RecordWildCards, NamedFieldPuns #-}
2
3data Rec = Rec {a :: Int} deriving (Show)
4
5-- Showing recs1 causes a panic
6recs1 = [a | Rec {..} <- [Rec 1], then group by a]
7
8-- Showing recs2 and recs3 works
9recs2 = [a | Rec {a, ..} <- [Rec 1], then group by a]
10recs3 = [a | Rec {a = a} <- [Rec 1], then group by a]
11
12-- If we don't refer to recs1, GHC will not panic, though ghci will.
13main = putStrLn $ show recs1