[Git][ghc/ghc][wip/romes/25052] ghc-internal: No trailing whitespace in exceptions

Rodrigo Mesquita (@alt-romes) gitlab at gitlab.haskell.org
Fri Jul 26 13:18:14 UTC 2024



Rodrigo Mesquita pushed to branch wip/romes/25052 at Glasgow Haskell Compiler / GHC


Commits:
c0d24252 by Rodrigo Mesquita at 2024-07-26T14:18:05+01:00
ghc-internal: No trailing whitespace in exceptions

Fixes #25052

- - - - -


2 changed files:

- libraries/ghc-internal/src/GHC/Internal/Exception/Type.hs
- testsuite/tests/driver/T13914/T13914.stdout


Changes:

=====================================
libraries/ghc-internal/src/GHC/Internal/Exception/Type.hs
=====================================
@@ -199,11 +199,14 @@ instance Exception SomeException where
     fromException = Just
     backtraceDesired (SomeException e) = backtraceDesired e
     displayException (SomeException e) =
-        displayException e ++ "\n" ++ displayContext ?exceptionContext
+      case displayContext ?exceptionContext of
+        "" -> displayException e
+        dc -> displayException e ++ "\n" ++ dc
 
 displayContext :: ExceptionContext -> String
 displayContext (ExceptionContext anns0) = go anns0
   where
+    go [SomeExceptionAnnotation ann]        = displayExceptionAnnotation ann
     go (SomeExceptionAnnotation ann : anns) = displayExceptionAnnotation ann ++ "\n" ++ go anns
     go [] = ""
 


=====================================
testsuite/tests/driver/T13914/T13914.stdout
=====================================
@@ -10,7 +10,6 @@ HasCallStack backtrace:
   throwIO, called at libraries/ghc-internal/src/GHC/Internal/IO/Exception.hs:453:5 in ghc-internal:GHC.Internal.IO.Exception
   assert, called at main.hs:3:8 in main:Main
 
-
 With -fignore-asserts
 [1 of 2] Compiling Main             ( main.hs, main.o ) [Optimisation flags changed]
 [2 of 2] Linking main [Objects changed]



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c0d242527a06756f5baafd05d79e6b26ee3e94f1

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c0d242527a06756f5baafd05d79e6b26ee3e94f1
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/20240726/426854c9/attachment-0001.html>


More information about the ghc-commits mailing list