Update field
keyword breaking change diagnostics
#76031
Labels
Area-Compilers
New Feature - Field Keyword
untriaged
Issues and PRs which have not yet been triaged by a lead
With
-langversion:preview
, the tokenfield
, 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 namedfield
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 namedfield
within the accessor, even thoughfield
will not bind to that variable. (To bind to the variable, use@field
.)We should consider updating the diagnostics to address these issues.
The text was updated successfully, but these errors were encountered: