-- nor does it need the 'lifting' treatment
ATcId { tct_id = id, tct_type = ty, tct_co = mb_co, tct_level = lvl }
+ | isNaughtyRecordSelector id -> failWithTc (naughtyRecordSel id)
+ -- Note [Local record selectors]
+ | otherwise
-> do { thLocalId orig id ty lvl
; case mb_co of
Unrefineable -> return (HsVar id, ty)
#endif /* GHCI */
\end{code}
+Local record selectors
+~~~~~~~~~~~~~~~~~~~~~~
+Record selectors for TyCons in this module are ordinary local bindings,
+which show up as ATcIds rather than AGlobals. So we need to check for
+naughtiness in both branches. c.f. TcTyClsBindings.mkAuxBinds.
+
%************************************************************************
%* *