[commit: ghc] wip/rae: Fix #13407 by suppressing invisibles better. (c93e798)

git at git.haskell.org git at git.haskell.org
Wed Aug 16 19:18:58 UTC 2017


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

On branch  : wip/rae
Link       : http://ghc.haskell.org/trac/ghc/changeset/c93e7981bc1f8c1de1d1200301ea876aaddb1631/ghc

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

commit c93e7981bc1f8c1de1d1200301ea876aaddb1631
Author: Richard Eisenberg <rae at cs.brynmawr.edu>
Date:   Tue Aug 15 18:04:32 2017 -0400

    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


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

c93e7981bc1f8c1de1d1200301ea876aaddb1631
 compiler/iface/IfaceType.hs                | 6 +++---
 testsuite/tests/ghci/scripts/T13407.script | 4 ++++
 testsuite/tests/ghci/scripts/T13407.stdout | 3 +++
 testsuite/tests/ghci/scripts/all.T         | 1 +
 4 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/compiler/iface/IfaceType.hs b/compiler/iface/IfaceType.hs
index b1ad780..c7405b3 100644
--- a/compiler/iface/IfaceType.hs
+++ b/compiler/iface/IfaceType.hs
@@ -321,9 +321,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 0000000..f77fd42
--- /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 0000000..7607413
--- /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 1f4e5b1..0861b70 100755
--- a/testsuite/tests/ghci/scripts/all.T
+++ b/testsuite/tests/ghci/scripts/all.T
@@ -256,3 +256,4 @@ test('T13466', normal, ghci_script, ['T13466.script'])
 test('GhciCurDir', normal, ghci_script, ['GhciCurDir.script'])
 test('T13591', expect_broken(13591), ghci_script, ['T13591.script'])
 test('T13699', normal, ghci_script, ['T13699.script'])
+test('T13407', normal, ghci_script, ['T13407.script'])



More information about the ghc-commits mailing list