Merge branch 'master' of http://darcs.haskell.org/ghc
[ghc-hetmet.git] / compiler / rename / RnSource.lhs
index 18c2dfd..6b8e5c0 100644 (file)
@@ -17,14 +17,14 @@ import {-# SOURCE #-} TcSplice ( runQuasiQuoteDecl )
 
 import HsSyn
 import RdrName         ( RdrName, isRdrDataCon, elemLocalRdrEnv, rdrNameOcc )
-import RdrHsSyn                ( extractGenericPatTyVars, extractHsRhoRdrTyVars )
+import RdrHsSyn                ( extractHsRhoRdrTyVars )
 import RnHsSyn
 import RnTypes         ( rnLHsType, rnLHsTypes, rnHsSigType, rnHsTypeFVs, rnContext, rnConDeclFields )
 import RnBinds         ( rnTopBindsLHS, rnTopBindsRHS, rnMethodBinds, renameSigs, mkSigTvFn,
                                 makeMiniFixityEnv)
 import RnEnv           ( lookupLocalDataTcNames, lookupLocatedOccRn,
                          lookupTopBndrRn, lookupLocatedTopBndrRn,
-                         lookupOccRn, newLocalBndrsRn, bindLocalNamesFV,
+                         lookupOccRn, bindLocalNamesFV,
                          bindLocatedLocalsFV, bindPatSigTyVarsFV,
                          bindTyVarsRn, bindTyVarsFV, extendTyVarEnvFVRn,
                          bindLocalNames, checkDupRdrNames, mapFvRn
@@ -443,24 +443,13 @@ rnSrcInstDecl (InstDecl inst_ty mbinds uprags ats)
        -- The typechecker (not the renamer) checks that all 
        -- the bindings are for the right class
     let
-       meth_names  = collectMethodBinders mbinds
        (inst_tyvars, _, cls,_) = splitHsInstDeclTy (unLoc inst_ty')
     in
-    checkDupRdrNames meth_names        `thenM_`
-       -- Check that the same method is not given twice in the
-       -- same instance decl   instance C T where
-       --                            f x = ...
-       --                            g y = ...
-       --                            f x = ...
-       -- We must use checkDupRdrNames because the Name of the
-       -- method is the Name of the class selector, whose SrcSpan
-       -- points to the class declaration
-
     extendTyVarEnvForMethodBinds inst_tyvars (         
        -- (Slightly strangely) the forall-d tyvars scope over
        -- the method bindings too
        rnMethodBinds cls (\_ -> [])    -- No scoped tyvars
-                     [] mbinds
+                     mbinds
     )                                          `thenM` \ (mbinds', meth_fvs) ->
        -- Rename the associated types
        -- The typechecker (not the renamer) checks that all 
@@ -677,6 +666,10 @@ rnHsVectDecl (HsVect var (Just rhs))
        ; (rhs', fv_rhs) <- rnLExpr rhs
        ; return (HsVect var' (Just rhs'), fv_rhs `addOneFV` unLoc var')
        }
+rnHsVectDecl (HsNoVect var)
+  = do { var' <- wrapLocM lookupTopBndrRn var
+       ; return (HsNoVect var', unitFV (unLoc var'))
+       }
 \end{code}
 
 %*********************************************************
@@ -826,15 +819,11 @@ rnTyClDecl (ClassDecl {tcdCtxt = context, tcdLName = cname,
        -- we want to name both "x" tyvars with the same unique, so that they are
        -- easy to group together in the typechecker.  
        ; (mbinds', meth_fvs) 
-           <- extendTyVarEnvForMethodBinds tyvars' $ do
-           { name_env <- getLocalRdrEnv
-           ; let gen_rdr_tyvars_w_locs = [ tv | tv <- extractGenericPatTyVars mbinds,
-                                                not (unLoc tv `elemLocalRdrEnv` name_env) ]
+           <- extendTyVarEnvForMethodBinds tyvars' $
                -- No need to check for duplicate method signatures
                -- since that is done by RnNames.extendGlobalRdrEnvRn
                -- and the methods are already in scope
-           ; gen_tyvars <- newLocalBndrsRn gen_rdr_tyvars_w_locs
-           ; rnMethodBinds (unLoc cname') (mkSigTvFn sigs') gen_tyvars mbinds }
+                rnMethodBinds (unLoc cname') (mkSigTvFn sigs') mbinds
 
   -- Haddock docs 
        ; docs' <- mapM (wrapLocM rnDocDecl) docs