From 229158665939f66550e26e102bb22d69fa261eb9 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Fri, 28 Aug 2026 22:45:10 +0200 Subject: [PATCH 1/7] Classify C# 14 user-defined compound assignment operators in the type system C# 14 lets a type declare "void operator +=(T)" and friends: void-returning instance methods under the op_*Assignment metadata names. Only that exact shape becomes SymbolKind.Operator, and only while the new setting is on, because other languages use the same names for unrelated methods: F# mangles "static member (+=)" to a static, value-returning op_AdditionAssignment, and C++/CLI emits value-returning instance operators. Those, and every method when the setting is off, stay plain methods with a surfaced [SpecialName]. Assisted-by: Claude:claude-opus-5:Claude Code --- .../ICSharpCode.Decompiler.Tests.csproj | 2 + ...nedCompoundAssignmentOperators.Expected.cs | 49 +++++++++++++++ ...oUserDefinedCompoundAssignmentOperators.cs | 60 ++++++++++++++++++ .../UglyTestRunner.cs | 8 +++ .../Syntax/TypeMembers/OperatorDeclaration.cs | 62 ++++++++++++++++++- ICSharpCode.Decompiler/DecompilerSettings.cs | 7 +++ .../TypeSystem/DecompilerTypeSystem.cs | 11 +++- .../Implementation/AttributeListBuilder.cs | 1 + .../Implementation/MetadataMethod.cs | 57 ++++++++++++++++- ILSpy/Properties/Resources.resx | 3 + 10 files changed, 254 insertions(+), 6 deletions(-) create mode 100644 ICSharpCode.Decompiler.Tests/TestCases/Ugly/NoUserDefinedCompoundAssignmentOperators.Expected.cs create mode 100644 ICSharpCode.Decompiler.Tests/TestCases/Ugly/NoUserDefinedCompoundAssignmentOperators.cs diff --git a/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj b/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj index 714454f75b..af25b88276 100644 --- a/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj +++ b/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj @@ -280,6 +280,8 @@ + +