Add test for updating a record with existentially quantified fields.
authorMatthew Pickering <matthewtpickering@gmail.com>
Wed, 2 Sep 2015 11:28:34 +0000 (13:28 +0200)
committerBen Gamari <ben@smart-cactus.org>
Wed, 2 Sep 2015 11:30:00 +0000 (13:30 +0200)
Test Plan: ./validate

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1193

testsuite/tests/typecheck/should_compile/all.T
testsuite/tests/typecheck/should_compile/update-existential.hs [new file with mode: 0644]

index d9f2bd8..b469689 100644 (file)
@@ -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 (file)
index 0000000..e216d1d
--- /dev/null
@@ -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.)
+}