Commit 55710e16 authored by simonpj@microsoft.com's avatar simonpj@microsoft.com
Browse files

Use the record fields of IdInfo.RecordSelId

parent ff8e1d01
......@@ -214,9 +214,10 @@ idPrimRep id = typePrimRep (idType id)
\begin{code}
recordSelectorFieldLabel :: Id -> (TyCon, FieldLabel)
recordSelectorFieldLabel id = case globalIdDetails id of
RecordSelId tycon lbl _ -> (tycon,lbl)
other -> panic "recordSelectorFieldLabel"
recordSelectorFieldLabel id
= case globalIdDetails id of
RecordSelId { sel_tycon = tycon, sel_label = lbl } -> (tycon,lbl)
other -> panic "recordSelectorFieldLabel"
isRecordSelector id = case globalIdDetails id of
RecordSelId {} -> True
......
......@@ -232,7 +232,8 @@ data GlobalIdDetails
= VanillaGlobal -- Imported from elsewhere, a default method Id.
| RecordSelId -- The Id for a record selector
{ sel_tycon :: TyCon
{ sel_tycon :: TyCon -- For a data type family, this is the *instance* TyCon
-- not the family TyCon
, sel_label :: FieldLabel
, sel_naughty :: Bool -- True <=> naughty
} -- See Note [Naughty record selectors]
......
......@@ -478,7 +478,8 @@ mkRecordSelId tycon field_label
| otherwise = sel_id
where
is_naughty = not (tyVarsOfType field_ty `subVarSet` data_tv_set)
sel_id_details = RecordSelId tycon field_label is_naughty
sel_id_details = RecordSelId { sel_tycon = tycon, sel_label = field_label, sel_naughty = is_naughty }
-- For a data type family, the tycon is the *instance* TyCon
-- Escapist case here for naughty constructors
-- We give it no IdInfo, and a type of forall a.a (never looked at)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment