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

Commits:

2 changed files:

Changes:

  • compiler/GHC/Tc/Types/Origin.hs
    ... ... @@ -431,7 +431,7 @@ data CtOrigin
    431 431
       | ProvCtxtOrigin      -- The "provided" context of a pattern synonym signature
    
    432 432
             (PatSynBind GhcRn GhcRn) -- Information about the pattern synonym, in
    
    433 433
                                      -- particular the name and the right-hand side
    
    434
    -  | RecordUpdOrigin (LHsRecUpdFields GhcRn)
    
    434
    +  | RecordUpdOrigin
    
    435 435
       | ViewPatOrigin
    
    436 436
     
    
    437 437
       -- | 'ScOrigin' is used only for the Wanted constraints for the
    
    ... ... @@ -623,7 +623,7 @@ exprCtOrigin (HsFunArr {}) = Shouldn'tHappenOrigin "function arrow"
    623 623
     exprCtOrigin (ExplicitList {})    = ListOrigin
    
    624 624
     exprCtOrigin (HsIf {})            = IfThenElseOrigin
    
    625 625
     exprCtOrigin (HsProjection _ p)   = RecordFieldProjectionOrigin (FieldLabelStrings $ fmap noLocA p)
    
    626
    -exprCtOrigin (RecordUpd _ _ flds) = RecordUpdOrigin flds
    
    626
    +exprCtOrigin (RecordUpd{})        = RecordUpdOrigin
    
    627 627
     exprCtOrigin (HsGetField _ _ f)   = GetFieldOrigin (fmap field_label $ dfoLabel (unLoc f))
    
    628 628
     exprCtOrigin (XExpr (ExpandedThingRn o _)) = errCtxtCtOrigin o
    
    629 629
     exprCtOrigin (XExpr (HsRecSelRn f))  = OccurrenceOfRecSel $ L (getLoc $ foLabel f) (foExt f)
    
    ... ... @@ -639,6 +639,7 @@ errCtxtCtOrigin (FunAppCtxt (FunAppCtxtExpr _ e) _) = exprCtOrigin e
    639 639
     errCtxtCtOrigin (StmtErrCtxt{}) = DoStmtOrigin
    
    640 640
     errCtxtCtOrigin (DoStmtErrCtxt{}) = DoStmtOrigin
    
    641 641
     errCtxtCtOrigin (StmtErrCtxtPat _ _ p) = DoPatOrigin p
    
    642
    +errCtxtCtOrigin (RecordUpdCtxt{}) = RecordUpdOrigin
    
    642 643
     errCtxtCtOrigin _ = Shouldn'tHappenOrigin "errCtxtCtOrigin"
    
    643 644
     
    
    644 645
     
    
    ... ... @@ -1168,8 +1169,8 @@ pprFixedRuntimeRepContext FRRBindStmtGuard
    1168 1169
       = sep [ text "The body of the bind statement" ]
    
    1169 1170
     pprFixedRuntimeRepContext (FRRArrow arrowContext)
    
    1170 1171
       = pprFRRArrowContext arrowContext
    
    1171
    -pprFixedRuntimeRepContext (FRRExpectedFunTy funTyOrig _)
    
    1172
    -  = pprExpectedFunTyHerald funTyOrig
    
    1172
    +pprFixedRuntimeRepContext (FRRExpectedFunTy funTyOrig i)
    
    1173
    +  = pprExpectedFunTyCtxt funTyOrig i
    
    1173 1174
     pprFixedRuntimeRepContext (FRRDeepSubsumption is_exp pos mb_fun)
    
    1174 1175
       = hsep [ text "The", what, text "type of the"
    
    1175 1176
              , ppr (Argument pos)
    

  • compiler/GHC/Tc/Zonk/TcType.hs
    ... ... @@ -811,153 +811,19 @@ zonkTidyErrCtxtMsg env (ThetaCtxt ctxt theta_ty) = do
    811 811
     zonkTidyErrCtxtMsg env (InferredTypeCtxt n ty) = do
    
    812 812
       (env', ty') <- zonkTidyTcType env ty
    
    813 813
       return $ (env', InferredTypeCtxt n ty')
    
    814
    --- zonkTidyErrCtxtMsg (RecordUpdCtxt n1 n2 tys) = do
    
    815
    ---   tys' <- lift $ mapM zonkTcTypeToType tys
    
    816
    ---   return $ RecordUpdCtxt n1 n2 tys'
    
    817 814
     zonkTidyErrCtxtMsg env (ClassOpCtxt n ty) = do
    
    818 815
       (env', ty') <- zonkTidyTcType env ty
    
    819 816
       return $ (env', ClassOpCtxt n ty')
    
    820 817
     zonkTidyErrCtxtMsg env (MethSigCtxt n ty1 ty2) = do
    
    821 818
       (env', ty1) <- zonkTidyTcType env ty1
    
    822
    -  (env', ty2) <- zonkTidyTcType env ty2
    
    819
    +  (env', ty2) <- zonkTidyTcType env' ty2
    
    823 820
       return $ (env',  MethSigCtxt n ty1 ty2)
    
    824
    --- zonkTidyErrCtxtMsg (PatSigErrCtxt ty exp_ty) = do
    
    825
    ---   ty' <- lift $ zonkTcTypeToType ty
    
    826
    ---   exp_ty' <- lift $ readExpType_maybe exp_ty
    
    827
    ---   case exp_ty' of
    
    828
    ---      Nothing -> error "zonkTidyErrCtxtMsg PatSingErrCtxt"
    
    829
    ---      Just exp_ty' -> do
    
    830
    ---        exp_ty' <- lift $ zonkTcTypeToType exp_ty'
    
    831
    ---        return $ PatSigErrCtxt ty' exp_ty'
    
    832
    -
    
    833 821
     zonkTidyErrCtxtMsg env e@(FunAppCtxt{}) = return (env, e)
    
    834 822
     zonkTidyErrCtxtMsg env (FunTysCtxt ctxt ty i1 i2) = do
    
    835 823
       (env', ty') <- zonkTidyTcType env ty
    
    836 824
       return $ (env', FunTysCtxt ctxt ty' i1 i2)
    
    837 825
     zonkTidyErrCtxtMsg env (FunResCtxt e i1 ty1 ty2 i2 i3) = do
    
    838 826
       (env', ty1') <- zonkTidyTcType env ty1
    
    839
    -  (env', ty2') <- zonkTidyTcType env ty2
    
    827
    +  (env', ty2') <- zonkTidyTcType env' ty2
    
    840 828
       return $ (env', FunResCtxt e i1 ty1' ty2' i2 i3)
    
    841 829
     zonkTidyErrCtxtMsg env p = return (env, p)
    842
    -{-
    
    843
    -  -- or a type signature, or... (see 'Sig').
    
    844
    -  | SigCtxt !(Sig GhcRn)
    
    845
    -  -- | In a user-written type signature.
    
    846
    -  | UserSigCtxt !UserTypeCtxt !UserSigType
    
    847
    -
    
    848
    -  -- | In a pattern.
    
    849
    -  | PatCtxt !(Pat GhcRn)
    
    850
    -  -- | In a pattern synonym declaration.
    
    851
    -  | PatSynDeclCtxt !Name
    
    852
    -  -- | In a pattern matching context, e.g. a equation for a function binding,
    
    853
    -  -- or a case alternative, ...
    
    854
    -  | MatchCtxt !HsMatchContextRn
    
    855
    -  -- | In a match in a pattern matching context,
    
    856
    -  -- either for an expression or for an arrow command.
    
    857
    -  | forall body. (Outputable body)
    
    858
    -  => MatchInCtxt !(Match GhcRn body)
    
    859
    -  -- | In the declaration of a type constructor.
    
    860
    -  | TyConDeclCtxt !Name !(TyConFlavour TyCon)
    
    861
    -  -- | In a type or data family instance (or default instance).
    
    862
    -  | TyConInstCtxt !Name !TyConInstFlavour
    
    863
    -  -- | In the declaration of a data constructor.
    
    864
    -  | DataConDefCtxt !(NE.NonEmpty (LocatedN Name))
    
    865
    -  -- | In the result type of a data constructor.
    
    866
    -  | DataConResTyCtxt !(NE.NonEmpty (LocatedN Name))
    
    867
    -  -- | In the equations for a closed type family.
    
    868
    -  | ClosedFamEqnCtxt !TyCon
    
    869
    -  -- | In the expansion of a type synonym.
    
    870
    -  | TySynErrCtxt !TyCon
    
    871
    -  -- | In a role annotation.
    
    872
    -  | RoleAnnotErrCtxt !Name
    
    873
    -  -- | In an arrow command.
    
    874
    -  | CmdCtxt !(HsCmd GhcRn)
    
    875
    -  -- | In an instance declaration.
    
    876
    -  | InstDeclErrCtxt !(Either (LHsType GhcRn) PredType)
    
    877
    -  -- | In a default declaration.
    
    878
    -  | DefaultDeclErrCtxt { ddec_in_type_list :: !Bool }
    
    879
    -  -- | In the body of a static form.
    
    880
    -  | StaticFormCtxt !(LHsExpr GhcRn)
    
    881
    -  -- | In a pattern binding.
    
    882
    -  | forall p. OutputableBndrId p
    
    883
    -  => PatMonoBindsCtxt !(LPat (GhcPass p)) !(GRHSs GhcRn (LHsExpr GhcRn))
    
    884
    -  -- | In a foreign import/export declaration.
    
    885
    -  | ForeignDeclCtxt !(ForeignDecl GhcRn)
    
    886
    -  -- | In a record field.
    
    887
    -  | FieldCtxt !FieldLabelString
    
    888
    -  -- | In a type.
    
    889
    -  | TypeCtxt !(LHsType GhcRn)
    
    890
    -  -- | In a kind.
    
    891
    -  | KindCtxt !(LHsKind GhcRn)
    
    892
    -  -- | In an ambiguity check.
    
    893
    -  | AmbiguityCheckCtxt !UserTypeCtxt !Bool
    
    894
    -
    
    895
    -  -- | In a term-level use of a 'Name'.
    
    896
    -  | TermLevelUseCtxt !Name !TermLevelUseCtxt
    
    897
    -
    
    898
    -  -- | When checking the type of the @main@ function.
    
    899
    -  | MainCtxt !Name
    
    900
    -  -- | Warning emitted when inferring use of visible dependent quantification.
    
    901
    -  | VDQWarningCtxt !TcTyCon
    
    902
    -
    
    903
    -  -- | In a statement
    
    904
    -  | forall body.
    
    905
    -    ( Anno (StmtLR GhcRn GhcRn body) ~ SrcSpanAnnA
    
    906
    -    , Outputable body
    
    907
    -    ) => StmtErrCtxt !HsStmtContextRn !(StmtLR GhcRn GhcRn body)
    
    908
    -
    
    909
    -  -- | In a do statement.
    
    910
    -  | DoStmtErrCtxt !HsStmtContextRn !(ExprLStmt GhcRn)
    
    911
    -
    
    912
    -  -- | In patten of the do statement. (c.f. MonadFailErrors)
    
    913
    -  | StmtErrCtxtPat !HsStmtContextRn !(ExprLStmt GhcRn) (LPat GhcRn)
    
    914
    -
    
    915
    -  -- | In an rebindable syntax expression.
    
    916
    -  | SyntaxNameCtxt !(HsExpr GhcRn) !CtOrigin !TcType !SrcSpan
    
    917
    -  -- | In a RULE.
    
    918
    -  | RuleCtxt !FastString
    
    919
    -  -- | In a subtype check.
    
    920
    -  | SubTypeCtxt !TcType !TcType
    
    921
    -
    
    922
    -  -- | In an export.
    
    923
    -  | forall p. OutputableBndrId p
    
    924
    -  => ExportCtxt (IE (GhcPass p))
    
    925
    -  -- | In an export of a pattern synonym.
    
    926
    -  | PatSynExportCtxt !PatSyn
    
    927
    -  -- | In an export of a pattern synonym record field.
    
    928
    -  | PatSynRecSelExportCtxt !PatSyn !Name
    
    929
    -
    
    930
    -  -- | In an annotation.
    
    931
    -  | forall p. OutputableBndrId p
    
    932
    -  => AnnCtxt (AnnDecl (GhcPass p))
    
    933
    -
    
    934
    -  -- | In a specialise pragma.
    
    935
    -  | SpecPragmaCtxt !(Sig GhcRn)
    
    936
    -
    
    937
    -  -- | In a deriving clause.
    
    938
    -  | DerivInstCtxt !PredType
    
    939
    -  -- | In a standalone deriving clause.
    
    940
    -  | StandaloneDerivCtxt !(LHsSigWcType GhcRn)
    
    941
    -  -- | When typechecking the body of a derived instance.
    
    942
    -  | DerivBindCtxt !Id !Class ![Type]
    
    943
    -
    
    944
    -  -- | In an untyped Template Haskell quote.
    
    945
    -  | UntypedTHBracketCtxt !(HsQuote GhcPs)
    
    946
    -  -- | In a typed Template Haskell quote.
    
    947
    -  | forall p. OutputableBndrId p
    
    948
    -  => TypedTHBracketCtxt !(LHsExpr (GhcPass p))
    
    949
    -  -- | In an untyped Template Haskell splice or quasi-quote.
    
    950
    -  | UntypedSpliceCtxt !(HsUntypedSplice GhcPs)
    
    951
    -  -- | In a typed Template Haskell splice.
    
    952
    -  | forall p. OutputableBndrId p
    
    953
    -  => TypedSpliceCtxt !(Maybe SplicePointName) !(HsTypedSplice (GhcPass p))
    
    954
    -  -- | In the result of a typed Template Haskell splice.
    
    955
    -  | TypedSpliceResultCtxt !(LHsExpr GhcTc)
    
    956
    -  -- | In an argument to the Template Haskell @reifyInstances@ function.
    
    957
    -  | ReifyInstancesCtxt !TH.Name ![TH.Type]
    
    958
    -
    
    959
    -  -- | While merging Backpack signatures.
    
    960
    -  | MergeSignaturesCtxt !UnitState !ModuleName ![InstantiatedModule]
    
    961
    -  -- | While checking that a module implements a Backpack signature.
    
    962
    -  | CheckImplementsCtxt !UnitState !Module !InstantiatedModule
    
    963
    --}