-renameSig :: Sig RdrName -> RnM (Sig Name)
--- FixitSig is renamed elsewhere.
-renameSig (TypeSig v ty) = do
- new_v <- lookupLocatedSigOccRn v
- new_ty <- rnHsSigType (quotes (ppr v)) ty
- return (TypeSig new_v new_ty)
-
-renameSig (SpecInstSig ty) = do
- new_ty <- rnLHsType (text "A SPECIALISE instance pragma") ty
- return (SpecInstSig new_ty)
-
-renameSig (SpecSig v ty inl) = do
- new_v <- lookupLocatedSigOccRn v
- new_ty <- rnHsSigType (quotes (ppr v)) ty
- return (SpecSig new_v new_ty inl)
-
-renameSig (InlineSig v s) = do
- new_v <- lookupLocatedSigOccRn v
- return (InlineSig new_v s)
-
-renameSig (FixSig (FixitySig v f)) = do
- new_v <- lookupLocatedSigOccRn v
- return (FixSig (FixitySig new_v f))
+renameSig :: Maybe NameSet -> Sig RdrName -> RnM (Sig Name)
+-- FixitySig is renamed elsewhere.
+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 _ (SpecInstSig ty)
+ = do { new_ty <- rnLHsType (text "A SPECIALISE instance pragma") ty
+ ; return (SpecInstSig new_ty) }
+
+renameSig mb_names sig@(SpecSig v ty inl)
+ = do { new_v <- lookupSigOccRn mb_names sig v
+ ; new_ty <- rnHsSigType (quotes (ppr v)) ty
+ ; return (SpecSig new_v new_ty inl) }
+
+renameSig mb_names sig@(InlineSig v s)
+ = do { new_v <- lookupSigOccRn mb_names sig v
+ ; return (InlineSig new_v s) }
+
+renameSig mb_names sig@(FixSig (FixitySig v f))
+ = do { new_v <- lookupSigOccRn mb_names sig v
+ ; return (FixSig (FixitySig new_v f)) }