summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2017-12-12 10:16:39 -0500
committerRyan Scott <ryan.gl.scott@gmail.com>2017-12-12 10:16:41 -0500
commitbe1ca0e439e9d26107c7d82fe6e78b64ee6320a9 (patch)
tree3e13e33e2a9ff46ecb697c4bbd4c1f1709884e3b /testsuite
parent9d299253e29558b7d18e6643e1a84fb2bbbecfe5 (diff)
downloadhaskell-be1ca0e439e9d26107c7d82fe6e78b64ee6320a9.tar.gz
Add regression test for #14040
This adds a regression test for the original program in #14040. This does not fix #14040 entirely, though, as the program in https://ghc.haskell.org/trac/ghc/ticket/14040#comment:2 still panics, so there is more work to be done there.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/partial-sigs/should_fail/T14040a.hs34
-rw-r--r--testsuite/tests/partial-sigs/should_fail/T14040a.stderr48
-rw-r--r--testsuite/tests/partial-sigs/should_fail/all.T1
3 files changed, 83 insertions, 0 deletions
diff --git a/testsuite/tests/partial-sigs/should_fail/T14040a.hs b/testsuite/tests/partial-sigs/should_fail/T14040a.hs
new file mode 100644
index 0000000000..382e21823c
--- /dev/null
+++ b/testsuite/tests/partial-sigs/should_fail/T14040a.hs
@@ -0,0 +1,34 @@
+{-# LANGUAGE GADTs #-}
+{-# LANGUAGE RankNTypes #-}
+{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeInType #-}
+module T14040a where
+
+import Data.Kind
+
+data family Sing (a :: k)
+
+data WeirdList :: Type -> Type where
+ WeirdNil :: WeirdList a
+ WeirdCons :: a -> WeirdList (WeirdList a) -> WeirdList a
+
+data instance Sing (z :: WeirdList a) where
+ SWeirdNil :: Sing WeirdNil
+ SWeirdCons :: Sing w -> Sing wws -> Sing (WeirdCons w wws)
+
+elimWeirdList :: forall (a :: Type) (wl :: WeirdList a)
+ (p :: forall (x :: Type). x -> WeirdList x -> Type).
+ Sing wl
+ -> (forall (y :: Type). p _ WeirdNil)
+ -> (forall (z :: Type) (x :: z) (xs :: WeirdList (WeirdList z)).
+ Sing x -> Sing xs -> p _ xs
+ -> p _ (WeirdCons x xs))
+ -> p _ wl
+elimWeirdList SWeirdNil pWeirdNil _ = pWeirdNil
+elimWeirdList (SWeirdCons (x :: Sing (x :: z))
+ (xs :: Sing (xs :: WeirdList (WeirdList z))))
+ pWeirdNil pWeirdCons
+ = pWeirdCons @z @x @xs x xs
+ (elimWeirdList @(WeirdList z) @xs @p xs pWeirdNil pWeirdCons)
diff --git a/testsuite/tests/partial-sigs/should_fail/T14040a.stderr b/testsuite/tests/partial-sigs/should_fail/T14040a.stderr
new file mode 100644
index 0000000000..b4f0e26822
--- /dev/null
+++ b/testsuite/tests/partial-sigs/should_fail/T14040a.stderr
@@ -0,0 +1,48 @@
+
+T14040a.hs:21:18: error:
+ • The kind of variable ‘wl1’, namely ‘WeirdList a1’,
+ depends on variable ‘a1’ from an inner scope
+ Perhaps bind ‘wl1’ sometime after binding ‘a1’
+ • In the type signature:
+ elimWeirdList :: forall (a :: Type)
+ (wl :: WeirdList a)
+ (p :: forall (x :: Type). x -> WeirdList x -> Type).
+ Sing wl
+ -> (forall (y :: Type). p _ WeirdNil)
+ -> (forall (z :: Type) (x :: z) (xs :: WeirdList (WeirdList z)).
+ Sing x -> Sing xs -> p _ xs -> p _ (WeirdCons x xs))
+ -> p _ wl
+
+T14040a.hs:34:8: error:
+ • Cannot apply expression of type ‘Sing wl
+ -> (forall y. p x0 w0 'WeirdNil)
+ -> (forall z1 (x :: z1) (xs :: WeirdList (WeirdList z1)).
+ Sing x
+ -> Sing xs
+ -> p (WeirdList z1) w1 xs
+ -> p z1 w2 ('WeirdCons x xs))
+ -> p a w3 wl’
+ to a visible type argument ‘(WeirdList z)’
+ • In the sixth argument of ‘pWeirdCons’, namely
+ ‘(elimWeirdList @(WeirdList z) @xs @p xs pWeirdNil pWeirdCons)’
+ In the expression:
+ pWeirdCons
+ @z
+ @x
+ @xs
+ x
+ xs
+ (elimWeirdList @(WeirdList z) @xs @p xs pWeirdNil pWeirdCons)
+ In an equation for ‘elimWeirdList’:
+ elimWeirdList
+ (SWeirdCons (x :: Sing (x :: z))
+ (xs :: Sing (xs :: WeirdList (WeirdList z))))
+ pWeirdNil
+ pWeirdCons
+ = pWeirdCons
+ @z
+ @x
+ @xs
+ x
+ xs
+ (elimWeirdList @(WeirdList z) @xs @p xs pWeirdNil pWeirdCons)
diff --git a/testsuite/tests/partial-sigs/should_fail/all.T b/testsuite/tests/partial-sigs/should_fail/all.T
index d452dad101..bb813f0b08 100644
--- a/testsuite/tests/partial-sigs/should_fail/all.T
+++ b/testsuite/tests/partial-sigs/should_fail/all.T
@@ -64,4 +64,5 @@ test('PatBind3', normal, compile_fail, [''])
test('T12039', normal, compile_fail, [''])
test('T12634', normal, compile_fail, [''])
test('T12732', normal, compile_fail, ['-fobject-code -fdefer-typed-holes'])
+test('T14040a', normal, compile_fail, [''])
test('T14449', normal, compile_fail, [''])