[commit: ghc] ghc-8.6: GHCi should not filter instances involving cTuples (51c4479)

git at git.haskell.org git at git.haskell.org
Sat Oct 13 17:18:26 UTC 2018


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

On branch  : ghc-8.6
Link       : http://ghc.haskell.org/trac/ghc/changeset/51c447936ef3f2f3f67c54d2dd62de537f443e89/ghc

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

commit 51c447936ef3f2f3f67c54d2dd62de537f443e89
Author: Alec Theriault <alec.theriault at gmail.com>
Date:   Tue Oct 2 14:48:00 2018 +0200

    GHCi should not filter instances involving cTuples
    
    Summary: See the new T12005 test case for an example of this.
    
    Test Plan: make TEST=T12005
    
    Reviewers: bgamari, osa1
    
    Reviewed By: osa1
    
    Subscribers: osa1, rwbarton, carter
    
    GHC Trac Issues: #12005
    
    Differential Revision: https://phabricator.haskell.org/D5182
    
    (cherry picked from commit 21efbc7599e39ec93b8b13b7d7b84811226e6f6f)


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

51c447936ef3f2f3f67c54d2dd62de537f443e89
 compiler/main/InteractiveEval.hs           | 2 ++
 compiler/parser/RdrHsSyn.hs                | 3 ++-
 testsuite/tests/ghci/scripts/T12005.script | 8 ++++++++
 testsuite/tests/ghci/scripts/T12005.stdout | 6 ++++++
 testsuite/tests/ghci/scripts/all.T         | 1 +
 5 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/compiler/main/InteractiveEval.hs b/compiler/main/InteractiveEval.hs
index cdca053..a808439 100644
--- a/compiler/main/InteractiveEval.hs
+++ b/compiler/main/InteractiveEval.hs
@@ -76,6 +76,7 @@ import UniqSupply
 import MonadUtils
 import Module
 import PrelNames  ( toDynName, pretendNameIsInScope )
+import TysWiredIn ( isCTupleTyConName )
 import Panic
 import Maybes
 import ErrUtils
@@ -758,6 +759,7 @@ getInfo allInfo name
                        -- The one we looked for in the first place!
                | pretendNameIsInScope n = True
                | isBuiltInSyntax n      = True
+               | isCTupleTyConName n    = True
                | isExternalName n       = isJust (lookupGRE_Name rdr_env n)
                | otherwise              = True
 
diff --git a/compiler/parser/RdrHsSyn.hs b/compiler/parser/RdrHsSyn.hs
index 572636b..cad6b60 100644
--- a/compiler/parser/RdrHsSyn.hs
+++ b/compiler/parser/RdrHsSyn.hs
@@ -91,7 +91,8 @@ import TcEvidence       ( idHsWrapper )
 import Lexer
 import Lexeme           ( isLexCon )
 import Type             ( TyThing(..) )
-import TysWiredIn       ( cTupleTyConName, tupleTyCon, tupleDataCon,
+import TysWiredIn       ( cTupleTyConName, tupleTyConName, tupleTyCon,
+                          tupleDataCon,
                           nilDataConName, nilDataConKey,
                           listTyConName, listTyConKey,
                           cTupleTyConNameArity_maybe  )
diff --git a/testsuite/tests/ghci/scripts/T12005.script b/testsuite/tests/ghci/scripts/T12005.script
new file mode 100644
index 0000000..a86e7d5
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T12005.script
@@ -0,0 +1,8 @@
+:set -XKindSignatures -XRank2Types -XConstraintKinds -XAllowAmbiguousTypes -XInstanceSigs
+
+import Data.Kind
+
+class Defer (p :: Constraint) where defer :: (p => r) -> r
+instance Defer () where defer :: r -> r; defer = id
+
+:i Defer
diff --git a/testsuite/tests/ghci/scripts/T12005.stdout b/testsuite/tests/ghci/scripts/T12005.stdout
new file mode 100644
index 0000000..34cde4a
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T12005.stdout
@@ -0,0 +1,6 @@
+class Defer (p :: Constraint) where
+  defer :: (p => r) -> r
+  {-# MINIMAL defer #-}
+  	-- Defined at <interactive>:5:1
+instance [safe] Defer (() :: Constraint)
+  -- Defined at <interactive>:6:10
diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T
index 8954594..c0cceca 100755
--- a/testsuite/tests/ghci/scripts/all.T
+++ b/testsuite/tests/ghci/scripts/all.T
@@ -240,6 +240,7 @@ test('T12007', normal, ghci_script, ['T12007.script'])
 test('T11975', normal, ghci_script, ['T11975.script'])
 test('T10963', normal, ghci_script, ['T10963.script'])
 test('T11721', normal, ghci_script, ['T11721.script'])
+test('T12005', normal, ghci_script, ['T12005.script'])
 test('T12023', normal, run_command,
                ['$MAKE -s --no-print-directory T12023'])
 test('T12520', normal, ghci_script, ['T12520.script'])



More information about the ghc-commits mailing list