diff options
Diffstat (limited to 'compiler/rename')
| -rw-r--r-- | compiler/rename/RnEnv.hs | 1 | ||||
| -rw-r--r-- | compiler/rename/RnNames.hs | 42 | ||||
| -rw-r--r-- | compiler/rename/RnSplice.hs | 6 |
3 files changed, 33 insertions, 16 deletions
diff --git a/compiler/rename/RnEnv.hs b/compiler/rename/RnEnv.hs index 0794412051..28da6cb413 100644 --- a/compiler/rename/RnEnv.hs +++ b/compiler/rename/RnEnv.hs @@ -53,6 +53,7 @@ import RdrName import HscTypes import TcEnv ( tcLookupDataCon, tcLookupField, isBrackStage ) import TcRnMonad +import RdrHsSyn ( setRdrNameSpace ) import Id ( isRecordSelector ) import Name import NameSet diff --git a/compiler/rename/RnNames.hs b/compiler/rename/RnNames.hs index 036d6520fb..00381b3567 100644 --- a/compiler/rename/RnNames.hs +++ b/compiler/rename/RnNames.hs @@ -32,6 +32,7 @@ import NameSet import Avail import HscTypes import RdrName +import RdrHsSyn ( setRdrNameSpace ) import Outputable import Maybes import SrcLoc @@ -652,10 +653,14 @@ Then M's export_avails are (recall the AvailTC invariant from Avails.hs) C(C,T), T(T,T1,T2,T3) Notice that T appears *twice*, once as a child and once as a parent. From this we construct the imp_occ_env - C -> (C, C(C,T), Nothing + C -> (C, C(C,T), Nothing) T -> (T, T(T,T1,T2,T3), Just C) T1 -> (T1, T(T1,T2,T3), Nothing) -- similarly T2,T3 +If we say + import M( T(T1,T2) ) +then we get *two* Avails: C(T), T(T1,T2) + Note that the imp_occ_env will have entries for data constructors too, although we never look up data constructors. -} @@ -763,19 +768,30 @@ filterImports ifaces decl_spec (Just (want_hiding, L l import_items)) return ([(IEVar (L l name), trimAvail avail name)], []) IEThingAll (L l tc) -> do - (name, avail@(AvailTC name2 subs), mb_parent) <- lookup_name tc - let warns | null (drop 1 subs) = [DodgyImport tc] - | not (is_qual decl_spec) = [MissingImportList] - | otherwise = [] + (name, avail, mb_parent) <- lookup_name tc + let warns = case avail of + Avail {} -- e.g. f(..) + -> [DodgyImport tc] + + AvailTC _ subs + | null (drop 1 subs) -- e.g. T(..) where T is a synonym + -> [DodgyImport tc] + + | not (is_qual decl_spec) -- e.g. import M( T(..) ) + -> [MissingImportList] + + | otherwise + -> [] + + renamed_ie = IEThingAll (L l name) + sub_avails = case avail of + Avail {} -> [] + AvailTC name2 subs -> [(renamed_ie, AvailTC name2 (subs \\ [name]))] case mb_parent of - -- non-associated ty/cls - Nothing -> return ([(IEThingAll (L l name), avail)], warns) - -- associated ty - Just parent -> return ([(IEThingAll (L l name), - AvailTC name2 (subs \\ [name])), - (IEThingAll (L l name), - AvailTC parent [name])], - warns) + Nothing -> return ([(renamed_ie, avail)], warns) + -- non-associated ty/cls + Just parent -> return ((renamed_ie, AvailTC parent [name]) : sub_avails, warns) + -- associated type IEThingAbs (L l tc) | want_hiding -- hiding ( C ) diff --git a/compiler/rename/RnSplice.hs b/compiler/rename/RnSplice.hs index 5d12720e2c..737dcc9584 100644 --- a/compiler/rename/RnSplice.hs +++ b/compiler/rename/RnSplice.hs @@ -37,15 +37,15 @@ import {-# SOURCE #-} RnExpr ( rnLExpr ) import PrelNames ( isUnboundName ) import TcEnv ( checkWellStaged ) -import DsMeta ( liftName ) +import THNames ( liftName ) #ifdef GHCI import ErrUtils ( dumpIfSet_dyn_printer ) -import DsMeta ( decsQTyConName, expQTyConName, patQTyConName, typeQTyConName, ) import TcEnv ( tcMetaTy ) import Hooks import Var ( Id ) -import DsMeta ( quoteExpName, quotePatName, quoteDecName, quoteTypeName ) +import THNames ( quoteExpName, quotePatName, quoteDecName, quoteTypeName + , decsQTyConName, expQTyConName, patQTyConName, typeQTyConName, ) import Util import {-# SOURCE #-} TcExpr ( tcMonoExpr ) |
