summaryrefslogtreecommitdiff
path: root/testsuite/tests/polykinds/T10670.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2015-07-23 08:33:43 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2015-07-23 08:34:35 +0100
commit5c3fc921aeeeec392a89914783b2be9ea3dade27 (patch)
treee039c252b58728c89213fb54750bba5f054c472b /testsuite/tests/polykinds/T10670.hs
parentdd365b1baab08b44e8feb1715ecacf7407628d5c (diff)
downloadhaskell-5c3fc921aeeeec392a89914783b2be9ea3dade27.tar.gz
Fix Trac #10670
In dataConCannotMatch we were using a GADT data con without properly instantiating the existential type variables. The fix is easy, and the code is tighter.
Diffstat (limited to 'testsuite/tests/polykinds/T10670.hs')
-rw-r--r--testsuite/tests/polykinds/T10670.hs24
1 files changed, 24 insertions, 0 deletions
diff --git a/testsuite/tests/polykinds/T10670.hs b/testsuite/tests/polykinds/T10670.hs
new file mode 100644
index 0000000000..5b9cc72e21
--- /dev/null
+++ b/testsuite/tests/polykinds/T10670.hs
@@ -0,0 +1,24 @@
+{-# LANGUAGE ScopedTypeVariables, RankNTypes, GADTs, PolyKinds #-}
+
+module T10670 where
+
+import Unsafe.Coerce
+
+data TypeRepT (a::k) where
+ TRCon :: TypeRepT a
+
+data G2 c a where
+ G2 :: TypeRepT a -> TypeRepT b -> G2 c (c a b)
+
+getT2 :: TypeRepT (c :: k2 -> k1 -> k) -> TypeRepT (a :: k) -> Maybe (G2 c a)
+{-# NOINLINE getT2 #-}
+getT2 c t = Nothing
+
+tyRepTArr :: TypeRepT (->)
+{-# NOINLINE tyRepTArr #-}
+tyRepTArr = TRCon
+
+s :: forall a x. TypeRepT (a :: *) -> Maybe x
+s tf = case getT2 tyRepTArr tf :: Maybe (G2 (->) a) of
+ Just (G2 _ _) -> Nothing
+ _ -> Nothing