summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_fail/tcfail177.hs
blob: 4cbe12bfbca649f9951b9011eb25080fb31cda82 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
module ShouldFail where

-- See #1176
-- This is really a pretty-printer test, not a typechecker test
--
-- Before ghc-7.2 the error messages looked like this (notice the wrong
-- indentation):

{-
tcfail177.hs:9:12:
    Couldn't match expected type `Bool' with actual type `Int'
    In the return type of a call of `foo'
    In the expression:
      foo
        ["One........" ~?= "1", "Two" ~?= "2", "Thre........." ~?= "3",
     "Four" ~?= "4", ....]
    In an equation for `allTest1':
        allTest1
          = foo
              ["One........" ~?= "1", "Two" ~?= "2", "Thre........." ~?= "3",
         ....]

tcfail177.hs:18:12:
    Couldn't match expected type `Bool' with actual type `Int'
    In the return type of a call of `foo'
    In the expression:
      foo
        ["One........" ~?= "1", "Two.................." ~?= "2",
       "Thre........." ~?= "3", "Four" ~?= "4", ....]
    In an equation for `allTest2':
        allTest2
          = foo
              ["One........" ~?= "1", "Two.................." ~?= "2",
             "Thre........." ~?= "3", ....]
-}

allTest1 :: Bool
allTest1 = foo
           ["One........" ~?= "1"
           ,"Two" ~?= "2"
           ,"Thre........." ~?= "3"
           ,"Four" ~?= "4"
           ,"Five" ~?= "5"
           ]

allTest2 :: Bool
allTest2 = foo
           ["One........" ~?= "1"
           ,"Two.................." ~?= "2"
           ,"Thre........." ~?= "3"
           ,"Four" ~?= "4"
           ,"Five" ~?= "5"
           ]

(~?=) :: a -> a -> Bool
(~?=) = error "urk"

foo :: a -> Int
foo x = 0