summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Eisenberg <rae@cs.brynmawr.edu>2017-08-15 18:04:32 -0400
committerBen Gamari <ben@smart-cactus.org>2017-09-14 13:08:46 -0400
commit04bb8736e1b0573ac45905a0f8c96bcb91564e2d (patch)
treee3c98d6f31e632bbf5429ff1a42ae01f01732054
parentb9776308f69b6c6cca39c0cf05045405cdcfc16e (diff)
downloadhaskell-04bb8736e1b0573ac45905a0f8c96bcb91564e2d.tar.gz
Fix #13407 by suppressing invisibles better.
Previously, the iface-invisible-suppresser assumed that all invisible things are up front. Not true! test case: ghci/scripts/T13407
-rw-r--r--compiler/iface/IfaceType.hs6
-rw-r--r--testsuite/tests/ghci/scripts/T13407.script4
-rw-r--r--testsuite/tests/ghci/scripts/T13407.stdout3
-rwxr-xr-xtestsuite/tests/ghci/scripts/all.T1
4 files changed, 11 insertions, 3 deletions
diff --git a/compiler/iface/IfaceType.hs b/compiler/iface/IfaceType.hs
index 1f3ee6df07..dcd3ad3f9d 100644
--- a/compiler/iface/IfaceType.hs
+++ b/compiler/iface/IfaceType.hs
@@ -325,9 +325,9 @@ suppressIfaceInvisibles dflags tys xs
where
suppress _ [] = []
suppress [] a = a
- suppress (k:ks) a@(_:xs)
- | isInvisibleTyConBinder k = suppress ks xs
- | otherwise = a
+ suppress (k:ks) (x:xs)
+ | isInvisibleTyConBinder k = suppress ks xs
+ | otherwise = x : suppress ks xs
stripIfaceInvisVars :: DynFlags -> [IfaceTyConBinder] -> [IfaceTyConBinder]
stripIfaceInvisVars dflags tyvars
diff --git a/testsuite/tests/ghci/scripts/T13407.script b/testsuite/tests/ghci/scripts/T13407.script
new file mode 100644
index 0000000000..f77fd42afe
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T13407.script
@@ -0,0 +1,4 @@
+:set -XTypeInType -XRankNTypes
+import Data.Kind
+data Foo :: (* -> *) -> (forall k. k -> *)
+:info Foo
diff --git a/testsuite/tests/ghci/scripts/T13407.stdout b/testsuite/tests/ghci/scripts/T13407.stdout
new file mode 100644
index 0000000000..7607413d11
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T13407.stdout
@@ -0,0 +1,3 @@
+type role Foo phantom phantom
+data Foo (a :: * -> *) (c :: k)
+ -- Defined at <interactive>:3:1
diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T
index d8ba10d62e..fd3744e190 100755
--- a/testsuite/tests/ghci/scripts/all.T
+++ b/testsuite/tests/ghci/scripts/all.T
@@ -257,3 +257,4 @@ test('GhciCurDir', normal, ghci_script, ['GhciCurDir.script'])
test('T13591', expect_broken(13591), ghci_script, ['T13591.script'])
test('T13699', normal, ghci_script, ['T13699.script'])
test('T13988', normal, ghci_script, ['T13988.script'])
+test('T13407', normal, ghci_script, ['T13407.script'])