-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Description
With -langversion:preview, the token field, when used as a primary expression in a property accessor, binds to the synthesized backing field for the property. That is a breaking change when there is another symbol in scope named field that the compiler would have bound to with earlier language versions. The compiler reports a warning in -langversion:preview for those cases.
A couple of issues have been reported regarding the current warning:
-
The warning does not match the Breaking change warnings proposal. In that proposal, warnings are reported in earlier language versions that the behavior will change rather than warning in later language versions that behavior has changed.
-
The warning is reported for a reference to
field, but not for a declaration of a local or parameter namedfieldwithin the accessor, even thoughfieldwill not bind to that variable. (To bind to the variable, use@field.)
We should consider updating the diagnostics to address these issues.