summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_fail/tcfail104.hs
blob: 371ed32557fdb4713a976ae3cd4877c13f722d81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{-# LANGUAGE RankNTypes, ScopedTypeVariables #-}

-- Test the handling of conditionals in rank-n stuff
-- Should fail, regardless of branch ordering

module ShouldFail where

-- These two are ok
f1 = (\ (x :: forall a. a->a) -> x)
f2 = (\ (x :: forall a. a->a) -> x) id 'c'

-- These fail
f3 v = (if v then
          (\ (x :: forall a. a->a) -> x)
        else
          (\ x -> x)
      ) id 'c'

f4 v = (if v then
          (\ x -> x)
        else
          (\ (x :: forall a. a->a) -> x)
       ) id 'c'