diff options
| author | David Waern <david.waern@gmail.com> | 2011-06-10 23:31:03 +0000 |
|---|---|---|
| committer | David Waern <david.waern@gmail.com> | 2011-06-10 23:31:03 +0000 |
| commit | a0770aa618f81e04737ba7bf4047ae4e7b644671 (patch) | |
| tree | 488e5abfc0e68ba7045febac28c4df608287728a /compiler/rename | |
| parent | f31e93496d7b7ec631b9402be9b566d0f5d2e1fa (diff) | |
| download | haskell-a0770aa618f81e04737ba7bf4047ae4e7b644671.tar.gz | |
Change TypeSig and GenericSig to take a list of names (fixes #1595).
This is a merge of a patch contributed by Michal Terepeta and the
recent generics changes.
Diffstat (limited to 'compiler/rename')
| -rw-r--r-- | compiler/rename/RnBinds.lhs | 19 | ||||
| -rw-r--r-- | compiler/rename/RnNames.lhs | 2 | ||||
| -rw-r--r-- | compiler/rename/RnSource.lhs | 2 |
3 files changed, 12 insertions, 11 deletions
diff --git a/compiler/rename/RnBinds.lhs b/compiler/rename/RnBinds.lhs index 80a47a4ff6..3052a314fd 100644 --- a/compiler/rename/RnBinds.lhs +++ b/compiler/rename/RnBinds.lhs @@ -560,8 +560,9 @@ mkSigTvFn sigs where env :: NameEnv [Name] env = mkNameEnv [ (name, map hsLTyVarName ltvs) - | L _ (TypeSig (L _ name) - (L _ (HsForAllTy Explicit ltvs _ _))) <- sigs] + | L _ (TypeSig names + (L _ (HsForAllTy Explicit ltvs _ _))) <- sigs + , (L _ name) <- names] -- Note the pattern-match on "Explicit"; we only bind -- type variables from signatures with an explicit top-level for-all \end{code} @@ -693,16 +694,16 @@ renameSig :: Maybe NameSet -> Sig RdrName -> RnM (Sig Name) -- FixitySig is renamed elsewhere. renameSig _ (IdSig x) = return (IdSig x) -- Actually this never occurs -renameSig mb_names sig@(TypeSig v ty) - = do { new_v <- lookupSigOccRn mb_names sig v - ; new_ty <- rnHsSigType (quotes (ppr v)) ty - ; return (TypeSig new_v new_ty) } +renameSig mb_names sig@(TypeSig vs ty) + = do { new_vs <- mapM (lookupSigOccRn mb_names sig) vs + ; new_ty <- rnHsSigType (quotes (ppr vs)) ty + ; return (TypeSig new_vs new_ty) } -renameSig mb_names sig@(GenericSig v ty) +renameSig mb_names sig@(GenericSig vs ty) = do { defaultSigs_on <- xoptM Opt_DefaultSignatures ; unless defaultSigs_on (addErr (defaultSigErr sig)) - ; new_v <- lookupSigOccRn mb_names sig v - ; new_ty <- rnHsSigType (quotes (ppr v)) ty + ; new_v <- mapM (lookupSigOccRn mb_names sig) vs + ; new_ty <- rnHsSigType (quotes (ppr vs)) ty ; return (GenericSig new_v new_ty) } renameSig _ (SpecInstSig ty) diff --git a/compiler/rename/RnNames.lhs b/compiler/rename/RnNames.lhs index 46058c4677..4c269d904d 100644 --- a/compiler/rename/RnNames.lhs +++ b/compiler/rename/RnNames.lhs @@ -472,7 +472,7 @@ get_local_binders gbl_env (HsGroup {hs_valds = ValBindsIn _ val_sigs, -- In a hs-boot file, the value binders come from the -- *signatures*, and there should be no foreign binders val_bndrs :: [Located RdrName] - val_bndrs | is_hs_boot = [nm | L _ (TypeSig nm _) <- val_sigs] + val_bndrs | is_hs_boot = [n | L _ (TypeSig ns _) <- val_sigs, n <- ns] | otherwise = for_hs_bndrs new_simple :: Located RdrName -> RnM (GenAvailInfo Name) diff --git a/compiler/rename/RnSource.lhs b/compiler/rename/RnSource.lhs index 54dc378dd5..73da1f1d3e 100644 --- a/compiler/rename/RnSource.lhs +++ b/compiler/rename/RnSource.lhs @@ -799,7 +799,7 @@ rnTyClDecl (ClassDecl {tcdCtxt = context, tcdLName = cname, -- Check the signatures -- First process the class op sigs (op_sigs), then the fixity sigs (non_op_sigs). - ; let sig_rdr_names_w_locs = [op | L _ (TypeSig op _) <- sigs] + ; let sig_rdr_names_w_locs = [op | L _ (TypeSig ops _) <- sigs, op <- ops] ; checkDupRdrNames sig_rdr_names_w_locs -- Typechecker is responsible for checking that we only -- give default-method bindings for things in this class. |
