summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Theriault <alec.theriault@gmail.com>2018-10-02 14:48:00 +0200
committerKrzysztof Gogolewski <krz.gogolewski@gmail.com>2018-10-02 16:00:19 +0200
commit21efbc7599e39ec93b8b13b7d7b84811226e6f6f (patch)
tree89e8ce0e648799b0b5e27bd90c9b719484f9bfba
parente3355b7c5955df8daab0f3fc75fe021f42d21dbb (diff)
downloadhaskell-21efbc7599e39ec93b8b13b7d7b84811226e6f6f.tar.gz
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
-rw-r--r--compiler/main/InteractiveEval.hs2
-rw-r--r--testsuite/tests/ghci/scripts/T12005.script8
-rw-r--r--testsuite/tests/ghci/scripts/T12005.stdout6
-rwxr-xr-xtestsuite/tests/ghci/scripts/all.T1
4 files changed, 17 insertions, 0 deletions
diff --git a/compiler/main/InteractiveEval.hs b/compiler/main/InteractiveEval.hs
index 452ccb3e80..3d9dc18970 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 0000000000..a86e7d5e8e
--- /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 0000000000..34cde4ad97
--- /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 dcc4855ab4..67c4b38009 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'])