diff options
author | Vladislav Zavialov <vlad.z.4096@gmail.com> | 2020-05-29 22:17:55 +0300 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-06-01 06:41:18 -0400 |
commit | c68e7e1e4c0bddd8b07cd8a2b3651c8cbb4b7851 (patch) | |
tree | 1a9c315982b9e089cde38e5ea062eb2ab078ad9c /testsuite/tests/parser/should_fail | |
parent | 0fde53770cacb0d54f0583707ef7ceec78f92c41 (diff) | |
download | haskell-c68e7e1e4c0bddd8b07cd8a2b3651c8cbb4b7851.tar.gz |
Improve parser error messages for TemplateHaskellQuotes
While [e| |], [t| |], [d| |], and so on, steal syntax from list
comprehensions, [| |] and [|| ||] do not steal any syntax.
Thus we can improve error messages by always accepting them in the
lexer. Turns out the renamer already performs necessary validation.
Diffstat (limited to 'testsuite/tests/parser/should_fail')
-rw-r--r-- | testsuite/tests/parser/should_fail/T18251e.hs | 3 | ||||
-rw-r--r-- | testsuite/tests/parser/should_fail/T18251e.stderr | 5 | ||||
-rw-r--r-- | testsuite/tests/parser/should_fail/all.T | 1 |
3 files changed, 9 insertions, 0 deletions
diff --git a/testsuite/tests/parser/should_fail/T18251e.hs b/testsuite/tests/parser/should_fail/T18251e.hs new file mode 100644 index 0000000000..c471a9601c --- /dev/null +++ b/testsuite/tests/parser/should_fail/T18251e.hs @@ -0,0 +1,3 @@ +module T18251e where + +a = [| id |] diff --git a/testsuite/tests/parser/should_fail/T18251e.stderr b/testsuite/tests/parser/should_fail/T18251e.stderr new file mode 100644 index 0000000000..7b869c09c8 --- /dev/null +++ b/testsuite/tests/parser/should_fail/T18251e.stderr @@ -0,0 +1,5 @@ + +T18251e.hs:3:5: error: + • Syntax error on [| id |] + Perhaps you intended to use TemplateHaskell or TemplateHaskellQuotes + • In the Template Haskell quotation [| id |] diff --git a/testsuite/tests/parser/should_fail/all.T b/testsuite/tests/parser/should_fail/all.T index 3b31682cb2..9142eb0393 100644 --- a/testsuite/tests/parser/should_fail/all.T +++ b/testsuite/tests/parser/should_fail/all.T @@ -171,4 +171,5 @@ test('T18251a', normal, compile_fail, ['']) test('T18251b', normal, compile_fail, ['']) test('T18251c', normal, compile_fail, ['']) test('T18251d', normal, compile_fail, ['']) +test('T18251e', normal, compile_fail, ['']) test('T18251f', normal, compile_fail, ['']) |