Skip to content
Snippets Groups Projects
Commit 356a2692 authored by Ackerman's avatar Ackerman Committed by Marge Bot
Browse files

Use generated src span for catch-all case of record selector functions

This fixes #23492. The problem was that we used the real source span
of the field declaration for the generated catch-all case in the
selector function, in particular in the generated call to
`recSelError`, which meant it was included in the HIE output. Using
`generatedSrcSpan` instead means that it is not included.
parent 6074cc3c
No related branches found
No related tags found
No related merge requests found
......@@ -64,6 +64,8 @@ import GHC.Data.FastString
import GHC.Unit.Module
import GHC.Rename.Utils (wrapGenSpan)
import GHC.Types.Basic
import GHC.Types.FieldLabel
import GHC.Types.SrcLoc
......@@ -954,10 +956,11 @@ mkOneRecordSelector all_cons idDetails fl has_sel
-- mentions this particular record selector
deflt | all dealt_with all_cons = []
| otherwise = [mkSimpleMatch CaseAlt
[L loc' (WildPat noExtField)]
(mkHsApp (L loc' (HsVar noExtField
(L locn (getName rEC_SEL_ERROR_ID))))
(L loc' (HsLit noComments msg_lit)))]
[wrapGenSpan (WildPat noExtField)]
(wrapGenSpan
(HsApp noComments
(wrapGenSpan (HsVar noExtField (wrapGenSpan (getName rEC_SEL_ERROR_ID))))
(wrapGenSpan (HsLit noComments msg_lit))))]
-- Do not add a default case unless there are unmatched
-- constructors. We must take account of GADTs, else we
......
At (13,20), got type: PartialFieldSelector -> Bool
Addr#
Bool
PartialFieldSelector
Addr# -> Bool
forall a. Addr# -> a
At (18,7), got type: PartialFieldSelector -> Bool
At (23,7), got type: PartialFieldSelector
At (23,8), got type: PartialFieldSelector
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment