It seems using nameof makes symbol resolved using type name resolution rules first.
let f (obj: obj) =
nameof obj
In this example obj inside the function is resolved to type, which is unexpected, making local obj value unused:

Without nameof it works as expected:

When there's no matching type to resolve to is found, it also works as expected:

@dsyme @TIHan we'll want to look at this one in the next sprint I think, especially if we can focus on finishing up some design concerns around nameof
But is it really an issue in practice? nameOf works on types as well as identifiers. And obj as variable is still accessible, and the returned string should be "obj" in either case; alternatively one might consider the ambiguity an error, after all, there's no way to know whether the user intended one over the other.
But is it really an issue in practice?
It can be. This is a close to minimal repro which doesn't look too bad on its own indeed. But it clearly shows a different behavior which, together with a more subtle names clash, can make features like Rename refactoring work very wrong.
can make features like Rename refactoring work very wrong.
Didn't think of that, good point.
Thanks for this bug report
Thanks again for this report, I made the appropriate fix and update to the RFC, see https://github.com/fsharp/fslang-design/pull/488
I'll close this report as it is now part of the RFC update at https://github.com/dotnet/fsharp/pull/8754
Most helpful comment
It can be. This is a close to minimal repro which doesn't look too bad on its own indeed. But it clearly shows a different behavior which, together with a more subtle names clash, can make features like Rename refactoring work very wrong.