diff options
| author | simonpj <unknown> | 2000-11-10 15:12:55 +0000 |
|---|---|---|
| committer | simonpj <unknown> | 2000-11-10 15:12:55 +0000 |
| commit | f23ba2b294429ccbdeb80f0344ec08f6abf61bb7 (patch) | |
| tree | 30e94ffff421c99ae25f35759e52b7e267e9e8af /ghc/compiler/rename/RnEnv.lhs | |
| parent | 6bd12a0cb5115d08a9ee84dbc1920e83bb7c1616 (diff) | |
| download | haskell-f23ba2b294429ccbdeb80f0344ec08f6abf61bb7.tar.gz | |
[project @ 2000-11-10 15:12:50 by simonpj]
1. Outputable.PprStyle now carries a bit more information
In particular, the printing style tells whether to print
a name in unqualified form. This used to be embedded in
a Name, but since Names now outlive a single compilation unit,
that's no longer appropriate.
So now the print-unqualified predicate is passed in the printing
style, not embedded in the Name.
2. I tidied up HscMain a little. Many of the showPass messages
have migraged into the repective pass drivers
Diffstat (limited to 'ghc/compiler/rename/RnEnv.lhs')
| -rw-r--r-- | ghc/compiler/rename/RnEnv.lhs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/ghc/compiler/rename/RnEnv.lhs b/ghc/compiler/rename/RnEnv.lhs index 782ae26d96..82d8993d53 100644 --- a/ghc/compiler/rename/RnEnv.lhs +++ b/ghc/compiler/rename/RnEnv.lhs @@ -11,7 +11,7 @@ module RnEnv where -- Export everything import HsSyn import RdrHsSyn ( RdrNameIE ) import RdrName ( RdrName, rdrNameModule, rdrNameOcc, isQual, isUnqual, isOrig, - mkRdrUnqual, mkRdrUnqual, qualifyRdrName, lookupRdrEnv + mkRdrUnqual, mkRdrUnqual, qualifyRdrName, lookupRdrEnv, foldRdrEnv ) import HsTypes ( hsTyVarName, replaceTyVarName ) import HscTypes ( Provenance(..), pprNameProvenance, hasBetterProv, @@ -539,11 +539,12 @@ in error messages. \begin{code} unQualInScope :: GlobalRdrEnv -> Name -> Bool unQualInScope env - = lookup + = (`elemNameSet` unqual_names) where - lookup name = case lookupRdrEnv env (mkRdrUnqual (nameOccName name)) of - Just [(name',_)] -> name == name' - other -> False + unqual_names :: NameSet + unqual_names = foldRdrEnv add emptyNameSet env + add rdr_name [(name,_)] unquals | isUnqual rdr_name = addOneToNameSet unquals name + add _ _ unquals = unquals \end{code} @@ -746,7 +747,7 @@ warnUnusedGroup names = case prov1 of LocalDef -> (True, getSrcLoc name1, text "Defined but not used") - NonLocalDef (UserImport mod loc _) _ + NonLocalDef (UserImport mod loc _) -> (True, loc, text "Imported from" <+> quotes (ppr mod) <+> text "but not used") reportable (name,_) = case occNameUserString (nameOccName name) of |
