diff options
author | Vladislav Zavialov <vlad.z.4096@gmail.com> | 2021-11-06 13:03:25 +0300 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-11-07 12:55:05 -0500 |
commit | 3d7e3d911c3dbfc114b7af33ad4b28cd2af29bbc (patch) | |
tree | 0ab04e83c31204e44cf509b3fc06c7fe5235a64f /testsuite | |
parent | 0d8a883e4b880453e044af3a69a96a648496926f (diff) | |
download | haskell-3d7e3d911c3dbfc114b7af33ad4b28cd2af29bbc.tar.gz |
Print the Type kind qualified when ambiguous (#20627)
The Type kind is printed unqualified:
ghci> :set -XNoStarIsType
ghci> :k (->)
(->) :: Type -> Type -> Type
This is the desired behavior unless the user has defined
their own Type:
ghci> data Type
Then we want to resolve the ambiguity by qualification:
ghci> :k (->)
(->) :: GHC.Types.Type -> GHC.Types.Type -> GHC.Types.Type
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/ghci/scripts/T20627.script | 17 | ||||
-rw-r--r-- | testsuite/tests/ghci/scripts/T20627.stdout | 13 | ||||
-rwxr-xr-x | testsuite/tests/ghci/scripts/all.T | 1 |
3 files changed, 31 insertions, 0 deletions
diff --git a/testsuite/tests/ghci/scripts/T20627.script b/testsuite/tests/ghci/scripts/T20627.script new file mode 100644 index 0000000000..b9f7478767 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T20627.script @@ -0,0 +1,17 @@ +:set -XNoStarIsType + +putStrLn "\nType and Constraint unqualified:" +:k (->) +:k Functor + +data Type + +putStrLn "\nType qualified, Constraint unqualified:" +:k (->) +:k Functor + +data Constraint + +putStrLn "\nType and Constraint qualified:" +:k (->) +:k Functor diff --git a/testsuite/tests/ghci/scripts/T20627.stdout b/testsuite/tests/ghci/scripts/T20627.stdout new file mode 100644 index 0000000000..e9cadc1a33 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T20627.stdout @@ -0,0 +1,13 @@ + +Type and Constraint unqualified: +(->) :: Type -> Type -> Type +Functor :: (Type -> Type) -> Constraint + +Type qualified, Constraint unqualified: +(->) :: GHC.Types.Type -> GHC.Types.Type -> GHC.Types.Type +Functor :: (GHC.Types.Type -> GHC.Types.Type) -> Constraint + +Type and Constraint qualified: +(->) :: GHC.Types.Type -> GHC.Types.Type -> GHC.Types.Type +Functor :: (GHC.Types.Type -> GHC.Types.Type) + -> GHC.Types.Constraint diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index 4db3ba2f7b..d67ff95308 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -347,3 +347,4 @@ test('T20101', normal, ghci_script, ['T20101.script']) test('T20206', normal, ghci_script, ['T20206.script']) test('T20217', normal, ghci_script, ['T20217.script']) test('T7388', normal, ghci_script, ['T7388.script']) +test('T20627', normal, ghci_script, ['T20627.script']) |