dotnet / dotnet/csharpstandard
Misleading preprocessor specification with mandatory whitespace.
- Dominant language
- C#
- Stars
- 815
- Forks
- 99
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 16
Description
Following this specification as seen in here: https://github.com/dotnet/csharplang/blob/master/spec/lexical-structure.md
For preprocessor directive it is specified that this is the specification:
```
pp_if_section
: whitespace? '#' whitespace? 'if' whitespace pp_expression pp_new_line conditional_section?
;
```
This must mean that something like:
`#if(ANDROID) && !(WINDOWS)`
Should not be correct as '(' is not defined in whitespace, which is mandatory in the specification:
```
whitespace
: ''
| ''
| ''
| ''
;
```
However this will pass in the .NET compiler.
So it seems like an `: whitespace? '#' whitespace? 'if'` can be followed by a '!', '(' or a whitespace.
Contributor guide
Assessment
This issue has not been assessed yet.