Apoorv Ingle pushed to branch wip/ani/kill-SrcCodeOrigin at Glasgow Haskell Compiler / GHC

Commits:

23 changed files:

Changes:

  • compiler/GHC/Hs/Expr.hs
    ... ... @@ -686,7 +686,7 @@ mkExpandedStmt
    686 686
       -> HsDoFlavour          -- ^ source statements do flavour
    
    687 687
       -> HsExpr GhcRn         -- ^ expanded expression
    
    688 688
       -> HsExpr GhcRn         -- ^ suitably wrapped 'XXExprGhcRn'
    
    689
    -mkExpandedStmt oStmt flav eExpr = XExpr (ExpandedThingRn { xrn_orig = StmtErrCtxt (HsDoStmt flav) oStmt
    
    689
    +mkExpandedStmt oStmt flav eExpr = XExpr (ExpandedThingRn { xrn_orig = DoStmtErrCtxt (HsDoStmt flav) oStmt
    
    690 690
                                                              , xrn_expanded = eExpr })
    
    691 691
     
    
    692 692
     data XXExprGhcTc
    

  • compiler/GHC/Hs/Instances.hs
    ... ... @@ -620,13 +620,48 @@ deriving instance Eq (IE GhcTc)
    620 620
     
    
    621 621
     -- ---------------------------------------------------------------------
    
    622 622
     
    
    623
    -deriving instance Data ErrCtxtMsg
    
    624
    -deriving instance Data XXExprGhcRn
    
    623
    +-- deriving instance Data ErrCtxtMsg
    
    624
    +-- deriving instance Data XXExprGhcRn
    
    625
    +con_ExpandedThingRn = mkConstr xXExprGhcRn_T "ExpandedThingRn" [] Prefix
    
    626
    +con_HsRecSelRn = mkConstr xXExprGhcRn_T "HsRecSelRn" [] Prefix
    
    627
    +xXExprGhcRn_T = mkDataType "GHC.Hs.Expr.XXExprGhcRn" []
    
    628
    +
    
    629
    +instance Data XXExprGhcRn where
    
    630
    +  toConstr (ExpandedThingRn{}) = con_ExpandedThingRn
    
    631
    +  toConstr (HsRecSelRn{}) = con_HsRecSelRn
    
    632
    +
    
    633
    +  dataTypeOf _ = xXExprGhcRn_T
    
    634
    +
    
    635
    +  gunfold k z c = error "no gunfold for XXExprGhcRn"
    
    636
    +  gfoldl k z c = error "no gfoldl for XXExprGhcRn"
    
    637
    +
    
    625 638
     deriving instance Data a => Data (WithUserRdr a)
    
    626 639
     
    
    627 640
     -- ---------------------------------------------------------------------
    
    628 641
     
    
    629
    -deriving instance Data XXExprGhcTc
    
    642
    +-- deriving instance Data XXExprGhcTc
    
    643
    +con_ExpandedThingTc = mkConstr xXExprGhcTc_T "ExpandedThingTc" [] Prefix
    
    644
    +con_WrapExpr = mkConstr xXExprGhcTc_T "WrapExpr" [] Prefix
    
    645
    +con_ConLikeTc = mkConstr xXExprGhcTc_T "ConLikeTc" [] Prefix
    
    646
    +con_HsTick = mkConstr xXExprGhcTc_T "HsTick" [] Prefix
    
    647
    +con_HsBinTick = mkConstr xXExprGhcTc_T "HsBinTick" [] Prefix
    
    648
    +con_HsRecSelTc = mkConstr xXExprGhcTc_T "HsRecSelTc" [] Prefix
    
    649
    +xXExprGhcTc_T = mkDataType "GHC.Hs.Expr.XXExprGhcTc" []
    
    650
    +
    
    651
    +instance Data XXExprGhcTc where
    
    652
    +  toConstr (ExpandedThingTc{}) = con_ExpandedThingTc
    
    653
    +  toConstr (WrapExpr{}) = con_WrapExpr
    
    654
    +  toConstr (ConLikeTc{}) = con_ConLikeTc
    
    655
    +  toConstr (HsTick{}) = con_HsTick
    
    656
    +  toConstr (HsBinTick{}) = con_HsBinTick
    
    657
    +  toConstr (HsRecSelTc{}) = con_HsRecSelTc
    
    658
    +
    
    659
    +  dataTypeOf _ = xXExprGhcTc_T
    
    660
    +
    
    661
    +
    
    662
    +  gunfold _ _ _ = error "no gunfold for XXExprGhcTc"
    
    663
    +  gfoldl _ _ _ = error "no gfoldl for XXExprGhcTc"
    
    664
    +
    
    630 665
     deriving instance Data XXPatGhcTc
    
    631 666
     
    
    632 667
     -- ---------------------------------------------------------------------
    

  • compiler/GHC/HsToCore/Ticks.hs
    ... ... @@ -47,6 +47,7 @@ import GHC.Types.CostCentre
    47 47
     import GHC.Types.CostCentre.State
    
    48 48
     import GHC.Types.Tickish
    
    49 49
     import GHC.Types.ProfAuto
    
    50
    +import GHC.Tc.Types.ErrCtxt
    
    50 51
     
    
    51 52
     import Control.Monad
    
    52 53
     import Data.List (isSuffixOf, intersperse)
    
    ... ... @@ -414,7 +415,7 @@ addTickLHsExpr e@(L pos e0) = do
    414 415
       d <- getDensity
    
    415 416
       case d of
    
    416 417
         TickForBreakPoints | isGoodBreakExpr e0 -> tick_it
    
    417
    -    TickForCoverage    | XExpr (ExpandedThingTc OrigStmt{} _) <- e0 -- expansion ticks are handled separately
    
    418
    +    TickForCoverage    | XExpr (ExpandedThingTc StmtErrCtxt{} _) <- e0 -- expansion ticks are handled separately
    
    418 419
                            -> dont_tick_it
    
    419 420
                            | otherwise -> tick_it
    
    420 421
         TickCallSites      | isCallSite e0      -> tick_it
    
    ... ... @@ -483,7 +484,7 @@ addTickLHsExprNever (L pos e0) = do
    483 484
     -- General heuristic: expressions which are calls (do not denote
    
    484 485
     -- values) are good break points.
    
    485 486
     isGoodBreakExpr :: HsExpr GhcTc -> Bool
    
    486
    -isGoodBreakExpr (XExpr (ExpandedThingTc (OrigStmt{}) _)) = False
    
    487
    +isGoodBreakExpr (XExpr (ExpandedThingTc (StmtErrCtxt{}) _)) = False
    
    487 488
     isGoodBreakExpr e = isCallSite e
    
    488 489
     
    
    489 490
     isCallSite :: HsExpr GhcTc -> Bool
    
    ... ... @@ -658,11 +659,11 @@ addTickHsExpr (HsDo srcloc cxt (L l stmts))
    658 659
                         ListComp -> Just $ BinBox QualBinBox
    
    659 660
                         _        -> Nothing
    
    660 661
     
    
    661
    -addTickHsExpanded :: SrcCodeOrigin -> HsExpr GhcTc -> TM (HsExpr GhcTc)
    
    662
    +addTickHsExpanded :: ErrCtxtMsg -> HsExpr GhcTc -> TM (HsExpr GhcTc)
    
    662 663
     addTickHsExpanded o e = liftM (XExpr . ExpandedThingTc o) $ case o of
    
    663 664
       -- We always want statements to get a tick, so we can step over each one.
    
    664 665
       -- To avoid duplicates we blacklist SrcSpans we already inserted here.
    
    665
    -  OrigStmt (L pos _) _ -> do_tick_black pos
    
    666
    +  DoStmtErrCtxt _ (L pos _) -> do_tick_black pos
    
    666 667
       _                    -> skip
    
    667 668
       where
    
    668 669
         skip = addTickHsExpr e
    

  • compiler/GHC/Iface/Ext/Ast.hs
    ... ... @@ -39,6 +39,7 @@ import GHC.Core.TyCon ( TyCon, tyConClass_maybe )
    39 39
     import GHC.Core.InstEnv
    
    40 40
     import GHC.Core.Predicate         ( isEvId )
    
    41 41
     import GHC.Tc.Types
    
    42
    +import GHC.Tc.Types.ErrCtxt
    
    42 43
     import GHC.Tc.Types.Evidence
    
    43 44
     import GHC.Types.Var              ( Id, Var, EvId, varName, varType, varUnique )
    
    44 45
     import GHC.Types.Var.Env
    
    ... ... @@ -755,7 +756,7 @@ instance HiePass p => HasType (LocatedA (HsExpr (GhcPass p))) where
    755 756
             ExprWithTySig _ e _ -> computeLType e
    
    756 757
             HsPragE _ _ e -> computeLType e
    
    757 758
             XExpr (ExpandedThingTc thing e)
    
    758
    -          | OrigExpr (HsGetField{}) <- thing -- for record-dot-syntax
    
    759
    +          | ExprCtxt (HsGetField{}) <- thing -- for record-dot-syntax
    
    759 760
               -> Just (hsExprType e)
    
    760 761
               | otherwise -> computeType e
    
    761 762
             XExpr (HsTick _ e) -> computeLType e
    

  • compiler/GHC/Tc/Errors.hs
    ... ... @@ -83,7 +83,6 @@ import qualified GHC.Data.Strict as Strict
    83 83
     
    
    84 84
     import Language.Haskell.Syntax.Basic (FieldLabelString(..))
    
    85 85
     import Language.Haskell.Syntax (HsExpr (RecordUpd, HsGetField, HsProjection))
    
    86
    -import GHC.Hs.Expr (SrcCodeOrigin(..))
    
    87 86
     
    
    88 87
     import Control.Monad      ( when, foldM, forM_ )
    
    89 88
     import Data.Bifunctor     ( bimap )
    

  • compiler/GHC/Tc/Errors/Ppr.hs
    ... ... @@ -68,11 +68,11 @@ import GHC.Core.FVs( orphNamesOfTypes )
    68 68
     import GHC.CoreToIface
    
    69 69
     
    
    70 70
     import GHC.Driver.Flags
    
    71
    --- import GHC.Driver.Backend
    
    71
    +import GHC.Driver.Backend
    
    72 72
     import GHC.Hs hiding (HoleError)
    
    73 73
     import GHC.Hs.Decls.Overlap
    
    74 74
     
    
    75
    --- import GHC.Tc.Errors.Types
    
    75
    +import GHC.Tc.Errors.Types
    
    76 76
     import GHC.Tc.Errors.Types.PromotionErr (pprTermLevelUseCtxt)
    
    77 77
     import GHC.Tc.Errors.Hole.FitTypes
    
    78 78
     import GHC.Tc.Types.BasicTypes
    
    ... ... @@ -109,7 +109,7 @@ import GHC.Iface.Errors.Types
    109 109
     import GHC.Iface.Errors.Ppr
    
    110 110
     import GHC.Iface.Syntax
    
    111 111
     
    
    112
    --- import GHC.Unit.State
    
    112
    +import GHC.Unit.State
    
    113 113
     import GHC.Unit.Module
    
    114 114
     
    
    115 115
     import GHC.Data.Bag
    
    ... ... @@ -7881,6 +7881,18 @@ pprErrCtxtMsg = \case
    7881 7881
         -> hang (text "In a stmt of" <+> pprAStmtContext ctxt <> colon)
    
    7882 7882
            2 (ppr_stmt stmt)
    
    7883 7883
     
    
    7884
    +  DoStmtErrCtxt ctxt stmt
    
    7885
    +    -- For [ e | .. ], do not mutter about "stmts"
    
    7886
    +    | LastStmt _ e _ _ <- (unLoc stmt)
    
    7887
    +    , isComprehensionContext ctxt
    
    7888
    +    -> hang (text "In the expression:") 2 (ppr e)
    
    7889
    +    | otherwise
    
    7890
    +    -> hang (text "In a stmt of" <+> pprAStmtContext ctxt <> colon)
    
    7891
    +       2 (ppr_stmt (unLoc stmt))
    
    7892
    +
    
    7893
    +  StmtErrCtxtPat _ _ pat ->
    
    7894
    +    hang (text "In the pattern:") 2 (ppr pat)
    
    7895
    +
    
    7884 7896
       DerivInstCtxt pred ->
    
    7885 7897
         text "When deriving the instance for" <+> parens (ppr pred)
    
    7886 7898
       StandaloneDerivCtxt ty ->
    

  • compiler/GHC/Tc/Gen/App.hs
    ... ... @@ -973,8 +973,8 @@ addArgCtxt arg_no (app_head, app_head_lspan) (L arg_loc arg) thing_inside
    973 973
      where
    
    974 974
         addNthFunArgErrCtxt :: HsExpr GhcRn -> HsExpr GhcRn -> Int -> TcM a -> TcM a
    
    975 975
         addNthFunArgErrCtxt app_head arg arg_no thing_inside
    
    976
    -      | XExpr (ExpandedThingRn o _) <- arg
    
    977
    -      = addExpansionErrCtxt o (FunAppCtxt (FunAppCtxtExpr app_head arg) arg_no) $
    
    976
    +      | XExpr (ExpandedThingRn _ _) <- arg
    
    977
    +      = addExpansionErrCtxt (FunAppCtxt (FunAppCtxtExpr app_head arg) arg_no) $
    
    978 978
               thing_inside
    
    979 979
           | otherwise
    
    980 980
           = addErrCtxt (FunAppCtxt (FunAppCtxtExpr app_head arg) arg_no) $
    

  • compiler/GHC/Tc/Gen/Bind.hs
    ... ... @@ -66,7 +66,7 @@ import GHC.Types.SourceText
    66 66
     import GHC.Types.Id
    
    67 67
     import GHC.Types.Var as Var
    
    68 68
     import GHC.Types.Var.Set
    
    69
    -import GHC.Types.Var.Env( TidyEnv, TyVarEnv, mkVarEnv, lookupVarEnv )
    
    69
    +import GHC.Types.Var.Env( TyVarEnv, mkVarEnv, lookupVarEnv )
    
    70 70
     import GHC.Types.Name
    
    71 71
     import GHC.Types.Name.Set
    
    72 72
     import GHC.Types.Name.Env
    
    ... ... @@ -970,7 +970,7 @@ mkInferredPolyId residual insoluble qtvs inferred_theta poly_name mb_sig_inst mo
    970 970
                                               , text "insoluble" <+> ppr insoluble ])
    
    971 971
     
    
    972 972
            ; unless insoluble $
    
    973
    -         addErrCtxtM (mk_inf_msg poly_name inferred_poly_ty) $
    
    973
    +         addErrCtxtM (InferredTypeCtxt poly_name inferred_poly_ty) $
    
    974 974
              do { checkEscapingKind inferred_poly_ty
    
    975 975
                      -- See Note [Inferred type with escaping kind]
    
    976 976
                 ; checkValidType (InfSigCtxt poly_name) inferred_poly_ty }
    
    ... ... @@ -1120,11 +1120,6 @@ chooseInferredQuantifiers residual inferred_theta tau_tvs qtvs
    1120 1120
     chooseInferredQuantifiers _ _ _ _ (Just sig)
    
    1121 1121
       = pprPanic "chooseInferredQuantifiers" (ppr sig)
    
    1122 1122
     
    
    1123
    -mk_inf_msg :: Name -> TcType -> TidyEnv -> ZonkM (TidyEnv, ErrCtxtMsg)
    
    1124
    -mk_inf_msg poly_name poly_ty tidy_env
    
    1125
    - = do { (tidy_env1, poly_ty) <- zonkTidyTcType tidy_env poly_ty
    
    1126
    -      ; return (tidy_env1, InferredTypeCtxt poly_name poly_ty) }
    
    1127
    -
    
    1128 1123
     -- | Warn the user about polymorphic local binders that lack type signatures.
    
    1129 1124
     localSigWarn :: Id -> Maybe TcIdSigInst -> TcM ()
    
    1130 1125
     localSigWarn id mb_sig
    
    ... ... @@ -1909,4 +1904,3 @@ NoGen is good when we have call sites, but not at top level, where the
    1909 1904
     function may be exported.  And it's easier to grok "MonoLocalBinds" as
    
    1910 1905
     applying to, well, local bindings.
    
    1911 1906
     -}
    1912
    -

  • compiler/GHC/Tc/Gen/Do.hs
    ... ... @@ -20,7 +20,7 @@ import GHC.Rename.Env ( irrefutableConLikeRn )
    20 20
     
    
    21 21
     import GHC.Tc.Utils.Monad
    
    22 22
     import GHC.Tc.Utils.TcMType
    
    23
    -
    
    23
    +import GHC.Tc.Types.ErrCtxt
    
    24 24
     import GHC.Hs
    
    25 25
     
    
    26 26
     import GHC.Utils.Outputable
    
    ... ... @@ -213,7 +213,7 @@ mk_fail_block doFlav pat stmt e (Just (SyntaxExprRn fail_op)) =
    213 213
     
    
    214 214
               fail_op_expr :: DynFlags -> LPat GhcRn -> HsExpr GhcRn -> LHsExpr GhcRn
    
    215 215
               fail_op_expr dflags pat@(L pat_lspan _) fail_op
    
    216
    -            = L pat_lspan $ mkExpandedPatRn (unLoc pat) stmt $ genHsApp fail_op (mk_fail_msg_expr dflags pat)
    
    216
    +            = L pat_lspan $ mkExpandedPatRn doFlav (unLoc pat) stmt $ genHsApp fail_op (mk_fail_msg_expr dflags pat)
    
    217 217
     
    
    218 218
               mk_fail_msg_expr :: DynFlags -> LPat GhcRn -> LHsExpr GhcRn
    
    219 219
               mk_fail_msg_expr dflags pat
    
    ... ... @@ -481,7 +481,7 @@ It stores the original statement (with location) and the expanded expression
    481 481
     -}
    
    482 482
     
    
    483 483
     
    
    484
    -mkExpandedPatRn :: Pat GhcRn -> ExprLStmt GhcRn -> HsExpr GhcRn -> HsExpr GhcRn
    
    485
    -mkExpandedPatRn oflav pat stmt e = XExpr $ ExpandedThingRn
    
    484
    +mkExpandedPatRn :: HsDoFlavour -> Pat GhcRn -> ExprLStmt GhcRn -> HsExpr GhcRn -> HsExpr GhcRn
    
    485
    +mkExpandedPatRn flav pat stmt e = XExpr $ ExpandedThingRn
    
    486 486
                                        { xrn_orig = StmtErrCtxtPat (HsDoStmt flav) stmt pat
    
    487
    -                                   , xrn_expand = e}
    487
    +                                   , xrn_expanded = e}

  • compiler/GHC/Tc/Gen/Head.hs
    ... ... @@ -1006,7 +1006,8 @@ addFunResCtxt :: HsExpr GhcTc -> [HsExprArg p]
    1006 1006
     addFunResCtxt fun args fun_res_ty env_ty thing_inside
    
    1007 1007
       = do { env_tv  <- newFlexiTyVarTy liftedTypeKind
    
    1008 1008
            ; dumping <- doptM Opt_D_dump_tc_trace
    
    1009
    -       ; addLandmarkErrCtxtM (\env -> (env, ) <$> mk_msg dumping env_tv) thing_inside }
    
    1009
    +       ; msg <- mk_msg dumping env_tv
    
    1010
    +       ; addLandmarkErrCtxtM msg thing_inside }
    
    1010 1011
           -- NB: use a landmark error context, so that an empty context
    
    1011 1012
           -- doesn't suppress some more useful context
    
    1012 1013
       where
    
    ... ... @@ -1014,13 +1015,12 @@ addFunResCtxt fun args fun_res_ty env_ty thing_inside
    1014 1015
           = do { mb_env_ty <- readExpType_maybe env_ty
    
    1015 1016
                          -- by the time the message is rendered, the ExpType
    
    1016 1017
                          -- will be filled in (except if we're debugging)
    
    1017
    -           ; fun_res' <- zonkTcType fun_res_ty
    
    1018 1018
                ; env'     <- case mb_env_ty of
    
    1019
    -                           Just env_ty -> zonkTcType env_ty
    
    1019
    +                           Just env_ty -> return env_ty
    
    1020 1020
                                Nothing     -> do { massert dumping; return env_tv }
    
    1021 1021
                ; let -- See Note [Splitting nested sigma types in mismatched
    
    1022 1022
                      --           function types]
    
    1023
    -                 (_, _, fun_tau) = tcSplitNestedSigmaTys fun_res'
    
    1023
    +                 (_, _, fun_tau) = tcSplitNestedSigmaTys fun_res_ty
    
    1024 1024
                      (_, _, env_tau) = tcSplitNestedSigmaTys env'
    
    1025 1025
                          -- env_ty is an ExpRhoTy, but with simple subsumption it
    
    1026 1026
                          -- is not deeply skolemised, so still use tcSplitNestedSigmaTys
    

  • compiler/GHC/Tc/Gen/HsType.hs
    ... ... @@ -353,7 +353,7 @@ funsSigCtxt :: [LocatedN Name] -> UserTypeCtxt
    353 353
     funsSigCtxt (L _ name1 : _) = FunSigCtxt name1 NoRRC
    
    354 354
     funsSigCtxt []              = panic "funSigCtxt"
    
    355 355
     
    
    356
    -addSigCtxt :: UserTypeCtxt -> UserSigType GhcRn -> TcM a -> TcM a
    
    356
    +addSigCtxt :: UserTypeCtxt -> UserSigType -> TcM a -> TcM a
    
    357 357
     addSigCtxt ctxt hs_ty thing_inside
    
    358 358
       = setSrcSpan l $
    
    359 359
         addErrCtxt (UserSigCtxt ctxt hs_ty) $
    

  • compiler/GHC/Tc/Gen/Match.hs
    ... ... @@ -487,7 +487,7 @@ tcStmtsAndThen ctxt stmt_chk (L loc stmt : stmts) res_ty thing_inside
    487 487
       | otherwise
    
    488 488
       = do  { (stmt', (stmts', thing)) <-
    
    489 489
                     setSrcSpanA loc                             $
    
    490
    -                addErrCtxt (StmtErrCtxt ctxt stmt)          $
    
    490
    +                addErrCtxt (StmtErrCtxt ctxt (L loc stmt))  $
    
    491 491
                     stmt_chk ctxt stmt res_ty                   $ \ res_ty' ->
    
    492 492
                     popErrCtxt                                  $
    
    493 493
                     tcStmtsAndThen ctxt stmt_chk stmts res_ty'  $
    

  • compiler/GHC/Tc/Gen/Pat.hs
    ... ... @@ -39,7 +39,6 @@ import GHC.Core.Multiplicity
    39 39
     import GHC.Tc.Utils.Concrete ( hasFixedRuntimeRep_syntactic )
    
    40 40
     import GHC.Tc.Utils.Env
    
    41 41
     import GHC.Tc.Utils.TcMType
    
    42
    -import GHC.Tc.Zonk.TcType
    
    43 42
     import GHC.Core.TyCo.Ppr ( pprTyVars )
    
    44 43
     import GHC.Tc.Utils.TcType
    
    45 44
     import GHC.Tc.Utils.Unify
    
    ... ... @@ -1021,7 +1020,8 @@ tcPatSig in_pat_bind sig res_ty
    1021 1020
             ; case NE.nonEmpty sig_tvs of
    
    1022 1021
                 Nothing -> do {
    
    1023 1022
                     -- Just do the subsumption check and return
    
    1024
    -                  wrap <- addErrCtxtM (mk_msg sig_ty) $
    
    1023
    +                  msg <- mk_msg res_ty sig_ty
    
    1024
    +                ; wrap <- addErrCtxtM msg $
    
    1025 1025
                               tcSubTypePat PatSigOrigin PatSigCtxt res_ty sig_ty
    
    1026 1026
                     ; return (sig_ty, [], sig_wcs, wrap)
    
    1027 1027
                     }
    
    ... ... @@ -1035,18 +1035,17 @@ tcPatSig in_pat_bind sig res_ty
    1035 1035
                     (addErr (TcRnCannotBindScopedTyVarInPatSig sig_tvs_ne))
    
    1036 1036
     
    
    1037 1037
                   -- Now do a subsumption check of the pattern signature against res_ty
    
    1038
    -              wrap <- addErrCtxtM (mk_msg sig_ty) $
    
    1038
    +              msg <- mk_msg res_ty sig_ty
    
    1039
    +              wrap <- addErrCtxtM msg $
    
    1039 1040
                           tcSubTypePat PatSigOrigin PatSigCtxt res_ty sig_ty
    
    1040 1041
     
    
    1041 1042
                   -- Phew!
    
    1042 1043
                   return (sig_ty, sig_tvs, sig_wcs, wrap)
    
    1043 1044
            }
    
    1044 1045
       where
    
    1045
    -    mk_msg sig_ty tidy_env
    
    1046
    -       = do { (tidy_env, sig_ty) <- zonkTidyTcType tidy_env sig_ty
    
    1047
    -            ; res_ty <- readExpType res_ty   -- should be filled in by now
    
    1048
    -            ; (tidy_env, res_ty) <- zonkTidyTcType tidy_env res_ty
    
    1049
    -            ; return (tidy_env, PatSigErrCtxt sig_ty res_ty) }
    
    1046
    +    mk_msg res_ty sig_ty
    
    1047
    +       = do { res_ty <- readExpType res_ty   -- should be filled in by now
    
    1048
    +            ; return $ PatSigErrCtxt sig_ty res_ty }
    
    1050 1049
     
    
    1051 1050
     {- *********************************************************************
    
    1052 1051
     *                                                                      *
    

  • compiler/GHC/Tc/TyCl/Instance.hs
    ... ... @@ -2108,7 +2108,7 @@ tcMethodBodyHelp hs_sig_fn sel_id local_meth_id meth_bind
    2108 2108
                                     -- The instance-sig is the focus here; the class-meth-sig
    
    2109 2109
                                     -- is fixed (#18036)
    
    2110 2110
                        ; let orig = InstanceSigOrigin sel_name sig_ty local_meth_ty
    
    2111
    -                   ; hs_wrap <- addErrCtxtM (methSigCtxt sel_name sig_ty local_meth_ty) $
    
    2111
    +                   ; hs_wrap <- addErrCtxtM (MethSigCtxt sel_name sig_ty meth_ty) $
    
    2112 2112
                                     tcSubTypeSigma orig ctxt sig_ty local_meth_ty
    
    2113 2113
                        ; return (sig_ty, hs_wrap) }
    
    2114 2114
     
    
    ... ... @@ -2176,11 +2176,6 @@ mkMethIds clas tyvars dfun_ev_vars inst_tys sel_id
    2176 2176
         poly_meth_ty  = mkSpecSigmaTy tyvars theta local_meth_ty
    
    2177 2177
         theta         = map idType dfun_ev_vars
    
    2178 2178
     
    
    2179
    -methSigCtxt :: Name -> TcType -> TcType -> TidyEnv -> ZonkM (TidyEnv, ErrCtxtMsg)
    
    2180
    -methSigCtxt sel_name sig_ty meth_ty env0
    
    2181
    -  = do { (env1, sig_ty)  <- zonkTidyTcType env0 sig_ty
    
    2182
    -       ; (env2, meth_ty) <- zonkTidyTcType env1 meth_ty
    
    2183
    -       ; return (env2, MethSigCtxt sel_name sig_ty meth_ty) }
    
    2184 2179
     
    
    2185 2180
     {- Note [Instance method signatures]
    
    2186 2181
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    

  • compiler/GHC/Tc/Types/ErrCtxt.hs
    ... ... @@ -175,10 +175,16 @@ data ErrCtxtMsg
    175 175
       -- | Warning emitted when inferring use of visible dependent quantification.
    
    176 176
       | VDQWarningCtxt !TcTyCon
    
    177 177
     
    
    178
    -  -- | In a statement.
    
    179
    -  | StmtErrCtxt !HsStmtContextRn !(ExprLStmt GhcRn)
    
    178
    +  -- | In a statement
    
    179
    +  | forall body.
    
    180
    +    ( Anno (StmtLR GhcRn GhcRn body) ~ SrcSpanAnnA
    
    181
    +    , Outputable body
    
    182
    +    ) => StmtErrCtxt !HsStmtContextRn !(StmtLR GhcRn GhcRn body)
    
    180 183
     
    
    181
    -  -- | In patten of the statement. (c.f. MonadFailErrors)
    
    184
    +  -- | In a do statement.
    
    185
    +  | DoStmtErrCtxt !HsStmtContextRn !(ExprLStmt GhcRn)
    
    186
    +
    
    187
    +  -- | In patten of the do statement. (c.f. MonadFailErrors)
    
    182 188
       | StmtErrCtxtPat !HsStmtContextRn !(ExprLStmt GhcRn) (Pat GhcRn)
    
    183 189
     
    
    184 190
       -- | In an rebindable syntax expression.
    

  • compiler/GHC/Tc/Types/LclEnv.hs
    ... ... @@ -36,7 +36,6 @@ module GHC.Tc.Types.LclEnv (
    36 36
     
    
    37 37
     import GHC.Prelude
    
    38 38
     
    
    39
    -import GHC.Hs ( SrcCodeOrigin (..) )
    
    40 39
     import GHC.Tc.Utils.TcType ( TcLevel )
    
    41 40
     import GHC.Tc.Errors.Types ( TcRnMessage )
    
    42 41
     
    
    ... ... @@ -120,8 +119,8 @@ push the new expression error message on top of the stack. cf. `LclEnv.setLclCtx
    120 119
     type ErrCtxtStack = [ErrCtxt]
    
    121 120
     
    
    122 121
     -- | Get the original source code
    
    123
    -get_src_code_origin :: ErrCtxtStack -> Maybe SrcCodeOrigin
    
    124
    -get_src_code_origin (MkErrCtxt (ExpansionCodeCtxt origSrcCode) _ : _) = Just origSrcCode
    
    122
    +get_src_code_origin :: ErrCtxtStack -> Maybe ErrCtxtMsg
    
    123
    +get_src_code_origin (MkErrCtxt ExpansionCodeCtxt e : _) = Just e
    
    125 124
                        -- we are in generated code, due to the expansion of the original syntax origSrcCode
    
    126 125
     get_src_code_origin _ = Nothing
    
    127 126
                        -- we are in user code, so blame the expression in hand
    
    ... ... @@ -203,7 +202,7 @@ setLclEnvErrCtxt ctxt = modifyLclCtxt (\env -> env { tcl_err_ctxt = ctxt })
    203 202
     addLclEnvErrCtxt :: ErrCtxt -> TcLclEnv -> TcLclEnv
    
    204 203
     addLclEnvErrCtxt ec = setLclEnvSrcCodeOrigin ec
    
    205 204
     
    
    206
    -getLclEnvSrcCodeOrigin :: TcLclEnv -> Maybe SrcCodeOrigin
    
    205
    +getLclEnvSrcCodeOrigin :: TcLclEnv -> Maybe ErrCtxtMsg
    
    207 206
     getLclEnvSrcCodeOrigin = get_src_code_origin . tcl_err_ctxt . tcl_lcl_ctxt
    
    208 207
     
    
    209 208
     setLclEnvSrcCodeOrigin :: ErrCtxt -> TcLclEnv -> TcLclEnv
    
    ... ... @@ -212,18 +211,18 @@ setLclEnvSrcCodeOrigin ec = modifyLclCtxt (setLclCtxtSrcCodeOrigin ec)
    212 211
     -- See Note [ErrCtxtStack Manipulation]
    
    213 212
     setLclCtxtSrcCodeOrigin :: ErrCtxt -> TcLclCtxt -> TcLclCtxt
    
    214 213
     setLclCtxtSrcCodeOrigin ec lclCtxt
    
    215
    -  | ecs@(MkErrCtxt (ExpansionCodeCtxt{}) _ : _) <- tcl_err_ctxt lclCtxt
    
    216
    -  , MkErrCtxt (ExpansionCodeCtxt ExprCtxt{}) _ <- ec
    
    214
    +  | ecs@(MkErrCtxt ExpansionCodeCtxt _ : _) <- tcl_err_ctxt lclCtxt
    
    215
    +  , MkErrCtxt ExpansionCodeCtxt ExprCtxt{} <- ec
    
    217 216
       = lclCtxt { tcl_err_ctxt =  ec : ecs }
    
    218
    -  | MkErrCtxt (ExpansionCodeCtxt{}) _ : ecs <- tcl_err_ctxt lclCtxt
    
    219
    -  , MkErrCtxt (ExpansionCodeCtxt{}) _ <- ec
    
    217
    +  | MkErrCtxt ExpansionCodeCtxt _ : ecs <- tcl_err_ctxt lclCtxt
    
    218
    +  , MkErrCtxt ExpansionCodeCtxt _ <- ec
    
    220 219
       = lclCtxt { tcl_err_ctxt =  ec : ecs }
    
    221 220
       | otherwise
    
    222 221
       = lclCtxt { tcl_err_ctxt = ec : tcl_err_ctxt lclCtxt }
    
    223 222
     
    
    224 223
     lclCtxtInGeneratedCode :: TcLclCtxt -> Bool
    
    225 224
     lclCtxtInGeneratedCode lclCtxt
    
    226
    -  | (MkErrCtxt (ExpansionCodeCtxt _) _ : _) <- tcl_err_ctxt lclCtxt
    
    225
    +  | (MkErrCtxt ExpansionCodeCtxt _ : _) <- tcl_err_ctxt lclCtxt
    
    227 226
       = True
    
    228 227
       | otherwise
    
    229 228
       = False
    

  • compiler/GHC/Tc/Types/Origin.hs
    ... ... @@ -51,6 +51,7 @@ module GHC.Tc.Types.Origin (
    51 51
     import GHC.Prelude
    
    52 52
     
    
    53 53
     import GHC.Tc.Utils.TcType
    
    54
    +import GHC.Tc.Types.ErrCtxt
    
    54 55
     
    
    55 56
     import GHC.Hs
    
    56 57
     
    
    ... ... @@ -836,7 +837,7 @@ exprCtOrigin e@(HsGetField{}) = ExpansionOrigin (ExprCtxt e)
    836 837
     exprCtOrigin (XExpr (ExpandedThingRn o _)) = ExpansionOrigin o
    
    837 838
     exprCtOrigin (XExpr (HsRecSelRn f))  = OccurrenceOfRecSel $ L (getLoc $ foLabel f) (foExt f)
    
    838 839
     
    
    839
    -srcCodeOriginCtOrigin :: HsExpr GhcRn -> Maybe SrcCodeOrigin -> CtOrigin
    
    840
    +srcCodeOriginCtOrigin :: HsExpr GhcRn -> Maybe ErrCtxtMsg -> CtOrigin
    
    840 841
     srcCodeOriginCtOrigin e Nothing = exprCtOrigin e
    
    841 842
     srcCodeOriginCtOrigin _ (Just o) = ExpansionOrigin o
    
    842 843
     
    
    ... ... @@ -874,7 +875,7 @@ pprCtOrigin (ExpansionOrigin o)
    874 875
           what = case o of
    
    875 876
             StmtErrCtxt{} ->
    
    876 877
               text "a do statement"
    
    877
    -        StmtErrCtxtPat _ p ->
    
    878
    +        StmtErrCtxtPat _ _ p ->
    
    878 879
               text "a do statement" $$
    
    879 880
                  text "with the failable pattern" <+> quotes (ppr p)
    
    880 881
             ExprCtxt (HsGetField _ _ (L _ f)) ->
    
    ... ... @@ -887,6 +888,7 @@ pprCtOrigin (ExpansionOrigin o)
    887 888
             ExprCtxt (HsProjection _ p) -> text "the record selector" <+>
    
    888 889
                  quotes (ppr ((FieldLabelStrings $ fmap noLocA p)))
    
    889 890
             ExprCtxt e -> text "the expression" <+> (ppr e)
    
    891
    +        _ -> text "shouldn't happen ExpansionOrigin pprCtOrigin"
    
    890 892
     
    
    891 893
     pprCtOrigin (GivenSCOrigin sk d blk)
    
    892 894
       = vcat [ ctoHerald <+> pprSkolInfo sk
    
    ... ... @@ -1112,6 +1114,7 @@ ppr_br (ExpansionOrigin (ExprCtxt (HsIf{}))) = text "an if-then-else expression"
    1112 1114
     ppr_br (ExpansionOrigin (ExprCtxt e)) = text "an expression" <+> ppr e
    
    1113 1115
     ppr_br (ExpansionOrigin (StmtErrCtxt{})) = text "a do statement"
    
    1114 1116
     ppr_br (ExpansionOrigin (StmtErrCtxtPat{})) = text "a do statement"
    
    1117
    +ppr_br (ExpansionOrigin{}) = text "shouldn't happen ExpansionOrigin ppr_br"
    
    1115 1118
     ppr_br (ExpectedTySyntax o _) = ppr_br o
    
    1116 1119
     ppr_br (ExpectedFunTySyntaxOp{}) = text "a rebindable syntax operator"
    
    1117 1120
     ppr_br (ExpectedFunTyViewPat{}) = text "a view pattern"
    

  • compiler/GHC/Tc/Utils/Instantiate.hs
    ... ... @@ -67,7 +67,6 @@ import GHC.Tc.Utils.Concrete ( hasFixedRuntimeRep_syntactic )
    67 67
     import GHC.Tc.Utils.TcMType
    
    68 68
     import GHC.Tc.Utils.TcType
    
    69 69
     import GHC.Tc.Errors.Types
    
    70
    -import GHC.Tc.Zonk.Monad ( ZonkM )
    
    71 70
     
    
    72 71
     import GHC.Rename.Utils( mkRnSyntaxExpr )
    
    73 72
     
    
    ... ... @@ -855,7 +854,7 @@ tcSyntaxName orig ty (std_nm, user_nm_expr) = do
    855 854
             -- case of locally-polymorphic methods.
    
    856 855
     
    
    857 856
         span <- getSrcSpanM
    
    858
    -    addErrCtxtM (syntaxNameCtxt user_nm_expr orig sigma1 span) $ do
    
    857
    +    addErrCtxtM (SyntaxNameCtxt user_nm_expr orig sigma1 span) $ do
    
    859 858
     
    
    860 859
             -- Check that the user-supplied thing has the
    
    861 860
             -- same type as the standard one.
    
    ... ... @@ -864,11 +863,6 @@ tcSyntaxName orig ty (std_nm, user_nm_expr) = do
    864 863
          hasFixedRuntimeRepRes std_nm user_nm_expr sigma1
    
    865 864
          return (std_nm, unLoc expr)
    
    866 865
     
    
    867
    -syntaxNameCtxt :: HsExpr GhcRn -> CtOrigin -> Type -> SrcSpan
    
    868
    -               -> TidyEnv -> ZonkM (TidyEnv, ErrCtxtMsg)
    
    869
    -syntaxNameCtxt name orig ty loc tidy_env =
    
    870
    -  return (tidy_env, SyntaxNameCtxt name orig (tidyType tidy_env ty) loc)
    
    871
    -
    
    872 866
     {-
    
    873 867
     ************************************************************************
    
    874 868
     *                                                                      *
    

  • compiler/GHC/Tc/Utils/Monad.hs
    ... ... @@ -1091,12 +1091,8 @@ setSrcSpan (RealSrcSpan loc _) thing_inside
    1091 1091
     setSrcSpan _ thing_inside
    
    1092 1092
       = thing_inside
    
    1093 1093
     
    
    1094
    -getSrcCodeOrigin :: TcRn (Maybe SrcCodeOrigin)
    
    1095
    -getSrcCodeOrigin =
    
    1096
    -  do inGenCode <- inGeneratedCode
    
    1097
    -     if inGenCode
    
    1098
    -       then getLclEnvSrcCodeOrigin <$> getLclEnv
    
    1099
    -       else return Nothing
    
    1094
    +getSrcCodeOrigin :: TcRn (Maybe ErrCtxtMsg)
    
    1095
    +getSrcCodeOrigin = getLclEnvSrcCodeOrigin <$> getLclEnv
    
    1100 1096
     
    
    1101 1097
     setSrcSpanA :: EpAnn ann -> TcRn a -> TcRn a
    
    1102 1098
     setSrcSpanA l = setSrcSpan (locA l)
    
    ... ... @@ -1369,21 +1365,21 @@ setErrCtxt ctxt = updLclEnv (setLclEnvErrCtxt ctxt)
    1369 1365
     -- See Note [Rebindable syntax and XXExprGhcRn] in GHC.Hs.Expr
    
    1370 1366
     addErrCtxt :: ErrCtxtMsg -> TcM a -> TcM a
    
    1371 1367
     {-# INLINE addErrCtxt #-}   -- Note [Inlining addErrCtxt]
    
    1372
    -addErrCtxt msg = addErrCtxtM (\env -> return (env, msg))
    
    1368
    +addErrCtxt msg = addErrCtxtM msg
    
    1373 1369
     
    
    1374 1370
     -- See Note [ErrCtxtStack Manipulation]
    
    1375 1371
     addExpansionErrCtxt :: ErrCtxtMsg -> TcM a -> TcM a
    
    1376 1372
     {-# INLINE addExpansionErrCtxt #-}   -- Note [Inlining addErrCtxt]
    
    1377
    -addExpansionErrCtxt msg = addExpansionErrCtxtM (\env -> return (env, msg))
    
    1373
    +addExpansionErrCtxt msg = addExpansionErrCtxtM msg
    
    1378 1374
     
    
    1379 1375
     -- | Add a message to the error context. This message may do tidying.
    
    1380 1376
     --   See Note [Rebindable syntax and XXExprGhcRn] in GHC.Hs.Expr
    
    1381
    -addErrCtxtM :: (TidyEnv -> ZonkM (TidyEnv, ErrCtxtMsg)) -> TcM a -> TcM a
    
    1377
    +addErrCtxtM :: ErrCtxtMsg -> TcM a -> TcM a
    
    1382 1378
     {-# INLINE addErrCtxtM #-}  -- Note [Inlining addErrCtxt]
    
    1383 1379
     addErrCtxtM ctxt = pushCtxt (MkErrCtxt VanillaUserSrcCode ctxt)
    
    1384 1380
     
    
    1385 1381
     -- See Note [ErrCtxtStack Manipulation]
    
    1386
    -addExpansionErrCtxtM :: (TidyEnv -> ZonkM (TidyEnv, ErrCtxtMsg)) -> TcM a -> TcM a
    
    1382
    +addExpansionErrCtxtM :: ErrCtxtMsg -> TcM a -> TcM a
    
    1387 1383
     {-# INLINE addExpansionErrCtxtM #-}  -- Note [Inlining addErrCtxt]
    
    1388 1384
     addExpansionErrCtxtM ctxt = pushCtxt (MkErrCtxt ExpansionCodeCtxt ctxt)
    
    1389 1385
     
    
    ... ... @@ -1393,11 +1389,11 @@ addExpansionErrCtxtM ctxt = pushCtxt (MkErrCtxt ExpansionCodeCtxt ctxt)
    1393 1389
     -- reported.
    
    1394 1390
     addLandmarkErrCtxt :: ErrCtxtMsg -> TcM a -> TcM a
    
    1395 1391
     {-# INLINE addLandmarkErrCtxt #-}  -- Note [Inlining addErrCtxt]
    
    1396
    -addLandmarkErrCtxt msg = addLandmarkErrCtxtM (\env -> return (env, msg))
    
    1392
    +addLandmarkErrCtxt msg = addLandmarkErrCtxtM msg
    
    1397 1393
     
    
    1398 1394
     -- | Variant of 'addLandmarkErrCtxt' that allows for monadic operations
    
    1399 1395
     -- and tidying.
    
    1400
    -addLandmarkErrCtxtM :: (TidyEnv -> ZonkM (TidyEnv, ErrCtxtMsg)) -> TcM a -> TcM a
    
    1396
    +addLandmarkErrCtxtM :: ErrCtxtMsg -> TcM a -> TcM a
    
    1401 1397
     {-# INLINE addLandmarkErrCtxtM #-}  -- Note [Inlining addErrCtxt]
    
    1402 1398
     addLandmarkErrCtxtM ctxt = pushCtxt (MkErrCtxt LandmarkUserSrcCode ctxt)
    
    1403 1399
     
    
    ... ... @@ -1966,14 +1962,14 @@ mkErrCtxt env ctxts
    1966 1962
        go :: Bool -> Int -> TidyEnv -> [ErrCtxt] -> TcM [ErrCtxtMsg]
    
    1967 1963
        go _ _ _   [] = return []
    
    1968 1964
        go dbg n env (MkErrCtxt LandmarkUserSrcCode ctxt : ctxts)
    
    1969
    -     = do { (env', msg) <- liftZonkM $ ctxt env
    
    1970
    -          ; rest <- go dbg n env' ctxts
    
    1971
    -          ; return (msg : rest) }
    
    1965
    +     = do { -- (env', msg) <- liftZonkM $ emptyTidyEnv env
    
    1966
    +          ; rest <- go dbg n env ctxts
    
    1967
    +          ; return (ctxt : rest) }
    
    1972 1968
        go dbg n env (MkErrCtxt _ ctxt : ctxts)
    
    1973 1969
          | n < mAX_CONTEXTS -- Too verbose || dbg
    
    1974
    -     = do { (env', msg) <- liftZonkM $ ctxt env
    
    1975
    -          ; rest <- go dbg (n+1) env' ctxts
    
    1976
    -          ; return (msg : rest) }
    
    1970
    +     = do { -- (env', msg) <- liftZonkM $ emptyTidyEnv env
    
    1971
    +          ; rest <- go dbg (n+1) env ctxts
    
    1972
    +          ; return (ctxt : rest) }
    
    1977 1973
          | otherwise
    
    1978 1974
          = go dbg n env ctxts -- need to compute this for zonking
    
    1979 1975
     
    

  • compiler/GHC/Tc/Utils/Unify.hs
    ... ... @@ -216,7 +216,7 @@ matchActualFunTy herald mb_thing err_info fun_ty
    216 216
                ; return (co, arg_ty, res_ty) }
    
    217 217
     
    
    218 218
         ------------
    
    219
    -    mk_ctxt :: TcType -> TidyEnv -> ZonkM (TidyEnv, ErrCtxtMsg)
    
    219
    +    mk_ctxt :: TcType -> ErrCtxtMsg
    
    220 220
         mk_ctxt _res_ty = mkFunTysMsg herald err_info
    
    221 221
     
    
    222 222
     {- Note [matchActualFunTy error handling]
    
    ... ... @@ -959,15 +959,13 @@ new_check_arg_ty herald arg_pos -- Position for error messages only, 1 for first
    959 959
     
    
    960 960
     mkFunTysMsg :: CtOrigin
    
    961 961
                 -> (VisArity, TcType)
    
    962
    -            -> TidyEnv -> ZonkM (TidyEnv, ErrCtxtMsg)
    
    962
    +            -> ErrCtxtMsg
    
    963 963
     -- See Note [Reporting application arity errors]
    
    964
    -mkFunTysMsg herald (n_vis_args_in_call, fun_ty) env
    
    965
    -  = do { (env', fun_ty) <- zonkTidyTcType env fun_ty
    
    966
    -
    
    967
    -       ; let (pi_ty_bndrs, _) = splitPiTys fun_ty
    
    964
    +mkFunTysMsg herald (n_vis_args_in_call, fun_ty)
    
    965
    +  = do { let (pi_ty_bndrs, _) = splitPiTys fun_ty
    
    968 966
                  n_fun_args = count isVisiblePiTyBinder pi_ty_bndrs
    
    969 967
     
    
    970
    -       ; return (env', FunTysCtxt herald fun_ty n_vis_args_in_call n_fun_args) }
    
    968
    +       ; FunTysCtxt herald fun_ty n_vis_args_in_call n_fun_args }
    
    971 969
     
    
    972 970
     
    
    973 971
     {- Note [Reporting application arity errors]
    
    ... ... @@ -1524,15 +1522,9 @@ addSubTypeCtxt ty_actual ty_expected thing_inside
    1524 1522
      , isRhoExpTy ty_expected   -- TypeEqOrigin stuff (added by the _NC functions)
    
    1525 1523
      = thing_inside             -- gives enough context by itself
    
    1526 1524
      | otherwise
    
    1527
    - = addErrCtxtM mk_msg thing_inside
    
    1528
    -  where
    
    1529
    -    mk_msg tidy_env
    
    1530
    -      = do { (tidy_env, ty_actual)   <- zonkTidyTcType tidy_env ty_actual
    
    1531
    -           ; ty_expected             <- readExpType ty_expected
    
    1532
    -                   -- A worry: might not be filled if we're debugging. Ugh.
    
    1533
    -           ; (tidy_env, ty_expected) <- zonkTidyTcType tidy_env ty_expected
    
    1534
    -           ; return (tidy_env, SubTypeCtxt ty_expected ty_actual) }
    
    1535
    -
    
    1525
    + = do ty_expected  <- readExpType ty_expected
    
    1526
    +      addErrCtxtM (SubTypeCtxt ty_expected ty_actual) $
    
    1527
    +        thing_inside
    
    1536 1528
     
    
    1537 1529
     ---------------
    
    1538 1530
     tc_sub_type :: (TcType -> TcType -> TcM TcCoercionN)  -- How to unify
    

  • compiler/GHC/Tc/Validity.hs
    ... ... @@ -1182,7 +1182,7 @@ applying the instance decl would show up two uses of ?x. #8912.
    1182 1182
     checkValidTheta :: UserTypeCtxt -> ThetaType -> TcM ()
    
    1183 1183
     -- Assumes argument is fully zonked
    
    1184 1184
     checkValidTheta ctxt theta
    
    1185
    -  = addErrCtxtM (checkThetaCtxt ctxt theta) $
    
    1185
    +  = addErrCtxtM (ThetaCtxt ctxt theta) $
    
    1186 1186
         do { env <- liftZonkM $ tcInitOpenTidyEnv (tyCoVarsOfTypesList theta)
    
    1187 1187
            ; expand <- initialExpandMode
    
    1188 1188
            ; check_valid_theta env ctxt expand theta }
    
    ... ... @@ -1458,10 +1458,6 @@ Flexibility check:
    1458 1458
       generalized actually.
    
    1459 1459
     -}
    
    1460 1460
     
    
    1461
    -checkThetaCtxt :: UserTypeCtxt -> ThetaType -> TidyEnv -> ZonkM (TidyEnv, ErrCtxtMsg)
    
    1462
    -checkThetaCtxt ctxt theta env
    
    1463
    -  = return (env, ThetaCtxt ctxt (tidyTypes env theta))
    
    1464
    -
    
    1465 1461
     tyConArityErr :: TyCon -> [TcType] -> TcRnMessage
    
    1466 1462
     -- For type-constructor arity errors, be careful to report
    
    1467 1463
     -- the number of /visible/ arguments required and supplied,
    

  • compiler/GHC/Unit/State.hs-boot
    ... ... @@ -4,4 +4,3 @@ data UnitState
    4 4
     data ModuleSuggestion
    
    5 5
     data ModuleOrigin
    
    6 6
     data UnusableUnit
    7
    -data UnitInfo
    \ No newline at end of file

  • compiler/GHC/Utils/Logger.hs
    ... ... @@ -82,10 +82,10 @@ where
    82 82
     
    
    83 83
     import GHC.Prelude
    
    84 84
     import GHC.Driver.Flags
    
    85
    -import {-# SOURCE #-} GHC.Types.Error
    
    86
    -  ( MessageClass (..), Severity (..), ResolvedDiagnosticReason, DiagnosticCode
    
    87
    -  , mkLocMessageWarningGroups,getCaretDiagnostic)
    
    88
    -import GHC.Types.Error ()
    
    85
    +import GHC.Types.Error
    
    86
    +  ( MessageClass (..), Severity (..)
    
    87
    +  , mkLocMessageWarningGroups,getCaretDiagnostic )
    
    88
    +-- import GHC.Types.Error ()
    
    89 89
     import GHC.Types.SrcLoc
    
    90 90
     
    
    91 91
     import qualified GHC.Utils.Ppr as Pretty