summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
authorAlfredo Di Napoli <alfredo@well-typed.com>2021-04-19 14:29:18 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-05-26 16:03:15 -0400
commitcdbce8fc22448837e53515946f16e9571e06f412 (patch)
treea07372a960e55eaeff036ed717272b47f821711b /testsuite/tests
parent2023b344a7567492881745609c494a9427dc8c30 (diff)
downloadhaskell-cdbce8fc22448837e53515946f16e9571e06f412.tar.gz
Support new parser types in GHC
This commit converts the lexers and all the parser machinery to use the new parser types and diagnostics infrastructure. Furthermore, it cleans up the way the parser code was emitting hints. As a result of this systematic approach, the test output of the `InfixAppPatErr` and `T984` tests have been changed. Previously they would emit a `SuggestMissingDo` hint, but this was not at all helpful in resolving the error, and it was even confusing by just looking at the original program that triggered the errors. Update haddock submodule
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/driver/werror.stderr2
-rw-r--r--testsuite/tests/mdo/should_fail/mdofail005.stderr2
-rw-r--r--testsuite/tests/parser/should_compile/T9723a.stderr2
-rw-r--r--testsuite/tests/parser/should_compile/T9723b.stderr2
-rw-r--r--testsuite/tests/parser/should_compile/read043.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/InfixAppPatErr.stderr1
-rw-r--r--testsuite/tests/parser/should_fail/NoBlockArgumentsFail.stderr5
-rw-r--r--testsuite/tests/parser/should_fail/NoBlockArgumentsFail2.stderr5
-rw-r--r--testsuite/tests/parser/should_fail/NoBlockArgumentsFail3.stderr5
-rw-r--r--testsuite/tests/parser/should_fail/NoBlockArgumentsFailArrowCmds.stderr5
-rw-r--r--testsuite/tests/parser/should_fail/T12429.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/T12610.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/T16270.stderr12
-rw-r--r--testsuite/tests/parser/should_fail/T8501a.stderr5
-rw-r--r--testsuite/tests/parser/should_fail/T8501b.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/T984.stderr1
-rw-r--r--testsuite/tests/parser/should_fail/readFail007.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/readFail040.stderr2
-rw-r--r--testsuite/tests/parser/should_run/CountAstDeps.stdout3
-rw-r--r--testsuite/tests/parser/should_run/CountParserDeps.stdout3
-rw-r--r--testsuite/tests/regalloc/regalloc_unit_tests.hs4
-rw-r--r--testsuite/tests/warnings/should_compile/T9230.stderr2
22 files changed, 36 insertions, 35 deletions
diff --git a/testsuite/tests/driver/werror.stderr b/testsuite/tests/driver/werror.stderr
index 7af5fb086f..2ca8354a91 100644
--- a/testsuite/tests/driver/werror.stderr
+++ b/testsuite/tests/driver/werror.stderr
@@ -11,7 +11,7 @@ werror.hs:7:13: error: [-Wname-shadowing (in -Wall), -Werror=name-shadowing]
werror.hs:8:1: error: [-Wtabs (in -Wdefault), -Werror=tabs]
Tab character found here.
- Please use spaces instead.
+ Suggested fix: Please use spaces instead.
werror.hs:10:1: error: [-Wmissing-signatures (in -Wall), -Werror=missing-signatures]
Top-level binding with no type signature: f :: [a1] -> [a2]
diff --git a/testsuite/tests/mdo/should_fail/mdofail005.stderr b/testsuite/tests/mdo/should_fail/mdofail005.stderr
index 0ebead149f..18e2e4ae9d 100644
--- a/testsuite/tests/mdo/should_fail/mdofail005.stderr
+++ b/testsuite/tests/mdo/should_fail/mdofail005.stderr
@@ -1,4 +1,4 @@
mdofail005.hs:11:14: error:
parse error on input ‘<-’
- Perhaps you intended to use RecursiveDo
+ Suggested fix: Perhaps you intended to use RecursiveDo
diff --git a/testsuite/tests/parser/should_compile/T9723a.stderr b/testsuite/tests/parser/should_compile/T9723a.stderr
index e3a2ede74f..5fdfdd9f22 100644
--- a/testsuite/tests/parser/should_compile/T9723a.stderr
+++ b/testsuite/tests/parser/should_compile/T9723a.stderr
@@ -1,4 +1,4 @@
T9723a.hs:8:5: warning: [-Wtabs (in -Wdefault)]
Tab character found here.
- Please use spaces instead.
+ Suggested fix: Please use spaces instead.
diff --git a/testsuite/tests/parser/should_compile/T9723b.stderr b/testsuite/tests/parser/should_compile/T9723b.stderr
index 380b2d8f88..c83b48e8a4 100644
--- a/testsuite/tests/parser/should_compile/T9723b.stderr
+++ b/testsuite/tests/parser/should_compile/T9723b.stderr
@@ -1,4 +1,4 @@
T9723b.hs:10:5: warning: [-Wtabs (in -Wdefault)]
Tab character found here, and in six further locations.
- Please use spaces instead.
+ Suggested fix: Please use spaces instead.
diff --git a/testsuite/tests/parser/should_compile/read043.stderr b/testsuite/tests/parser/should_compile/read043.stderr
index 9e792e7409..a551294064 100644
--- a/testsuite/tests/parser/should_compile/read043.stderr
+++ b/testsuite/tests/parser/should_compile/read043.stderr
@@ -1,4 +1,4 @@
read043.hs:8:5: warning: [-Wtabs (in -Wdefault)]
Tab character found here, and in one further location.
- Please use spaces instead.
+ Suggested fix: Please use spaces instead.
diff --git a/testsuite/tests/parser/should_fail/InfixAppPatErr.stderr b/testsuite/tests/parser/should_fail/InfixAppPatErr.stderr
index f50166fd41..4651dae571 100644
--- a/testsuite/tests/parser/should_fail/InfixAppPatErr.stderr
+++ b/testsuite/tests/parser/should_fail/InfixAppPatErr.stderr
@@ -1,4 +1,3 @@
InfixAppPatErr.hs:2:7: error:
do-notation in pattern
- Possibly caused by a missing 'do'?
diff --git a/testsuite/tests/parser/should_fail/NoBlockArgumentsFail.stderr b/testsuite/tests/parser/should_fail/NoBlockArgumentsFail.stderr
index 813271bdb9..bdb3301dea 100644
--- a/testsuite/tests/parser/should_fail/NoBlockArgumentsFail.stderr
+++ b/testsuite/tests/parser/should_fail/NoBlockArgumentsFail.stderr
@@ -2,5 +2,6 @@
NoBlockArgumentsFail.hs:6:17: error:
Unexpected do block in function application:
do return ()
- You could write it with parentheses
- Or perhaps you meant to enable BlockArguments?
+ Suggested fixes:
+ Use parentheses.
+ Perhaps you intended to use BlockArguments
diff --git a/testsuite/tests/parser/should_fail/NoBlockArgumentsFail2.stderr b/testsuite/tests/parser/should_fail/NoBlockArgumentsFail2.stderr
index 0361369774..5b3a697f2e 100644
--- a/testsuite/tests/parser/should_fail/NoBlockArgumentsFail2.stderr
+++ b/testsuite/tests/parser/should_fail/NoBlockArgumentsFail2.stderr
@@ -2,5 +2,6 @@
NoBlockArgumentsFail2.hs:6:22: error:
Unexpected lambda expression in function application:
\ x -> print x
- You could write it with parentheses
- Or perhaps you meant to enable BlockArguments?
+ Suggested fixes:
+ Use parentheses.
+ Perhaps you intended to use BlockArguments
diff --git a/testsuite/tests/parser/should_fail/NoBlockArgumentsFail3.stderr b/testsuite/tests/parser/should_fail/NoBlockArgumentsFail3.stderr
index e285e6ea72..93a3c99d49 100644
--- a/testsuite/tests/parser/should_fail/NoBlockArgumentsFail3.stderr
+++ b/testsuite/tests/parser/should_fail/NoBlockArgumentsFail3.stderr
@@ -2,5 +2,6 @@
NoBlockArgumentsFail3.hs:7:22: error:
Unexpected lambda-case expression in function application:
\case Just 3 -> print x
- You could write it with parentheses
- Or perhaps you meant to enable BlockArguments?
+ Suggested fixes:
+ Use parentheses.
+ Perhaps you intended to use BlockArguments
diff --git a/testsuite/tests/parser/should_fail/NoBlockArgumentsFailArrowCmds.stderr b/testsuite/tests/parser/should_fail/NoBlockArgumentsFailArrowCmds.stderr
index 2a99cda137..504f4c738f 100644
--- a/testsuite/tests/parser/should_fail/NoBlockArgumentsFailArrowCmds.stderr
+++ b/testsuite/tests/parser/should_fail/NoBlockArgumentsFailArrowCmds.stderr
@@ -2,5 +2,6 @@
NoBlockArgumentsFailArrowCmds.hs:7:27: error:
Unexpected lambda command in function application:
\ () -> () >- returnA
- You could write it with parentheses
- Or perhaps you meant to enable BlockArguments?
+ Suggested fixes:
+ Use parentheses.
+ Perhaps you intended to use BlockArguments
diff --git a/testsuite/tests/parser/should_fail/T12429.stderr b/testsuite/tests/parser/should_fail/T12429.stderr
index e29388f3e5..eab51a5646 100644
--- a/testsuite/tests/parser/should_fail/T12429.stderr
+++ b/testsuite/tests/parser/should_fail/T12429.stderr
@@ -1,4 +1,4 @@
T12429.hs:2:29: error:
parse error on input ‘Y’
- Perhaps you intended to use PatternSynonyms
+ Suggested fix: Perhaps you intended to use PatternSynonyms
diff --git a/testsuite/tests/parser/should_fail/T12610.stderr b/testsuite/tests/parser/should_fail/T12610.stderr
index 29d9b26cf2..2eb924bfb0 100644
--- a/testsuite/tests/parser/should_fail/T12610.stderr
+++ b/testsuite/tests/parser/should_fail/T12610.stderr
@@ -1,6 +1,6 @@
T12610.hs:5:1: warning: [-Wtabs (in -Wdefault)]
Tab character found here.
- Please use spaces instead.
+ Suggested fix: Please use spaces instead.
T12610.hs:5:9: parse error on input ‘y’
diff --git a/testsuite/tests/parser/should_fail/T16270.stderr b/testsuite/tests/parser/should_fail/T16270.stderr
index 323d9c93e3..40a986879e 100644
--- a/testsuite/tests/parser/should_fail/T16270.stderr
+++ b/testsuite/tests/parser/should_fail/T16270.stderr
@@ -4,7 +4,7 @@ T16270.hs:3:13: warning: [-Wdeprecated-flags (in -Wdefault)]
T16270.hs:8:1: warning: [-Wtabs (in -Wdefault)]
Tab character found here, and in five further locations.
- Please use spaces instead.
+ Suggested fix: Please use spaces instead.
T16270.hs:8:12: error:
Unexpected semi-colons in conditional:
@@ -14,14 +14,16 @@ T16270.hs:8:12: error:
T16270.hs:13:8: error:
Unexpected do block in function application:
do 1
- You could write it with parentheses
- Or perhaps you meant to enable BlockArguments?
+ Suggested fixes:
+ Use parentheses.
+ Perhaps you intended to use BlockArguments
T16270.hs:14:8: error:
Unexpected lambda expression in function application:
\ x -> x
- You could write it with parentheses
- Or perhaps you meant to enable BlockArguments?
+ Suggested fixes:
+ Use parentheses.
+ Perhaps you intended to use BlockArguments
T16270.hs:18:22: error:
Illegal record syntax (use TraditionalRecordSyntax): {fst :: a,
diff --git a/testsuite/tests/parser/should_fail/T8501a.stderr b/testsuite/tests/parser/should_fail/T8501a.stderr
index 44431fca77..1c899e8bca 100644
--- a/testsuite/tests/parser/should_fail/T8501a.stderr
+++ b/testsuite/tests/parser/should_fail/T8501a.stderr
@@ -1,5 +1,6 @@
T8501a.hs:5:3: error:
Parse error in pattern: rec
- Possibly caused by a missing 'do'?
- Perhaps you intended to use RecursiveDo
+ Suggested fixes:
+ Perhaps you intended to use RecursiveDo
+ Possibly caused by a missing 'do'?
diff --git a/testsuite/tests/parser/should_fail/T8501b.stderr b/testsuite/tests/parser/should_fail/T8501b.stderr
index e9e4b5ec91..15a631c177 100644
--- a/testsuite/tests/parser/should_fail/T8501b.stderr
+++ b/testsuite/tests/parser/should_fail/T8501b.stderr
@@ -1,4 +1,4 @@
T8501b.hs:5:9: error:
parse error on input ‘<-’
- Perhaps you intended to use RecursiveDo
+ Suggested fix: Perhaps you intended to use RecursiveDo
diff --git a/testsuite/tests/parser/should_fail/T984.stderr b/testsuite/tests/parser/should_fail/T984.stderr
index 6d25a36e9e..aaa4f532a9 100644
--- a/testsuite/tests/parser/should_fail/T984.stderr
+++ b/testsuite/tests/parser/should_fail/T984.stderr
@@ -1,4 +1,3 @@
T984.hs:6:9: error:
(case ... of ...)-syntax in pattern
- Possibly caused by a missing 'do'?
diff --git a/testsuite/tests/parser/should_fail/readFail007.stderr b/testsuite/tests/parser/should_fail/readFail007.stderr
index bd6d92ed58..ab4140f52a 100644
--- a/testsuite/tests/parser/should_fail/readFail007.stderr
+++ b/testsuite/tests/parser/should_fail/readFail007.stderr
@@ -1,4 +1,4 @@
readFail007.hs:6:4:
Parse error in pattern: 2 + 2
- Possibly caused by a missing 'do'?
+ Suggested fix: Possibly caused by a missing 'do'?
diff --git a/testsuite/tests/parser/should_fail/readFail040.stderr b/testsuite/tests/parser/should_fail/readFail040.stderr
index 663220da26..3ba58a4adb 100644
--- a/testsuite/tests/parser/should_fail/readFail040.stderr
+++ b/testsuite/tests/parser/should_fail/readFail040.stderr
@@ -1,4 +1,4 @@
readFail040.hs:7:11: error:
parse error on input ‘<-’
- Perhaps you intended to use RecursiveDo
+ Suggested fix: Perhaps you intended to use RecursiveDo
diff --git a/testsuite/tests/parser/should_run/CountAstDeps.stdout b/testsuite/tests/parser/should_run/CountAstDeps.stdout
index c898dd7424..51df841ab0 100644
--- a/testsuite/tests/parser/should_run/CountAstDeps.stdout
+++ b/testsuite/tests/parser/should_run/CountAstDeps.stdout
@@ -1,4 +1,4 @@
-Found 258 Language.Haskell.Syntax module dependencies
+Found 257 Language.Haskell.Syntax module dependencies
GHC.Builtin.Names
GHC.Builtin.PrimOps
GHC.Builtin.Types
@@ -114,7 +114,6 @@ GHC.Iface.Syntax
GHC.Iface.Type
GHC.Linker.Types
GHC.Parser.Annotation
-GHC.Parser.Errors
GHC.Parser.Errors.Ppr
GHC.Parser.Errors.Types
GHC.Parser.Types
diff --git a/testsuite/tests/parser/should_run/CountParserDeps.stdout b/testsuite/tests/parser/should_run/CountParserDeps.stdout
index 05d6073262..bfd270bf00 100644
--- a/testsuite/tests/parser/should_run/CountParserDeps.stdout
+++ b/testsuite/tests/parser/should_run/CountParserDeps.stdout
@@ -1,4 +1,4 @@
-Found 264 GHC.Parser module dependencies
+Found 263 GHC.Parser module dependencies
GHC.Builtin.Names
GHC.Builtin.PrimOps
GHC.Builtin.Types
@@ -117,7 +117,6 @@ GHC.Linker.Types
GHC.Parser
GHC.Parser.Annotation
GHC.Parser.CharClass
-GHC.Parser.Errors
GHC.Parser.Errors.Ppr
GHC.Parser.Errors.Types
GHC.Parser.Lexer
diff --git a/testsuite/tests/regalloc/regalloc_unit_tests.hs b/testsuite/tests/regalloc/regalloc_unit_tests.hs
index 4e84261264..f68cd040df 100644
--- a/testsuite/tests/regalloc/regalloc_unit_tests.hs
+++ b/testsuite/tests/regalloc/regalloc_unit_tests.hs
@@ -120,11 +120,9 @@ compileCmmForRegAllocStats logger dflags' cmmFile ncgImplF us = do
-- parse the cmm file and output any warnings or errors
let fake_mod = mkHomeModule (hsc_home_unit hscEnv) (mkModuleName "fake")
(warnings, errors, parsedCmm) <- parseCmmFile dflags fake_mod (hsc_home_unit hscEnv) cmmFile
- let warningMsgs = fmap (mkParserWarn dflags') warnings
- errorMsgs = fmap mkParserErr errors
-- print parser errors or warnings
- mapM_ (printMessages logger dflags . mkMessages) [warningMsgs, errorMsgs]
+ mapM_ (printMessages logger dflags) [warnings, errors]
let initTopSRT = emptySRT thisMod
cmmGroup <- fmap snd $ cmmPipeline hscEnv initTopSRT $ fst $ fromJust parsedCmm
diff --git a/testsuite/tests/warnings/should_compile/T9230.stderr b/testsuite/tests/warnings/should_compile/T9230.stderr
index 14458ff5c3..208002033b 100644
--- a/testsuite/tests/warnings/should_compile/T9230.stderr
+++ b/testsuite/tests/warnings/should_compile/T9230.stderr
@@ -1,4 +1,4 @@
T9230.hs:5:1: warning: [-Wtabs (in -Wdefault)]
Tab character found here.
- Please use spaces instead.
+ Suggested fix: Please use spaces instead.