Skip to content

Less noisy version of -fwarn-name-shadowing

I would like a flag that warns about name-shadowing in more restricted circumstances than the current flag. I.e. I would like examples like these not to produce a warning:

foo x = ..
  where
    bar x = ...
baz z = do
  z <- .... z ...
  return z

But I would like these to produce one:

foo x = ..
  where
    x = ... x ...
baz z = mdo
  z <- .... z ...
  return z

Basically warn when a definition shadows *itself*. My motivation is that code like my first two examples is almost never an error in my experience, but my last two examples almost always are examples of my accidentally building a loop that evaluates to |.

Edited by batterseapower
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information