diff options
Diffstat (limited to 'testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail01.hs')
| -rw-r--r-- | testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail01.hs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail01.hs b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail01.hs new file mode 100644 index 0000000000..0087237d9d --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail01.hs @@ -0,0 +1,17 @@ +{-# LANGUAGE OverloadedRecordFields #-} + +data R = MkR { w :: Bool, x :: Int, y :: Bool } +data S = MkS { w :: Bool, x :: Int, y :: Bool } +data T = MkT { x :: Int, z :: Bool } +data U = MkU { y :: Bool } + +-- Straightforward ambiguous update +upd1 r = r { x = 3 } + +-- No type has all these fields +upd2 r = r { x = 3, y = True, z = False } + +-- User-specified type does not have these fields +upd3 r = r { w = True, x = 3, y = True } :: U + +main = return ()
\ No newline at end of file |
