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

Use the record fields of IdInfo.RecordSelId

parent ff8e1d01
...@@ -214,8 +214,9 @@ idPrimRep id = typePrimRep (idType id) ...@@ -214,8 +214,9 @@ idPrimRep id = typePrimRep (idType id)
\begin{code} \begin{code}
recordSelectorFieldLabel :: Id -> (TyCon, FieldLabel) recordSelectorFieldLabel :: Id -> (TyCon, FieldLabel)
recordSelectorFieldLabel id = case globalIdDetails id of recordSelectorFieldLabel id
RecordSelId tycon lbl _ -> (tycon,lbl) = case globalIdDetails id of
RecordSelId { sel_tycon = tycon, sel_label = lbl } -> (tycon,lbl)
other -> panic "recordSelectorFieldLabel" other -> panic "recordSelectorFieldLabel"
isRecordSelector id = case globalIdDetails id of isRecordSelector id = case globalIdDetails id of
......
...@@ -232,7 +232,8 @@ data GlobalIdDetails ...@@ -232,7 +232,8 @@ data GlobalIdDetails
= VanillaGlobal -- Imported from elsewhere, a default method Id. = VanillaGlobal -- Imported from elsewhere, a default method Id.
| RecordSelId -- The Id for a record selector | 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_label :: FieldLabel
, sel_naughty :: Bool -- True <=> naughty , sel_naughty :: Bool -- True <=> naughty
} -- See Note [Naughty record selectors] } -- See Note [Naughty record selectors]
......
...@@ -478,7 +478,8 @@ mkRecordSelId tycon field_label ...@@ -478,7 +478,8 @@ mkRecordSelId tycon field_label
| otherwise = sel_id | otherwise = sel_id
where where
is_naughty = not (tyVarsOfType field_ty `subVarSet` data_tv_set) 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 -- Escapist case here for naughty constructors
-- We give it no IdInfo, and a type of forall a.a (never looked at) -- 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