[project @ 1999-12-02 15:52:19 by simonmar]
[ghc-hetmet.git] / ghc / compiler / rename / RnNames.lhs
index f549234..fa5b376 100644 (file)
@@ -216,9 +216,9 @@ checkEarlyExit mod
        -- Unchanged source, and no errors yet; see if usage info
        -- up to date, and exit if so
     checkUpToDate mod                                          `thenRn` \ up_to_date ->
-    putDocRn (text "Compilation" <+> 
-             text (if up_to_date then "IS NOT" else "IS") <+>
-             text "required")                                  `thenRn_`
+    (if up_to_date 
+       then putDocRn (text "Compilation IS NOT required")
+       else returnRn ())                                       `thenRn_`
     returnRn up_to_date
 \end{code}
        
@@ -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
@@ -325,7 +331,7 @@ fixitiesFromLocalDecls gbl_env decls
     getFixities acc (FixD fix)
       = fix_decl acc fix
 
-    getFixities acc (TyClD (ClassDecl _ _ _ sigs _ _ _ _ _ _))
+    getFixities acc (TyClD (ClassDecl _ _ _ _ sigs _ _ _ _ _ _))
       = foldlRn fix_decl acc [sig | FixSig sig <- sigs]
                -- Get fixities from class decl sigs too.
     getFixities acc other_decl