-
Notifications
You must be signed in to change notification settings - Fork 790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warn if function shadows union case #16062
Warn if function shadows union case #16062
Conversation
@dotnet-policy-service agree |
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. |
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. |
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. |
Yep, have pretty much the same thoughts. |
Shall I then close this PR in favor of #16064? |
(Fix for #15559, improve error reporting)
to ProvidedTypes.fs in vs integration tests
I suppose so, I am also in favor of it being off by default |
Closed in favor of #16064 |
Fix for #15559