protected override void GenerateInner(CodeGenerator generator) { generator.Write(TokenType.Punctuation, '('); TargetType.Generate(generator); generator.Write(TokenType.Punctuation, ')'); bool parenthesized = Expression.Precedence > PrecedenceGroup.Unary; // CS0075: To cast a negative value, you must enclose the value in parentheses if (!parenthesized && Expression is CodePrimitiveExpression primitive && primitive.Value != null && primitive.Value.GetType().IsNumeric()) { if (Convert.ToDouble(primitive.Value) < 0) { parenthesized = true; } } if (parenthesized) { generator.Write(TokenType.Punctuation, '('); } Expression.Generate(generator); if (parenthesized) { generator.Write(TokenType.Punctuation, ')'); } }