From 55710e16202e985f8e4f910a09dfc2d0298ca255 Mon Sep 17 00:00:00 2001 From: "simonpj@microsoft.com" Date: Wed, 2 May 2007 16:36:18 +0000 Subject: [PATCH] Use the record fields of IdInfo.RecordSelId --- compiler/basicTypes/Id.lhs | 7 ++++--- compiler/basicTypes/IdInfo.lhs | 3 ++- compiler/basicTypes/MkId.lhs | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/compiler/basicTypes/Id.lhs b/compiler/basicTypes/Id.lhs index 61a39f1..5f43a9d 100644 --- a/compiler/basicTypes/Id.lhs +++ b/compiler/basicTypes/Id.lhs @@ -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 diff --git a/compiler/basicTypes/IdInfo.lhs b/compiler/basicTypes/IdInfo.lhs index b59ddf9..b009794 100644 --- a/compiler/basicTypes/IdInfo.lhs +++ b/compiler/basicTypes/IdInfo.lhs @@ -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] diff --git a/compiler/basicTypes/MkId.lhs b/compiler/basicTypes/MkId.lhs index c4618ca..bcfd33d 100644 --- a/compiler/basicTypes/MkId.lhs +++ b/compiler/basicTypes/MkId.lhs @@ -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) -- 1.7.10.4