dotnet / dotnet/csharpstandard

When is a unary operator not a unary operator?

Open
#1,215 0 comments 0 reactions 1 assignee Claimed by @jskeet View on GitHub
type: bug
Dominant language
C#
Stars
815
Forks
99
Avg merge
1d 14h
Merged PRs (30d)
16

Description

#1195 claims that the null-forgiving operator is not a unary operator.

I would like that to not be so, given that it's a (postfix) operator with a single operand, which has always been my understanding of "unary operator".

This may prove to be more controversial than I'd expected.

Note that `unary_expression` and `primary_expression` are *not* up for being changed here - even though `unary_expression` doesn't include all expressions using unary operators.

This bug is for research around how feasible it is to make this consistent without being too disruptive.

Note that `await` already counts as a "unary operator" but can't be overloaded, so "unary operator" doesn't actually mean "overloadable operator with one operand".

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.