dotnet / dotnet/csharpstandard

Ambiguities in grammar ambiguities

Open
#935 4 comments 0 reactions 1 assignee Claimed by @Nigel-Ecma View on GitHub
type: clarity
Dominant language
C#
Stars
815
Forks
99
Avg merge
1d 14h
Merged PRs (30d)
16

Description

See https://github.com/dotnet/csharpstandard/pull/757#discussion_r1142419702

In 6.2.5, this paragraph can be hard to understand:

> If the following token is among this list, or an identifier in such a context, then the *type_argument_list* is retained as part of the *simple_name*, *member_access* or *pointer_member-access* and any other possible parse of the sequence of tokens is discarded. Otherwise, the *type_argument_list* is not considered to be part of the *simple_name*, *member_access* or *pointer_member_access*, even if there is no other possible parse of the sequence of tokens. (These rules are not applied when parsing a *type_argument_list* in a *namespace_or_type_name* §7.8.)

also See https://github.com/dotnet/csharpstandard/pull/757#discussion_r1326620299

In 12.12, the grammar for relational and type testing operators has some ambiguities related to *`is` type* and *`is` pattern*:

1. A nullable type is allowed for `is type`, but not for `is pattern`.
2. For `is pattern`, the pattern expression must be the same or higher precedence than *shift_expression*.

This was deferred from the C# 7.3 standard.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.