diff --git a/src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs b/src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs index 22d405e6f7..4c704adbaf 100644 --- a/src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs +++ b/src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs @@ -820,6 +820,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter } else { switch (operatorDeclaration.OverloadableOperator) { case OverloadableOperatorType.Add: + case OverloadableOperatorType.UnaryPlus: outputFormatter.PrintToken(Tokens.Plus); break; case OverloadableOperatorType.BitNot: @@ -893,6 +894,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.PrintToken(Tokens.GreaterThan); outputFormatter.PrintToken(Tokens.GreaterThan); break; + case OverloadableOperatorType.UnaryMinus: case OverloadableOperatorType.Subtract: outputFormatter.PrintToken(Tokens.Minus); break; diff --git a/src/Libraries/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetOutputVisitor.cs b/src/Libraries/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetOutputVisitor.cs index a1b5d5013a..c21847984f 100644 --- a/src/Libraries/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetOutputVisitor.cs +++ b/src/Libraries/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetOutputVisitor.cs @@ -1071,8 +1071,10 @@ namespace ICSharpCode.NRefactory.PrettyPrinter switch(operatorDeclaration.OverloadableOperator) { case OverloadableOperatorType.Add: + case OverloadableOperatorType.UnaryPlus: op = Tokens.Plus; break; + case OverloadableOperatorType.UnaryMinus: case OverloadableOperatorType.Subtract: op = Tokens.Minus; break; diff --git a/src/Libraries/NRefactory/Test/Output/CSharp/CSharpOutputTest.cs b/src/Libraries/NRefactory/Test/Output/CSharp/CSharpOutputTest.cs index 508f38ff3f..8aaef637d5 100644 --- a/src/Libraries/NRefactory/Test/Output/CSharp/CSharpOutputTest.cs +++ b/src/Libraries/NRefactory/Test/Output/CSharp/CSharpOutputTest.cs @@ -541,6 +541,15 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter TestTypeMember("public static TheBug operator >>(TheBug bugNode, int b)\n{\n}"); } + [Test] + public void OverloadedUnaryOperators() + { + TestTypeMember("public static TheBug operator +(TheBug bugNode)\n{\n}"); + TestTypeMember("public static TheBug operator -(TheBug bugNode)\n{\n}"); + TestTypeMember("public static TheBug operator ~(TheBug bugNode)\n{\n}"); + TestTypeMember("public static TheBug operator !(TheBug bugNode)\n{\n}"); + } + [Test] public void PropertyWithAccessorAccessModifiers() { diff --git a/src/Main/StartUp/Project/Resources/BitmapResources.resources b/src/Main/StartUp/Project/Resources/BitmapResources.resources index 841b74faec..d6ebebbdd4 100644 Binary files a/src/Main/StartUp/Project/Resources/BitmapResources.resources and b/src/Main/StartUp/Project/Resources/BitmapResources.resources differ