Commit f0d10279 authored by simonpj's avatar simonpj
Browse files

Add test for record wildcards

parent 404e5aa7
......@@ -17,3 +17,4 @@ test('dsrun011', skip_if_fast, compile_and_run, [''])
test('dsrun012', skip_if_fast, compile_and_run, [''])
test('dsrun013', normal, compile_and_run, [''])
test('dsrun014', expect_broken_for(1257, 'ghci'), compile_and_run, [''])
test('dsrun015', expect_broken(1491), compile_and_run, [''])
{-# OPTIONS_GHC -XRecordWildCards -XRecordPuns #-}
-- This is a very partial test of the record-wildcard extension
-- but better than nothing
module Main where
data T = C { x :: Int, y :: Int }
| D { x :: Int, b :: Bool }
select :: T -> Int
select = Foo.x
f :: (T,T) -> Int
f v = let (C {..}, d) = v in Foo.x d
mkC a =
let x = a + 1
y = a * 2
in C{..}
sumC C{..} = x + y
foo x b =
let y = x+1
in (C{..}, let x = 100 in D{..})
bar a =
let (C{..}, d) = a
in (x + y + Main.x d, let D{..} = d in b)
main = do
print $ sumC $ mkC 10
print $ bar $ foo 5 True
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment