Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
-
4f2a21f7
by Andreas Klebinger at 2026-08-02T22:46:46-04:00
-
21e4b89d
by Andreas Klebinger at 2026-08-02T22:46:46-04:00
-
d415f38a
by Alan Zimmerman at 2026-08-02T22:47:27-04:00
-
f663faf7
by Ben Gamari at 2026-08-03T14:03:56-04:00
-
19732024
by Simon Jakobi at 2026-08-03T14:03:58-04:00
-
8eec1aa9
by Simon Jakobi at 2026-08-03T14:03:58-04:00
-
2c6d8d0e
by Simon Jakobi at 2026-08-03T14:03:58-04:00
15 changed files:
- + changelog.d/T27455
- compiler/GHC/Hs/Decls.hs
- compiler/GHC/Parser.y
- compiler/GHC/Parser/PostProcess.hs
- compiler/GHC/Stg/Lint.hs
- compiler/GHC/Types/ForeignCall.hs
- libraries/base/changelog.md
- libraries/base/tests/all.T
- libraries/base/tests/listThreads1.hs
- libraries/base/tests/listThreads1.stdout
- libraries/ghc-internal/src/GHC/Internal/Exception/Type.hs
- testsuite/tests/ghc-e/should_run/ghc-e005.stderr
- testsuite/tests/rts/all.T
- utils/check-exact/ExactPrint.hs
- utils/haddock/haddock-api/src/Haddock/Types.hs
Changes:
| 1 | +section: base
|
|
| 2 | +issues: #27455
|
|
| 3 | +mrs: !16274
|
|
| 4 | +synopsis:
|
|
| 5 | + Don't drop `ExceptionContext` in `SomeException(toException)`
|
|
| 6 | +description:
|
|
| 7 | + Previously the implementation of ``Exception(toException)`` given to `SomeException` would inappropriately drop the carried `ExceptionContext`. Now ``toException = id``, faithfully implementing the semantics proposed in :ref:`CLC Proposal #200 <https://github.com/haskell/core-libraries-committee/issues/200>`.
|
|
| 8 | + |
| ... | ... | @@ -1583,7 +1583,7 @@ type instance Anno (FunDep (GhcPass p)) = SrcSpanAnnA |
| 1583 | 1583 | type instance Anno (FamilyResultSig (GhcPass p)) = EpAnnCO
|
| 1584 | 1584 | type instance Anno (FamilyDecl (GhcPass p)) = SrcSpanAnnA
|
| 1585 | 1585 | type instance Anno (InjectivityAnn (GhcPass p)) = EpAnnCO
|
| 1586 | -type instance Anno (CType (GhcPass p)) = SrcSpanAnnP
|
|
| 1586 | +type instance Anno (CType (GhcPass p)) = SrcSpanAnnA
|
|
| 1587 | 1587 | type instance Anno (HsDerivingClause (GhcPass p)) = EpAnnCO
|
| 1588 | 1588 | type instance Anno (DerivClauseTys (GhcPass _)) = SrcSpanAnnA
|
| 1589 | 1589 | type instance Anno (StandaloneKindSig (GhcPass p)) = SrcSpanAnnA
|
| ... | ... | @@ -1707,15 +1707,17 @@ datafam_inst_hdr :: { Located (Maybe (LHsContext GhcPs), HsOuterFamEqnTyVarBndrs |
| 1707 | 1707 | | type { sL1 $1 (Nothing, mkHsOuterImplicit, $1) }
|
| 1708 | 1708 | |
| 1709 | 1709 | |
| 1710 | -capi_ctype :: { Maybe (LocatedP (CType GhcPs)) }
|
|
| 1710 | +capi_ctype :: { Maybe (LocatedA (CType GhcPs)) }
|
|
| 1711 | 1711 | capi_ctype : '{-# CTYPE' STRING STRING '#-}'
|
| 1712 | - {% fmap Just $ amsr (sLL $1 $> (mkCType (getCTYPEs $1) (getSTRINGs $3) (Just (Header (getSTRINGs $2) (getSTRING $2)))
|
|
| 1713 | - (getSTRING $3)))
|
|
| 1714 | - (AnnPragma (glR $1) (epTok $4) noAnn (glR $2) (glR $3) noAnn noAnn) }
|
|
| 1712 | + {% fmap Just $ amsA' (sLL $1 $> (mkCType (getCTYPEs $1) (getSTRINGs $3)
|
|
| 1713 | + (AnnPragma (glR $1) (epTok $4) noAnn (glR $2) (glR $3) noAnn noAnn)
|
|
| 1714 | + (Just (Header (getSTRINGs $2) (getSTRING $2)))
|
|
| 1715 | + (getSTRING $3)))}
|
|
| 1715 | 1716 | |
| 1716 | 1717 | | '{-# CTYPE' STRING '#-}'
|
| 1717 | - {% fmap Just $ amsr (sLL $1 $> (mkCType (getCTYPEs $1) (getSTRINGs $2) Nothing (getSTRING $2)))
|
|
| 1718 | - (AnnPragma (glR $1) (epTok $3) noAnn noAnn (glR $2) noAnn noAnn) }
|
|
| 1718 | + {% fmap Just $ amsA' (sLL $1 $> (mkCType (getCTYPEs $1) (getSTRINGs $2)
|
|
| 1719 | + (AnnPragma (glR $1) (epTok $3) noAnn noAnn (glR $2) noAnn noAnn)
|
|
| 1720 | + Nothing (getSTRING $2)))}
|
|
| 1719 | 1721 | |
| 1720 | 1722 | | { Nothing }
|
| 1721 | 1723 |
| ... | ... | @@ -229,7 +229,7 @@ mkClassDecl loc' (L _ (mcxt, tycl_hdr)) fds where_cls layout annsIn |
| 229 | 229 | mkTyData :: SrcSpan
|
| 230 | 230 | -> Bool
|
| 231 | 231 | -> NewOrData
|
| 232 | - -> Maybe (LocatedP (CType GhcPs))
|
|
| 232 | + -> Maybe (LocatedA (CType GhcPs))
|
|
| 233 | 233 | -> Located (Maybe (LHsContext GhcPs), LHsType GhcPs)
|
| 234 | 234 | -> Maybe (LHsKind GhcPs)
|
| 235 | 235 | -> [LConDecl GhcPs]
|
| ... | ... | @@ -251,7 +251,7 @@ mkTyData loc' is_type_data new_or_data cType (L _ (mcxt, tycl_hdr)) |
| 251 | 251 | tcdDataDefn = defn,
|
| 252 | 252 | tcdModifiers = [] })) }
|
| 253 | 253 | |
| 254 | -mkDataDefn :: Maybe (LocatedP (CType GhcPs))
|
|
| 254 | +mkDataDefn :: Maybe (LocatedA (CType GhcPs))
|
|
| 255 | 255 | -> Maybe (LHsContext GhcPs)
|
| 256 | 256 | -> Maybe (LHsKind GhcPs)
|
| 257 | 257 | -> DataDefnCons (LConDecl GhcPs)
|
| ... | ... | @@ -326,7 +326,7 @@ mkTyFamInstEqn loc bndrs lhs rhs annEq |
| 326 | 326 | |
| 327 | 327 | mkDataFamInst :: SrcSpan
|
| 328 | 328 | -> NewOrData
|
| 329 | - -> Maybe (LocatedP (CType GhcPs))
|
|
| 329 | + -> Maybe (LocatedA (CType GhcPs))
|
|
| 330 | 330 | -> (Maybe ( LHsContext GhcPs), HsOuterFamEqnTyVarBndrs GhcPs
|
| 331 | 331 | , LHsType GhcPs)
|
| 332 | 332 | -> Maybe (LHsKind GhcPs)
|
| ... | ... | @@ -92,6 +92,7 @@ be ill-typed in Core. But it must still be well-kinded! |
| 92 | 92 | -}
|
| 93 | 93 | |
| 94 | 94 | {-# LANGUAGE TypeFamilies #-}
|
| 95 | +{-# LANGUAGE PatternSynonyms #-}
|
|
| 95 | 96 | |
| 96 | 97 | module GHC.Stg.Lint ( lintStgTopBindings ) where
|
| 97 | 98 | |
| ... | ... | @@ -123,6 +124,7 @@ import GHC.Unit.Module ( Module ) |
| 123 | 124 | import GHC.Data.Bag ( Bag, emptyBag, isEmptyBag, snocBag, bagToList )
|
| 124 | 125 | |
| 125 | 126 | import Control.Monad
|
| 127 | +import GHC.Exts ( oneShot )
|
|
| 126 | 128 | import GHC.Core.Multiplicity (scaledThing)
|
| 127 | 129 | import GHC.Settings (Platform)
|
| 128 | 130 | import GHC.Core.TyCon (primRepCompatible, primRepsCompatible)
|
| ... | ... | @@ -432,17 +434,40 @@ The Lint monad |
| 432 | 434 | ************************************************************************
|
| 433 | 435 | -}
|
| 434 | 436 | |
| 435 | -newtype LintM a = LintM
|
|
| 436 | - { unLintM :: Module
|
|
| 437 | - -> LintFlags
|
|
| 438 | - -> DiagOpts -- Diagnostic options
|
|
| 439 | - -> StgPprOpts -- Pretty-printing options
|
|
| 437 | +data LintReaderEnv = LintReaderEnv
|
|
| 438 | + { le_mod :: !Module
|
|
| 439 | + , le_flags :: !LintFlags
|
|
| 440 | + , le_diag_opts :: !DiagOpts -- Diagnostic options
|
|
| 441 | + , le_ppr_opts :: !StgPprOpts -- Pretty-printing options
|
|
| 442 | + }
|
|
| 443 | + |
|
| 444 | +newtype LintM a = LintM'
|
|
| 445 | + { unLintM :: LintReaderEnv
|
|
| 440 | 446 | -> [LintLocInfo] -- Locations
|
| 441 | 447 | -> IdSet -- Local vars in scope
|
| 442 | 448 | -> Bag SDoc -- Error messages so far
|
| 443 | 449 | -> (a, Bag SDoc) -- Result and error messages (if any)
|
| 444 | 450 | }
|
| 445 | - deriving (Functor)
|
|
| 451 | +instance Functor LintM where
|
|
| 452 | + fmap f (LintM m) =
|
|
| 453 | + LintM $ \env loc scope errs ->
|
|
| 454 | + case m env loc scope errs of
|
|
| 455 | + (a, errs') -> (f a, errs')
|
|
| 456 | + |
|
| 457 | +-- See Note [The one-shot state monad trick] in GHC.Utils.Monad
|
|
| 458 | +{-# COMPLETE LintM #-}
|
|
| 459 | +pattern LintM :: (LintReaderEnv
|
|
| 460 | + -> [LintLocInfo]
|
|
| 461 | + -> IdSet
|
|
| 462 | + -> Bag SDoc
|
|
| 463 | + -> (a, Bag SDoc))
|
|
| 464 | + -> LintM a
|
|
| 465 | +pattern LintM m <- LintM' m
|
|
| 466 | + where
|
|
| 467 | + LintM m = LintM' $ oneShot (\env -> oneShot
|
|
| 468 | + (\loc -> oneShot
|
|
| 469 | + (\scope -> oneShot
|
|
| 470 | + (\errs -> m env loc scope errs))))
|
|
| 446 | 471 | |
| 447 | 472 | data LintFlags = LintFlags { lf_unarised :: !Bool
|
| 448 | 473 | , lf_platform :: !Platform
|
| ... | ... | @@ -473,14 +498,16 @@ pp_binders bs |
| 473 | 498 | |
| 474 | 499 | initL :: Platform -> DiagOpts -> Module -> Bool -> StgPprOpts -> IdSet -> LintM a -> Maybe SDoc
|
| 475 | 500 | initL platform diag_opts this_mod unarised opts locals (LintM m) = do
|
| 476 | - let (_, errs) = m this_mod (LintFlags unarised platform) diag_opts opts [] locals emptyBag
|
|
| 501 | + let !flags = LintFlags unarised platform
|
|
| 502 | + !env = LintReaderEnv this_mod flags diag_opts opts
|
|
| 503 | + (_, errs) = m env [] locals emptyBag
|
|
| 477 | 504 | if isEmptyBag errs then
|
| 478 | 505 | Nothing
|
| 479 | 506 | else
|
| 480 | 507 | Just (vcat (punctuate blankLine (bagToList errs)))
|
| 481 | 508 | |
| 482 | 509 | instance Applicative LintM where
|
| 483 | - pure a = LintM $ \_mod _lf _df _opts _loc _scope errs -> (a, errs)
|
|
| 510 | + pure a = LintM $ \_env _loc _scope errs -> (a, errs)
|
|
| 484 | 511 | (<*>) = ap
|
| 485 | 512 | (*>) = thenL_
|
| 486 | 513 | |
| ... | ... | @@ -489,14 +516,14 @@ instance Monad LintM where |
| 489 | 516 | (>>) = (*>)
|
| 490 | 517 | |
| 491 | 518 | thenL :: LintM a -> (a -> LintM b) -> LintM b
|
| 492 | -thenL m k = LintM $ \mod lf diag_opts opts loc scope errs
|
|
| 493 | - -> case unLintM m mod lf diag_opts opts loc scope errs of
|
|
| 494 | - (r, errs') -> unLintM (k r) mod lf diag_opts opts loc scope errs'
|
|
| 519 | +thenL m k = LintM $ \env loc scope errs
|
|
| 520 | + -> case unLintM m env loc scope errs of
|
|
| 521 | + (r, errs') -> unLintM (k r) env loc scope errs'
|
|
| 495 | 522 | |
| 496 | 523 | thenL_ :: LintM a -> LintM b -> LintM b
|
| 497 | -thenL_ m k = LintM $ \mod lf diag_opts opts loc scope errs
|
|
| 498 | - -> case unLintM m mod lf diag_opts opts loc scope errs of
|
|
| 499 | - (_, errs') -> unLintM k mod lf diag_opts opts loc scope errs'
|
|
| 524 | +thenL_ m k = LintM $ \env loc scope errs
|
|
| 525 | + -> case unLintM m env loc scope errs of
|
|
| 526 | + (_, errs') -> unLintM k env loc scope errs'
|
|
| 500 | 527 | |
| 501 | 528 | checkL :: Bool -> SDoc -> LintM ()
|
| 502 | 529 | checkL True _ = return ()
|
| ... | ... | @@ -525,7 +552,8 @@ checkPostUnariseId id |
| 525 | 552 | id_ty = idType id
|
| 526 | 553 | |
| 527 | 554 | addErrL :: SDoc -> LintM ()
|
| 528 | -addErrL msg = LintM $ \_mod _lf df _opts loc _scope errs -> ((), addErr df errs msg loc)
|
|
| 555 | +addErrL msg = LintM $ \LintReaderEnv{le_diag_opts = df} loc _scope errs
|
|
| 556 | + -> ((), addErr df errs msg loc)
|
|
| 529 | 557 | |
| 530 | 558 | addErr :: DiagOpts -> Bag SDoc -> SDoc -> [LintLocInfo] -> Bag SDoc
|
| 531 | 559 | addErr diag_opts errs_so_far msg locs
|
| ... | ... | @@ -537,23 +565,23 @@ addErr diag_opts errs_so_far msg locs |
| 537 | 565 | mk_msg [] = msg
|
| 538 | 566 | |
| 539 | 567 | addLoc :: LintLocInfo -> LintM a -> LintM a
|
| 540 | -addLoc extra_loc m = LintM $ \mod lf diag_opts opts loc scope errs
|
|
| 541 | - -> unLintM m mod lf diag_opts opts (extra_loc:loc) scope errs
|
|
| 568 | +addLoc extra_loc m = LintM $ \env loc scope errs
|
|
| 569 | + -> unLintM m env (extra_loc:loc) scope errs
|
|
| 542 | 570 | |
| 543 | 571 | addInScopeVars :: [Id] -> LintM a -> LintM a
|
| 544 | -addInScopeVars ids m = LintM $ \mod lf diag_opts opts loc scope errs
|
|
| 572 | +addInScopeVars ids m = LintM $ \env loc scope errs
|
|
| 545 | 573 | -> let
|
| 546 | 574 | new_set = mkVarSet ids
|
| 547 | - in unLintM m mod lf diag_opts opts loc (scope `unionVarSet` new_set) errs
|
|
| 575 | + in unLintM m env loc (scope `unionVarSet` new_set) errs
|
|
| 548 | 576 | |
| 549 | 577 | getLintFlags :: LintM LintFlags
|
| 550 | -getLintFlags = LintM $ \_mod lf _df _opts _loc _scope errs -> (lf, errs)
|
|
| 578 | +getLintFlags = LintM $ \LintReaderEnv{le_flags = lf} _loc _scope errs -> (lf, errs)
|
|
| 551 | 579 | |
| 552 | 580 | getStgPprOpts :: LintM StgPprOpts
|
| 553 | -getStgPprOpts = LintM $ \_mod _lf _df opts _loc _scope errs -> (opts, errs)
|
|
| 581 | +getStgPprOpts = LintM $ \LintReaderEnv{le_ppr_opts = opts} _loc _scope errs -> (opts, errs)
|
|
| 554 | 582 | |
| 555 | 583 | checkInScope :: Id -> LintM ()
|
| 556 | -checkInScope id = LintM $ \mod _lf diag_opts _opts loc scope errs
|
|
| 584 | +checkInScope id = LintM $ \LintReaderEnv{le_mod = mod, le_diag_opts = diag_opts} loc scope errs
|
|
| 557 | 585 | -> if nameIsLocalOrFrom mod (idName id) && not (id `elemVarSet` scope) then
|
| 558 | 586 | ((), addErr diag_opts errs (hsep [ppr id, dcolon, ppr (idType id),
|
| 559 | 587 | text "is out of scope"]) loc)
|
| ... | ... | @@ -109,6 +109,7 @@ import Data.Data (Data) |
| 109 | 109 | import Data.Functor ((<&>))
|
| 110 | 110 | |
| 111 | 111 | import Control.DeepSeq (NFData(..))
|
| 112 | +import GHC.Parser.Annotation (AnnPragma, noAnn)
|
|
| 112 | 113 | |
| 113 | 114 | {-
|
| 114 | 115 | ************************************************************************
|
| ... | ... | @@ -213,11 +214,11 @@ instance Outputable CCallSpec where |
| 213 | 214 | |
| 214 | 215 | defaultCType :: String -> CType (GhcPass p)
|
| 215 | 216 | defaultCType =
|
| 216 | - CType (CTypeGhc NoSourceText NoSourceText) Nothing . packHText
|
|
| 217 | + CType (CTypeGhc NoSourceText NoSourceText noAnn) Nothing . packHText
|
|
| 217 | 218 | |
| 218 | -mkCType :: SourceText -> SourceText -> Maybe (Header (GhcPass p)) -> HText -> CType (GhcPass p)
|
|
| 219 | -mkCType x y m =
|
|
| 220 | - CType (CTypeGhc x y) m
|
|
| 219 | +mkCType :: SourceText -> SourceText -> AnnPragma -> Maybe (Header (GhcPass p)) -> HText -> CType (GhcPass p)
|
|
| 220 | +mkCType x y ann m =
|
|
| 221 | + CType (CTypeGhc x y ann) m
|
|
| 221 | 222 | |
| 222 | 223 | typeCheckCType :: CType GhcRn -> CType GhcTc
|
| 223 | 224 | typeCheckCType (CType x y z) = CType x (typeCheckHeader <$> y) z
|
| ... | ... | @@ -302,6 +303,7 @@ data StaticTargetGhc = StaticTargetGhc |
| 302 | 303 | data CTypeGhc = CTypeGhc
|
| 303 | 304 | { cTypeSourceText :: SourceText
|
| 304 | 305 | , cTypeOtherText :: SourceText
|
| 306 | + , cTypeAnn :: AnnPragma
|
|
| 305 | 307 | }
|
| 306 | 308 | deriving (Data, Eq)
|
| 307 | 309 | |
| ... | ... | @@ -349,6 +351,7 @@ instance Binary CTypeGhc where |
| 349 | 351 | return $ CTypeGhc
|
| 350 | 352 | { cTypeSourceText = str1
|
| 351 | 353 | , cTypeOtherText = str2
|
| 354 | + , cTypeAnn = noAnn
|
|
| 352 | 355 | }
|
| 353 | 356 | |
| 354 | 357 | instance NFData StaticTargetGhc where
|
| ... | ... | @@ -38,6 +38,7 @@ |
| 38 | 38 | * Show `ExceptionContext` in `displayExceptionAnnotation` implementation of `WhileHandling` ([GHC #27456](https://gitlab.haskell.org/ghc/ghc/-/issues/27456))
|
| 39 | 39 | * Hide implementation details when throwing exceptions in throw and throwSTM. ([CLC proposal #387](https://github.com/haskell/core-libraries-committee/issues/387))
|
| 40 | 40 | * 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))
|
| 41 | + * The implementation of `toException` in `SomeException`'s `Exception` instance no longer drops exception context, in keeping with the behavior originally proposed in [CLC Proposal #200](https://github.com/haskell/core-libraries-committee/issues/200).
|
|
| 41 | 42 | * Annotate `onException` continuation with `WhileHandling`. ([CLC Proposal #397](https://github.com/haskell/core-libraries-committee/issues/397))
|
| 42 | 43 | * Improve error message for `Data.Char.chr`. ([CLC Proposal #384](https://github.com/haskell/core-libraries-committee/issues/384))
|
| 43 | 44 |
| ... | ... | @@ -80,7 +80,7 @@ test('length001', |
| 80 | 80 | # excessive amounts of stack space. So we specifically set a low
|
| 81 | 81 | # stack limit and mark it as failing under a few conditions.
|
| 82 | 82 | [extra_run_opts('+RTS -K8m -RTS'),
|
| 83 | - expect_fail_for(['normal', 'threaded1', 'llvm', 'nonmoving', 'nonmoving_thr', 'nonmoving_thr_ghc', 'ext-interp']),
|
|
| 83 | + expect_fail_for(['normal', 'threaded1', 'llvm', 'nonmoving', 'nonmoving_thr', 'nonmoving_thr_sanity', 'nonmoving_thr_ghc', 'ext-interp']),
|
|
| 84 | 84 | # JS doesn't support stack limit so the test sometimes passes just fine. Therefore the test is
|
| 85 | 85 | # marked as fragile.
|
| 86 | 86 | when(js_arch(), fragile(22921))],
|
| ... | ... | @@ -2,5 +2,10 @@ module Main where |
| 2 | 2 | |
| 3 | 3 | import GHC.Conc.Sync
|
| 4 | 4 | |
| 5 | +-- Regression test for the JS backend's ListThreadsOp, which used to omit the
|
|
| 6 | +-- running thread. Whatever other threads the RTS has is irrelevant here.
|
|
| 5 | 7 | main :: IO ()
|
| 6 | -main = listThreads >>= print |
|
| 8 | +main = do
|
|
| 9 | + tid <- myThreadId
|
|
| 10 | + ts <- listThreads
|
|
| 11 | + print (tid `elem` ts) |
| 1 | -[ThreadId 1] |
|
| 1 | +True |
| ... | ... | @@ -55,7 +55,7 @@ import GHC.Internal.Data.Maybe |
| 55 | 55 | import GHC.Internal.Data.Typeable (Typeable, TypeRep, cast)
|
| 56 | 56 | import qualified GHC.Internal.Data.Typeable as Typeable
|
| 57 | 57 | -- loop: GHC.Internal.Data.Typeable -> GHC.Internal.Err -> GHC.Internal.Exception
|
| 58 | -import GHC.Internal.Base (String, Void, fmap, return, ($), (.), (++))
|
|
| 58 | +import GHC.Internal.Base (String, Void, fmap, return, ($), (.), (++), id)
|
|
| 59 | 59 | import GHC.Internal.Show
|
| 60 | 60 | import GHC.Internal.Types (Bool(..))
|
| 61 | 61 | import GHC.Internal.Exception.Context
|
| ... | ... | @@ -208,7 +208,16 @@ Caught MismatchedParentheses |
| 208 | 208 | |
| 209 | 209 | -}
|
| 210 | 210 | class (Typeable e, Show e) => Exception e where
|
| 211 | - -- | @toException@ should produce a 'SomeException' with no attached 'ExceptionContext'.
|
|
| 211 | + -- | 'toException' converts an exception into the existential 'SomeException'
|
|
| 212 | + -- wrapper type.
|
|
| 213 | + --
|
|
| 214 | + -- In doing so, 'toException' should not /add/ an 'ExceptionContext'.
|
|
| 215 | + --
|
|
| 216 | + -- - In most cases, the exception does not store its own 'ExceptionContext'.
|
|
| 217 | + -- The default implementation of 'toException' (which does not store any
|
|
| 218 | + -- 'ExceptionContext') is suitable for these cases.
|
|
| 219 | + -- - In the rare case that the exception itself stores an 'ExceptionContext',
|
|
| 220 | + -- this context should be preserved by 'toException'.
|
|
| 212 | 221 | toException :: e -> SomeException
|
| 213 | 222 | fromException :: SomeException -> Maybe e
|
| 214 | 223 | |
| ... | ... | @@ -231,13 +240,11 @@ class (Typeable e, Show e) => Exception e where |
| 231 | 240 | -- | @since base-4.8.0.0
|
| 232 | 241 | instance Exception Void
|
| 233 | 242 | |
| 234 | --- | This drops any attached 'ExceptionContext'.
|
|
| 243 | +-- | NB: this instance preserves the attached 'ExceptionContext'.
|
|
| 235 | 244 | --
|
| 236 | 245 | -- @since base-3.0
|
| 237 | 246 | instance Exception SomeException where
|
| 238 | - toException (SomeException e) =
|
|
| 239 | - let ?exceptionContext = emptyExceptionContext
|
|
| 240 | - in SomeException e
|
|
| 247 | + toException = id
|
|
| 241 | 248 | fromException = Just
|
| 242 | 249 | backtraceDesired (SomeException e) = backtraceDesired e
|
| 243 | 250 | displayException (SomeException e) = displayException e
|
| ... | ... | @@ -4,3 +4,8 @@ foo |
| 4 | 4 | |
| 5 | 5 | HasCallStack backtrace:
|
| 6 | 6 | error, called at ghc-e005.hs:12:10 in main:Main
|
| 7 | + |
|
| 8 | + |
|
| 9 | +HasCallStack backtrace:
|
|
| 10 | + throwIO, called at ghc\GHCi\UI.hs:1655:31 in ghc-bin-10.1.20260629-inplace:GHCi.UI
|
|
| 11 | + |
| ... | ... | @@ -679,7 +679,7 @@ test('T22859', |
| 679 | 679 | [js_skip,
|
| 680 | 680 | # This test is vulnerable to changes in allocation behaviour, so we disable it in some ways
|
| 681 | 681 | when(arch('wasm32'), skip),
|
| 682 | - omit_ways(llvm_ways)],
|
|
| 682 | + omit_ways(llvm_ways + ['nonmoving_thr', 'nonmoving_thr_sanity'])],
|
|
| 683 | 683 | compile_and_run, ['-with-rtsopts -A8K'])
|
| 684 | 684 | |
| 685 | 685 | # These tests need access to the internal RTS headers.
|
| ... | ... | @@ -4401,13 +4401,14 @@ instance ExactPrint t => ExactPrint (HsModifierOf t GhcPs) where |
| 4401 | 4401 | |
| 4402 | 4402 | -- ---------------------------------------------------------------------
|
| 4403 | 4403 | |
| 4404 | -instance Typeable p => ExactPrint (LocatedP (CType (GhcPass p))) where
|
|
| 4405 | - getAnnotationEntry = entryFromLocatedA
|
|
| 4406 | - setAnnotationAnchor = setAnchorAn
|
|
| 4404 | +instance Typeable p => ExactPrint (CType (GhcPass p)) where
|
|
| 4405 | + getAnnotationEntry _ = NoEntryVal
|
|
| 4406 | + setAnnotationAnchor a _ _ _ = a
|
|
| 4407 | 4407 | |
| 4408 | - exact (L (EpAnn l (AnnPragma o c s l1 l2 t m) cs) (CType ext mh ct)) = do
|
|
| 4408 | + exact (CType ext mh ct) = do
|
|
| 4409 | 4409 | let stp = cTypeSourceText ext
|
| 4410 | 4410 | stct = cTypeOtherText ext
|
| 4411 | + AnnPragma o c s l1 l2 t m = cTypeAnn ext
|
|
| 4411 | 4412 | o' <- markAnnOpen'' o stp "{-# CTYPE"
|
| 4412 | 4413 | l1' <- case mh of
|
| 4413 | 4414 | Nothing -> return l1
|
| ... | ... | @@ -4415,7 +4416,7 @@ instance Typeable p => ExactPrint (LocatedP (CType (GhcPass p))) where |
| 4415 | 4416 | printStringAtAA l1 (toSourceTextWithSuffix srcH "" "")
|
| 4416 | 4417 | l2' <- printStringAtAA l2 (toSourceTextWithSuffix stct (unpackHText ct) "")
|
| 4417 | 4418 | c' <- markEpToken c
|
| 4418 | - return (L (EpAnn l (AnnPragma o' c' s l1' l2' t m) cs) (CType ext mh ct))
|
|
| 4419 | + return (CType (ext { cTypeAnn = AnnPragma o' c' s l1' l2' t m }) mh ct)
|
|
| 4419 | 4420 | |
| 4420 | 4421 | -- ---------------------------------------------------------------------
|
| 4421 | 4422 |
| ... | ... | @@ -837,7 +837,7 @@ type instance Anno (HsOuterTyVarBndrs Specificity DocNameI) = SrcSpanAnnA |
| 837 | 837 | type instance Anno (HsSigType DocNameI) = SrcSpanAnnA
|
| 838 | 838 | type instance Anno (BooleanFormula DocNameI) = SrcSpanAnnBF
|
| 839 | 839 | type instance Anno (OverlapMode DocNameI) = SrcSpanAnnA
|
| 840 | -type instance Anno (CType DocNameI) = EpAnn AnnPragma
|
|
| 840 | +type instance Anno (CType DocNameI) = SrcSpanAnnA
|
|
| 841 | 841 | type instance Anno (Header DocNameI) = EpAnn AnnPragma
|
| 842 | 842 | type instance Anno (HsModifierOf (LocatedA (HsType DocNameI)) DocNameI) = SrcSpanAnnA
|
| 843 | 843 | type instance Anno (HsContextDetails DocNameI a) = SrcSpanAnnA
|