summaryrefslogtreecommitdiff
path: root/compiler/parser
diff options
context:
space:
mode:
authorRupert Horlick <ruperthorlick@gmail.com>2017-03-02 16:35:31 -0500
committerBen Gamari <ben@smart-cactus.org>2017-03-02 19:58:01 -0500
commit4b1f0721ce164d079848d1f8890630dbbf4cbf7a (patch)
tree4f30c8a9afe63421c92bbdb7fcadee003c2a1ee8 /compiler/parser
parent27bf6b6857b181cd70402829a10d78e8d205962f (diff)
downloadhaskell-4b1f0721ce164d079848d1f8890630dbbf4cbf7a.tar.gz
Add suggestion for PatternSynonyms parse error (fixes #12429)
Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3261
Diffstat (limited to 'compiler/parser')
-rw-r--r--compiler/parser/Lexer.x4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x
index 3c5d98d054..6f91f44241 100644
--- a/compiler/parser/Lexer.x
+++ b/compiler/parser/Lexer.x
@@ -2394,8 +2394,12 @@ srcParseErr options buf len
$$ ppWhen (token == "=")
(text "Perhaps you need a 'let' in a 'do' block?"
$$ text "e.g. 'let x = 5' instead of 'x = 5'")
+ $$ ppWhen (not ps_enabled && pattern == "pattern") -- #12429
+ (text "Perhaps you intended to use PatternSynonyms")
where token = lexemeToString (offsetBytes (-len) buf) len
+ pattern = lexemeToString (offsetBytes (-len - 8) buf) 7
th_enabled = extopt LangExt.TemplateHaskell options
+ ps_enabled = extopt LangExt.PatternSynonyms options
-- Report a parse failure, giving the span of the previous token as
-- the location of the error. This is the entry point for errors