on master help sign in
Improve the error message in case of a parse error (take 2)
44cef92Mark Karpov
expected-failures/aws.txt+2−4
@@ -1,11 +1,9 @@
1−Parsing of source code failed:
1+The GHC parser (in Haddock mode) failed:
2 Examples/PutBucketNearLine.hs:5:1-6
2 Examples/PutBucketNearLine.hs:5:1-6
3 parse error on input `import'
3 parse error on input `import'
4−GHC parser failed on this input, it is not an Ormolu bug.
5
4
6−Parsing of source code failed:
5+The GHC parser (in Haddock mode) failed:
7 Examples/Sqs.hs:(88,3)-(90,4)
6 Examples/Sqs.hs:(88,3)-(90,4)
8 parse error on input `{- | Let's make sure the queue was actually deleted and that the same number of queues exist at when
7 parse error on input `{- | Let's make sure the queue was actually deleted and that the same number of queues exist at when
9 | the program ends as when it started.
8 | the program ends as when it started.
10 -}'
9 -}'
11−GHC parser failed on this input, it is not an Ormolu bug.
expected-failures/distributed-process.txt+2−4
@@ -1,9 +1,7 @@
1−Parsing of source code failed:
1+The GHC parser (in Haddock mode) failed:
2 benchmarks/Channels.hs:2:1-6
2 benchmarks/Channels.hs:2:1-6
3 parse error on input `import'
3 parse error on input `import'
4−GHC parser failed on this input, it is not an Ormolu bug.
5
4
6−Parsing of source code failed:
5+The GHC parser (in Haddock mode) failed:
7 benchmarks/Spawns.hs:5:1-6
6 benchmarks/Spawns.hs:5:1-6
8 parse error on input `import'
7 parse error on input `import'
9−GHC parser failed on this input, it is not an Ormolu bug.
expected-failures/esqueleto.txt+2−4
@@ -1,9 +1,7 @@
1−Parsing of source code failed:
1+The GHC parser (in Haddock mode) failed:
2 src/Database/Esqueleto/Internal/Internal.hs:379:1
2 src/Database/Esqueleto/Internal/Internal.hs:379:1
3 lexical error in string/character literal at character 's'
3 lexical error in string/character literal at character 's'
4−GHC parser failed on this input, it is not an Ormolu bug.
5
4
6−Parsing of source code failed:
5+The GHC parser (in Haddock mode) failed:
7 test/PostgreSQL/Test.hs:510:9-41
6 test/PostgreSQL/Test.hs:510:9-41
8 parse error on input `-- | Check the result is not null'
7 parse error on input `-- | Check the result is not null'
9−GHC parser failed on this input, it is not an Ormolu bug.
expected-failures/fay.txt+4−8
@@ -1,22 +1,18 @@
1−Parsing of source code failed:
1+The GHC parser (in Haddock mode) failed:
2 examples/Separated.hs:12:1-6
2 examples/Separated.hs:12:1-6
3 parse error on input `module'
3 parse error on input `module'
4−GHC parser failed on this input, it is not an Ormolu bug.
5
4
6−Parsing of source code failed:
5+The GHC parser (in Haddock mode) failed:
7 examples/calc.hs:(4,1)-(6,2)
6 examples/calc.hs:(4,1)-(6,2)
8 parse error on input `-- $ fay -p --html-wrapper --html-js-lib jquery.min.js examples/calc.hs
7 parse error on input `-- $ fay -p --html-wrapper --html-js-lib jquery.min.js examples/calc.hs
9-- You also need to download jquery.min.js.
8-- You also need to download jquery.min.js.
10--'
9--'
11−GHC parser failed on this input, it is not an Ormolu bug.
12
10
13−Parsing of source code failed:
11+The GHC parser (in Haddock mode) failed:
14 examples/canvaswater.hs:(6,1)-(7,17)
12 examples/canvaswater.hs:(6,1)-(7,17)
15 parse error on input `-- | A demonstration of Fay using the canvas element to display a
13 parse error on input `-- | A demonstration of Fay using the canvas element to display a
16-- simple effect.'
14-- simple effect.'
17−GHC parser failed on this input, it is not an Ormolu bug.
18
15
19−Parsing of source code failed:
16+The GHC parser (in Haddock mode) failed:
20 examples/data.hs:9:1-6
17 examples/data.hs:9:1-6
21 parse error on input `module'
18 parse error on input `module'
22−GHC parser failed on this input, it is not an Ormolu bug.
expected-failures/idris.txt+2−4
@@ -52,19 +52,17 @@ Formatting is not idempotent:
52 after: "timisation\n = PETra"
52 after: "timisation\n = PETra"
53Please, consider reporting the bug.
53Please, consider reporting the bug.
54
54
55−Parsing of source code failed:
55+The GHC parser (in Haddock mode) failed:
56 src/Idris/Parser.hs:1052:1
56 src/Idris/Parser.hs:1052:1
57 parse error on input `@'
57 parse error on input `@'
58−GHC parser failed on this input, it is not an Ormolu bug.
59
58
60AST of input and AST of formatted code differ.
59AST of input and AST of formatted code differ.
61 at src/Idris/Parser/Data.hs:281:1-29
60 at src/Idris/Parser/Data.hs:281:1-29
62Please, consider reporting the bug.
61Please, consider reporting the bug.
63
62
64−Parsing of source code failed:
63+The GHC parser (in Haddock mode) failed:
65 src/Idris/Parser/Expr.hs:75:1
64 src/Idris/Parser/Expr.hs:75:1
66 parse error on input `@'
65 parse error on input `@'
67−GHC parser failed on this input, it is not an Ormolu bug.
68
66
69Formatting is not idempotent:
67Formatting is not idempotent:
70 src/Idris/PartialEval.hs<rendered>:280:42
68 src/Idris/PartialEval.hs<rendered>:280:42
expected-failures/lens.txt+1−2
@@ -1,4 +1,3 @@
1−Parsing of source code failed:
1+The GHC parser (in Haddock mode) failed:
2 src/Control/Exception/Lens.hs:180:13-37
2 src/Control/Exception/Lens.hs:180:13-37
3 parse error on input `AllocationLimitExceeded__'
3 parse error on input `AllocationLimitExceeded__'
4−GHC parser failed on this input, it is not an Ormolu bug.
expected-failures/pandoc.txt+1−2
@@ -1,7 +1,6 @@
1−Parsing of source code failed:
1+The GHC parser (in Haddock mode) failed:
2 benchmark/weigh-pandoc.hs:14:1-6
2 benchmark/weigh-pandoc.hs:14:1-6
3 parse error on input `import'
3 parse error on input `import'
4−GHC parser failed on this input, it is not an Ormolu bug.
5
4
6Formatting is not idempotent:
5Formatting is not idempotent:
7 src/Text/Pandoc/Readers/Vimwiki.hs<rendered>:615:19
6 src/Text/Pandoc/Readers/Vimwiki.hs<rendered>:615:19
expected-failures/purescript.txt+4−8
@@ -1,22 +1,18 @@
1−Parsing of source code failed:
1+The GHC parser (in Haddock mode) failed:
2 src/Language/PureScript/AST/Declarations.hs:478:1-17
2 src/Language/PureScript/AST/Declarations.hs:478:1-17
3 Invalid type signature: pattern ValueDecl :: ...
3 Invalid type signature: pattern ValueDecl :: ...
4Perhaps you meant to use PatternSynonyms?
4Perhaps you meant to use PatternSynonyms?
5−GHC parser failed on this input, it is not an Ormolu bug.
6
5
7−Parsing of source code failed:
6+The GHC parser (in Haddock mode) failed:
8 src/Language/PureScript/AST/SourcePos.hs:101:1-22
7 src/Language/PureScript/AST/SourcePos.hs:101:1-22
9 Invalid type signature: pattern NullSourceSpan :: ...
8 Invalid type signature: pattern NullSourceSpan :: ...
10Perhaps you meant to use PatternSynonyms?
9Perhaps you meant to use PatternSynonyms?
11−GHC parser failed on this input, it is not an Ormolu bug.
12
10
13−Parsing of source code failed:
11+The GHC parser (in Haddock mode) failed:
14 src/Language/PureScript/Constants.hs:42:1-15
12 src/Language/PureScript/Constants.hs:42:1-15
15 Invalid type signature: pattern Discard :: ...
13 Invalid type signature: pattern Discard :: ...
16Perhaps you meant to use PatternSynonyms?
14Perhaps you meant to use PatternSynonyms?
17−GHC parser failed on this input, it is not an Ormolu bug.
18
15
19−Parsing of source code failed:
16+The GHC parser (in Haddock mode) failed:
20 src/Language/PureScript/Crash.hs:16:1-6
17 src/Language/PureScript/Crash.hs:16:1-6
21 parse error on input `import'
18 parse error on input `import'
22−GHC parser failed on this input, it is not an Ormolu bug.
src/Ormolu/Exception.hs+1−2
@@ -41,8 +41,7 @@ instance Exception OrmoluException where
41 withIndent path
41 withIndent path
42 ]
42 ]
43 OrmoluParsingFailed s e ->
43 OrmoluParsingFailed s e ->
44− showParsingErr "Parsing of source code failed:" s [e]
44+ showParsingErr "The GHC parser (in Haddock mode) failed:" s [e]
45− ++ "GHC parser failed on this input, it is not an Ormolu bug.\n"
46 OrmoluOutputParsingFailed s e ->
45 OrmoluOutputParsingFailed s e ->
47 showParsingErr "Parsing of formatted code failed:" s [e]
46 showParsingErr "Parsing of formatted code failed:" s [e]
48 ++ "Please, consider reporting the bug.\n"
47 ++ "Please, consider reporting the bug.\n"