diff --git a/Src/CSharpier.Tests/TestFiles/IsPatternExpression/IsPatternExpressions.cst b/Src/CSharpier.Tests/TestFiles/IsPatternExpression/IsPatternExpressions.cst index 28c8ed62d..d91660f01 100644 --- a/Src/CSharpier.Tests/TestFiles/IsPatternExpression/IsPatternExpressions.cst +++ b/Src/CSharpier.Tests/TestFiles/IsPatternExpression/IsPatternExpressions.cst @@ -13,8 +13,9 @@ class ClassName } if ( - MethodKind is not (MethodKind.Ordinary - or MethodKind.LocalFunction) + MethodKind + is not (MethodKind.Ordinary + or MethodKind.LocalFunction) ) { return; } @@ -32,10 +33,19 @@ class ClassName } var useLine = - node.OperatorToken.Kind() is SyntaxKind.BarBarToken - or SyntaxKind.BarToken - or SyntaxKind.AmpersandAmpersandToken - or SyntaxKind.AmpersandToken - or SyntaxKind.PlusToken; + node.OperatorToken.Kind() + is SyntaxKind.BarBarToken + or SyntaxKind.BarToken + or SyntaxKind.AmpersandAmpersandToken + or SyntaxKind.AmpersandToken + or SyntaxKind.PlusToken; + + if ( + Nullable.GetUnderlyingType111111111111111(typeof(T)) + is Type innerType + && innerType.IsEnum + ) { + return; + } } } diff --git a/Src/CSharpier/Printer/IsPatternExpressionSyntax.cs b/Src/CSharpier/Printer/IsPatternExpressionSyntax.cs index fd7af8ada..b42ce3858 100644 --- a/Src/CSharpier/Printer/IsPatternExpressionSyntax.cs +++ b/Src/CSharpier/Printer/IsPatternExpressionSyntax.cs @@ -1,4 +1,5 @@ using CSharpier.DocTypes; +using CSharpier.SyntaxPrinter; using Microsoft.CodeAnalysis.CSharp.Syntax; namespace CSharpier @@ -9,13 +10,12 @@ private Doc PrintIsPatternExpressionSyntax( IsPatternExpressionSyntax node ) { return Doc.Concat( - this.Print(node.Expression), - " ", - this.PrintSyntaxToken( - node.IsKeyword, - afterTokenIfNoTrailing: " " - ), - Doc.Indent(this.Print(node.Pattern)) + Node.Print(node.Expression), + Doc.Indent( + Doc.Line, + Token.PrintWithSuffix(node.IsKeyword, " "), + Doc.Indent(this.Print(node.Pattern)) + ) ); } }