Legend:

'''AMG''' I thought this would be the `tcg_ev_binds` field of the `TcGblEnv`, but this seems to be empty by the end of `tcRnModule`. We could also look at the `inert_solved_dicts` field of `InertSet`, but I'm not sure how to propagate the required information out of the `TcS` monad to the `TcM` monad where unused names are reported.

124

125

126

== Deprecated field names ==

127

128

Consider the following:

129

130

{{{

131

module M where

132

{-# DEPRECATED foo "Don't use foo" #-}

133

134

data S = MkS { foo :: Int }

135

data T = MkT { foo :: Int }

136

137

module N where

138

import M

139

140

data U = MkU { foo :: Int }

141

142

goo = foo (MkT 42)

143

bar = foo (MkU 42)

144

baz x = foo x

145

}}}

146

147

The `DEPRECATED` pragma applies to all fields `foo` exported by the module `M`, since it is based on the `OccName`. The renamer will issue a deprecation warning for every use of `foo` in `N`, regardless of whether it will later resolve to one of the fields from `M` (as in `goo`), a field definitely not in `M` (as in `bar`), or a polymorphic field (as in `baz`). It might be possible to delay the warnings to type-checking time and report deprecations more precisely, as for [#Unusedimports unused imports].