summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghci
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2020-12-31 17:01:46 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-01-22 15:00:07 -0500
commit34950fb84b85d964e30ae9eca995b84fbf4fd165 (patch)
tree06a51660ddfe8a9504d4483f167e1de451ad86f6 /testsuite/tests/ghci
parenta255b4e38918065ac028789872e53239ac30ae1a (diff)
downloadhaskell-34950fb84b85d964e30ae9eca995b84fbf4fd165.tar.gz
Fix error recovery in solveEqualities
As #19142 showed, with -fdefer-type-errors we were allowing compilation to proceed despite a fatal kind error. This patch fixes it, as described in the new note in GHC.Tc.Solver, Note [Wrapping failing kind equalities] Also fixes #19158 Also when checking default( ty1, ty2, ... ) only consider a possible default (C ty2) if ty2 is kind-compatible with C. Previously we could form kind-incompatible constraints, with who knows what kind of chaos resulting. (Actually, no chaos results, but that's only by accident. It's plain wrong to form the constraint (Num Either) for example.) I just happened to notice this during fixing #19142.
Diffstat (limited to 'testsuite/tests/ghci')
-rw-r--r--testsuite/tests/ghci/scripts/T19158.script3
-rw-r--r--testsuite/tests/ghci/scripts/T19158.stderr6
-rwxr-xr-xtestsuite/tests/ghci/scripts/all.T2
3 files changed, 11 insertions, 0 deletions
diff --git a/testsuite/tests/ghci/scripts/T19158.script b/testsuite/tests/ghci/scripts/T19158.script
new file mode 100644
index 0000000000..81d392cf43
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T19158.script
@@ -0,0 +1,3 @@
+:set -fdefer-type-errors
+:set -XTypeApplications
+:t id @Maybe
diff --git a/testsuite/tests/ghci/scripts/T19158.stderr b/testsuite/tests/ghci/scripts/T19158.stderr
new file mode 100644
index 0000000000..9b15a102e8
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T19158.stderr
@@ -0,0 +1,6 @@
+
+<interactive>:1:5: error:
+ • Expecting one more argument to ‘Maybe’
+ Expected a type, but ‘Maybe’ has kind ‘* -> *’
+ • In the type ‘Maybe’
+ In the expression: id @Maybe
diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T
index f5c1a4ca39..08a6c4ee6a 100755
--- a/testsuite/tests/ghci/scripts/all.T
+++ b/testsuite/tests/ghci/scripts/all.T
@@ -327,3 +327,5 @@ test('T18644', normal, ghci_script, ['T18644.script'])
test('T18755', normal, ghci_script, ['T18755.script'])
test('T18828', normal, ghci_script, ['T18828.script'])
test('T19197', normal, ghci_script, ['T19197.script'])
+test('T19158', normal, ghci_script, ['T19158.script'])
+