dotnet / dotnet/csharpstandard
Perhaps `value` should not be a contextual keyword
- Dominant language
- C#
- Stars
- 815
- Forks
- 99
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 16
Description
**Describe the bug**
§6.4.4 (Keywords) says
> A ***contextual keyword*** is an identifier-like sequence of characters that has special meaning in certain contexts, but is not reserved, and can be used as an identifier outside of those contexts as well as when prefaced by the `@` character.
and lists `value` in the *contextual_keyword* grammar rule. However, `value` is reserved as a parameter name in `set`, `init`, `add`, and `remove` accessors no matter whether it is spelled `value` or `@value`. This seems to mean it is an implicitly-declared identifier, rather than a contextual keyword.
**Example**
```csharp
class C {
int P {
set {
_ = @value;
}
}
}
```
If the special treatment of `value` were only for a contextual keyword, then it would not apply to `@value`, and this snippet would be an error.
**Expected behavior**
Remove `value` from the list of contextual keywords.
**Additional context**
None.
Contributor guide
Assessment
This issue has not been assessed yet.