-
Notes added [Error Context Stack] [Typechecking by expansion: overview] Notes updated Note [Expanding HsDo with XXExprGhcRn] [tcApp: typechecking applications] ------------------------- Metric Decrease: T9020 ------------------------- There are 2 key changes: 1. `HsExpand` datatype mediates between expansions 2. Replace `ErrCtxtM` to a simpler `HsCtxt` that does not depend on a `TidyEnv` This has some consequences detailed below: 1. `HsExpand` datatype mediates between expansions * Simplifies the implementations of `tcExpr` to work on `XExpr` * Removes `VACtxt` (and its associated `VAExpansion` and `VACall`) datatype, it is subsumed by simply a `SrcSpan`. * Removes the function `addHeadCtxt` as it is now mearly setting a location * The function `tcValArgs` does its own argument number management * move `splitHsTypes` out of `tcApp` * Removes special case of tcBody from `tcLambdaMatches` * Removes special case of `dsExpr` for `ExpandedThingTc` * Renames `tcMonoExpr` -> `tcMonoLExpr`, `tcMonoExprNC` -> `tcMonoLExpr` * Renames `EValArg`, `EValArgQL` fields: `ea_ctxt` -> `ea_loc_span` and `eaql_ctx` -> `eaql_loc_span` * Remove `PopErrCtxt` from `XXExprGhcRn` * `fun_orig` in tcInstFun depends on the SrcSpan of the head of the application chain (similar to addArgCtxt) - it references the application chain head if it is user located, or uses the error context stack as a fallback if it's a generated location * Make a new variant `GeneratedSrcSpan` in `SrcSpan` for HIEAst Nodes - Expressions wrapped around `GeneratedSrcSpan` are ignored and never added to the error context stack - In Explicit list expansion `fromListN` is wrapped with a `GeneratedSrcSpan` with `GeneratedSrcSpanDetails` field to store the original srcspan 2. Replace `ErrCtxtM` to a simpler `HsCtxt` that does not depend on a `TidyEnv` * Merge `HsThingRn` to `HsCtxt` * Landmark Error messages are now just computed on the fly * Make HsExpandedRn and HsExpandedTc payload a located HsExpr GhcRn * `HsCtxt` are tidied and zonked at the end right before printing Co-authored-by:simonpj <simon.peytonjones@gmail.com>
Notes added [Error Context Stack] [Typechecking by expansion: overview] Notes updated Note [Expanding HsDo with XXExprGhcRn] [tcApp: typechecking applications] ------------------------- Metric Decrease: T9020 ------------------------- There are 2 key changes: 1. `HsExpand` datatype mediates between expansions 2. Replace `ErrCtxtM` to a simpler `HsCtxt` that does not depend on a `TidyEnv` This has some consequences detailed below: 1. `HsExpand` datatype mediates between expansions * Simplifies the implementations of `tcExpr` to work on `XExpr` * Removes `VACtxt` (and its associated `VAExpansion` and `VACall`) datatype, it is subsumed by simply a `SrcSpan`. * Removes the function `addHeadCtxt` as it is now mearly setting a location * The function `tcValArgs` does its own argument number management * move `splitHsTypes` out of `tcApp` * Removes special case of tcBody from `tcLambdaMatches` * Removes special case of `dsExpr` for `ExpandedThingTc` * Renames `tcMonoExpr` -> `tcMonoLExpr`, `tcMonoExprNC` -> `tcMonoLExpr` * Renames `EValArg`, `EValArgQL` fields: `ea_ctxt` -> `ea_loc_span` and `eaql_ctx` -> `eaql_loc_span` * Remove `PopErrCtxt` from `XXExprGhcRn` * `fun_orig` in tcInstFun depends on the SrcSpan of the head of the application chain (similar to addArgCtxt) - it references the application chain head if it is user located, or uses the error context stack as a fallback if it's a generated location * Make a new variant `GeneratedSrcSpan` in `SrcSpan` for HIEAst Nodes - Expressions wrapped around `GeneratedSrcSpan` are ignored and never added to the error context stack - In Explicit list expansion `fromListN` is wrapped with a `GeneratedSrcSpan` with `GeneratedSrcSpanDetails` field to store the original srcspan 2. Replace `ErrCtxtM` to a simpler `HsCtxt` that does not depend on a `TidyEnv` * Merge `HsThingRn` to `HsCtxt` * Landmark Error messages are now just computed on the fly * Make HsExpandedRn and HsExpandedTc payload a located HsExpr GhcRn * `HsCtxt` are tidied and zonked at the end right before printing Co-authored-by:simonpj <simon.peytonjones@gmail.com>
Loading