dotnet / dotnet/csharpstandard
The special names op_Exponent and op_Exponentiation are not reserved for interop.
- Dominant language
- C#
- Stars
- 815
- Forks
- 99
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 16
Description
**Describe the bug**
The special name `op_Exponent` is not reserved for interop, although Roslyn reserves and uses it.
https://github.com/dotnet/roslyn/blob/main/src/Compilers/Core/Portable/Symbols/WellKnownMemberNames.cs
The name is also recognized by System.Linq.Expressions along with `op_Exponentiation`.
It is missing from section §15.3.10.6 "Method names reserved for operators".
- https://github.com/dotnet/csharpstandard/blob/draft-v8/standard/classes.md#153106-method-names-reserved-for-operators
- https://github.com/dotnet/csharpstandard/blob/draft-v9/standard/classes.md#153106-method-names-reserved-for-operators
**Example**
Provide an example that shows the problem in the standard. A small code snippet that should be allowed or disallowed, or code that behaves differently than the standard.
```csharp
void Main()
{
var x = new HasExponent();
var constant = Expression.Constant(x);
var exponent = Expression.Power(constant, constant);
Console.WriteLine(exponent.Method.Name);
}
class HasExponent
{
[SpecialName]
public static HasExponent op_Exponent(HasExponent left, HasExponent right) => new HasExponent();
}
```
**Expected behavior**
What should the standard declare differently?
Include `op_Exponent` as reserved.
**Additional context**
System.Linq.Expressions: https://github.com/dotnet/runtime/blob/main/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/BinaryExpression.cs#L2756
Contributor guide
Assessment
This issue has not been assessed yet.