| ... |
... |
@@ -183,7 +183,7 @@ tcExprSigma inst rn_expr |
|
183
|
183
|
; do_ql <- wantQuickLook rn_fun
|
|
184
|
184
|
; (tc_fun, fun_sigma) <- tcInferAppHead fun
|
|
185
|
185
|
; code_orig <- getSrcCodeOrigin
|
|
186
|
|
- ; let fun_orig | isGoodSrcSpan fun_lspan
|
|
|
186
|
+ ; let fun_orig | not (isGeneratedSrcSpan fun_lspan)
|
|
187
|
187
|
= exprCtOrigin rn_fun
|
|
188
|
188
|
| otherwise
|
|
189
|
189
|
= srcCodeOriginCtOrigin rn_fun code_orig
|
| ... |
... |
@@ -435,7 +435,7 @@ tcApp rn_expr exp_res_ty |
|
435
|
435
|
-- See Note [Error contexts in generated code]
|
|
436
|
436
|
-- See Note [Error Context Stack]
|
|
437
|
437
|
; code_orig <- getSrcCodeOrigin
|
|
438
|
|
- ; let fun_orig | isGoodSrcSpan fun_lspan
|
|
|
438
|
+ ; let fun_orig | not (isGeneratedSrcSpan fun_lspan)
|
|
439
|
439
|
= exprCtOrigin rn_fun
|
|
440
|
440
|
| otherwise
|
|
441
|
441
|
= srcCodeOriginCtOrigin rn_fun code_orig
|
| ... |
... |
@@ -962,9 +962,7 @@ addArgCtxt arg_no (app_head, app_head_lspan) (L arg_loc arg) thing_inside |
|
962
|
962
|
, ppr arg_loc
|
|
963
|
963
|
, ppr arg
|
|
964
|
964
|
, ppr arg_no])
|
|
965
|
|
- ; setSrcSpanA arg_loc $
|
|
966
|
|
- addErrCtxt (FunAppCtxt (FunAppCtxtExpr app_head arg) arg_no) $
|
|
967
|
|
- thing_inside
|
|
|
965
|
+ ; setSrcSpanA arg_loc $ mkNthFunArgErrCtxt app_head arg arg_no thing_inside
|
|
968
|
966
|
}
|
|
969
|
967
|
| otherwise
|
|
970
|
968
|
= do { traceTc "addArgCtxt" (vcat [text "generated Head"
|
| ... |
... |
@@ -975,6 +973,15 @@ addArgCtxt arg_no (app_head, app_head_lspan) (L arg_loc arg) thing_inside |
|
975
|
973
|
; addLExprCtxt (locA arg_loc) arg $
|
|
976
|
974
|
thing_inside
|
|
977
|
975
|
}
|
|
|
976
|
+ where
|
|
|
977
|
+ mkNthFunArgErrCtxt :: HsExpr GhcRn -> HsExpr GhcRn -> Int -> TcM a -> TcM a
|
|
|
978
|
+ mkNthFunArgErrCtxt app_head arg arg_no thing_inside
|
|
|
979
|
+ | XExpr (ExpandedThingRn o _) <- arg
|
|
|
980
|
+ = addExpansionErrCtxt o (FunAppCtxt (FunAppCtxtExpr app_head arg) arg_no) $
|
|
|
981
|
+ thing_inside
|
|
|
982
|
+ | otherwise
|
|
|
983
|
+ = addErrCtxt (FunAppCtxt (FunAppCtxtExpr app_head arg) arg_no) $
|
|
|
984
|
+ thing_inside
|
|
978
|
985
|
|
|
979
|
986
|
|
|
980
|
987
|
|
| ... |
... |
@@ -1839,7 +1846,7 @@ quickLookArg1 pos app_lspan (fun, fun_lspan) larg@(L _ arg) sc_arg_ty@(Scaled _ |
|
1839
|
1846
|
do { let tc_head = (tc_fun, fun_lspan)
|
|
1840
|
1847
|
; do_ql <- wantQuickLook rn_fun
|
|
1841
|
1848
|
; code_orig <- getSrcCodeOrigin
|
|
1842
|
|
- ; let arg_orig | isGoodSrcSpan fun_lspan
|
|
|
1849
|
+ ; let arg_orig | not (isGeneratedSrcSpan fun_lspan)
|
|
1843
|
1850
|
= exprCtOrigin fun
|
|
1844
|
1851
|
| otherwise
|
|
1845
|
1852
|
= srcCodeOriginCtOrigin fun code_orig
|