summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/parser/Lexer.x3
-rw-r--r--testsuite/tests/ghci/should_run/T9915.stderr5
-rw-r--r--testsuite/tests/parser/should_fail/readFail011.stderr5
-rw-r--r--testsuite/tests/parser/should_fail/readFail034.stderr5
4 files changed, 15 insertions, 3 deletions
diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x
index 1be724526f..5839a410fb 100644
--- a/compiler/parser/Lexer.x
+++ b/compiler/parser/Lexer.x
@@ -2229,6 +2229,9 @@ srcParseErr dflags buf len
(text "Perhaps you intended to use TemplateHaskell")
$$ ppWhen (token == "<-")
(text "Perhaps this statement should be within a 'do' block?")
+ $$ ppWhen (token == "=")
+ (text "Perhaps you need a 'let' in a 'do' block?"
+ $$ text "e.g. 'let x = 5' instead of 'x = 5'")
where token = lexemeToString (offsetBytes (-len) buf) len
th_enabled = xopt Opt_TemplateHaskell dflags
diff --git a/testsuite/tests/ghci/should_run/T9915.stderr b/testsuite/tests/ghci/should_run/T9915.stderr
index de2c5cb286..333f17ac81 100644
--- a/testsuite/tests/ghci/should_run/T9915.stderr
+++ b/testsuite/tests/ghci/should_run/T9915.stderr
@@ -1,2 +1,5 @@
-<interactive>:3:9: parse error on input ‘=’
+<interactive>:3:9: error:
+ parse error on input ‘=’
+ Perhaps you need a 'let' in a 'do' block?
+ e.g. 'let x = 5' instead of 'x = 5'
diff --git a/testsuite/tests/parser/should_fail/readFail011.stderr b/testsuite/tests/parser/should_fail/readFail011.stderr
index 5c5504ba9a..25accd2a19 100644
--- a/testsuite/tests/parser/should_fail/readFail011.stderr
+++ b/testsuite/tests/parser/should_fail/readFail011.stderr
@@ -1,2 +1,5 @@
-readFail011.hs:7:10: parse error on input ‘=’
+readFail011.hs:7:10: error:
+ parse error on input ‘=’
+ Perhaps you need a 'let' in a 'do' block?
+ e.g. 'let x = 5' instead of 'x = 5'
diff --git a/testsuite/tests/parser/should_fail/readFail034.stderr b/testsuite/tests/parser/should_fail/readFail034.stderr
index 027d0ca13f..75156c9ae4 100644
--- a/testsuite/tests/parser/should_fail/readFail034.stderr
+++ b/testsuite/tests/parser/should_fail/readFail034.stderr
@@ -1,2 +1,5 @@
-readFail034.hs:4:6: parse error on input ‘=’
+readFail034.hs:4:6: error:
+ parse error on input ‘=’
+ Perhaps you need a 'let' in a 'do' block?
+ e.g. 'let x = 5' instead of 'x = 5'