Uh oh!
There was an error while loading. Please reload this page.
Warn if function shadows union case - #16062
Conversation
Martin521
commented
Sep 29, 2023
@dotnet-policy-service agree |
vzarytovskii
commented
Sep 29, 2023
Since it's a potentially quite common case (shadowing in general, and this case in particular), I personally don't think it should be an on-by-default warning even if guarded by language version, since it can break a lot of builds out of the blue. I think instead, we should have a set of warnings which we can suggest to help people avoid dubious code (this warning included). Thoughts @T-Gro@KevinRansom @dotnet/fsharp-team-msft It might be a me thing, will be happy to be proven wrong. |
Martin521
commented
Sep 29, 2023
Yes, tbh I did not expect any intentional shadowing of this particular type, but then found 3 in the compiler code base. All sort of weird though. |
vzarytovskii
commented
Sep 30, 2023
I still think it shouldn't be warning which is on by default, even for next version. Many if not majority of F# projects treat warnings as errors, this will mean that people will get compilation errors just by updating SDK, we try to avoid it as much as possible. Will wait for others' opinions though. |
My gut feeling is that the warning by default rubs against the shadowing idioms. I'd personally prefer it is a non default warning. edit: the shadowing can be intentional, and it is generally possible to access the union case by using the type qualifier. |
vzarytovskii
commented
Oct 1, 2023
Yep, have pretty much the same thoughts. |
Martin521
commented
Oct 1, 2023
Shall I then close this PR in favor of #16064? |
(Fix for #15559, improve error reporting)
to ProvidedTypes.fs in vs integration tests
abonie
commented
Oct 5, 2023
I suppose so, I am also in favor of it being off by default |
Martin521
commented
Oct 5, 2023
Closed in favor of #16064 |
Fix for #15559