Commit a00334cc authored by chak@cse.unsw.edu.au.'s avatar chak@cse.unsw.edu.au.
Browse files

Fix export of associated families with new name parent story

Given

  module Exp (T)
  where

  class C a where
    data T a :: *

we need the AvailInfo for the export item to be C|{T}, not just T.
This patch achieves that under the new name parent scheme.
parent 4f55ec2c
......@@ -43,7 +43,8 @@ import HscTypes ( GenAvailInfo(..), AvailInfo, availNames, availName,
import RdrName ( RdrName, rdrNameOcc, setRdrNameSpace, Parent(..),
GlobalRdrEnv, mkGlobalRdrEnv, GlobalRdrElt(..),
emptyGlobalRdrEnv, plusGlobalRdrEnv, globalRdrEnvElts,
extendGlobalRdrEnv, lookupGlobalRdrEnv, lookupGRE_Name,
extendGlobalRdrEnv, lookupGlobalRdrEnv,
lookupGRE_RdrName, lookupGRE_Name,
Provenance(..), ImportSpec(..), ImpDeclSpec(..), ImpItemSpec(..),
importSpecLoc, importSpecModule, isLocalGRE, pprNameProvenance,
unQualSpecOK, qualSpecOK )
......@@ -408,11 +409,6 @@ filterImports iface decl_spec (Just (want_hiding, import_items)) all_avails
gres | want_hiding = gresFromAvails hiding_prov pruned_avails
| otherwise = concatMap (gresFromIE decl_spec) items2
traceRn (ppr $ all_avails)
traceRn (ppr $ occ_env)
traceRn (ppr $ items2)
traceRn (ppr $ mkGlobalRdrEnv gres)
return (Just (want_hiding, map fst items2), mkGlobalRdrEnv gres)
where
-- This environment is how we map names mentioned in the import
......@@ -935,7 +931,13 @@ exports_from_avail (Just rdr_items) rdr_env imports this_mod
lookup_ie (IEThingAbs rdr)
= do name <- lookupGlobalOccRn rdr
return (IEThingAbs name, AvailTC name [name])
case lookupGRE_RdrName rdr rdr_env of
[] -> panic "RnNames.lookup_ie"
elt:_ -> case gre_par elt of
NoParent -> return (IEThingAbs name,
AvailTC name [name])
ParentIs p -> return (IEThingAbs name,
AvailTC p [name])
lookup_ie ie@(IEThingAll rdr)
= do name <- lookupGlobalOccRn rdr
......
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