Ben Gamari pushed to branch wip/T27456 at Glasgow Haskell Compiler / GHC

Commits:

10 changed files:

Changes:

  • changelog.d/T27456
    1
    +section: base
    
    2
    +issues: #27456
    
    3
    +mrs: !16275
    
    4
    +synopsis:
    
    5
    +  Show `ExceptionContext` in `displayExceptionAnnotation` implementation of `WhileHandling`
    
    6
    +description:
    
    7
    +  In the past ``displayException`` (in terms of which ``WhileHandling``\'s ``displayExceptionAnnotation` is implemented) was changed to hide ``ExceptionContext``. This regressed the behavior of ``displayExceptionAnnotation`` from that which was originally specified. Restore the intended behavior of showing the ``ExceptionContext`` of the carried exception.
    
    8
    +

  • libraries/base/changelog.md
    ... ... @@ -31,6 +31,7 @@
    31 31
       * Export `labelThread` from `Control.Concurrent`.([CLC proposal #376](https://github.com/haskell/core-libraries-committee/issues/376))
    
    32 32
       * Add a new module `System.IO.OS` with operations for obtaining operating-system handles (file descriptors, Windows handles). ([CLC proposal #369](https://github.com/haskell/core-libraries-committee/issues/369))
    
    33 33
       * Evaluate backtraces for "error" exceptions at the moment they are thrown. ([CLC proposal #383](https://github.com/haskell/core-libraries-committee/issues/383))
    
    34
    +  * Show `ExceptionContext` in `displayExceptionAnnotation` implementation of `WhileHandling` ([GHC #27456](https://gitlab.haskell.org/ghc/ghc/-/issues/27456))
    
    34 35
       * Hide implementation details when throwing exceptions in throw and throwSTM. ([CLC proposal #387](https://github.com/haskell/core-libraries-committee/issues/387))
    
    35 36
       * Change `hIsReadable` and `hIsWritable` such that they always throw a respective exception when encountering a closed or semi-closed handle, not just in the case of a file handle. ([CLC proposal #371](github.com/haskell/core-libraries-committee/issues/371))
    
    36 37
       * Annotate `onException` continuation with `WhileHandling`. ([CLC Proposal #397](https://github.com/haskell/core-libraries-committee/issues/397))
    

  • libraries/base/tests/T15349.stderr
    1
    -T15349: Uncaught exception ghc-internal:GHC.Internal.Control.Exception.Base.NonTermination:
    
    1
    +T15349.exe: Uncaught exception ghc-internal:GHC.Internal.Control.Exception.Base.NonTermination:
    
    2 2
     
    
    3 3
     <<loop>>
    
    4 4
     
    
    5
    -While handling thread blocked indefinitely in an MVar operation
    
    5
    +While handling ghc-internal:GHC.Internal.IO.Exception.BlockedIndefinitelyOnMVar:
    
    6
    +  |
    
    7
    +  | thread blocked indefinitely in an MVar operation
    
    6 8
     
    
    7 9
     HasCallStack backtrace:
    
    8
    -  throwIO, called at libraries/ghc-internal/src/GHC/Internal/Control/Monad/ST/Imp.hs:58:37 in ghc-internal:GHC.Internal.Control.Monad.ST.Imp
    
    10
    +  throwIO, called at libraries\ghc-internal\src\GHC\Internal\Control\Monad\ST\Imp.hs:59:37 in ghc-internal:GHC.Internal.Control.Monad.ST.Imp
    
    9 11
     

  • libraries/ghc-internal/src/GHC/Internal/Exception/Type.hs
    ... ... @@ -84,7 +84,7 @@ data WhileHandling = WhileHandling SomeException deriving Show
    84 84
     
    
    85 85
     instance ExceptionAnnotation WhileHandling where
    
    86 86
       displayExceptionAnnotation (WhileHandling e) =
    
    87
    -    "While handling " ++ case lines $ displayException e of
    
    87
    +    "While handling " ++ case lines $ displayExceptionWithInfo e of
    
    88 88
           [] -> ""
    
    89 89
           (l1:ls) ->
    
    90 90
             -- Indent lines forward.
    

  • libraries/ghc-internal/tests/backtraces/T14532b.stdout
    ... ... @@ -2,7 +2,14 @@ ghc-internal:GHC.Internal.Exception.ErrorCall:
    2 2
     
    
    3 3
     Error in Exception Handler
    
    4 4
     
    
    5
    -While handling Main Error
    
    5
    +While handling ghc-internal:GHC.Internal.Exception.ErrorCall:
    
    6
    +  |
    
    7
    +  | Main Error
    
    8
    +  |
    
    9
    +  | My custom Backtraces:
    
    10
    +  | HasCallStack backtrace:
    
    11
    +  |   throwIO, called at T14532b.hs:32:6 in main:Main
    
    12
    +  |
    
    6 13
     
    
    7 14
     My custom Backtraces:
    
    8 15
     HasCallStack backtrace:
    
    ... ... @@ -13,7 +20,14 @@ ghc-internal:GHC.Internal.Exception.ErrorCall:
    13 20
     
    
    14 21
     Error in Exception Handler
    
    15 22
     
    
    16
    -While handling Main Error
    
    23
    +While handling ghc-internal:GHC.Internal.Exception.ErrorCall:
    
    24
    +  |
    
    25
    +  | Main Error
    
    26
    +  |
    
    27
    +  | My custom Backtraces:
    
    28
    +  | HasCallStack backtrace:
    
    29
    +  |   error, called at T14532b.hs:41:6 in main:Main
    
    30
    +  |
    
    17 31
     
    
    18 32
     My custom Backtraces:
    
    19 33
     HasCallStack backtrace:
    

  • testsuite/tests/codeGen/should_run/cgrun025.stderr
    1
    -"cgrun025"
    
    1
    +"cgrun025.exe"
    
    2 2
     ["cgrun025.hs"]
    
    3 3
     GOT PATH
    
    4 4
     {-# LANGUAGE ScopedTypeVariables #-}
    
    ... ... @@ -27,11 +27,16 @@ main = do
    27 27
         trace "hello, trace" $
    
    28 28
           catch (getEnv "__WURBLE__" >> return ()) (\ (e :: SomeException) -> error "hello, error")
    
    29 29
     hello, trace
    
    30
    -cgrun025: Uncaught exception ghc-internal:GHC.Internal.Exception.ErrorCall:
    
    30
    +cgrun025.exe: Uncaught exception ghc-internal:GHC.Internal.Exception.ErrorCall:
    
    31 31
     
    
    32 32
     hello, error
    
    33 33
     
    
    34
    -While handling __WURBLE__: getEnv: does not exist (no environment variable)
    
    34
    +While handling ghc-internal:GHC.Internal.IO.Exception.IOException:
    
    35
    +  |
    
    36
    +  | __WURBLE__: getEnv: does not exist (no environment variable)
    
    37
    +  |
    
    38
    +  | HasCallStack backtrace:
    
    39
    +  |   ioException, called at libraries\ghc-internal\src\GHC\Internal\System\Environment.hs:204:26 in ghc-internal:GHC.Internal.System.Environment
    
    35 40
     
    
    36 41
     HasCallStack backtrace:
    
    37 42
       error, called at cgrun025.hs:25:75 in main:Main
    

  • testsuite/tests/exceptions/T26759.stderr
    1
    -T26759: Uncaught exception ghc-internal:GHC.Internal.Exception.ErrorCall:
    
    1
    +T26759.exe: Uncaught exception ghc-internal:GHC.Internal.Exception.ErrorCall:
    
    2 2
     
    
    3 3
     cleanup failure
    
    4 4
     
    
    5
    -While handling outer failure
    
    5
    +While handling ghc-internal:GHC.Internal.Exception.ErrorCall:
    
    6
    +  |
    
    7
    +  | outer failure
    
    8
    +  |
    
    9
    +  | HasCallStack backtrace:
    
    10
    +  |   throwIO, called at T26759.hs:6:21 in main:Main
    
    6 11
     
    
    7 12
     HasCallStack backtrace:
    
    8 13
       throwIO, called at T26759.hs:7:22 in main:Main
    

  • testsuite/tests/ghc-e/should_fail/T18441fail7.stderr
    1
    -<interactive>: Uncaught exception ghc-9.13-inplace:GHC.Utils.Panic.GhcException:
    
    1
    +<interactive>: Uncaught exception ghc-10.1-inplace:GHC.Utils.Panic.GhcException:
    
    2 2
     
    
    3 3
     IO error:  "Abcde" does not exist
    
    4 4
     
    
    5
    -While handling IO error:  "Abcde" does not exist
    
    5
    +While handling ghc-10.1-inplace:GHC.Utils.Panic.GhcException:
    
    6
    +  |
    
    7
    +  | IO error:  "Abcde" does not exist
    
    6 8
     
    
    7 9
     HasCallStack backtrace:
    
    8
    -  throwIO, called at compiler/GHC/Utils/Error.hs:512:19 in ghc-9.13-inplace:GHC.Utils.Error
    
    10
    +  throwIO, called at compiler\GHC\Utils\Error.hs:499:19 in ghc-10.1-inplace:GHC.Utils.Error
    
    9 11
     
    
    10 12
     1

  • testsuite/tests/mdo/should_fail/mdofail006.stderr
    1
    -mdofail006: Uncaught exception ghc-internal:GHC.Internal.IO.Exception.FixIOException:
    
    1
    +mdofail006.exe: Uncaught exception ghc-internal:GHC.Internal.IO.Exception.FixIOException:
    
    2 2
     
    
    3 3
     cyclic evaluation in fixIO
    
    4 4
     
    
    5
    -While handling thread blocked indefinitely in an MVar operation
    
    5
    +While handling ghc-internal:GHC.Internal.IO.Exception.BlockedIndefinitelyOnMVar:
    
    6
    +  |
    
    7
    +  | thread blocked indefinitely in an MVar operation
    
    6 8
     
    
    7 9
     HasCallStack backtrace:
    
    8
    -  throwIO, called at libraries/ghc-internal/src/GHC/Internal/Control/Monad/Fix.hs:167:37 in ghc-internal:GHC.Internal.Control.Monad.Fix
    
    10
    +  throwIO, called at libraries\ghc-internal\src\GHC\Internal\Control\Monad\Fix.hs:169:37 in ghc-internal:GHC.Internal.Control.Monad.Fix
    
    9 11
     

  • testsuite/tests/runghc/T7859.stderr-mingw32
    ... ... @@ -2,7 +2,12 @@ runghc-9.13.20241015.exe: Uncaught exception ghc-internal:GHC.Internal.IO.Except
    2 2
     
    
    3 3
     defer-type-errors: rawSystem: does not exist (No such file or directory)
    
    4 4
     
    
    5
    -While handling rawSystem: does not exist (No such file or directory)
    
    5
    +While handling ghc-internal:GHC.Internal.IO.Exception.IOException:
    
    6
    +  |
    
    7
    +  | rawSystem: does not exist (No such file or directory)
    
    8
    +  |
    
    9
    +  | HasCallStack backtrace:
    
    10
    +  |   ioError, called at libraries/ghc-internal/src/GHC/Internal/Foreign/C/Error.hs:<line>:<column> in <package-id>:GHC.Internal.Foreign.C.Error
    
    6 11
     
    
    7 12
     HasCallStack backtrace:
    
    8 13
       ioError, called at libraries\process\System\Process\Common.hs:239:16 in process-1.6.25.0-inplace:System.Process.Common