[commit: ghc] master: GHCi should not filter instances involving cTuples (21efbc7)

git at git.haskell.org git at git.haskell.org
Tue Oct 2 14:00:44 UTC 2018


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/21efbc7599e39ec93b8b13b7d7b84811226e6f6f/ghc

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

commit 21efbc7599e39ec93b8b13b7d7b84811226e6f6f
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


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

21efbc7599e39ec93b8b13b7d7b84811226e6f6f
 compiler/main/InteractiveEval.hs           | 2 ++
 testsuite/tests/ghci/scripts/T12005.script | 8 ++++++++
 testsuite/tests/ghci/scripts/T12005.stdout | 6 ++++++
 testsuite/tests/ghci/scripts/all.T         | 1 +
 4 files changed, 17 insertions(+)

diff --git a/compiler/main/InteractiveEval.hs b/compiler/main/InteractiveEval.hs
index 452ccb3..3d9dc18 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/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 dcc4855..67c4b38 100755
--- a/testsuite/tests/ghci/scripts/all.T
+++ b/testsuite/tests/ghci/scripts/all.T
@@ -252,6 +252,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