Simon Hengel pushed to branch wip/sol/rename-mc-diagnostics at Glasgow Haskell Compiler / GHC

Commits:

15 changed files:

Changes:

  • compiler/GHC/Driver/Errors.hs
    1
    +{-# OPTIONS_GHC -Wno-x-unsafe-diagnostics #-}
    
    1 2
     module GHC.Driver.Errors (
    
    2 3
         reportError
    
    3 4
       , reportDiagnostic
    
    ... ... @@ -66,7 +67,7 @@ printMessage logger msg_opts opts message
    66 67
         doc = updSDocContext (\_ -> ctx) (messageWithHints diagnostic)
    
    67 68
     
    
    68 69
         messageClass :: MessageClass
    
    69
    -    messageClass = MCDiagnostic severity (errMsgReason message) (diagnosticCode diagnostic)
    
    70
    +    messageClass = UnsafeMCDiagnostic severity (errMsgReason message) (diagnosticCode diagnostic)
    
    70 71
     
    
    71 72
         style :: PprStyle
    
    72 73
         style = mkErrStyle (errMsgContext message)
    

  • compiler/GHC/Driver/Main/Passes.hs
    ... ... @@ -2,6 +2,7 @@
    2 2
     {-# LANGUAGE MultiWayIf #-}
    
    3 3
     
    
    4 4
     {-# OPTIONS_GHC -fprof-auto-top #-}
    
    5
    +{-# OPTIONS_GHC -Wno-x-unsafe-diagnostics #-}
    
    5 6
     
    
    6 7
     -------------------------------------------------------------------------------
    
    7 8
     -- | Aspects of GHC.Driver.Main dealing with running particular passes.
    
    ... ... @@ -1400,9 +1401,10 @@ markUnsafeInfer tcg_env whyUnsafe = do
    1400 1401
         whyUnsafe' df = vcat [ quotes pprMod <+> text "has been inferred as unsafe!"
    
    1401 1402
                              , text "Reason:"
    
    1402 1403
                              , nest 4 $ (vcat $ badFlags df) $+$
    
    1403
    -                                    -- MP: Using defaultDiagnosticOpts here is not right but it's also not right to handle these
    
    1404
    -                                    -- unsafety error messages in an unstructured manner.
    
    1405
    -                                    (vcat $ pprMsgEnvelopeBagWithLoc (defaultDiagnosticOpts @e) (getMessages whyUnsafe)) $+$
    
    1404
    +                                    -- `unsafePprMessages` uses `defaultDiagnosticOpts`.
    
    1405
    +                                    -- That is not right, but it's also not right to handle
    
    1406
    +                                    -- these unsafety error messages in an unstructured manner.
    
    1407
    +                                    (vcat $ unsafePprMessages (getMessages whyUnsafe)) $+$
    
    1406 1408
                                         (vcat $ badInsts $ tcg_insts tcg_env)
    
    1407 1409
                              ]
    
    1408 1410
         badFlags df   = concatMap (badFlag df) unsafeFlagsForInfer
    

  • compiler/GHC/Driver/Pipeline.hs
    ... ... @@ -101,7 +101,7 @@ import GHC.Iface.Recomp
    101 101
     import GHC.Runtime.Loader      ( initializePlugins )
    
    102 102
     
    
    103 103
     import GHC.Types.Basic        ( SuccessFlag(..), ForeignSrcLang(..) )
    
    104
    -import GHC.Types.Error        ( singleMessage, getMessages, mkSimpleUnknownDiagnostic, defaultDiagnosticOpts )
    
    104
    +import GHC.Types.Error        ( singleMessage, getMessages, mkSimpleUnknownDiagnostic )
    
    105 105
     import GHC.Types.ForeignStubs ( ForeignStubs (NoStubs) )
    
    106 106
     import GHC.Types.Target
    
    107 107
     import GHC.Types.SrcLoc
    
    ... ... @@ -169,9 +169,7 @@ preprocess hsc_env input_fn mb_input_buf mb_phase =
    169 169
     
    
    170 170
         to_driver_messages :: Messages GhcMessage -> Messages DriverMessage
    
    171 171
         to_driver_messages msgs = case traverse to_driver_message msgs of
    
    172
    -      Nothing    -> pprPanic "non-driver message in preprocess"
    
    173
    -                             -- MP: Default config is fine here as it's just in a panic.
    
    174
    -                             (vcat $ pprMsgEnvelopeBagWithLoc (defaultDiagnosticOpts @GhcMessage) (getMessages msgs))
    
    172
    +      Nothing    -> panicMessage "non-driver message in preprocess" (getMessages msgs)
    
    175 173
           Just msgs' -> msgs'
    
    176 174
     
    
    177 175
         to_driver_message = \case
    

  • compiler/GHC/HsToCore/Monad.hs
    ... ... @@ -404,7 +404,7 @@ initTcDsForSolver thing_inside
    404 404
              thing_inside
    
    405 405
            ; case mb_ret of
    
    406 406
                Just ret -> pure ret
    
    407
    -           Nothing  -> pprPanic "initTcDsForSolver" (vcat $ pprMsgEnvelopeBagWithLocDefault (getErrorMessages msgs)) }
    
    407
    +           Nothing  -> panicMessage "initTcDsForSolver" (getErrorMessages msgs) }
    
    408 408
     
    
    409 409
     mkDsEnvs :: UnitEnv -> Module -> GlobalRdrEnv -> TypeEnv -> FamInstEnv
    
    410 410
              -> TcMPluginsRun
    

  • compiler/GHC/Tc/Errors.hs
    ... ... @@ -71,7 +71,7 @@ import GHC.Core.TyCo.FVs
    71 71
     import GHC.Core.InstEnv
    
    72 72
     import GHC.Core.TyCon
    
    73 73
     
    
    74
    -import GHC.Utils.Error  (diagReasonSeverity,  pprLocMsgEnvelope )
    
    74
    +import GHC.Utils.Error  (diagReasonSeverity, deferredTypeErrorMessage )
    
    75 75
     import GHC.Utils.Misc
    
    76 76
     import GHC.Utils.Outputable as O
    
    77 77
     import GHC.Utils.Panic
    
    ... ... @@ -1389,9 +1389,8 @@ mkErrorTerm ct_loc ty ctxt msg supp hints
    1389 1389
                       hints
    
    1390 1390
              -- This will be reported at runtime, so we always want "error:" in the report, never "warning:"
    
    1391 1391
            ; dflags <- getDynFlags
    
    1392
    -       ; let err_msg = pprLocMsgEnvelope (initTcMessageOpts dflags) msg
    
    1393
    -             err_str = showSDoc dflags $
    
    1394
    -                       err_msg $$ text "(deferred type error)"
    
    1392
    +       ; let err_msg = deferredTypeErrorMessage (initTcMessageOpts dflags) msg
    
    1393
    +             err_str = showSDoc dflags err_msg
    
    1395 1394
     
    
    1396 1395
            ; return $ evDelayedError ty err_str }
    
    1397 1396
     
    

  • compiler/GHC/Tc/Utils/Monad.hs
    ... ... @@ -1432,8 +1432,7 @@ reportDiagnostics = mapM_ reportDiagnostic
    1432 1432
     
    
    1433 1433
     reportDiagnostic :: MsgEnvelope TcRnMessage -> TcRn ()
    
    1434 1434
     reportDiagnostic msg
    
    1435
    -  = do { traceTc "Adding diagnostic:" (pprLocMsgEnvelopeDefault msg) ;
    
    1436
    -         errs_var <- getErrsVar ;
    
    1435
    +  = do { errs_var <- getErrsVar ;
    
    1437 1436
              msgs     <- readTcRef errs_var ;
    
    1438 1437
              writeTcRef errs_var (msg `addMessage` msgs) }
    
    1439 1438
     
    

  • compiler/GHC/Types/Error.hs
    ... ... @@ -18,7 +18,7 @@ module GHC.Types.Error
    18 18
     
    
    19 19
        -- * Classifying Messages
    
    20 20
     
    
    21
    -   , MessageClass (..)
    
    21
    +   , MessageClass (MCDiagnostic, ..)
    
    22 22
        , Severity (..)
    
    23 23
        , Diagnostic (..)
    
    24 24
        , UnknownDiagnostic (..)
    
    ... ... @@ -482,7 +482,7 @@ data MessageClass
    482 482
         -- ^ Log messages intended for end users.
    
    483 483
         -- No file\/line\/column stuff.
    
    484 484
     
    
    485
    -  | MCDiagnostic Severity ResolvedDiagnosticReason (Maybe DiagnosticCode)
    
    485
    +  | UnsafeMCDiagnostic Severity ResolvedDiagnosticReason (Maybe DiagnosticCode)
    
    486 486
         -- ^ Diagnostics from the compiler. This constructor is very powerful as
    
    487 487
         -- it allows the construction of a 'MessageClass' with a completely
    
    488 488
         -- arbitrary permutation of 'Severity' and 'DiagnosticReason'. As such,
    
    ... ... @@ -492,10 +492,19 @@ data MessageClass
    492 492
         -- 'GHC.Utils.Error'. In all the other circumstances, /especially/ when
    
    493 493
         -- emitting compiler diagnostics, use higher level primitives.
    
    494 494
         --
    
    495
    +    -- For deconstruction use `MCDiagnostic`.
    
    496
    +    --
    
    495 497
         -- The @Maybe 'DiagnosticCode'@ field carries a code (if available) for
    
    496 498
         -- this diagnostic. If you are creating a message not tied to any
    
    497 499
         -- error-message type, then use Nothing. In the long run, this really
    
    498 500
         -- should always have a 'DiagnosticCode'. See Note [Diagnostic codes].
    
    501
    +    --
    
    502
    +{-# WARNING in "x-unsafe-diagnostics" UnsafeMCDiagnostic
    
    503
    +    "This is an internal constructor.  Use `MCDiagnostic` or `GHC.Driver.Errors.printMessages` instead." #-}
    
    504
    +
    
    505
    +{-# COMPLETE MCOutput, MCFatal, MCInteractive, MCDump, MCInfo, MCDiagnostic #-}
    
    506
    +pattern MCDiagnostic :: Severity -> ResolvedDiagnosticReason -> Maybe DiagnosticCode -> MessageClass
    
    507
    +pattern MCDiagnostic severity reason code <- UnsafeMCDiagnostic severity reason code
    
    499 508
     
    
    500 509
     {-
    
    501 510
     Note [Suppressing Messages]
    

  • compiler/GHC/Types/Error.hs-boot deleted
    1
    -module GHC.Types.Error where
    
    2
    -
    
    3
    -import GHC.Prelude (Maybe, Bool, IO)
    
    4
    -import GHC.Utils.Outputable (SDoc)
    
    5
    -import GHC.Types.SrcLoc (SrcSpan)
    
    6
    -
    
    7
    -data MessageClass
    
    8
    -  = MCOutput
    
    9
    -  | MCFatal
    
    10
    -  | MCInteractive
    
    11
    -  | MCDump
    
    12
    -  | MCInfo
    
    13
    -  | MCDiagnostic Severity ResolvedDiagnosticReason (Maybe DiagnosticCode)
    
    14
    -
    
    15
    -data Severity
    
    16
    -  = SevIgnore
    
    17
    -  | SevWarning
    
    18
    -  | SevError
    
    19
    -
    
    20
    -data DiagnosticCode
    
    21
    -data ResolvedDiagnosticReason
    
    22
    -
    
    23
    -mkLocMessageWarningGroups  :: Bool -> MessageClass -> SrcSpan -> SDoc -> SDoc
    
    24
    -getCaretDiagnostic :: MessageClass -> SrcSpan -> IO SDoc

  • compiler/GHC/Types/SourceError.hs
    ... ... @@ -16,8 +16,7 @@ import GHC.Types.Error
    16 16
     import GHC.Utils.Monad
    
    17 17
     import GHC.Utils.Panic
    
    18 18
     import GHC.Utils.Exception
    
    19
    -import GHC.Utils.Error (pprMsgEnvelopeBagWithLocDefault, DiagOpts, diag_ppr_ctx)
    
    20
    -import GHC.Utils.Outputable
    
    19
    +import GHC.Utils.Error (unsafeShow, DiagOpts)
    
    21 20
     
    
    22 21
     import GHC.Driver.Config.Diagnostic (initDiagOpts, initPrintConfig)
    
    23 22
     import GHC.Driver.DynFlags (DynFlags, HasDynFlags (getDynFlags))
    
    ... ... @@ -76,12 +75,7 @@ instance Show SourceError where
    76 75
       -- We implement 'Show' because it's required by the 'Exception' instance, but diagnostics
    
    77 76
       -- shouldn't be shown via the 'Show' typeclass, but rather rendered using the ppr functions.
    
    78 77
       -- This also explains why there is no 'Show' instance for a 'MsgEnvelope'.
    
    79
    -  show (SourceError (SEC diag_opts _) msgs) =
    
    80
    -      renderWithContext (diag_ppr_ctx diag_opts)
    
    81
    -    . vcat
    
    82
    -    . pprMsgEnvelopeBagWithLocDefault
    
    83
    -    . getMessages
    
    84
    -    $ msgs
    
    78
    +  show (SourceError _ msgs) = unsafeShow msgs
    
    85 79
     
    
    86 80
     instance Exception SourceError
    
    87 81
     
    

  • compiler/GHC/Utils/Error.hs
    1 1
     {-# LANGUAGE ViewPatterns    #-}
    
    2 2
     
    
    3
    +{-# OPTIONS_GHC -Wno-x-unsafe-diagnostics #-}
    
    4
    +
    
    3 5
     {-
    
    4 6
     (c) The AQUA Project, Glasgow University, 1994-1998
    
    5 7
     
    
    ... ... @@ -22,10 +24,9 @@ module GHC.Utils.Error (
    22 24
             errorsFound, isEmptyMessages,
    
    23 25
     
    
    24 26
             -- ** Formatting
    
    25
    -        pprMessageBag, pprMsgEnvelopeBagWithLoc, pprMsgEnvelopeBagWithLocDefault,
    
    26
    -        pprMessages,
    
    27
    -        pprLocMsgEnvelope, pprLocMsgEnvelopeDefault,
    
    28
    -        formatBulleted,
    
    27
    +        pprMessageBag, formatBulleted,
    
    28
    +        deferredTypeErrorMessage,
    
    29
    +        panicMessage, unsafeShow, unsafePprMessages,
    
    29 30
     
    
    30 31
             -- ** Construction
    
    31 32
             DiagOpts (..), emptyDiagOpts, diag_wopt, diag_fatal_wopt,
    
    ... ... @@ -265,29 +266,33 @@ formatBulleted (unDecorated -> docs)
    265 266
         msgs ctx = filter (not . Outputable.isEmpty ctx) docs
    
    266 267
         starred = (bullet<+>)
    
    267 268
     
    
    268
    -pprMessages :: Diagnostic e => DiagnosticOpts e -> Messages e -> SDoc
    
    269
    -pprMessages e = vcat . pprMsgEnvelopeBagWithLoc e . getMessages
    
    269
    +deferredTypeErrorMessage :: Diagnostic e => DiagnosticOpts e -> MsgEnvelope e -> SDoc
    
    270
    +deferredTypeErrorMessage opts msg = unsafePprMessage opts msg $$ text "(deferred type error)"
    
    270 271
     
    
    271
    -pprMsgEnvelopeBagWithLoc :: Diagnostic e => DiagnosticOpts e -> Bag (MsgEnvelope e) -> [SDoc]
    
    272
    -pprMsgEnvelopeBagWithLoc e bag = [ pprLocMsgEnvelope e item | item <- sortMsgBag Nothing bag ]
    
    272
    +panicMessage :: Diagnostic e => String -> Bag (MsgEnvelope e) -> a
    
    273
    +panicMessage name msgs = pprPanic name (vcat $ unsafePprMessages msgs)
    
    273 274
     
    
    274
    --- | Print the messages with the suitable default configuration, usually not what you want but sometimes you don't really
    
    275
    --- care about what the configuration is (for example, if the message is in a panic).
    
    276
    -pprMsgEnvelopeBagWithLocDefault :: forall e . Diagnostic e => Bag (MsgEnvelope e) -> [SDoc]
    
    277
    -pprMsgEnvelopeBagWithLocDefault bag = [ pprLocMsgEnvelopeDefault item | item <- sortMsgBag Nothing bag ]
    
    275
    +unsafeShow :: Diagnostic e => Messages e -> String
    
    276
    +unsafeShow =
    
    277
    +    renderWithContext defaultSDocContext
    
    278
    +  . vcat
    
    279
    +  . unsafePprMessages
    
    280
    +  . getMessages
    
    278 281
     
    
    279
    -pprLocMsgEnvelopeDefault :: forall e . Diagnostic e => MsgEnvelope e -> SDoc
    
    280
    -pprLocMsgEnvelopeDefault = pprLocMsgEnvelope (defaultDiagnosticOpts @e)
    
    282
    +{-# WARNING in "x-unsafe-diagnostics" unsafePprMessages
    
    283
    +    "This function sidesteps @-fdiagnostics-as-json@!  Use `GHC.Driver.Errors.printMessages` instead." #-}
    
    284
    +unsafePprMessages :: forall e . Diagnostic e => Bag (MsgEnvelope e) -> [SDoc]
    
    285
    +unsafePprMessages = map (unsafePprMessage (defaultDiagnosticOpts @e)) . sortMsgBag Nothing
    
    281 286
     
    
    282
    -pprLocMsgEnvelope :: Diagnostic e => DiagnosticOpts e -> MsgEnvelope e -> SDoc
    
    283
    -pprLocMsgEnvelope opts (MsgEnvelope { errMsgSpan       = s
    
    287
    +unsafePprMessage :: Diagnostic e => DiagnosticOpts e -> MsgEnvelope e -> SDoc
    
    288
    +unsafePprMessage opts (MsgEnvelope { errMsgSpan        = s
    
    284 289
                                         , errMsgDiagnostic = e
    
    285 290
                                         , errMsgSeverity   = sev
    
    286 291
                                         , errMsgContext    = name_ppr_ctx
    
    287 292
                                         , errMsgReason     = reason })
    
    288 293
       = withErrStyle name_ppr_ctx $
    
    289 294
           mkLocMessage
    
    290
    -        (MCDiagnostic sev reason (diagnosticCode e))
    
    295
    +        (UnsafeMCDiagnostic sev reason (diagnosticCode e))
    
    291 296
             s
    
    292 297
             (formatBulleted $ diagnosticMessage opts e)
    
    293 298
     
    

  • ghc/GHCi/UI/Exception.hs
    ... ... @@ -56,12 +56,7 @@ instance Show GhciCommandError where
    56 56
       -- We implement 'Show' because it's required by the 'Exception' instance, but diagnostics
    
    57 57
       -- shouldn't be shown via the 'Show' typeclass, but rather rendered using the ppr functions.
    
    58 58
       -- This also explains why there is no 'Show' instance for a 'MsgEnvelope'.
    
    59
    -  show (GhciCommandError msgs) =
    
    60
    -      renderWithContext defaultSDocContext
    
    61
    -    . vcat
    
    62
    -    . pprMsgEnvelopeBagWithLocDefault
    
    63
    -    . getMessages
    
    64
    -    $ msgs
    
    59
    +  show (GhciCommandError msgs) = unsafeShow msgs
    
    65 60
     
    
    66 61
     -- | Perform the given action and call the exception handler if the action
    
    67 62
     -- throws a 'GhciCommandError'.  See 'GhciCommandError' for more information.
    

  • utils/check-exact/Main.hs
    ... ... @@ -368,19 +368,11 @@ parseOneFile :: FilePath -> FilePath -> IO (ParsedSource, [Located Token])
    368 368
     parseOneFile libdir fileName = do
    
    369 369
       res <- parseModuleEpAnnsWithCpp libdir defaultCppOptions fileName
    
    370 370
       case res of
    
    371
    -    Left m -> error (showErrorMessages m)
    
    371
    +    Left m -> error (unsafeShow m)
    
    372 372
         Right (injectedComments, _dflags, pmod) -> do
    
    373 373
           let !pmodWithComments = insertCppComments pmod injectedComments
    
    374 374
           return (pmodWithComments, [])
    
    375 375
     
    
    376
    -showErrorMessages :: Messages GhcMessage -> String
    
    377
    -showErrorMessages msgs =
    
    378
    -  renderWithContext defaultSDocContext
    
    379
    -    $ vcat
    
    380
    -    $ pprMsgEnvelopeBagWithLocDefault
    
    381
    -    $ getMessages
    
    382
    -    $ msgs
    
    383
    -
    
    384 376
     -- ---------------------------------------------------------------------
    
    385 377
     
    
    386 378
     exactprintWithChange :: FilePath -> Changer -> ParsedSource -> IO (String, ParsedSource)
    

  • utils/check-exact/Preprocess.hs
    ... ... @@ -216,20 +216,12 @@ getPreprocessedSrcDirectPrim cppOptions src_fn = do
    216 216
           new_env = hsc_env { GHC.hsc_dflags = injectCppOptions cppOptions dfs }
    
    217 217
       r <- GHC.liftIO $ GHC.preprocess new_env src_fn Nothing (Just (GHC.Cpp GHC.HsSrcFile))
    
    218 218
       case r of
    
    219
    -    Left err -> error $ showErrorMessages err
    
    219
    +    Left err -> error $ GHC.unsafeShow err
    
    220 220
         Right (dflags', hspp_fn) -> do
    
    221 221
           buf <- GHC.liftIO $ GHC.hGetStringBuffer hspp_fn
    
    222 222
           txt <- GHC.liftIO $ readFileGhc hspp_fn
    
    223 223
           return (txt, buf, dflags')
    
    224 224
     
    
    225
    -showErrorMessages :: GHC.Messages GHC.DriverMessage -> String
    
    226
    -showErrorMessages msgs =
    
    227
    -  GHC.renderWithContext GHC.defaultSDocContext
    
    228
    -    $ GHC.vcat
    
    229
    -    $ GHC.pprMsgEnvelopeBagWithLocDefault
    
    230
    -    $ GHC.getMessages
    
    231
    -    $ msgs
    
    232
    -
    
    233 225
     injectCppOptions :: CppOptions -> GHC.DynFlags -> GHC.DynFlags
    
    234 226
     injectCppOptions CppOptions{..} dflags = folded_opt
    
    235 227
       where
    

  • utils/haddock/haddock-api/src/Haddock/Backends/Hyperlinker.hs
    ... ... @@ -97,7 +97,7 @@ ppHyperlinkedModuleSource verbosity srcdir pretty srcs iface = do
    97 97
           mast
    
    98 98
             | M.size asts == 1 = snd <$> M.lookupMin asts
    
    99 99
             | otherwise = M.lookup (HiePath (mkFastString file)) asts
    
    100
    -      tokens' = parse parserOpts sDocContext file rawSrc
    
    100
    +      tokens' = parse parserOpts file rawSrc
    
    101 101
           ast = fromMaybe (emptyHieAst fileFs) mast
    
    102 102
           fullAst = recoverFullIfaceTypes sDocContext types ast
    
    103 103
     
    

  • utils/haddock/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs
    ... ... @@ -9,7 +9,6 @@ import Control.Monad.Trans.Class
    9 9
     import Control.Monad.Trans.Maybe
    
    10 10
     import qualified Data.ByteString as BS
    
    11 11
     import Data.List (isPrefixOf, isSuffixOf)
    
    12
    -import GHC.Data.Bag (bagToList)
    
    13 12
     import GHC.Data.FastString (mkFastString)
    
    14 13
     import GHC.Data.StringBuffer (StringBuffer, atEnd)
    
    15 14
     import GHC.Parser.Errors.Ppr ()
    
    ... ... @@ -26,10 +25,7 @@ import GHC.Parser.Lexer as Lexer
    26 25
     import qualified GHC.Types.Error as E
    
    27 26
     import GHC.Types.SourceText
    
    28 27
     import GHC.Types.SrcLoc
    
    29
    -import GHC.Utils.Error (pprLocMsgEnvelopeDefault)
    
    30
    -import GHC.Utils.Outputable (SDocContext, text, ($$))
    
    31
    -import qualified GHC.Utils.Outputable as Outputable
    
    32
    -import GHC.Utils.Panic (panic)
    
    28
    +import GHC.Utils.Error (panicMessage)
    
    33 29
     
    
    34 30
     import Haddock.Backends.Hyperlinker.Types as T
    
    35 31
     import Haddock.GhcUtils
    
    ... ... @@ -40,19 +36,14 @@ import Haddock.GhcUtils
    40 36
     -- whitespace, and CPP).
    
    41 37
     parse
    
    42 38
       :: ParserOpts
    
    43
    -  -> SDocContext
    
    44 39
       -> FilePath
    
    45 40
       -- ^ Path to the source of this module
    
    46 41
       -> BS.ByteString
    
    47 42
       -- ^ Raw UTF-8 encoded source of this module
    
    48 43
       -> [T.Token]
    
    49
    -parse parserOpts sDocContext fpath bs = case unP (go False []) initState of
    
    44
    +parse parserOpts fpath bs = case unP (go False []) initState of
    
    50 45
       POk _ toks -> reverse toks
    
    51
    -  PFailed pst ->
    
    52
    -    let err : _ = bagToList (E.getMessages $ getPsErrorMessages pst)
    
    53
    -     in panic $
    
    54
    -          Outputable.renderWithContext sDocContext $
    
    55
    -            text "Hyperlinker parse error:" $$ pprLocMsgEnvelopeDefault err
    
    46
    +  PFailed pst -> panicMessage "Hyperlinker parse error:" (E.getMessages $ getPsErrorMessages pst)
    
    56 47
       where
    
    57 48
         initState = initParserState parserOpts buf start
    
    58 49
         buf = stringBufferFromByteString bs