blob: 22b4349fa2cb06c3c9f47bc16e89c4bf28bd9837 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
-- In this test we do -ddump-simpl, and grep for 'patError.
-- We expect *not* to see patError in the output
-- because the branch is inaccessible.
-- In GHC 7.0 and earlier, we did get a patError in the output program.
{-# LANGUAGE TypeFamilies, GADTs #-}
module NoMatch where
data Tag
data TagExtra
--------
data Foo a where
Foo :: String -> Foo a
FooExtra :: Int -> Foo TagExtra
-- The cmm code for fooName does not match against 'FooExtra'
fooName :: Foo Tag -> String
fooName (Foo s) = s
--------
data Bar a where
Bar :: String -> Bar a
BarExtra :: a ~ TagExtra => Int -> Bar a
-- The cmm code for barName will try to pattern-match against 'BarExtra'
barName :: Bar Tag -> String
barName (Bar s) = s
|