summaryrefslogtreecommitdiff
path: root/compiler/rename/RnNames.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rename/RnNames.hs')
-rw-r--r--compiler/rename/RnNames.hs13
1 files changed, 12 insertions, 1 deletions
diff --git a/compiler/rename/RnNames.hs b/compiler/rename/RnNames.hs
index b0b79f55e6..c673ac3729 100644
--- a/compiler/rename/RnNames.hs
+++ b/compiler/rename/RnNames.hs
@@ -610,11 +610,22 @@ getLocalNonValBinders fixity_env
mk_fld_env :: HsDataDefn RdrName -> [Name] -> [FieldLabel] -> [(Name, [FieldLabel])]
mk_fld_env d names flds = concatMap find_con_flds (dd_cons d)
where
- find_con_flds (L _ (ConDecl { con_names = rdrs
+ find_con_flds (L _ (ConDeclH98 { con_name = rdrs
, con_details = RecCon cdflds }))
= map (\ (L _ rdr) -> ( find_con_name rdr
, concatMap find_con_decl_flds (unLoc cdflds)))
+ [rdrs] -- AZ:TODO remove map
+ find_con_flds (L _ (ConDeclGADT
+ { con_names = rdrs
+ , con_type = (HsIB { hsib_body = res_ty})}))
+ = map (\ (L _ rdr) -> ( find_con_name rdr
+ , concatMap find_con_decl_flds cdflds))
rdrs
+ where
+ (_tvs, _cxt, tau) = splitLHsSigmaTy res_ty
+ cdflds = case tau of
+ L _ (HsFunTy (L _ (HsRecTy flds)) _) -> flds
+ _ -> []
find_con_flds _ = []
find_con_name rdr