[commit: ghc] master: testsuite: Add testcase for #14253 (acd346e)

git at git.haskell.org git at git.haskell.org
Thu Sep 21 16:10:07 UTC 2017


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

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

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

commit acd346e3fad4d138cd8f421bb84ec6a1b357e326
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Tue Sep 19 19:03:33 2017 -0400

    testsuite: Add testcase for #14253
    
    Reviewers: austin
    
    Subscribers: rwbarton, thomie
    
    Differential Revision: https://phabricator.haskell.org/D3997


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

acd346e3fad4d138cd8f421bb84ec6a1b357e326
 testsuite/tests/pmcheck/complete_sigs/T14253.hs | 39 +++++++++++++++++++++++++
 testsuite/tests/pmcheck/complete_sigs/all.T     |  1 +
 2 files changed, 40 insertions(+)

diff --git a/testsuite/tests/pmcheck/complete_sigs/T14253.hs b/testsuite/tests/pmcheck/complete_sigs/T14253.hs
new file mode 100644
index 0000000..88cc4f8
--- /dev/null
+++ b/testsuite/tests/pmcheck/complete_sigs/T14253.hs
@@ -0,0 +1,39 @@
+{-# LANGUAGE GADTs #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE RankNTypes #-}
+{-# LANGUAGE TypeInType #-}
+
+module T14253 where
+
+import GHC.Exts
+import Data.Kind
+
+data TypeRep (a :: k) where
+    Con :: TypeRep (a :: k)
+    TrFun   :: forall (r1 :: RuntimeRep) (r2 :: RuntimeRep)
+                      (a :: TYPE r1) (b :: TYPE r2).
+               TypeRep a
+            -> TypeRep b
+            -> TypeRep (a -> b)
+
+pattern Fun :: forall k (fun :: k). ()
+            => forall (r1 :: RuntimeRep) (r2 :: RuntimeRep)
+                      (arg :: TYPE r1) (res :: TYPE r2).
+               (k ~ Type, fun ~~ (arg -> res))
+            => TypeRep arg
+            -> TypeRep res
+            -> TypeRep fun
+pattern Fun arg res <- TrFun arg res
+
+data Dynamic where
+    Dynamic :: forall a. TypeRep a -> a -> Dynamic
+
+-- Adding this results in failure
+{-# COMPLETE Con #-}
+
+dynApply :: Dynamic -> Dynamic -> Maybe Dynamic
+-- Changing TrFun to Fun also results in failure
+dynApply (Dynamic (Fun ta tr) f) (Dynamic ta' x) = undefined
+dynApply _ _ = Nothing
+
diff --git a/testsuite/tests/pmcheck/complete_sigs/all.T b/testsuite/tests/pmcheck/complete_sigs/all.T
index 4e8c33d..7e47877 100644
--- a/testsuite/tests/pmcheck/complete_sigs/all.T
+++ b/testsuite/tests/pmcheck/complete_sigs/all.T
@@ -13,3 +13,4 @@ test('completesig12', normal, compile, [''])
 test('completesig13', normal, compile, [''])
 test('completesig14', normal, compile, [''])
 test('completesig15', normal, compile_fail, [''])
+test('T14253', expect_broken(14253), compile, [''])



More information about the ghc-commits mailing list