@@ -75,7 +75,7 @@ public CommonConversions(Document document, SemanticModel semanticModel,
7575 foreach ( var name in declarator . Names ) {
7676
7777 var declaredSymbol = SemanticModel . GetDeclaredSymbol ( name ) ;
78- if ( symbolsToSkip ? . Contains ( declaredSymbol ) == true ) continue ;
78+ if ( symbolsToSkip ? . Contains ( declaredSymbol , SymbolEqualityComparer . IncludeNullability ) == true ) continue ;
7979 var declaredSymbolType = declaredSymbol . GetSymbolType ( ) ;
8080 var equalsValueClauseSyntax = await ConvertEqualsValueClauseSyntaxAsync ( declarator , name , vbInitValue , declaredSymbolType , declaredSymbol , initializerOrMethodDecl ) ;
8181 var v = SyntaxFactory . VariableDeclarator ( ConvertIdentifier ( name . Identifier ) , null , equalsValueClauseSyntax ) ;
@@ -107,7 +107,7 @@ public bool ShouldPreferExplicitType(VBSyntax.ExpressionSyntax exp,
107107 exp = op . Syntax as VBSyntax . ExpressionSyntax ;
108108 var vbInitConstantValue = SemanticModel . GetConstantValue ( exp ) ;
109109 isNothingLiteral = vbInitConstantValue . HasValue && vbInitConstantValue . Value == null || exp is VBSyntax . LiteralExpressionSyntax les && les . IsKind ( SyntaxKind . NothingLiteralExpression ) ;
110- bool shouldPreferExplicitType = expConvertedType != null && ( expConvertedType . HasCsKeyword ( ) || ! expConvertedType . Equals ( op . Type ) ) ;
110+ bool shouldPreferExplicitType = expConvertedType != null && ( expConvertedType . HasCsKeyword ( ) || ! expConvertedType . Equals ( op . Type , SymbolEqualityComparer . IncludeNullability ) ) ;
111111 return shouldPreferExplicitType ;
112112 }
113113
@@ -172,7 +172,7 @@ private CSSyntax.VariableDeclarationSyntax CreateVariableDeclaration(VariableDec
172172 CSSyntax . EqualsValueClauseSyntax equalsValueClauseSyntax , IMethodSymbol initSymbol , CSSyntax . VariableDeclaratorSyntax v )
173173 {
174174 var requireExplicitType = requireExplicitTypeForAll ||
175- vbInitializerType != null && ! Equals ( declaredSymbolType , vbInitializerType ) ;
175+ vbInitializerType != null && ! SymbolEqualityComparer . IncludeNullability . Equals ( declaredSymbolType , vbInitializerType ) ;
176176 bool useVar = equalsValueClauseSyntax != null && ! preferExplicitType && ! requireExplicitType ;
177177 var typeSyntax = initSymbol == null || ! initSymbol . IsAnonymousFunction ( )
178178 ? GetTypeSyntax ( declaredSymbolType , useVar )
@@ -267,7 +267,7 @@ public SyntaxToken ConvertIdentifier(SyntaxToken id, bool isAttribute = false, S
267267 text = idSymbol . ContainingType . Name ;
268268 if ( normalizedText . EndsWith ( "Attribute" , StringComparison . OrdinalIgnoreCase ) )
269269 text = text . Remove ( text . Length - "Attribute" . Length ) ;
270- } else if ( idSymbol . IsKind ( SymbolKind . Parameter ) && idSymbol . ContainingSymbol . IsAccessorWithValueInCsharp ( ) && ( ( idSymbol . IsImplicitlyDeclared && idSymbol . Name . WithHalfWidthLatinCharacters ( ) . Equals ( "value" , StringComparison . OrdinalIgnoreCase ) ) || idSymbol . Equals ( idSymbol . ContainingSymbol . GetParameters ( ) . FirstOrDefault ( x => ! x . IsImplicitlyDeclared ) ) ) ) {
270+ } else if ( idSymbol . IsKind ( SymbolKind . Parameter ) && idSymbol . ContainingSymbol . IsAccessorWithValueInCsharp ( ) && ( ( idSymbol . IsImplicitlyDeclared && idSymbol . Name . WithHalfWidthLatinCharacters ( ) . Equals ( "value" , StringComparison . OrdinalIgnoreCase ) ) || idSymbol . Equals ( idSymbol . ContainingSymbol . GetParameters ( ) . FirstOrDefault ( x => ! x . IsImplicitlyDeclared ) , SymbolEqualityComparer . IncludeNullability ) ) ) {
271271 // The case above is basically that if the symbol is a parameter, and the corresponding definition is a property set definition
272272 // AND the first explicitly declared parameter is this symbol, we need to replace it with value.
273273 text = "value" ;
0 commit comments