X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Frename%2FRnEnv.lhs;fp=compiler%2Frename%2FRnEnv.lhs;h=a6503a88f3b23d0200faf23fe92bcd3a05890618;hp=c4ad95a333dff71a461e960bd617a8af6e1b741c;hb=cf5905ea24904cf73a041fd7535e8723a668cb9a;hpb=25fa4bdbff4a84d6717c4ff7cdf7080687616818 diff --git a/compiler/rename/RnEnv.lhs b/compiler/rename/RnEnv.lhs index c4ad95a..a6503a8 100644 --- a/compiler/rename/RnEnv.lhs +++ b/compiler/rename/RnEnv.lhs @@ -36,6 +36,7 @@ module RnEnv ( import LoadIface ( loadInterfaceForName, loadSrcInterface ) import IfaceEnv ( lookupOrig, newGlobalBinder, newIPName ) +import TcEnv ( getHetMetLevel ) import HsSyn import RdrHsSyn ( extractHsTyRdrTyVars ) import RdrName @@ -768,14 +769,14 @@ lookupIfThenElse lookupSyntaxName :: Name -- The standard name -> RnM (SyntaxExpr Name, FreeVars) -- Possibly a non-standard name lookupSyntaxName std_name - = xoptM Opt_RebindableSyntax `thenM` \ rebindable_on -> - if not rebindable_on then normal_case - else - -- Get the similarly named thing from the local environment - lookupOccRn (mkRdrUnqual (nameOccName std_name)) `thenM` \ usr_name -> - return (HsVar usr_name, unitFV usr_name) - where - normal_case = return (HsVar std_name, emptyFVs) + = do ec <- getHetMetLevel + std_name' <- return $ setNameDepth (length ec) std_name + rebindable_on <- xoptM Opt_RebindableSyntax + if not rebindable_on + then return (HsVar std_name', emptyFVs) + else do usr_name <- lookupOccRn (mkRdrUnqual (nameOccName std_name')) + return (HsVar usr_name, unitFV usr_name) + -- Get the similarly named thing from the local environment lookupSyntaxTable :: [Name] -- Standard names -> RnM (SyntaxTable Name, FreeVars) -- See comments with HsExpr.ReboundNames