Fix #13407 by suppressing invisibles better.
authorRichard Eisenberg <rae@cs.brynmawr.edu>
Tue, 15 Aug 2017 22:04:32 +0000 (18:04 -0400)
committerBen Gamari <ben@smart-cactus.org>
Thu, 14 Sep 2017 17:08:46 +0000 (13:08 -0400)
Previously, the iface-invisible-suppresser assumed that all
invisible things are up front. Not true!

test case: ghci/scripts/T13407

compiler/iface/IfaceType.hs
testsuite/tests/ghci/scripts/T13407.script [new file with mode: 0644]
testsuite/tests/ghci/scripts/T13407.stdout [new file with mode: 0644]
testsuite/tests/ghci/scripts/all.T

index 1f3ee6d..dcd3ad3 100644 (file)
@@ -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 (file)
index 0000000..f77fd42
--- /dev/null
@@ -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 (file)
index 0000000..7607413
--- /dev/null
@@ -0,0 +1,3 @@
+type role Foo phantom phantom
+data Foo (a :: * -> *) (c :: k)
+       -- Defined at <interactive>:3:1
index d8ba10d..fd3744e 100755 (executable)
@@ -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'])