Note [Error contexts in generated code]
* setSrcSpan sets tcl_in_gen_code to True if the SrcSpan is GeneratedSrcSpan, and back to False when we get a useful SrcSpan * When tcl_in_gen_code is True, addErrCtxt becomes a no-op. So typically it's better to do setSrcSpan /before/ addErrCtxt. See Note [Rebindable syntax and XXExprGhcRn] in GHC.Hs.Expr for more discussion of this fancy footwork, as well as Note [Generated code and pattern-match checking] in GHC.Types.Basic for the relation with pattern-match checks.
References 2
- Rebindable syntax and XXExprGhcRn GHC.Hs.Expr
- Generated code and pattern-match checking GHC.Types.Basic
Referenced by 8
- GHC.Tc.Gen.Expr call site ×3
- GHC.Tc.Utils.Monad call site ×3
- GHC.Tc.Types.CtLoc call site
- Generated code and pattern-match checking GHC.Types.Basic