Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC

Commits:

6 changed files:

Changes:

  • compiler/GHC/Utils/Trace.hs
    1 1
     -- | Tracing utilities
    
    2 2
     module GHC.Utils.Trace
    
    3 3
       ( pprTrace
    
    4
    +  , pprTrace_
    
    4 5
       , pprTraceM
    
    5 6
       , pprTraceDebug
    
    6 7
       , pprTraceIt
    
    ... ... @@ -43,6 +44,22 @@ pprTrace str doc x
    43 44
       | unsafeHasNoDebugOutput = x
    
    44 45
       | otherwise              = pprDebugAndThen traceSDocContext trace (text str) doc x
    
    45 46
     
    
    47
    +-- | A version of 'pprTrace' that is useful for quick debugging:
    
    48
    +--
    
    49
    +-- @
    
    50
    +-- fooBar x y
    
    51
    +--   | cond      = body1
    
    52
    +--   | otherwise = body2
    
    53
    +--   where
    
    54
    +--     !_ = pprTrace_ "fooBar" $
    
    55
    +--          vcat [ text "x:" <+> ppr x
    
    56
    +--               , text "y:" <+> ppr y
    
    57
    +--               , text "cond:" <+> ppr cond
    
    58
    +--               ]
    
    59
    +-- @
    
    60
    +pprTrace_ :: String -> SDoc -> ()
    
    61
    +pprTrace_ str doc = pprTrace str doc ()
    
    62
    +
    
    46 63
     pprTraceM :: Applicative f => String -> SDoc -> f ()
    
    47 64
     pprTraceM str doc = pprTrace str doc (pure ())
    
    48 65
     
    

  • libraries/base/changelog.md
    ... ... @@ -28,6 +28,7 @@
    28 28
       * Hide implementation details when throwing exceptions in throw and throwSTM. ([CLC proposal #387](https://github.com/haskell/core-libraries-committee/issues/387))
    
    29 29
       * 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))
    
    30 30
       * Annotate `onException` continuation with `WhileHandling`. ([CLC Proposal #397](https://github.com/haskell/core-libraries-committee/issues/397))
    
    31
    +  * Improve error message for `Data.Char.chr`. ([CLC Proposal #384](https://github.com/haskell/core-libraries-committee/issues/384))
    
    31 32
     
    
    32 33
     ## 4.22.0.0 *TBA*
    
    33 34
       * Shipped with GHC 9.14.1
    

  • libraries/base/tests/enum01.stdout
    ... ... @@ -81,7 +81,7 @@ Testing Enum Char:
    81 81
         pred (maxBound::Char) = '\1114110'
    
    82 82
         pred (minBound::Char) = error "Prelude.Enum.Char.pred: bad argument"
    
    83 83
         (map (toEnum::Int->Char) [123,ord (minBound::Char), ord(maxBound::Char)]) = "{\NUL\1114111"
    
    84
    -    (toEnum::Int->Char) (minBound::Int) = error "Prelude.chr: bad argument: (-2147483648)"
    
    84
    +    (toEnum::Int->Char) (minBound::Int) = error "Data.Char.chr: argument outside Unicode range: 0..1114111: (-2147483648)"
    
    85 85
         (map fromEnum ['X',minBound,maxBound]) = [88,0,1114111]
    
    86 86
         (take 7 ['\NUL' .. ]) = "\NUL\SOH\STX\ETX\EOT\ENQ\ACK"
    
    87 87
         (take 7 ['\250' .. ]) = "\250\251\252\253\254\255\256"
    

  • libraries/base/tests/enum01.stdout-alpha-dec-osf3
    ... ... @@ -65,7 +65,7 @@ Testing Enum Char:
    65 65
         pred (maxBound::Char) = '\1114110'
    
    66 66
         pred (minBound::Char) = error "Prelude.Enum.Char.pred: bad argument"
    
    67 67
         (map (toEnum::Int->Char) [123,ord (minBound::Char), ord(maxBound::Char)]) = "{\NUL\1114111"
    
    68
    -    (toEnum::Int->Char) (minBound::Int) = error "Prelude.chr: bad argument"
    
    68
    +    (toEnum::Int->Char) (minBound::Int) = error "Data.Char.chr: argument outside Unicode range: 0..1114111:"
    
    69 69
         (map fromEnum ['X',minBound,maxBound]) = [88,0,1114111]
    
    70 70
         (take 7 ['\NUL' .. ]) = "\NUL\SOH\STX\ETX\EOT\ENQ\ACK"
    
    71 71
         (take 7 ['\250' .. ]) = "\250\251\252\253\254\255\256"
    

  • libraries/base/tests/enum01.stdout-ws-64
    ... ... @@ -81,7 +81,7 @@ Testing Enum Char:
    81 81
         pred (maxBound::Char) = '\1114110'
    
    82 82
         pred (minBound::Char) = error "Prelude.Enum.Char.pred: bad argument"
    
    83 83
         (map (toEnum::Int->Char) [123,ord (minBound::Char), ord(maxBound::Char)]) = "{\NUL\1114111"
    
    84
    -    (toEnum::Int->Char) (minBound::Int) = error "Prelude.chr: bad argument: (-9223372036854775808)"
    
    84
    +    (toEnum::Int->Char) (minBound::Int) = error "Data.Char.chr: argument outside Unicode range: 0..1114111: (-9223372036854775808)"
    
    85 85
         (map fromEnum ['X',minBound,maxBound]) = [88,0,1114111]
    
    86 86
         (take 7 ['\NUL' .. ]) = "\NUL\SOH\STX\ETX\EOT\ENQ\ACK"
    
    87 87
         (take 7 ['\250' .. ]) = "\250\251\252\253\254\255\256"
    

  • libraries/ghc-internal/src/GHC/Internal/Char.hs
    ... ... @@ -12,7 +12,7 @@ module GHC.Internal.Char
    12 12
     
    
    13 13
     import GHC.Internal.Classes (eqChar, neChar)
    
    14 14
     import GHC.Internal.Base (otherwise, (++))
    
    15
    -import GHC.Internal.Err (errorWithoutStackTrace)
    
    15
    +import GHC.Internal.Err (error)
    
    16 16
     import GHC.Internal.Show
    
    17 17
     import GHC.Internal.Prim (chr#, int2Word#, leWord#, Int#, Char#)
    
    18 18
     import GHC.Internal.Types (Char(..), Int(..), isTrue#)
    
    ... ... @@ -29,4 +29,7 @@ safe_chr# i#
    29 29
     
    
    30 30
     {-# NOINLINE chr_error #-}
    
    31 31
     chr_error :: Int# -> Char#
    
    32
    -chr_error i# = errorWithoutStackTrace ("Prelude.chr: bad argument: " ++ showSignedInt (I# 9#) (I# i#) "")
    32
    +chr_error i# = error ("Data.Char.chr: argument outside Unicode range: 0..1114111: " ++ showSignedInt (I# 9#) (I# i#) "")
    
    33
    +-- It's not really "Data.Char", but we assume that
    
    34
    +-- the majority of users will import it from "base:Data.Char"
    
    35
    +-- and not from "ghc-internal:GHC.Internal.Char".