summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2019-03-04 09:52:14 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-03-06 16:05:45 -0500
commit78dd04f9126dc5df966070b8db4b39a517a9d99f (patch)
tree151aeab576581094c09d293a0f4157fcb3e8521b /testsuite/tests
parenta4944d8d98770b869f6aa5fb667877c56c3f8825 (diff)
downloadhaskell-78dd04f9126dc5df966070b8db4b39a517a9d99f.tar.gz
Fix #16385 by appending _maybe to a use of lookupGlobalOcc
`instance forall c. c` claimed that `c` was out of scope because the renamer was invoking `lookupGlobalOcc` on `c` (in `RnNames.getLocalNonValBinders`) without binding `c` first. To avoid this, this patch changes GHC to invoke `lookupGlobalOcc_maybe` on `c` instead, and if that returns `Nothing`, then bail out, resulting in a better error message.
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/rename/should_fail/T16385.hs5
-rw-r--r--testsuite/tests/rename/should_fail/T16385.stderr8
-rw-r--r--testsuite/tests/rename/should_fail/all.T1
3 files changed, 14 insertions, 0 deletions
diff --git a/testsuite/tests/rename/should_fail/T16385.hs b/testsuite/tests/rename/should_fail/T16385.hs
new file mode 100644
index 0000000000..174d406c9e
--- /dev/null
+++ b/testsuite/tests/rename/should_fail/T16385.hs
@@ -0,0 +1,5 @@
+{-# LANGUAGE ScopedTypeVariables #-}
+module T16385 where
+
+instance c
+instance forall c. c
diff --git a/testsuite/tests/rename/should_fail/T16385.stderr b/testsuite/tests/rename/should_fail/T16385.stderr
new file mode 100644
index 0000000000..b80275643c
--- /dev/null
+++ b/testsuite/tests/rename/should_fail/T16385.stderr
@@ -0,0 +1,8 @@
+
+T16385.hs:4:10: error:
+ • Instance head is not headed by a class: c
+ • In the instance declaration for ‘c’
+
+T16385.hs:5:10: error:
+ • Instance head is not headed by a class: c
+ • In the instance declaration for ‘c’
diff --git a/testsuite/tests/rename/should_fail/all.T b/testsuite/tests/rename/should_fail/all.T
index af382b1a0c..4f1b1fa34b 100644
--- a/testsuite/tests/rename/should_fail/all.T
+++ b/testsuite/tests/rename/should_fail/all.T
@@ -146,3 +146,4 @@ test('T16114', normal, compile_fail, [''])
test('T16116b', normal, compile_fail, [''])
test('ExplicitForAllRules2', normal, compile_fail, [''])
test('T15957_Fail', normal, compile_fail, ['-Werror -Wall -Wno-missing-signatures'])
+test('T16385', normal, compile_fail, [''])