diff options
author | Andrei Borzenkov <andreyborzenkov2002@gmail.com> | 2022-11-21 11:57:14 +0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-11-24 17:24:51 -0500 |
commit | 86ff1523d21f27f69351f8a2d053ba9d5d98aa89 (patch) | |
tree | c4cfd8424053a84a9ccad33295b1689393f25e3f /testsuite | |
parent | 11627c422cfba5e1d84afb08f427007dbc801f10 (diff) | |
download | haskell-86ff1523d21f27f69351f8a2d053ba9d5d98aa89.tar.gz |
Convert diagnostics in GHC.Rename.Expr to proper TcRnMessage (#20115)
Problem: avoid usage of TcRnMessageUnknown
Solution:
The following `TcRnMessage` messages has been introduced:
TcRnNoRebindableSyntaxRecordDot
TcRnNoFieldPunsRecordDot
TcRnIllegalStaticExpression
TcRnIllegalStaticFormInSplice
TcRnListComprehensionDuplicateBinding
TcRnEmptyStmtsGroup
TcRnLastStmtNotExpr
TcRnUnexpectedStatementInContext
TcRnIllegalTupleSection
TcRnIllegalImplicitParameterBindings
TcRnSectionWithoutParentheses
Co-authored-by: sheaf <sam.derbyshire@gmail.com>
Diffstat (limited to 'testsuite')
22 files changed, 87 insertions, 48 deletions
diff --git a/testsuite/tests/ghci/prog011/prog011.stderr b/testsuite/tests/ghci/prog011/prog011.stderr index 328fa16192..23e5983274 100644 --- a/testsuite/tests/ghci/prog011/prog011.stderr +++ b/testsuite/tests/ghci/prog011/prog011.stderr @@ -1,4 +1,4 @@ -prog011.hx:14:22: error: +prog011.hx:14:22: [GHC-82311] error: Empty 'do' block Suggested fix: Perhaps you intended to use NondecreasingIndentation diff --git a/testsuite/tests/parser/should_fail/NondecreasingIndentationFail.stderr b/testsuite/tests/parser/should_fail/NondecreasingIndentationFail.stderr index 38c3a4cdad..075ac76ce2 100644 --- a/testsuite/tests/parser/should_fail/NondecreasingIndentationFail.stderr +++ b/testsuite/tests/parser/should_fail/NondecreasingIndentationFail.stderr @@ -1,7 +1,8 @@ -NondecreasingIndentationFail.hs:7:28: +NondecreasingIndentationFail.hs:7:28: [GHC-82311] Empty 'do' block Suggested fix: Perhaps you intended to use NondecreasingIndentation -NondecreasingIndentationFail.hs:9:28: + +NondecreasingIndentationFail.hs:9:28: [GHC-82311] Empty 'do' block Suggested fix: Perhaps you intended to use NondecreasingIndentation diff --git a/testsuite/tests/parser/should_fail/RecordDotSyntaxFail12.stderr b/testsuite/tests/parser/should_fail/RecordDotSyntaxFail12.stderr index edbfbb9432..9c49869353 100644 --- a/testsuite/tests/parser/should_fail/RecordDotSyntaxFail12.stderr +++ b/testsuite/tests/parser/should_fail/RecordDotSyntaxFail12.stderr @@ -11,26 +11,26 @@ RecordDotSyntaxFail12.hs:124:65: error: [GHC-44287] Illegal use of punning for field ‘bar’ Suggested fix: Perhaps you intended to use NamedFieldPuns -RecordDotSyntaxFail12.hs:125:11: error: - For this to work enable NamedFieldPuns. +RecordDotSyntaxFail12.hs:125:11: error: [GHC-57365] + For this to work enable NamedFieldPuns -RecordDotSyntaxFail12.hs:126:11: error: - For this to work enable NamedFieldPuns. +RecordDotSyntaxFail12.hs:126:11: error: [GHC-57365] + For this to work enable NamedFieldPuns -RecordDotSyntaxFail12.hs:127:11: error: - For this to work enable NamedFieldPuns. +RecordDotSyntaxFail12.hs:127:11: error: [GHC-57365] + For this to work enable NamedFieldPuns -RecordDotSyntaxFail12.hs:128:11: error: - For this to work enable NamedFieldPuns. +RecordDotSyntaxFail12.hs:128:11: error: [GHC-57365] + For this to work enable NamedFieldPuns -RecordDotSyntaxFail12.hs:130:11: error: - For this to work enable NamedFieldPuns. +RecordDotSyntaxFail12.hs:130:11: error: [GHC-57365] + For this to work enable NamedFieldPuns -RecordDotSyntaxFail12.hs:133:11: error: - For this to work enable NamedFieldPuns. +RecordDotSyntaxFail12.hs:133:11: error: [GHC-57365] + For this to work enable NamedFieldPuns -RecordDotSyntaxFail12.hs:134:11: error: - For this to work enable NamedFieldPuns. +RecordDotSyntaxFail12.hs:134:11: error: [GHC-57365] + For this to work enable NamedFieldPuns -RecordDotSyntaxFail12.hs:135:11: error: - For this to work enable NamedFieldPuns. +RecordDotSyntaxFail12.hs:135:11: error: [GHC-57365] + For this to work enable NamedFieldPuns diff --git a/testsuite/tests/parser/should_fail/RecordDotSyntaxFail5.stderr b/testsuite/tests/parser/should_fail/RecordDotSyntaxFail5.stderr index efe360222c..1bea8d8917 100644 --- a/testsuite/tests/parser/should_fail/RecordDotSyntaxFail5.stderr +++ b/testsuite/tests/parser/should_fail/RecordDotSyntaxFail5.stderr @@ -1,2 +1,2 @@ -RecordDotSyntaxFail5.hs:17:11: +RecordDotSyntaxFail5.hs:17:11: [GHC-65945] RebindableSyntax is required if OverloadedRecordUpdate is enabled. diff --git a/testsuite/tests/parser/should_fail/T3811g.stderr b/testsuite/tests/parser/should_fail/T3811g.stderr index 94917e52ae..900f48ecc3 100644 --- a/testsuite/tests/parser/should_fail/T3811g.stderr +++ b/testsuite/tests/parser/should_fail/T3811g.stderr @@ -1,4 +1,4 @@ -T3811g.hs:6:8: +T3811g.hs:6:8: [GHC-55814] The last statement in a 'do' block must be an expression _ <- return () diff --git a/testsuite/tests/parser/should_fail/readFail028.stderr b/testsuite/tests/parser/should_fail/readFail028.stderr index 651f778bb4..5bd8fee1e6 100644 --- a/testsuite/tests/parser/should_fail/readFail028.stderr +++ b/testsuite/tests/parser/should_fail/readFail028.stderr @@ -1,4 +1,4 @@ -readFail028.hs:4:11: +readFail028.hs:4:11: [GHC-55814] The last statement in a 'do' block must be an expression x <- return () diff --git a/testsuite/tests/parser/should_fail/readFail038.stderr b/testsuite/tests/parser/should_fail/readFail038.stderr index f9d4be89f9..6563c248fc 100644 --- a/testsuite/tests/parser/should_fail/readFail038.stderr +++ b/testsuite/tests/parser/should_fail/readFail038.stderr @@ -1,4 +1,4 @@ -readFail038.hs:5:9: +readFail038.hs:5:9: [GHC-42026] Unexpected parallel statement in a list comprehension - Use ParallelListComp + Suggested fix: Perhaps you intended to use ParallelListComp diff --git a/testsuite/tests/parser/should_fail/readFail042.stderr b/testsuite/tests/parser/should_fail/readFail042.stderr index 79d1016e78..66ec565370 100644 --- a/testsuite/tests/parser/should_fail/readFail042.stderr +++ b/testsuite/tests/parser/should_fail/readFail042.stderr @@ -1,8 +1,8 @@ -readFail042.hs:9:9: error: +readFail042.hs:9:9: [GHC-42026] error: Unexpected transform statement in a list comprehension - Use TransformListComp + Suggested fix: Perhaps you intended to use TransformListComp -readFail042.hs:9:9: error: +readFail042.hs:9:9: [GHC-42026] error: Unexpected transform statement in a list comprehension - Use TransformListComp + Suggested fix: Perhaps you intended to use TransformListComp diff --git a/testsuite/tests/parser/should_fail/readFail043.stderr b/testsuite/tests/parser/should_fail/readFail043.stderr index 803bffe7bb..1d0ddb2c4c 100644 --- a/testsuite/tests/parser/should_fail/readFail043.stderr +++ b/testsuite/tests/parser/should_fail/readFail043.stderr @@ -1,12 +1,12 @@ -readFail043.hs:9:9: error: +readFail043.hs:9:9: [GHC-42026] error: Unexpected transform statement in a list comprehension - Use TransformListComp + Suggested fix: Perhaps you intended to use TransformListComp -readFail043.hs:9:9: error: +readFail043.hs:9:9: [GHC-42026] error: Unexpected transform statement in a list comprehension - Use TransformListComp + Suggested fix: Perhaps you intended to use TransformListComp -readFail043.hs:9:9: error: +readFail043.hs:9:9: [GHC-42026] error: Unexpected transform statement in a list comprehension - Use TransformListComp + Suggested fix: Perhaps you intended to use TransformListComp diff --git a/testsuite/tests/rename/should_fail/RnEmptyStatementGroup1.hs b/testsuite/tests/rename/should_fail/RnEmptyStatementGroup1.hs new file mode 100644 index 0000000000..6c2eb3a984 --- /dev/null +++ b/testsuite/tests/rename/should_fail/RnEmptyStatementGroup1.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE TransformListComp #-} +{-# LANGUAGE Arrows #-} + +module ShouldFail where + +one = [() | then ()] + +two = do + +three = proc () -> do diff --git a/testsuite/tests/rename/should_fail/RnEmptyStatementGroup1.stderr b/testsuite/tests/rename/should_fail/RnEmptyStatementGroup1.stderr new file mode 100644 index 0000000000..835a82a222 --- /dev/null +++ b/testsuite/tests/rename/should_fail/RnEmptyStatementGroup1.stderr @@ -0,0 +1,10 @@ + +RnEmptyStatementGroup1.hs:6:13: error: [GHC-92693] + Empty statement group preceding 'group' or 'then' + +RnEmptyStatementGroup1.hs:8:7: error: [GHC-82311] + Empty 'do' block + Suggested fix: Perhaps you intended to use NondecreasingIndentation + +RnEmptyStatementGroup1.hs:10:20: error: [GHC-19442] + Empty 'do' block in an arrow command diff --git a/testsuite/tests/rename/should_fail/RnImplicitBindInMdoNotation.hs b/testsuite/tests/rename/should_fail/RnImplicitBindInMdoNotation.hs new file mode 100644 index 0000000000..c04ce4d623 --- /dev/null +++ b/testsuite/tests/rename/should_fail/RnImplicitBindInMdoNotation.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE RecursiveDo #-} +{-# LANGUAGE ImplicitParams #-} + +module ShouldFail where + +x = mdo + let ?x = 5 + () diff --git a/testsuite/tests/rename/should_fail/RnImplicitBindInMdoNotation.stderr b/testsuite/tests/rename/should_fail/RnImplicitBindInMdoNotation.stderr new file mode 100644 index 0000000000..24defe1f2f --- /dev/null +++ b/testsuite/tests/rename/should_fail/RnImplicitBindInMdoNotation.stderr @@ -0,0 +1,3 @@ + +RnImplicitBindInMdoNotation.hs:6:5: error: [GHC-50730] + Implicit-parameter bindings illegal in an mdo expression ?x = 5 diff --git a/testsuite/tests/rename/should_fail/T20147.stderr b/testsuite/tests/rename/should_fail/T20147.stderr index c70d3d0a8e..0e782f902b 100644 --- a/testsuite/tests/rename/should_fail/T20147.stderr +++ b/testsuite/tests/rename/should_fail/T20147.stderr @@ -1,4 +1,4 @@ -T20147.hs:6:28: error: +T20147.hs:6:28: error: [GHC-82311] Empty 'do' block Suggested fix: Perhaps you intended to use NondecreasingIndentation diff --git a/testsuite/tests/rename/should_fail/T2490.stderr b/testsuite/tests/rename/should_fail/T2490.stderr index 15beadab1e..24049cb8ba 100644 --- a/testsuite/tests/rename/should_fail/T2490.stderr +++ b/testsuite/tests/rename/should_fail/T2490.stderr @@ -1,15 +1,15 @@ -T2490.hs:6:10: +T2490.hs:6:10: [GHC-95880] A section must be enclosed in parentheses thus: (`head` x) -T2490.hs:7:10: +T2490.hs:7:10: [GHC-95880] A section must be enclosed in parentheses thus: (+ x) -T2490.hs:8:14: +T2490.hs:8:14: [GHC-95880] A section must be enclosed in parentheses thus: (+ x) -T2490.hs:9:14: +T2490.hs:9:14: [GHC-95880] A section must be enclosed in parentheses thus: (+ x) -T2490.hs:10:14: +T2490.hs:10:14: [GHC-95880] A section must be enclosed in parentheses thus: (x +) diff --git a/testsuite/tests/rename/should_fail/T5657.stderr b/testsuite/tests/rename/should_fail/T5657.stderr index 042f7af35b..ee0ca60032 100644 --- a/testsuite/tests/rename/should_fail/T5657.stderr +++ b/testsuite/tests/rename/should_fail/T5657.stderr @@ -3,5 +3,5 @@ T5657.hs:3:8: error: [GHC-76037] Not in scope: ‘LT..’ NB: no module named ‘LT’ is imported. -T5657.hs:3:8: error: +T5657.hs:3:8: error: [GHC-95880] A section must be enclosed in parentheses thus: (LT.. GT) diff --git a/testsuite/tests/rename/should_fail/T6060.stderr b/testsuite/tests/rename/should_fail/T6060.stderr index 3d381cb184..93479dc6e3 100644 --- a/testsuite/tests/rename/should_fail/T6060.stderr +++ b/testsuite/tests/rename/should_fail/T6060.stderr @@ -1,4 +1,4 @@ -T6060.hs:5:10: +T6060.hs:5:10: [GHC-55814] The last statement in a 'do' block must be an expression let bad = [True | x <- [] | y <- []] diff --git a/testsuite/tests/rename/should_fail/all.T b/testsuite/tests/rename/should_fail/all.T index a096e07634..43bff14df1 100644 --- a/testsuite/tests/rename/should_fail/all.T +++ b/testsuite/tests/rename/should_fail/all.T @@ -177,3 +177,6 @@ test('T19843m', normal, compile_fail, ['']) test('T11167_ambig', normal, compile_fail, ['']) test('T18138', normal, compile_fail, ['']) test('T20147', normal, compile_fail, ['']) + +test('RnEmptyStatementGroup1', normal, compile_fail, ['']) +test('RnImplicitBindInMdoNotation', normal, compile_fail, ['']) diff --git a/testsuite/tests/rename/should_fail/rnfail056.stderr b/testsuite/tests/rename/should_fail/rnfail056.stderr index b32a31d58c..7d3e1eb5bb 100644 --- a/testsuite/tests/rename/should_fail/rnfail056.stderr +++ b/testsuite/tests/rename/should_fail/rnfail056.stderr @@ -1,4 +1,8 @@ -rnfail056.hs:7:7: error: Illegal tuple section: use TupleSections +rnfail056.hs:7:7: [GHC-59155] error: + Illegal tuple section + Suggested fix: Perhaps you intended to use TupleSections -rnfail056.hs:9:7: error: Illegal tuple section: use TupleSections +rnfail056.hs:9:7: [GHC-59155] error: + Illegal tuple section + Suggested fix: Perhaps you intended to use TupleSections diff --git a/testsuite/tests/th/T14204.stderr b/testsuite/tests/th/T14204.stderr index 5a8f57aa58..8f9638071f 100644 --- a/testsuite/tests/th/T14204.stderr +++ b/testsuite/tests/th/T14204.stderr @@ -1,5 +1,5 @@ -T14204.hs:8:34: error: +T14204.hs:8:34: [GHC-23800] error: • Illegal static expression: static "wat" - Use StaticPointers to enable this extension • In the untyped splice: $(pure (StaticE (LitE (StringL "wat")))) + Suggested fix: Perhaps you intended to use StaticPointers diff --git a/testsuite/tests/th/TH_StaticPointers02.stderr b/testsuite/tests/th/TH_StaticPointers02.stderr index 6d2c759ab8..6a7fa47098 100644 --- a/testsuite/tests/th/TH_StaticPointers02.stderr +++ b/testsuite/tests/th/TH_StaticPointers02.stderr @@ -1,5 +1,5 @@ -TH_StaticPointers02.hs:11:34: error: +TH_StaticPointers02.hs:11:34: [GHC-12219] error: • static forms cannot be used in splices: static 'a' • In the untyped splice: $(case staticKey (static 'a') of diff --git a/testsuite/tests/typecheck/should_fail/tcfail092.stderr b/testsuite/tests/typecheck/should_fail/tcfail092.stderr index 68f94ea7d9..77b6e1f160 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail092.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail092.stderr @@ -1,3 +1,3 @@ -tcfail092.hs:7:27: +tcfail092.hs:7:27: [GHC-81232] Duplicate binding in parallel list comprehension for: ‘a’ |