summaryrefslogtreecommitdiff
path: root/testsuite/tests/rename/should_compile/T15957.hs
blob: d684e57495a7e68e7d4af5d0a4ceb89d99be49bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE NamedFieldPuns #-}
module T15957 where

data P = P { x :: Int, y :: Int }

g1 P{..} = x + 3 -- x from .. is used
g2 P{x, ..} = x + y -- y from .. is used, even if it's in a weird style

old P{..} | x < 5 = 10

-- Record wildcards in lets have different scoping rules.. they bring
-- all the identifiers into scope
do_example :: IO Int
do_example = do
  let P{..} = P 1 2
  return $ x + y

let_in_example =
  let P{..} = P 1 2
  in x + 4