[commit: ghc] master: Add test for updating a record with existentially quantified fields. (ff9432f)

git at git.haskell.org git at git.haskell.org
Wed Sep 2 11:49:28 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/ff9432f600ca294fb747b0288dc10659d035d45e/ghc

>---------------------------------------------------------------

commit ff9432f600ca294fb747b0288dc10659d035d45e
Author: Matthew Pickering <matthewtpickering at gmail.com>
Date:   Wed Sep 2 13:28:34 2015 +0200

    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


>---------------------------------------------------------------

ff9432f600ca294fb747b0288dc10659d035d45e
 testsuite/tests/typecheck/should_compile/all.T      |  1 +
 .../typecheck/should_compile/update-existential.hs  | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T
index d9f2bd8..b469689 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 0000000..e216d1d
--- /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.)
+}



More information about the ghc-commits mailing list