X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Frename%2FRnNames.lhs;h=911718c9491833e863fe4f59b897f4d008095658;hb=1ea67691a1d115d95d6c3e8e593c2c2dbc36aa9c;hp=f549234e04919bf3d3e736ba1d8ef1913b948bfa;hpb=452eaacb49baed523569c2db967cac10fed24a10;p=ghc-hetmet.git diff --git a/ghc/compiler/rename/RnNames.lhs b/ghc/compiler/rename/RnNames.lhs index f549234..911718c 100644 --- a/ghc/compiler/rename/RnNames.lhs +++ b/ghc/compiler/rename/RnNames.lhs @@ -273,10 +273,7 @@ importsFromLocalDecls mod_name rec_exp_fn decls all_names = [name | avail <- avails, name <- availNames avail] dups :: [[Name]] - dups = filter non_singleton (equivClassesByUniq getUnique all_names) - where - non_singleton (x1:x2:xs) = True - non_singleton other = False + (_, dups) = removeDups compare all_names in -- Check for duplicate definitions mapRn_ (addErrRn . dupDeclErr) dups `thenRn_` @@ -293,10 +290,19 @@ importsFromLocalDecls mod_name rec_exp_fn decls (\n -> n) where - newLocalName rdr_name loc = newLocalTopBinder mod (rdrNameOcc rdr_name) - rec_exp_fn loc mod = mkThisModule mod_name + newLocalName rdr_name loc + = (if isQual rdr_name then + qualNameErr (text "the binding for" <+> quotes (ppr rdr_name)) (rdr_name,loc) + -- There should never be a qualified name in a binding position (except in instance decls) + -- The parser doesn't check this because the same parser parses instance decls + else + returnRn ()) `thenRn_` + + newLocalTopBinder mod (rdrNameOcc rdr_name) rec_exp_fn loc + + getLocalDeclBinders :: (RdrName -> SrcLoc -> RnMG Name) -- New-name function -> RdrNameHsDecl -> RnMG Avails