Don't warn FS3559 when obj is inferred if the obj is expected there
Open
Area-Diagnostics
Bug
help wanted
Impact-Low
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 131
Description
The new FS3559 triggers where I think it should not. Consider this:
```f#
let foo (x: obj) = ()
foo null
```
It triggers on `null`:
> A type has been implicitly inferred as 'obj', which may be unintended. Consider adding explicit type annotations. You can disable this warning by using '#nowarn "3559"' or '--nowarn:3559'.
But the type of the argument is explicitly `obj`, so it doesn't make sense that it should trigger here.
Another slightly more realistic example:
```f#
let invokeStatic (mi: System.Reflection.MethodInfo) =
mi.Invoke(null, [||])
```
`MethodInfo.Invoke` expects `obj` as its first argument, so F# inferring `obj` here should not cause a warning.
Contributor guide
Assessment
This issue has not been assessed yet.