X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Frename%2FRnEnv.lhs;h=63db61ccb646e766e7529786b62f29d50d03b17d;hp=94c90ac90bcf46afbfb592b862f752d8a135532d;hb=d1984e439154e95b2804ee83897e740b1713c53d;hpb=c8577590bd59c65effd1f178d1b97a6a0db32851 diff --git a/compiler/rename/RnEnv.lhs b/compiler/rename/RnEnv.lhs index 94c90ac..63db61c 100644 --- a/compiler/rename/RnEnv.lhs +++ b/compiler/rename/RnEnv.lhs @@ -359,23 +359,27 @@ lookupGlobalOccRn rdr_name = lookupImportedName rdr_name | otherwise - = -- First look up the name in the normal environment. - lookupGreRn_maybe rdr_name `thenM` \ mb_gre -> + = do + -- First look up the name in the normal environment. + mb_gre <- lookupGreRn_maybe rdr_name case mb_gre of { Just gre -> returnM (gre_name gre) ; - Nothing -> + Nothing -> do -- We allow qualified names on the command line to refer to -- *any* name exported by any module in scope, just as if -- there was an "import qualified M" declaration for every -- module. - getModule `thenM` \ mod -> - if isQual rdr_name && mod == iNTERACTIVE then - -- This test is not expensive, - lookupQualifiedName rdr_name -- and only happens for failed lookups - else do + allow_qual <- doptM Opt_ImplicitImportQualified + mod <- getModule + -- This test is not expensive, + -- and only happens for failed lookups + if isQual rdr_name && allow_qual && mod == iNTERACTIVE + then lookupQualifiedName rdr_name + else do traceRn $ text "lookupGlobalOccRn" - unboundName rdr_name } + unboundName rdr_name + } lookupImportedName :: RdrName -> TcRnIf m n Name -- Lookup the occurrence of an imported name