summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghci
diff options
context:
space:
mode:
authorNingning Xie <xnningxie@gmail.com>2018-10-28 12:26:12 -0400
committerBen Gamari <ben@smart-cactus.org>2018-10-28 13:40:13 -0400
commitc4a876d5f99554e87400946dd26ca11819d11673 (patch)
treeb22e6f689a886c02682af21653aa045e17c6b0d8 /testsuite/tests/ghci
parent134de45117bdbb031f513734b84403443e083fbe (diff)
downloadhaskell-c4a876d5f99554e87400946dd26ca11819d11673.tar.gz
Fix `:k` command: add validity checking
Summary: This patch fixes #15806, where we found that the `:k` command in GHCi misses a validity checking for the type. Missing validity checking causes `:k` to accept types that are not validated. For example, `:k (Maybe (forall a. a -> a))` (incorrectly) returns `*`, while impredictivity of type instantiation shouldn't be allowed. Test Plan: ./validate Reviewers: simonpj, goldfire, bgamari Reviewed By: bgamari Subscribers: rwbarton, carter GHC Trac Issues: #15806 Differential Revision: https://phabricator.haskell.org/D5265
Diffstat (limited to 'testsuite/tests/ghci')
-rw-r--r--testsuite/tests/ghci/should_run/T15806.script3
-rw-r--r--testsuite/tests/ghci/should_run/T15806.stderr3
-rw-r--r--testsuite/tests/ghci/should_run/T15806.stdout1
-rw-r--r--testsuite/tests/ghci/should_run/all.T1
4 files changed, 8 insertions, 0 deletions
diff --git a/testsuite/tests/ghci/should_run/T15806.script b/testsuite/tests/ghci/should_run/T15806.script
new file mode 100644
index 0000000000..71f0dee143
--- /dev/null
+++ b/testsuite/tests/ghci/should_run/T15806.script
@@ -0,0 +1,3 @@
+:set -XRankNTypes
+:k (Maybe Int)
+:k (Maybe (forall a. a -> a)) \ No newline at end of file
diff --git a/testsuite/tests/ghci/should_run/T15806.stderr b/testsuite/tests/ghci/should_run/T15806.stderr
new file mode 100644
index 0000000000..b7e0b4be56
--- /dev/null
+++ b/testsuite/tests/ghci/should_run/T15806.stderr
@@ -0,0 +1,3 @@
+<interactive>:1:1: error:
+ Illegal polymorphic type: forall a. a -> a
+ GHC doesn't yet support impredicative polymorphism \ No newline at end of file
diff --git a/testsuite/tests/ghci/should_run/T15806.stdout b/testsuite/tests/ghci/should_run/T15806.stdout
new file mode 100644
index 0000000000..f4e9f230dc
--- /dev/null
+++ b/testsuite/tests/ghci/should_run/T15806.stdout
@@ -0,0 +1 @@
+(Maybe Int) :: * \ No newline at end of file
diff --git a/testsuite/tests/ghci/should_run/all.T b/testsuite/tests/ghci/should_run/all.T
index 70e200c0d1..855b603656 100644
--- a/testsuite/tests/ghci/should_run/all.T
+++ b/testsuite/tests/ghci/should_run/all.T
@@ -35,3 +35,4 @@ test('T14963a', just_ghci, ghci_script, ['T14963a.script'])
test('T14963b', just_ghci, ghci_script, ['T14963b.script'])
test('T14963c', [extra_hc_opts("-fdefer-type-errors")], ghci_script, ['T14963c.script'])
test('T15007', just_ghci, ghci_script, ['T15007.script'])
+test('T15806', just_ghci, ghci_script, ['T15806.script'])