@@ -72,7 +72,7 @@ public RequiredType GetObjectEqualityType(VBSyntax.BinaryExpressionSyntax node,
7272
7373
7474
75- public ( ExpressionSyntax lhs , ExpressionSyntax rhs ) VbCoerceToString ( VBSyntax . ExpressionSyntax vbLeft , ExpressionSyntax csLeft , TypeInfo lhsTypeInfo , VBSyntax . ExpressionSyntax vbRight , ExpressionSyntax csRight , TypeInfo rhsTypeInfo )
75+ public ( ExpressionSyntax lhs , ExpressionSyntax rhs ) VbCoerceToNonNullString ( VBSyntax . ExpressionSyntax vbLeft , ExpressionSyntax csLeft , TypeInfo lhsTypeInfo , VBSyntax . ExpressionSyntax vbRight , ExpressionSyntax csRight , TypeInfo rhsTypeInfo )
7676 {
7777 if ( IsNonEmptyStringLiteral ( vbLeft ) || IsNonEmptyStringLiteral ( vbRight ) ) {
7878 return ( csLeft , csRight ) ;
@@ -206,7 +206,7 @@ private static ExpressionSyntax NegateIfNeeded(VBSyntax.BinaryExpressionSyntax n
206206 {
207207 if ( OptionCompareTextCaseInsensitive ) {
208208 ExtraUsingDirectives . Add ( "System.Globalization" ) ;
209- ( csLeft , csRight ) = ( VbCoerceToString ( csLeft , lhsTypeInfo ) , VbCoerceToString ( csRight , rhsTypeInfo ) ) ;
209+ ( csLeft , csRight ) = VbCoerceToNonNullString ( vbLeft , csLeft , lhsTypeInfo , vbLeft , csRight , rhsTypeInfo ) ;
210210 var compareOptions = SyntaxFactory . Argument ( GetCompareTextCaseInsensitiveCompareOptions ( ) ) ;
211211 var compareString = SyntaxFactory . InvocationExpression ( ValidSyntaxFactory . MemberAccess ( nameof ( CultureInfo ) , nameof ( CultureInfo . CurrentCulture ) ,
212212 nameof ( CultureInfo . CompareInfo ) , nameof ( CompareInfo . Compare ) ) ,
@@ -217,7 +217,7 @@ private static ExpressionSyntax NegateIfNeeded(VBSyntax.BinaryExpressionSyntax n
217217 csRight = SyntaxFactory . LiteralExpression ( SyntaxKind . NumericLiteralExpression ,
218218 SyntaxFactory . Literal ( 0 ) ) ;
219219 } else {
220- ( csLeft , csRight ) = VbCoerceToString ( vbLeft , csLeft , lhsTypeInfo , vbRight , csRight , rhsTypeInfo ) ;
220+ ( csLeft , csRight ) = VbCoerceToNonNullString ( vbLeft , csLeft , lhsTypeInfo , vbRight , csRight , rhsTypeInfo ) ;
221221 }
222222
223223 return ( csLeft , csRight ) ;
0 commit comments