1010using System . Diagnostics ;
1111using System . Linq ;
1212using Microsoft . CodeAnalysis . Shared . Extensions ;
13- using Roslyn . Utilities ;
1413
1514namespace Microsoft . CodeAnalysis . Shared . Utilities ;
1615
@@ -153,15 +152,15 @@ private bool AssembliesAreEquivalent(IAssemblySymbol x, IAssemblySymbol y)
153152 private bool FieldsAreEquivalent ( IFieldSymbol x , IFieldSymbol y , Dictionary < INamedTypeSymbol , INamedTypeSymbol > ? equivalentTypesWithDifferingAssemblies )
154153 {
155154 return
156- x . Name == y . Name &&
155+ x . MetadataName == y . MetadataName &&
157156 AreEquivalent ( x . CustomModifiers , y . CustomModifiers , equivalentTypesWithDifferingAssemblies ) &&
158157 AreEquivalent ( x . ContainingSymbol , y . ContainingSymbol , equivalentTypesWithDifferingAssemblies ) ;
159158 }
160159
161160 private static bool LabelsAreEquivalent ( ILabelSymbol x , ILabelSymbol y )
162161 {
163162 return
164- x . Name == y . Name &&
163+ x . MetadataName == y . MetadataName &&
165164 HaveSameLocation ( x , y ) ;
166165 }
167166
@@ -208,7 +207,7 @@ private bool MethodsAreEquivalent(IMethodSymbol x, IMethodSymbol y, Dictionary<I
208207 IsConstructedFromSelf ( x ) != IsConstructedFromSelf ( y ) ||
209208 x . Arity != y . Arity ||
210209 x . Parameters . Length != y . Parameters . Length ||
211- x . Name != y . Name )
210+ x . MetadataName != y . MetadataName )
212211 {
213212 return false ;
214213 }
@@ -277,7 +276,7 @@ private static bool HaveSameLocation(ISymbol x, ISymbol y)
277276 }
278277
279278 private bool ModulesAreEquivalent ( IModuleSymbol x , IModuleSymbol y )
280- => AssembliesAreEquivalent ( x . ContainingAssembly , y . ContainingAssembly ) && x . Name == y . Name ;
279+ => AssembliesAreEquivalent ( x . ContainingAssembly , y . ContainingAssembly ) && x . MetadataName == y . MetadataName ;
281280
282281 private bool NamedTypesAreEquivalent ( INamedTypeSymbol x , INamedTypeSymbol y , Dictionary < INamedTypeSymbol , INamedTypeSymbol > ? equivalentTypesWithDifferingAssemblies )
283282 {
@@ -357,8 +356,7 @@ private bool HandleNamedTypesWorker(INamedTypeSymbol x, INamedTypeSymbol y, Dict
357356 return true ;
358357
359358 if ( IsConstructedFromSelf ( x ) != IsConstructedFromSelf ( y ) ||
360- x . Arity != y . Arity ||
361- x . Name != y . Name ||
359+ x . MetadataName != y . MetadataName ||
362360 x . IsAnonymousType != y . IsAnonymousType ||
363361 x . IsUnboundGenericType != y . IsUnboundGenericType ||
364362 ! NullableAnnotationsEquivalent ( x , y ) )
@@ -375,12 +373,12 @@ x.ContainingSymbol is INamespaceSymbol xNamespace &&
375373 // For error types, we just ensure that the containing namespaces are equivalent up to the root.
376374 while ( true )
377375 {
378- if ( xNamespace . Name != yNamespace . Name )
376+ if ( xNamespace . MetadataName != yNamespace . MetadataName )
379377 return false ;
380378
381379 // Error namespaces don't set the IsGlobalNamespace bit unfortunately. So we just do the
382380 // nominal check to see if we've actually hit the root.
383- if ( xNamespace . Name == "" )
381+ if ( xNamespace . MetadataName == "" )
384382 break ;
385383
386384 xNamespace = xNamespace . ContainingNamespace ;
@@ -398,7 +396,7 @@ x.ContainingSymbol is INamespaceSymbol xNamespace &&
398396 if ( equivalentTypesWithDifferingAssemblies != null &&
399397 x . ContainingType == null &&
400398 x . ContainingAssembly != null &&
401- ! AssemblyIdentityComparer . SimpleNameComparer . Equals ( x . ContainingAssembly . Name , y . ContainingAssembly . Name ) &&
399+ ! AssemblyIdentityComparer . SimpleNameComparer . Equals ( x . ContainingAssembly . MetadataName , y . ContainingAssembly . MetadataName ) &&
402400 ! equivalentTypesWithDifferingAssemblies . ContainsKey ( x ) )
403401 {
404402 equivalentTypesWithDifferingAssemblies . Add ( x , y ) ;
@@ -434,7 +432,7 @@ private bool HandleTupleTypes(INamedTypeSymbol x, INamedTypeSymbol y, Dictionary
434432 {
435433 var xElement = xElements [ i ] ;
436434 var yElement = yElements [ i ] ;
437- if ( xElement . Name != yElement . Name )
435+ if ( xElement . MetadataName != yElement . MetadataName )
438436 return false ;
439437 }
440438 }
@@ -534,7 +532,7 @@ private bool HandleAnonymousTypes(INamedTypeSymbol x, INamedTypeSymbol y, Dictio
534532 var p1 = xMembersEnumerator . Current ;
535533 var p2 = yMembersEnumerator . Current ;
536534
537- if ( p1 . Name != p2 . Name ||
535+ if ( p1 . MetadataName != p2 . MetadataName ||
538536 p1 . IsReadOnly != p2 . IsReadOnly ||
539537 ! AreEquivalent ( p1 . Type , p2 . Type , equivalentTypesWithDifferingAssemblies ) )
540538 {
@@ -549,7 +547,7 @@ private bool HandleAnonymousTypes(INamedTypeSymbol x, INamedTypeSymbol y, Dictio
549547 private bool NamespacesAreEquivalent ( INamespaceSymbol x , INamespaceSymbol y , Dictionary < INamedTypeSymbol , INamedTypeSymbol > ? equivalentTypesWithDifferingAssemblies )
550548 {
551549 if ( x . IsGlobalNamespace != y . IsGlobalNamespace ||
552- x . Name != y . Name )
550+ x . MetadataName != y . MetadataName )
553551 {
554552 return false ;
555553 }
@@ -567,7 +565,7 @@ private bool ParametersAreEquivalent(IParameterSymbol x, IParameterSymbol y, Dic
567565 {
568566 return
569567 x . IsRefOrOut ( ) == y . IsRefOrOut ( ) &&
570- x . Name == y . Name &&
568+ x . MetadataName == y . MetadataName &&
571569 AreEquivalent ( x . CustomModifiers , y . CustomModifiers , equivalentTypesWithDifferingAssemblies ) &&
572570 AreEquivalent ( x . Type , y . Type , equivalentTypesWithDifferingAssemblies ) &&
573571 AreEquivalent ( x . ContainingSymbol , y . ContainingSymbol , equivalentTypesWithDifferingAssemblies ) ;
@@ -610,7 +608,7 @@ private bool PropertiesAreEquivalent(IPropertySymbol x, IPropertySymbol y, Dicti
610608 private bool EventsAreEquivalent ( IEventSymbol x , IEventSymbol y , Dictionary < INamedTypeSymbol , INamedTypeSymbol > ? equivalentTypesWithDifferingAssemblies )
611609 {
612610 return
613- x . Name == y . Name &&
611+ x . MetadataName == y . MetadataName &&
614612 IsPartialEventDefinitionPart ( x ) == IsPartialEventDefinitionPart ( y ) &&
615613 IsPartialEventImplementationPart ( x ) == IsPartialEventImplementationPart ( y ) &&
616614 AreEquivalent ( x . ContainingSymbol , y . ContainingSymbol , equivalentTypesWithDifferingAssemblies ) ;
@@ -660,6 +658,6 @@ private static bool RangeVariablesAreEquivalent(IRangeVariableSymbol x, IRangeVa
660658 => HaveSameLocation ( x , y ) ;
661659
662660 private static bool PreprocessingSymbolsAreEquivalent ( IPreprocessingSymbol x , IPreprocessingSymbol y )
663- => x . Name == y . Name ;
661+ => x . MetadataName == y . MetadataName ;
664662 }
665663}
0 commit comments