[Git][ghc/ghc][wip/structured-ghci-errors] Repair tests
Jade (@Jade)
gitlab at gitlab.haskell.org
Thu Aug 1 20:55:21 UTC 2024
Jade pushed to branch wip/structured-ghci-errors at Glasgow Haskell Compiler / GHC
Commits:
8758621b by Jade at 2024-08-01T22:54:59+02:00
Repair tests
- - - - -
21 changed files:
- ghc/GHCi/UI/Exception.hs
- testsuite/tests/driver/multipleHomeUnits/multiGHCi.stderr
- testsuite/tests/ghc-e/should_fail/T18441fail0.stderr
- testsuite/tests/ghc-e/should_fail/T18441fail1.stderr
- testsuite/tests/ghc-e/should_fail/T18441fail10.stderr
- testsuite/tests/ghc-e/should_fail/T18441fail11.stderr
- testsuite/tests/ghc-e/should_fail/T18441fail14.stderr
- testsuite/tests/ghc-e/should_fail/T18441fail15.stderr
- testsuite/tests/ghc-e/should_fail/T18441fail2.stderr
- testsuite/tests/ghc-e/should_fail/T18441fail6.stderr
- testsuite/tests/ghc-e/should_fail/T18441fail8.stderr
- testsuite/tests/ghc-e/should_fail/T23663.stderr
- testsuite/tests/ghci.debugger/scripts/break016.stdout
- testsuite/tests/ghci/scripts/T10508.stderr
- testsuite/tests/ghci/scripts/T14676.stderr
- testsuite/tests/ghci/scripts/T16804.stderr
- testsuite/tests/ghci/scripts/ghci005.stdout
- testsuite/tests/ghci/should_fail/T18027a.stderr
- testsuite/tests/ghci/should_run/T13456.stdout
- testsuite/tests/safeHaskell/ghci/p12.stderr
- testsuite/tests/safeHaskell/ghci/p5.stderr
Changes:
=====================================
ghc/GHCi/UI/Exception.hs
=====================================
@@ -34,6 +34,8 @@ import GHC.Generics
import GHC.Types.Error
import qualified GHC
+import Data.List.NonEmpty (NonEmpty(..))
+
data GhciMessageOpts = GhciMessageOpts
{ ghcMessageOpts :: DiagnosticOpts GhcMessage
@@ -204,14 +206,15 @@ data GhciCommandHint
= HelpCommand
| SetEditor
| Overwrite
- | MeantOther [String]
+ | MeantOther (NonEmpty String)
instance Outputable GhciCommandHint where
ppr = \case
HelpCommand
-> use "?" <+> "for help"
- MeantOther suggs
- -> "did you mean one of" <> colon <+> nest 2 (hsep (map text suggs))
+ MeantOther (sugg :| rest)
+ | [] <- rest -> "did you mean" <+> text sugg
+ | otherwise -> "did you mean one of" <> colon <+> nest 2 (hsep (map text (sugg : rest)))
SetEditor
-> use "set editor"
Overwrite
@@ -245,7 +248,8 @@ instance Diagnostic GhciCommandMessage where
-> "No module for" <+> ppr name
GhciNoMatchingModuleExport
-> "No matching export in any local modules."
- GhciArgumentParseError ape -> ape
+ GhciArgumentParseError ape
+ -> ape -- JADE_TODO
GhciCommandNotSupportedInMultiMode
-> "Command is not supported (yet) in multi-mode"
GhciInvalidArgumentString str
@@ -277,8 +281,8 @@ instance Diagnostic GhciCommandMessage where
-> [HelpCommand]
GhciNoLastCommandAvailable{}
-> [HelpCommand]
- GhciUnknownFlag _ suggs@(_:_)
- -> [MeantOther suggs]
+ GhciUnknownFlag _ (x:xs)
+ -> [MeantOther (x :| xs)]
GhciNoSetEditor{}
-> [SetEditor]
GhciMacroAlreadyDefined{}
=====================================
testsuite/tests/driver/multipleHomeUnits/multiGHCi.stderr
=====================================
@@ -1,2 +1,6 @@
-Command is not supported (yet) in multi-mode
-Command is not supported (yet) in multi-mode
+<interactive>: error: [GHCi-83514]
+ Command is not supported (yet) in multi-mode
+
+<interactive>: error: [GHCi-83514]
+ Command is not supported (yet) in multi-mode
+
=====================================
testsuite/tests/ghc-e/should_fail/T18441fail0.stderr
=====================================
@@ -1,3 +1,5 @@
-there is no last command to perform
-use :? for help.
+<interactive>: error: [GHCi-29130]
+ There is no last command to perform
+ Suggested fix: Use ‘:?’ for help
+
1
=====================================
testsuite/tests/ghc-e/should_fail/T18441fail1.stderr
=====================================
@@ -1,3 +1,5 @@
-unknown command ':abcde'
-use :? for help.
+<interactive>: error: [GHCi-54713]
+ Unknown command ‘:abcde’
+ Suggested fix: Use ‘:?’ for help
+
1
=====================================
testsuite/tests/ghc-e/should_fail/T18441fail10.stderr
=====================================
@@ -1,2 +1,4 @@
-macro name cannot start with a colon
+<interactive>: error: [GHCi-64996]
+ Macro name cannot start with a colon
+
1
=====================================
testsuite/tests/ghc-e/should_fail/T18441fail11.stderr
=====================================
@@ -1,2 +1,4 @@
-macro name cannot start with an exclamation mark
+<interactive>: error: [GHCi-64996]
+ Macro name cannot start with an exclamation mark
+
1
=====================================
testsuite/tests/ghc-e/should_fail/T18441fail14.stderr
=====================================
@@ -1,2 +1,4 @@
-Couldn't guess that module name. Does it exist?
+<interactive>: error: [GHCi-21939]
+ Couldn't guess that module name. Does it exist?
+
1
=====================================
testsuite/tests/ghc-e/should_fail/T18441fail15.stderr
=====================================
@@ -1,2 +1,4 @@
-Couldn't guess that module name. Does it exist?
+<interactive>: error: [GHCi-21939]
+ Couldn't guess that module name. Does it exist?
+
1
=====================================
testsuite/tests/ghc-e/should_fail/T18441fail2.stderr
=====================================
@@ -1,10 +1,3 @@
-<interactive>: unrecognised flag: -Xabcde
-
-HasCallStack backtrace:
- collectBacktraces, called at libraries/ghc-internal/src/GHC/Internal/Exception.hs:92:13 in ghc-internal:GHC.Internal.Exception
- toExceptionWithBacktrace, called at libraries/ghc-internal/src/GHC/Internal/IO.hs:260:11 in ghc-internal:GHC.Internal.IO
- throwIO, called at compiler/GHC/Utils/Error.hs:512:19 in ghc-9.9-inplace:GHC.Utils.Error
-
-
+<interactive>: error: [GHCi-15670] Unrecognised flag: -Xabcde
1
=====================================
testsuite/tests/ghc-e/should_fail/T18441fail6.stderr
=====================================
@@ -1,2 +1,3 @@
-Module Abcde not found
+<interactive>: error: [GHCi-23305] Module Abcde not found
+
1
=====================================
testsuite/tests/ghc-e/should_fail/T18441fail8.stderr
=====================================
@@ -1,9 +1,5 @@
-<interactive>: syntax: :script <filename>
-HasCallStack backtrace:
- collectBacktraces, called at libraries/ghc-internal/src/GHC/Internal/Exception.hs:92:13 in ghc-internal:GHC.Internal.Exception
- toExceptionWithBacktrace, called at libraries/ghc-internal/src/GHC/Internal/IO.hs:260:11 in ghc-internal:GHC.Internal.IO
- throwIO, called at compiler/GHC/Utils/Error.hs:512:19 in ghc-9.9-inplace:GHC.Utils.Error
-
-
+<interactive>: error: [GHCi-72682]
+ Syntax:
+ :script <filename>
1
=====================================
testsuite/tests/ghc-e/should_fail/T23663.stderr
=====================================
@@ -1,12 +1,5 @@
-<interactive>: unrecognised flag: -XCUSKS
-did you mean one of:
- -XCUSKs
-
-HasCallStack backtrace:
- collectBacktraces, called at libraries/ghc-internal/src/GHC/Internal/Exception.hs:92:13 in ghc-internal:GHC.Internal.Exception
- toExceptionWithBacktrace, called at libraries/ghc-internal/src/GHC/Internal/IO.hs:260:11 in ghc-internal:GHC.Internal.IO
- throwIO, called at compiler/GHC/Utils/Error.hs:512:19 in ghc-9.9-inplace:GHC.Utils.Error
-
-
+<interactive>: error: [GHCi-15670]
+ Unrecognised flag: -XCUSKS
+ Suggested fix: did you mean -XCUSKs
1
=====================================
testsuite/tests/ghci.debugger/scripts/break016.stdout
=====================================
@@ -1,3 +1,4 @@
Breakpoint 0 activated at break016.hs:1:7-14
-macro '__cond' is not defined
+<interactive>: error: [GHCi-40561] Macro ‘__cond’ is not defined
+
4
=====================================
testsuite/tests/ghci/scripts/T10508.stderr
=====================================
@@ -10,5 +10,5 @@
<interactive>: error: [GHCi-54713]
Unknown command ‘:macro’
- use :? for help
+ Suggested fix: Use ‘:?’ for help
=====================================
testsuite/tests/ghci/scripts/T14676.stderr
=====================================
@@ -1,2 +1,6 @@
-File Notfound.hs not found
-Module NotFound not found
+<interactive>: error: [GHCi-31901]
+ File Notfound.hs not found
+
+<interactive>: error: [GHCi-23305]
+ Module NotFound not found
+
=====================================
testsuite/tests/ghci/scripts/T16804.stderr
=====================================
@@ -1,33 +1,66 @@
-Couldn't resolve to any modules.
-Couldn't resolve to any modules.
-Couldn't resolve to any modules.
-Couldn't resolve to any modules.
-Couldn't resolve to any modules.
-Couldn't resolve to any modules.
-Couldn't resolve to any modules.
-Couldn't resolve to any modules.
-Couldn't resolve to any modules.
-Couldn't resolve to any modules.
-Couldn't resolve to any modules.
-Couldn't resolve to any modules.
-Couldn't resolve to any modules.
-Couldn't resolve to any modules.
-Couldn't resolve to any modules.
-Couldn't resolve to any modules.
-Couldn't resolve to any modules.
-Couldn't resolve to any modules.
-Couldn't resolve to any modules.
-Couldn't resolve to any modules.
-Couldn't resolve to any modules.
-Couldn't resolve to any modules.
-Couldn't resolve to any modules.
-Couldn't resolve to any modules.
-Couldn't resolve to any modules.
-Couldn't resolve to any modules.
-Couldn't resolve to any modules.
-Couldn't resolve to any modules.
-Couldn't resolve to any modules.
-Couldn't resolve to any modules.
-Couldn't resolve to any modules.
-Couldn't resolve to any modules.
-Couldn't resolve to any modules.
+<interactive>: error: [GHCi-54909] Couldn't resolve to any modules.
+
+<interactive>: error: [GHCi-54909] Couldn't resolve to any modules.
+
+<interactive>: error: [GHCi-54909] Couldn't resolve to any modules.
+
+<interactive>: error: [GHCi-54909] Couldn't resolve to any modules.
+
+<interactive>: error: [GHCi-54909] Couldn't resolve to any modules.
+
+<interactive>: error: [GHCi-54909] Couldn't resolve to any modules.
+
+<interactive>: error: [GHCi-54909] Couldn't resolve to any modules.
+
+<interactive>: error: [GHCi-54909] Couldn't resolve to any modules.
+
+<interactive>: error: [GHCi-54909] Couldn't resolve to any modules.
+
+<interactive>: error: [GHCi-54909] Couldn't resolve to any modules.
+
+<interactive>: error: [GHCi-54909] Couldn't resolve to any modules.
+
+<interactive>: error: [GHCi-54909] Couldn't resolve to any modules.
+
+<interactive>: error: [GHCi-54909] Couldn't resolve to any modules.
+
+<interactive>: error: [GHCi-54909] Couldn't resolve to any modules.
+
+<interactive>: error: [GHCi-54909] Couldn't resolve to any modules.
+
+<interactive>: error: [GHCi-54909] Couldn't resolve to any modules.
+
+<interactive>: error: [GHCi-54909] Couldn't resolve to any modules.
+
+<interactive>: error: [GHCi-54909] Couldn't resolve to any modules.
+
+<interactive>: error: [GHCi-54909] Couldn't resolve to any modules.
+
+<interactive>: error: [GHCi-54909] Couldn't resolve to any modules.
+
+<interactive>: error: [GHCi-54909] Couldn't resolve to any modules.
+
+<interactive>: error: [GHCi-54909] Couldn't resolve to any modules.
+
+<interactive>: error: [GHCi-54909] Couldn't resolve to any modules.
+
+<interactive>: error: [GHCi-54909] Couldn't resolve to any modules.
+
+<interactive>: error: [GHCi-54909] Couldn't resolve to any modules.
+
+<interactive>: error: [GHCi-54909] Couldn't resolve to any modules.
+
+<interactive>: error: [GHCi-54909] Couldn't resolve to any modules.
+
+<interactive>: error: [GHCi-54909] Couldn't resolve to any modules.
+
+<interactive>: error: [GHCi-54909] Couldn't resolve to any modules.
+
+<interactive>: error: [GHCi-54909] Couldn't resolve to any modules.
+
+<interactive>: error: [GHCi-54909] Couldn't resolve to any modules.
+
+<interactive>: error: [GHCi-54909] Couldn't resolve to any modules.
+
+<interactive>: error: [GHCi-54909] Couldn't resolve to any modules.
+
=====================================
testsuite/tests/ghci/scripts/ghci005.stdout
=====================================
@@ -1,9 +1,15 @@
no macros defined
the following macros are defined:
-echo
+ • echo
hello, world!
hello, world!
-macro 'echo' is already defined. Use ':def!' to overwrite.
+<interactive>: error: [GHCi-93909]
+ Macro ‘echo’ is already defined
+ Suggested fix: Use ‘:def!’ to overwrite
+
HELLO, WORLD!
hello, world!
-macro 'f' is not defined
+<interactive>: error: [GHCi-40561] Macro ‘f’ is not defined
+
+<interactive>: error: [GHCi-40561] Macro ‘f’ is not defined
+
=====================================
testsuite/tests/ghci/should_fail/T18027a.stderr
=====================================
@@ -1,2 +1,8 @@
-syntax: :script <filename>
-syntax: :script <filename>
+<interactive>: error: [GHCi-72682]
+ Syntax:
+ :script <filename>
+
+<interactive>: error: [GHCi-72682]
+ Syntax:
+ :script <filename>
+
=====================================
testsuite/tests/ghci/should_run/T13456.stdout
=====================================
@@ -1,11 +1,22 @@
-macro name cannot start with an exclamation mark
-macro 'type' overwrites builtin command. Use ':def!' to overwrite.
-macro 'ty' overwrites builtin command. Use ':def!' to overwrite.
+<interactive>: error: [GHCi-64996]
+ Macro name cannot start with an exclamation mark
+
+<interactive>: error: [GHCi-86201]
+ Macro ‘type’ overwrites builtin command
+ Suggested fix: Use ‘:def!’ to overwrite
+
+<interactive>: error: [GHCi-86201]
+ Macro ‘ty’ overwrites builtin command
+ Suggested fix: Use ‘:def!’ to overwrite
+
I'm a macro
I'm a macro
macro :: p -> IO String
macro :: p -> IO String
-macro 'test' is already defined. Use ':def!' to overwrite.
+<interactive>: error: [GHCi-93909]
+ Macro ‘test’ is already defined
+ Suggested fix: Use ‘:def!’ to overwrite
+
the following macros are defined:
-test
-type
+ • test
+ • type
=====================================
testsuite/tests/safeHaskell/ghci/p12.stderr
=====================================
@@ -1,12 +1,12 @@
-unrecognised flag: -XNoSafe
-did you mean one of:
- -XSafe
-
-unrecognised flag: -fno-package-trust
-did you mean one of:
- -fpackage-trust
+<interactive>: error: [GHCi-15670]
+ Unrecognised flag: -XNoSafe
+ Suggested fix: did you mean -XSafe
+<interactive>: error: [GHCi-15670]
+ Unrecognised flag: -fno-package-trust
+ Suggested fix: did you mean -fpackage-trust
<no location info>: error: [GHC-75165]
Data.ByteString: Can't be safely imported!
- The package (bytestring-0.11.4.0) the module resides in isn't trusted.
+ The package (bytestring-0.12.1.0) the module resides in isn't trusted.
+
=====================================
testsuite/tests/safeHaskell/ghci/p5.stderr
=====================================
@@ -1,16 +1,16 @@
-unrecognised flag: -XNoSafe
-did you mean one of:
- -XSafe
+<interactive>: error: [GHCi-15670]
+ Unrecognised flag: -XNoSafe
+ Suggested fix: did you mean -XSafe
<no location info>: Incompatible Safe Haskell flags! (Safe, Trustworthy)
Usage: For basic information, try the `--help' option.
-unrecognised flag: -XNoTrustworthy
-did you mean one of:
- -XTrustworthy
+<interactive>: error: [GHCi-15670]
+ Unrecognised flag: -XNoTrustworthy
+ Suggested fix: did you mean -XTrustworthy
<no location info>: Incompatible Safe Haskell flags! (Safe, Unsafe)
Usage: For basic information, try the `--help' option.
-unrecognised flag: -XNoUnsafe
-did you mean one of:
- -XUnsafe
+<interactive>: error: [GHCi-15670]
+ Unrecognised flag: -XNoUnsafe
+ Suggested fix: did you mean -XUnsafe
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8758621b99e5186305535caf3c89b0182c2ec49a
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8758621b99e5186305535caf3c89b0182c2ec49a
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240801/5737c101/attachment-0001.html>
More information about the ghc-commits
mailing list