Use the record fields of IdInfo.RecordSelId
authorsimonpj@microsoft.com <unknown>
Wed, 2 May 2007 16:36:18 +0000 (16:36 +0000)
committersimonpj@microsoft.com <unknown>
Wed, 2 May 2007 16:36:18 +0000 (16:36 +0000)
compiler/basicTypes/Id.lhs
compiler/basicTypes/IdInfo.lhs
compiler/basicTypes/MkId.lhs

index 61a39f1..5f43a9d 100644 (file)
@@ -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
index b59ddf9..b009794 100644 (file)
@@ -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]
index c4618ca..bcfd33d 100644 (file)
@@ -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)