diff --git a/compiler/GHC/Tc/TyCl/Utils.hs b/compiler/GHC/Tc/TyCl/Utils.hs
index 8e7b3b8c399b55a9b2e7ff0f5ac31f349e446dbd..0ca024fefd3c9967a31d427102b803ad720f00f9 100644
--- a/compiler/GHC/Tc/TyCl/Utils.hs
+++ b/compiler/GHC/Tc/TyCl/Utils.hs
@@ -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
diff --git a/testsuite/tests/hiefile/should_run/T23492.stdout b/testsuite/tests/hiefile/should_run/T23492.stdout
index 1c53e8ff657b197b0ffa3404d402083617da99d4..c4965ef47e57c055b51309c82d0f4c037267b445 100644
--- a/testsuite/tests/hiefile/should_run/T23492.stdout
+++ b/testsuite/tests/hiefile/should_run/T23492.stdout
@@ -1,9 +1,6 @@
 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