Add test for #12589
[ghc.git] / testsuite / tests / typecheck / should_fail / tcfail177.hs
1 module ShouldFail where
2
3 -- See Trac #1176
4 -- This is really a pretty-printer test, not a typechecker test
5 --
6 -- Before ghc-7.2 the error messages looked like this (notice the wrong
7 -- indentation):
8
9 {-
10 tcfail177.hs:9:12:
11 Couldn't match expected type `Bool' with actual type `Int'
12 In the return type of a call of `foo'
13 In the expression:
14 foo
15 ["One........" ~?= "1", "Two" ~?= "2", "Thre........." ~?= "3",
16 "Four" ~?= "4", ....]
17 In an equation for `allTest1':
18 allTest1
19 = foo
20 ["One........" ~?= "1", "Two" ~?= "2", "Thre........." ~?= "3",
21 ....]
22
23 tcfail177.hs:18:12:
24 Couldn't match expected type `Bool' with actual type `Int'
25 In the return type of a call of `foo'
26 In the expression:
27 foo
28 ["One........" ~?= "1", "Two.................." ~?= "2",
29 "Thre........." ~?= "3", "Four" ~?= "4", ....]
30 In an equation for `allTest2':
31 allTest2
32 = foo
33 ["One........" ~?= "1", "Two.................." ~?= "2",
34 "Thre........." ~?= "3", ....]
35 -}
36
37 allTest1 :: Bool
38 allTest1 = foo
39 ["One........" ~?= "1"
40 ,"Two" ~?= "2"
41 ,"Thre........." ~?= "3"
42 ,"Four" ~?= "4"
43 ,"Five" ~?= "5"
44 ]
45
46 allTest2 :: Bool
47 allTest2 = foo
48 ["One........" ~?= "1"
49 ,"Two.................." ~?= "2"
50 ,"Thre........." ~?= "3"
51 ,"Four" ~?= "4"
52 ,"Five" ~?= "5"
53 ]
54
55 (~?=) :: a -> a -> Bool
56 (~?=) = error "urk"
57
58 foo :: a -> Int
59 foo x = 0