diff --git a/Packages/com.vrchat.UdonSharp/Editor/Compiler/Binder/BinderSyntaxVisitor.cs b/Packages/com.vrchat.UdonSharp/Editor/Compiler/Binder/BinderSyntaxVisitor.cs index c7204d1c..3d5af66f 100644 --- a/Packages/com.vrchat.UdonSharp/Editor/Compiler/Binder/BinderSyntaxVisitor.cs +++ b/Packages/com.vrchat.UdonSharp/Editor/Compiler/Binder/BinderSyntaxVisitor.cs @@ -42,7 +42,7 @@ public override BoundNode Visit(SyntaxNode node) // Strip unary plus operator if (node.Kind() == SyntaxKind.UnaryPlusExpression) - return Visit((node as PrefixUnaryExpressionSyntax)?.Operand); + return VisitExpression((node as PrefixUnaryExpressionSyntax)?.Operand); Symbol nodeSymbol = GetSymbol(node); if (nodeSymbol is TypeSymbol) diff --git a/Packages/com.vrchat.UdonSharp/Tests~/TestScripts/Core/ArithmeticTest.cs b/Packages/com.vrchat.UdonSharp/Tests~/TestScripts/Core/ArithmeticTest.cs index 669447be..efd03787 100644 --- a/Packages/com.vrchat.UdonSharp/Tests~/TestScripts/Core/ArithmeticTest.cs +++ b/Packages/com.vrchat.UdonSharp/Tests~/TestScripts/Core/ArithmeticTest.cs @@ -34,6 +34,7 @@ public void ExecuteTests() UdonBehaviourFieldCompoundAssignment(); NullEquals(); CastCharToFloat(); + UnaryPlus(); } void IntBinaryOps() @@ -481,5 +482,11 @@ void CastCharToFloat() tester.TestAssertion("Cast char to double", c == 97.0); tester.TestAssertion("Cast char to decimal", c == 97m); } + + void UnaryPlus() + { + int n = 1; + tester.TestAssertion("Strip unary plus operator", +n == 1); + } } } \ No newline at end of file