@@ -75,7 +75,7 @@ public CommonConversions(Document document, SemanticModel semanticModel,
75
75
foreach ( var name in declarator . Names ) {
76
76
77
77
var declaredSymbol = SemanticModel . GetDeclaredSymbol ( name ) ;
78
- if ( symbolsToSkip ? . Contains ( declaredSymbol ) == true ) continue ;
78
+ if ( symbolsToSkip ? . Contains ( declaredSymbol , SymbolEqualityComparer . IncludeNullability ) == true ) continue ;
79
79
var declaredSymbolType = declaredSymbol . GetSymbolType ( ) ;
80
80
var equalsValueClauseSyntax = await ConvertEqualsValueClauseSyntaxAsync ( declarator , name , vbInitValue , declaredSymbolType , declaredSymbol , initializerOrMethodDecl ) ;
81
81
var v = SyntaxFactory . VariableDeclarator ( ConvertIdentifier ( name . Identifier ) , null , equalsValueClauseSyntax ) ;
@@ -107,7 +107,7 @@ public bool ShouldPreferExplicitType(VBSyntax.ExpressionSyntax exp,
107
107
exp = op . Syntax as VBSyntax . ExpressionSyntax ;
108
108
var vbInitConstantValue = SemanticModel . GetConstantValue ( exp ) ;
109
109
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 ) ) ;
111
111
return shouldPreferExplicitType ;
112
112
}
113
113
@@ -172,7 +172,7 @@ private CSSyntax.VariableDeclarationSyntax CreateVariableDeclaration(VariableDec
172
172
CSSyntax . EqualsValueClauseSyntax equalsValueClauseSyntax , IMethodSymbol initSymbol , CSSyntax . VariableDeclaratorSyntax v )
173
173
{
174
174
var requireExplicitType = requireExplicitTypeForAll ||
175
- vbInitializerType != null && ! Equals ( declaredSymbolType , vbInitializerType ) ;
175
+ vbInitializerType != null && ! SymbolEqualityComparer . IncludeNullability . Equals ( declaredSymbolType , vbInitializerType ) ;
176
176
bool useVar = equalsValueClauseSyntax != null && ! preferExplicitType && ! requireExplicitType ;
177
177
var typeSyntax = initSymbol == null || ! initSymbol . IsAnonymousFunction ( )
178
178
? GetTypeSyntax ( declaredSymbolType , useVar )
@@ -267,7 +267,7 @@ public SyntaxToken ConvertIdentifier(SyntaxToken id, bool isAttribute = false, S
267
267
text = idSymbol . ContainingType . Name ;
268
268
if ( normalizedText . EndsWith ( "Attribute" , StringComparison . OrdinalIgnoreCase ) )
269
269
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 ) ) ) {
271
271
// The case above is basically that if the symbol is a parameter, and the corresponding definition is a property set definition
272
272
// AND the first explicitly declared parameter is this symbol, we need to replace it with value.
273
273
text = "value" ;
0 commit comments