summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2021-04-11 19:50:20 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-04-13 18:44:28 -0400
commit1e2e62a462d2a13a1e43a520c9de38553334b0e0 (patch)
tree84496c3725424e28c569da12aeaba2157c48e803
parent8d87975ebe943a0461039a0cf2d4b8a2f32f436b (diff)
downloadhaskell-1e2e62a462d2a13a1e43a520c9de38553334b0e0.tar.gz
Add {lifted,unlifted}DataConKey to pretendNameIsInScope's list of Names
Fixes #19688.
-rw-r--r--compiler/GHC/Builtin/Names.hs7
-rw-r--r--testsuite/tests/ghci/T18060/T18060.stdout3
-rw-r--r--testsuite/tests/ghci/scripts/T12550.stdout25
-rw-r--r--testsuite/tests/ghci/scripts/T19688.hs5
-rw-r--r--testsuite/tests/ghci/scripts/T19688.script2
-rw-r--r--testsuite/tests/ghci/scripts/T19688.stdout4
-rw-r--r--testsuite/tests/ghci/scripts/T8535.stdout3
-rw-r--r--testsuite/tests/ghci/scripts/T8674.stdout1
-rwxr-xr-xtestsuite/tests/ghci/scripts/all.T1
-rw-r--r--testsuite/tests/ghci/scripts/ghci020.stdout3
-rw-r--r--testsuite/tests/ghci/should_run/T10145.stdout3
11 files changed, 56 insertions, 1 deletions
diff --git a/compiler/GHC/Builtin/Names.hs b/compiler/GHC/Builtin/Names.hs
index ec8d5a0afc..84210fb236 100644
--- a/compiler/GHC/Builtin/Names.hs
+++ b/compiler/GHC/Builtin/Names.hs
@@ -2817,7 +2817,11 @@ interactiveClassKeys = map getUnique interactiveClassNames
* *
************************************************************************
-The following names should be considered by GHCi to be in scope always.
+GHCi's :info command will usually filter out instances mentioning types whose
+names are not in scope. GHCi makes an exception for some commonly used names,
+such as Data.Kind.Type, which may not actually be in scope but should be
+treated as though they were in scope. The list in the definition of
+pretendNameIsInScope below contains these commonly used names.
-}
@@ -2825,5 +2829,6 @@ pretendNameIsInScope :: Name -> Bool
pretendNameIsInScope n
= any (n `hasKey`)
[ liftedTypeKindTyConKey, unliftedTypeKindTyConKey
+ , liftedDataConKey, unliftedDataConKey
, tYPETyConKey
, runtimeRepTyConKey, boxedRepDataConKey ]
diff --git a/testsuite/tests/ghci/T18060/T18060.stdout b/testsuite/tests/ghci/T18060/T18060.stdout
index 0d5d798db6..e60b6346a4 100644
--- a/testsuite/tests/ghci/T18060/T18060.stdout
+++ b/testsuite/tests/ghci/T18060/T18060.stdout
@@ -2,6 +2,9 @@ type (->) :: * -> * -> *
type (->) = FUN 'Many :: * -> * -> *
-- Defined in ‘GHC.Types’
infixr -1 ->
+instance Applicative ((->) r) -- Defined in ‘GHC.Base’
+instance Functor ((->) r) -- Defined in ‘GHC.Base’
+instance Monad ((->) r) -- Defined in ‘GHC.Base’
instance Monoid b => Monoid (a -> b) -- Defined in ‘GHC.Base’
instance Semigroup b => Semigroup (a -> b) -- Defined in ‘GHC.Base’
type (~) :: forall k. k -> k -> Constraint
diff --git a/testsuite/tests/ghci/scripts/T12550.stdout b/testsuite/tests/ghci/scripts/T12550.stdout
index f5d6d7ba05..05baf3e900 100644
--- a/testsuite/tests/ghci/scripts/T12550.stdout
+++ b/testsuite/tests/ghci/scripts/T12550.stdout
@@ -23,12 +23,37 @@ class Functor f where
(<$) ∷ ∀ a b. a → f b → f a
{-# MINIMAL fmap #-}
-- Defined in ‘GHC.Base’
+instance Functor V1 -- Defined in ‘GHC.Generics’
+instance Functor (URec Char) -- Defined in ‘GHC.Generics’
+instance Functor (URec Double) -- Defined in ‘GHC.Generics’
+instance Functor (URec Float) -- Defined in ‘GHC.Generics’
+instance Functor (URec Int) -- Defined in ‘GHC.Generics’
+instance Functor (URec Word) -- Defined in ‘GHC.Generics’
+instance Functor U1 -- Defined in ‘GHC.Generics’
+instance ∀ (f ∷ ★ → ★). Functor f ⇒ Functor (Rec1 f)
+ -- Defined in ‘GHC.Generics’
instance Functor Par1 -- Defined in ‘GHC.Generics’
+instance ∀ i (c ∷ Meta) (f ∷ ★ → ★). Functor f ⇒ Functor (M1 i c f)
+ -- Defined in ‘GHC.Generics’
+instance ∀ i c. Functor (K1 i c) -- Defined in ‘GHC.Generics’
+instance ∀ (f ∷ ★ → ★) (g ∷ ★ → ★).
+ (Functor f, Functor g) ⇒
+ Functor (f :.: g)
+ -- Defined in ‘GHC.Generics’
+instance ∀ (f ∷ ★ → ★) (g ∷ ★ → ★).
+ (Functor f, Functor g) ⇒
+ Functor (f :+: g)
+ -- Defined in ‘GHC.Generics’
+instance ∀ (f ∷ ★ → ★) (g ∷ ★ → ★).
+ (Functor f, Functor g) ⇒
+ Functor (f :*: g)
+ -- Defined in ‘GHC.Generics’
instance ∀ a. Functor (Either a) -- Defined in ‘Data.Either’
instance Functor [] -- Defined in ‘GHC.Base’
instance Functor Solo -- Defined in ‘GHC.Base’
instance Functor Maybe -- Defined in ‘GHC.Base’
instance Functor IO -- Defined in ‘GHC.Base’
+instance ∀ r. Functor ((->) r) -- Defined in ‘GHC.Base’
instance ∀ a b c. Functor ((,,,) a b c) -- Defined in ‘GHC.Base’
instance ∀ a b. Functor ((,,) a b) -- Defined in ‘GHC.Base’
instance ∀ a. Functor ((,) a) -- Defined in ‘GHC.Base’
diff --git a/testsuite/tests/ghci/scripts/T19688.hs b/testsuite/tests/ghci/scripts/T19688.hs
new file mode 100644
index 0000000000..e43de2f9f9
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T19688.hs
@@ -0,0 +1,5 @@
+{-# LANGUAGE TypeFamilies #-}
+module T19688 where
+
+data family D (a :: k)
+data instance D Int = DInt
diff --git a/testsuite/tests/ghci/scripts/T19688.script b/testsuite/tests/ghci/scripts/T19688.script
new file mode 100644
index 0000000000..1c4ae8f1f3
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T19688.script
@@ -0,0 +1,2 @@
+:load T19688
+:info D
diff --git a/testsuite/tests/ghci/scripts/T19688.stdout b/testsuite/tests/ghci/scripts/T19688.stdout
new file mode 100644
index 0000000000..eb02d532ea
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T19688.stdout
@@ -0,0 +1,4 @@
+type D :: forall k. k -> *
+data family D a
+ -- Defined at T19688.hs:4:1
+data instance D Int = DInt -- Defined at T19688.hs:5:15
diff --git a/testsuite/tests/ghci/scripts/T8535.stdout b/testsuite/tests/ghci/scripts/T8535.stdout
index 981124c9cb..5786372e9d 100644
--- a/testsuite/tests/ghci/scripts/T8535.stdout
+++ b/testsuite/tests/ghci/scripts/T8535.stdout
@@ -2,5 +2,8 @@ type (->) :: * -> * -> *
type (->) = FUN 'Many :: * -> * -> *
-- Defined in ‘GHC.Types’
infixr -1 ->
+instance Applicative ((->) r) -- Defined in ‘GHC.Base’
+instance Functor ((->) r) -- Defined in ‘GHC.Base’
+instance Monad ((->) r) -- Defined in ‘GHC.Base’
instance Monoid b => Monoid (a -> b) -- Defined in ‘GHC.Base’
instance Semigroup b => Semigroup (a -> b) -- Defined in ‘GHC.Base’
diff --git a/testsuite/tests/ghci/scripts/T8674.stdout b/testsuite/tests/ghci/scripts/T8674.stdout
index ff0355b617..7d7beeb1cd 100644
--- a/testsuite/tests/ghci/scripts/T8674.stdout
+++ b/testsuite/tests/ghci/scripts/T8674.stdout
@@ -1,5 +1,6 @@
type Sing :: forall k. k -> *
data family Sing a
-- Defined at T8674.hs:4:1
+data instance Sing Bool = SBool -- Defined at T8674.hs:6:15
data instance forall k (a :: [k]). Sing a = SNil
-- Defined at T8674.hs:5:15
diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T
index d6f2dd567e..bc8de5e5a0 100755
--- a/testsuite/tests/ghci/scripts/all.T
+++ b/testsuite/tests/ghci/scripts/all.T
@@ -329,3 +329,4 @@ test('T19158', normal, ghci_script, ['T19158.script'])
test('T19279', normal, ghci_script, ['T19279.script'])
test('T19310', normal, ghci_script, ['T19310.script'])
test('T19667Ghci', extra_files(['T19667Ghci.hs']), ghci_script, ['T19667Ghci.script'])
+test('T19688', normal, ghci_script, ['T19688.script'])
diff --git a/testsuite/tests/ghci/scripts/ghci020.stdout b/testsuite/tests/ghci/scripts/ghci020.stdout
index 981124c9cb..5786372e9d 100644
--- a/testsuite/tests/ghci/scripts/ghci020.stdout
+++ b/testsuite/tests/ghci/scripts/ghci020.stdout
@@ -2,5 +2,8 @@ type (->) :: * -> * -> *
type (->) = FUN 'Many :: * -> * -> *
-- Defined in ‘GHC.Types’
infixr -1 ->
+instance Applicative ((->) r) -- Defined in ‘GHC.Base’
+instance Functor ((->) r) -- Defined in ‘GHC.Base’
+instance Monad ((->) r) -- Defined in ‘GHC.Base’
instance Monoid b => Monoid (a -> b) -- Defined in ‘GHC.Base’
instance Semigroup b => Semigroup (a -> b) -- Defined in ‘GHC.Base’
diff --git a/testsuite/tests/ghci/should_run/T10145.stdout b/testsuite/tests/ghci/should_run/T10145.stdout
index 981124c9cb..5786372e9d 100644
--- a/testsuite/tests/ghci/should_run/T10145.stdout
+++ b/testsuite/tests/ghci/should_run/T10145.stdout
@@ -2,5 +2,8 @@ type (->) :: * -> * -> *
type (->) = FUN 'Many :: * -> * -> *
-- Defined in ‘GHC.Types’
infixr -1 ->
+instance Applicative ((->) r) -- Defined in ‘GHC.Base’
+instance Functor ((->) r) -- Defined in ‘GHC.Base’
+instance Monad ((->) r) -- Defined in ‘GHC.Base’
instance Monoid b => Monoid (a -> b) -- Defined in ‘GHC.Base’
instance Semigroup b => Semigroup (a -> b) -- Defined in ‘GHC.Base’