summaryrefslogtreecommitdiff
path: root/testsuite/tests/patsyn/should_compile/T23038.hs
blob: b00878642f7a6918d3302dae002c5767a8f73feb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{-# LANGUAGE PatternSynonyms, ViewPatterns, ScopedTypeVariables #-}

module T23038 where

import GHC.Types( Any )
import Unsafe.Coerce( unsafeCoerce )

pattern N1 :: forall a. () => forall. () => a -> Any
pattern N1 { fld1 } <- ( unsafeCoerce -> fld1 )
  where N1 = unsafeCoerce

pattern N2 :: forall. () => forall a. () => a -> Any
pattern N2 { fld2 } <- ( unsafeCoerce -> fld2 )
  where N2 = unsafeCoerce

test1, test2 :: forall a. Any -> a

test1 = fld1  -- Should be OK
test2 = fld2  -- Should be rejected