summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2015-09-02 13:28:34 +0200
committerBen Gamari <ben@smart-cactus.org>2015-09-02 13:30:00 +0200
commitff9432f600ca294fb747b0288dc10659d035d45e (patch)
treefe02c0d2a379a41da8c72cb7c0554bc41d9579e2 /testsuite
parent010e1878c9c851a638211a03fd58bfa6bdd93081 (diff)
downloadhaskell-ff9432f600ca294fb747b0288dc10659d035d45e.tar.gz
Add test for updating a record with existentially quantified fields.
Test Plan: ./validate Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1193
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/typecheck/should_compile/all.T1
-rw-r--r--testsuite/tests/typecheck/should_compile/update-existential.hs21
2 files changed, 22 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T
index d9f2bd8160..b469689445 100644
--- a/testsuite/tests/typecheck/should_compile/all.T
+++ b/testsuite/tests/typecheck/should_compile/all.T
@@ -469,3 +469,4 @@ test('T10564', normal, compile, [''])
test('T10632', normal, compile, [''])
test('T10642', normal, compile, [''])
test('T10744', normal, compile, [''])
+test('update-existential', normal, compile, [''])
diff --git a/testsuite/tests/typecheck/should_compile/update-existential.hs b/testsuite/tests/typecheck/should_compile/update-existential.hs
new file mode 100644
index 0000000000..e216d1da01
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/update-existential.hs
@@ -0,0 +1,21 @@
+{-# LANGUAGE
+ NoImplicitPrelude
+ , ExistentialQuantification
+ #-}
+
+module Test where
+
+hGetContents handle_ = handle_{ haType=SemiClosedHandle}
+
+data HandleType = SemiClosedHandle
+
+class Show a where
+ show :: a -> a
+
+-- they have to check whether the handle has indeed been closed.
+data Handle__
+ = forall dev . (Show dev) =>
+ Handle__ {
+ haDevice :: !dev,
+ haType :: HandleType -- type (read/write/append etc.)
+}