dotnet / dotnet/dotnet-api-docs

Checked operator definitions don't use `operator` syntax

Open
#8,383 3 comments 0 reactions 0 assignees View on GitHub
area-Infrastructure Pri3 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

As the title says, checked operator method definitions don't use the `operator` syntax. Instead they use the CLR function names of `op_CheckedABC`. For example, [`Int128.op_CheckedIncrement` shows the definition as just that](https://docs.microsoft.com/en-us/dotnet/api/system.int128.op_checkedincrement?view=net-7.0):

```cs
public static Int128 op_CheckedIncrement (Int128 value);
```

![An image of MSDN showing the definition in the code block above](https://user-images.githubusercontent.com/11381599/190005396-a75d2d53-bca9-4b06-bce3-54cb89f0cbfe.png)

They should be using the new ["checked operator"](https://github.com/dotnet/csharplang/blob/main/proposals/checked-user-defined-operators.md) syntax. For `Int128.op_CheckedIncrement`, this would result in the following function definition:

```cs
public static Int128 operator checked ++ (Int128 value);
```

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.