1 instantiation of ReferenceEqualityComparer
Microsoft.CodeAnalysis (1)
InternalUtilities\ReferenceEqualityComparer.cs (1)
15public static readonly ReferenceEqualityComparer Instance = new();
147 references to ReferenceEqualityComparer
Microsoft.CodeAnalysis (51)
CodeGen\ILBuilder.cs (2)
17using ReferenceEqualityComparer = Roslyn.Utilities.ReferenceEqualityComparer; 81_labelInfos = new SmallDictionary<object, LabelInfo>(ReferenceEqualityComparer.Instance);
CodeGen\ItemTokenMap.cs (2)
9using ReferenceEqualityComparer = Roslyn.Utilities.ReferenceEqualityComparer; 22private readonly ConcurrentDictionary<T, uint> _itemToToken = new ConcurrentDictionary<T, uint>(ReferenceEqualityComparer.Instance);
CodeGen\LocalSlotManager.cs (2)
14using ReferenceEqualityComparer = Roslyn.Utilities.ReferenceEqualityComparer; 97map = new Dictionary<ILocalSymbolInternal, LocalDefinition>(ReferenceEqualityComparer.Instance);
Compilation\Compilation.cs (4)
31using ReferenceEqualityComparer = Roslyn.Utilities.ReferenceEqualityComparer; 1209ref _getTypeCache, static () => new ConcurrentCache<string, INamedTypeSymbol?>(50, ReferenceEqualityComparer.Instance)); 1240ref _getTypesCache, static () => new ConcurrentCache<string, ImmutableArray<INamedTypeSymbol>>(50, ReferenceEqualityComparer.Instance)); 1248|| Enumerable.SequenceEqual(addedArray, val, ReferenceEqualityComparer.Instance));
DiagnosticAnalyzer\AnalyzerDriver.cs (2)
22using ReferenceEqualityComparer = Roslyn.Utilities.ReferenceEqualityComparer; 382_diagnosticsProcessedForProgrammaticSuppressions = HasDiagnosticSuppressors ? new ConcurrentSet<Diagnostic>(ReferenceEqualityComparer.Instance) : null;
DiagnosticAnalyzer\AnalyzerManager.AnalyzerExecutionContext.cs (1)
25private static ImmutableDictionary<LocalizableString, Exception?> s_localizableStringToException = ImmutableDictionary<LocalizableString, Exception?>.Empty.WithComparers(Roslyn.Utilities.ReferenceEqualityComparer.Instance);
Emit\CommonPEModuleBuilder.cs (3)
19using ReferenceEqualityComparer = Roslyn.Utilities.ReferenceEqualityComparer; 66_methodBodyMap = new ConcurrentDictionary<IMethodSymbolInternal, Cci.IMethodBody>(ReferenceEqualityComparer.Instance); 869new ConcurrentDictionary<TNamedTypeSymbol, SynthesizedDefinitions>(ReferenceEqualityComparer.Instance);
Emit\EditAndContinue\DeltaMetadataWriter.cs (7)
21using ReferenceEqualityComparer = Roslyn.Utilities.ReferenceEqualityComparer; 103_deletedTypeMembers = new Dictionary<ITypeDefinition, ImmutableArray<IMethodDefinition>>(ReferenceEqualityComparer.Instance); 121_existingParameterDefs = new Dictionary<IParameterDefinition, int>(ReferenceEqualityComparer.Instance); 497var result = new Dictionary<ITypeDefinition, ArrayBuilder<IMethodDefinition>>(ReferenceEqualityComparer.Instance); 498var typesUsedByDeletedMembers = new Dictionary<ITypeDefinition, DeletedSourceTypeDefinition>(ReferenceEqualityComparer.Instance); 1543: base(lastRowId, ReferenceEqualityComparer.Instance) 1727: base(lastRowId, ReferenceEqualityComparer.Instance)
Emit\NoPia\EmbeddedTypesManager.cs (6)
15using ReferenceEqualityComparer = Roslyn.Utilities.ReferenceEqualityComparer; 70public readonly ConcurrentDictionary<TNamedTypeSymbol, TEmbeddedType> EmbeddedTypesMap = new ConcurrentDictionary<TNamedTypeSymbol, TEmbeddedType>(ReferenceEqualityComparer.Instance); 71public readonly ConcurrentDictionary<TFieldSymbol, TEmbeddedField> EmbeddedFieldsMap = new ConcurrentDictionary<TFieldSymbol, TEmbeddedField>(ReferenceEqualityComparer.Instance); 72public readonly ConcurrentDictionary<TMethodSymbol, TEmbeddedMethod> EmbeddedMethodsMap = new ConcurrentDictionary<TMethodSymbol, TEmbeddedMethod>(ReferenceEqualityComparer.Instance); 73public readonly ConcurrentDictionary<TPropertySymbol, TEmbeddedProperty> EmbeddedPropertiesMap = new ConcurrentDictionary<TPropertySymbol, TEmbeddedProperty>(ReferenceEqualityComparer.Instance); 74public readonly ConcurrentDictionary<TEventSymbol, TEmbeddedEvent> EmbeddedEventsMap = new ConcurrentDictionary<TEventSymbol, TEmbeddedEvent>(ReferenceEqualityComparer.Instance);
InternalUtilities\ReferenceEqualityComparer.cs (2)
15public static readonly ReferenceEqualityComparer Instance = new(); 28return ReferenceEqualityComparer.GetHashCode(a);
MetadataReference\AssemblyIdentity.DisplayName.cs (1)
175new ConcurrentCache<string, (AssemblyIdentity? identity, AssemblyIdentityParts parts)>(1024, ReferenceEqualityComparer.Instance);
NativePdbWriter\PdbWriter.cs (2)
22using ReferenceEqualityComparer = Roslyn.Utilities.ReferenceEqualityComparer; 50_qualifiedNameCache = new Dictionary<object, string>(ReferenceEqualityComparer.Instance);
PEWriter\FullMetadataWriter.cs (5)
14using ReferenceEqualityComparer = Roslyn.Utilities.ReferenceEqualityComparer; 101_fieldDefIndex = new Dictionary<ITypeDefinition, int>(numTypeDefsGuess, ReferenceEqualityComparer.Instance); 102_methodDefIndex = new Dictionary<ITypeDefinition, int>(numTypeDefsGuess, ReferenceEqualityComparer.Instance); 103_parameterListIndex = new SegmentedDictionary<IMethodDefinition, int>(numMethods, ReferenceEqualityComparer.Instance); 437_index = new SegmentedDictionary<T, int>(capacity, ReferenceEqualityComparer.Instance);
PEWriter\MetadataWriter.cs (7)
35using ReferenceEqualityComparer = Roslyn.Utilities.ReferenceEqualityComparer; 114_signatureIndex = new Dictionary<ISignature, KeyValuePair<BlobHandle, ImmutableArray<byte>>>(module.HintNumberOfMethodDefinitions, ReferenceEqualityComparer.Instance); //ignores field signatures 440private readonly Dictionary<ITypeReference, BlobHandle> _typeSpecSignatureIndex = new Dictionary<ITypeReference, BlobHandle>(ReferenceEqualityComparer.Instance); 443private readonly Dictionary<IFieldReference, BlobHandle> _fieldSignatureIndex = new Dictionary<IFieldReference, BlobHandle>(ReferenceEqualityComparer.Instance); 450private readonly Dictionary<IGenericMethodInstanceReference, BlobHandle> _methodInstanceSignatureIndex = new Dictionary<IGenericMethodInstanceReference, BlobHandle>(ReferenceEqualityComparer.Instance); 4274: this(writer, new Dictionary<ITypeReference, int>(ReferenceEqualityComparer.Instance), lastRowId) 4304_instanceIndex = new Dictionary<T, int>(ReferenceEqualityComparer.Instance);
SourceGeneration\IncrementalContexts.cs (2)
16using ReferenceEqualityComparer = Roslyn.Utilities.ReferenceEqualityComparer; 57.WithComparer(ReferenceEqualityComparer.Instance)
SourceGeneration\Nodes\PredicateSyntaxStrategy.cs (1)
88if (state != EntryState.Modified || !_filterTable.TryModifyEntries(nodes, Roslyn.Utilities.ReferenceEqualityComparer.Instance, stopwatch.Elapsed, noInputStepsStepInfo, state, out entry))
SourceGeneration\Nodes\SharedInputNodes.cs (2)
9using ReferenceEqualityComparer = Roslyn.Utilities.ReferenceEqualityComparer; 20public static readonly InputNode<CompilationOptions> CompilationOptions = new(b => ImmutableArray.Create(b.Compilation.Options), ReferenceEqualityComparer.Instance);
Microsoft.CodeAnalysis.CSharp (27)
Binder\Binder.CapturedParametersFinder.cs (1)
76var result = new Dictionary<ParameterSymbol, FieldSymbol>(ReferenceEqualityComparer.Instance);
Binder\LocalBinderFactory.cs (1)
140_map = new SmallDictionary<SyntaxNode, Binder>(ReferenceEqualityComparer.Instance);
CodeGen\Optimizer.cs (1)
410new SmallDictionary<object, DummyLocal>(ReferenceEqualityComparer.Instance);
Compiler\MethodCompiler.cs (1)
1997identifierMap = new ConcurrentDictionary<IdentifierNameSyntax, int>(ReferenceEqualityComparer.Instance);
Emitter\EditAndContinue\CSharpSymbolMatcher.cs (3)
106private readonly ConcurrentDictionary<Symbol, Symbol?> _matches = new(ReferenceEqualityComparer.Instance); 114private readonly ConcurrentDictionary<ISymbolInternal, IReadOnlyDictionary<string, ImmutableArray<ISymbolInternal>>> _otherMembers = new(ReferenceEqualityComparer.Instance); 844_matches = new ConcurrentDictionary<Symbol, Symbol>(ReferenceEqualityComparer.Instance);
Emitter\Model\PEModuleBuilder.cs (1)
32new ConcurrentDictionary<ImportChain, ImmutableArray<Cci.UsedNamespaceOrType>>(ReferenceEqualityComparer.Instance);
Emitter\NoPia\EmbeddedType.cs (1)
71return refs.IndexOf(UnderlyingNamedType.AdaptedNamedTypeSymbol.ContainingAssembly, ReferenceEqualityComparer.Instance);
Emitter\NoPia\EmbeddedTypesManager.cs (2)
39private readonly ConcurrentDictionary<AssemblySymbol, string> _assemblyGuidMap = new ConcurrentDictionary<AssemblySymbol, string>(ReferenceEqualityComparer.Instance); 40private readonly ConcurrentDictionary<Symbol, bool> _reportedSymbolsMap = new ConcurrentDictionary<Symbol, bool>(ReferenceEqualityComparer.Instance);
FlowAnalysis\AbstractFlowPass.cs (1)
219_loopHeadState = new Dictionary<BoundLoopStatement, TLocalState>(ReferenceEqualityComparer.Instance);
Lowering\LocalRewriter\DelegateCacheRewriter.cs (1)
108var containers = _genericCacheContainers ??= new Dictionary<MethodSymbol, DelegateCacheContainer>(ReferenceEqualityComparer.Instance);
Symbols\Compilation_UsedAssemblies.cs (1)
32var setOfReferences = new HashSet<MetadataReference>(ReferenceEqualityComparer.Instance);
Symbols\Source\SourceMemberContainerSymbol.cs (1)
2693var instanceMap = new Dictionary<NamedTypeSymbol, NamedTypeSymbol>(ReferenceEqualityComparer.Instance);
Symbols\Source\SourceNamespaceSymbol.cs (1)
23ImmutableDictionary<SingleNamespaceDeclaration, AliasesAndUsings>.Empty.WithComparers(ReferenceEqualityComparer.Instance);
Symbols\Source\TypeParameterConstraintClause.cs (2)
138var isValueTypeMap = new SmallDictionary<TypeParameterSymbol, bool>(ReferenceEqualityComparer.Instance); 203var isReferenceTypeFromConstraintTypesMap = new SmallDictionary<TypeParameterSymbol, bool>(ReferenceEqualityComparer.Instance);
Symbols\SubstitutedNamedTypeSymbol.cs (1)
272var replacedFields = new HashSet<Symbol>(ReferenceEqualityComparer.Instance);
Symbols\Symbol_Attributes.cs (1)
486var toRemove = new HashSet<Diagnostic>(ReferenceEqualityComparer.Instance);
Symbols\Tuples\TupleTypeSymbol.cs (2)
606int tupleFieldIndex = currentFieldsForElements.IndexOf(underlyingField, ReferenceEqualityComparer.Instance); 1053var map = new SmallDictionary<Symbol, Symbol>(ReferenceEqualityComparer.Instance);
Symbols\TypeMap.cs (5)
57: base(new SmallDictionary<TypeParameterSymbol, TypeWithAnnotations>(mapping, ReferenceEqualityComparer.Instance)) 66new SmallDictionary<TypeParameterSymbol, TypeWithAnnotations>(substituted.TypeSubstitution.Mapping, ReferenceEqualityComparer.Instance) : 67new SmallDictionary<TypeParameterSymbol, TypeWithAnnotations>(ReferenceEqualityComparer.Instance); 85new SmallDictionary<TypeParameterSymbol, TypeWithAnnotations>(ReferenceEqualityComparer.Instance); 202var mapping = new SmallDictionary<TypeParameterSymbol, TypeWithAnnotations>(ReferenceEqualityComparer.Instance);
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (24)
Semantics\OutVarTests.cs (16)
1113Assert.True(dataFlow.VariablesDeclared.Contains(symbol, ReferenceEqualityComparer.Instance)); 1117Assert.True(dataFlow.AlwaysAssigned.Contains(symbol, ReferenceEqualityComparer.Instance)); 1118Assert.True(dataFlow.WrittenInside.Contains(symbol, ReferenceEqualityComparer.Instance)); 1122dataFlow.DataFlowsIn.Contains(symbol, ReferenceEqualityComparer.Instance)); 1124dataFlow.ReadInside.Contains(symbol, ReferenceEqualityComparer.Instance)); 1127dataFlow.DataFlowsOut.Contains(symbol, ReferenceEqualityComparer.Instance)); 1129dataFlow.ReadOutside.Contains(symbol, ReferenceEqualityComparer.Instance)); 1132dataFlow.WrittenOutside.Contains(symbol, ReferenceEqualityComparer.Instance)); 32799Assert.False(dataFlow.VariablesDeclared.Contains(symbol, ReferenceEqualityComparer.Instance)); 32800Assert.False(dataFlow.AlwaysAssigned.Contains(symbol, ReferenceEqualityComparer.Instance)); 32801Assert.False(dataFlow.WrittenInside.Contains(symbol, ReferenceEqualityComparer.Instance)); 32802Assert.False(dataFlow.DataFlowsIn.Contains(symbol, ReferenceEqualityComparer.Instance)); 32803Assert.False(dataFlow.ReadInside.Contains(symbol, ReferenceEqualityComparer.Instance)); 32804Assert.False(dataFlow.DataFlowsOut.Contains(symbol, ReferenceEqualityComparer.Instance)); 32805Assert.False(dataFlow.ReadOutside.Contains(symbol, ReferenceEqualityComparer.Instance)); 32806Assert.False(dataFlow.WrittenOutside.Contains(symbol, ReferenceEqualityComparer.Instance));
Semantics\PatternMatchingTestBase.cs (8)
335Assert.False(dataFlow.VariablesDeclared.Contains(symbol, ReferenceEqualityComparer.Instance)); 336Assert.False(dataFlow.AlwaysAssigned.Contains(symbol, ReferenceEqualityComparer.Instance)); 337Assert.False(dataFlow.WrittenInside.Contains(symbol, ReferenceEqualityComparer.Instance)); 338Assert.False(dataFlow.DataFlowsIn.Contains(symbol, ReferenceEqualityComparer.Instance)); 339Assert.False(dataFlow.ReadInside.Contains(symbol, ReferenceEqualityComparer.Instance)); 340Assert.False(dataFlow.DataFlowsOut.Contains(symbol, ReferenceEqualityComparer.Instance)); 341Assert.False(dataFlow.ReadOutside.Contains(symbol, ReferenceEqualityComparer.Instance)); 342Assert.False(dataFlow.WrittenOutside.Contains(symbol, ReferenceEqualityComparer.Instance));
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (1)
Semantics\NativeIntegerTests.cs (1)
512Assert.Equal(allMembers, type.GetMembers(), ReferenceEqualityComparer.Instance); // same member instances
Microsoft.CodeAnalysis.Scripting (1)
Hosting\ObjectFormatter\CommonObjectFormatter.Visitor.cs (1)
40_lazyVisitedObjects ??= new HashSet<object>(ReferenceEqualityComparer.Instance);
Microsoft.CodeAnalysis.Test.Utilities (1)
Assert\AssertXml.cs (1)
178HashSet<XElement> children2Used = new HashSet<XElement>(ReferenceEqualityComparer.Instance);
Microsoft.CodeAnalysis.VisualBasic (39)
Binding\Binder_Query.vb (3)
3663If _outerRangeVariables.IndexOf(rangeVariable, ReferenceEqualityComparer.Instance) >= 0 Then 3665ElseIf _innerRangeVariables.IndexOf(rangeVariable, ReferenceEqualityComparer.Instance) >= 0 Then 3714If _badRangeVariables.IndexOf(rangeVariable, ReferenceEqualityComparer.Instance) >= 0 Then
Binding\MemberSemanticModel.vb (1)
1209Private ReadOnly _guardedBoundNodeMap As New SmallDictionary(Of SyntaxNode, ImmutableArray(Of BoundNode))(ReferenceEqualityComparer.Instance)
Compilation\MethodCompiler.vb (2)
354Dim processedSymbols As New ConcurrentSet(Of Symbol)(ReferenceEqualityComparer.Instance) 1894_calledMethods = New HashSet(Of MethodSymbol)(ReferenceEqualityComparer.Instance)
Compilation\TypeCompilationState.vb (3)
63Public ReadOnly StateMachineImplementationClass As New Dictionary(Of MethodSymbol, NamedTypeSymbol)(ReferenceEqualityComparer.Instance) 152_initializeComponentCallTree = New Dictionary(Of MethodSymbol, ImmutableArray(Of MethodSymbol))(ReferenceEqualityComparer.Instance) 165Return CallsInitializeComponent(method, New HashSet(Of MethodSymbol)(ReferenceEqualityComparer.Instance))
Emit\EditAndContinue\VisualBasicSymbolMatcher.vb (3)
102_matches = New ConcurrentDictionary(Of Symbol, Symbol)(ReferenceEqualityComparer.Instance) 103_otherMembers = New ConcurrentDictionary(Of ISymbolInternal, IReadOnlyDictionary(Of String, ImmutableArray(Of ISymbolInternal)))(ReferenceEqualityComparer.Instance) 565_matches = New ConcurrentDictionary(Of Symbol, Symbol)(ReferenceEqualityComparer.Instance)
Emit\NoPia\EmbeddedType.vb (1)
60Return refs.IndexOf(UnderlyingNamedType.AdaptedNamedTypeSymbol.ContainingAssembly, ReferenceEqualityComparer.Instance)
Emit\NoPia\EmbeddedTypesManager.vb (2)
30Private ReadOnly _assemblyGuidMap As New ConcurrentDictionary(Of AssemblySymbol, String)(ReferenceEqualityComparer.Instance) 31Private ReadOnly _reportedSymbolsMap As New ConcurrentDictionary(Of Symbol, Boolean)(ReferenceEqualityComparer.Instance)
Emit\PEModuleBuilder.vb (1)
22Private ReadOnly _disableJITOptimization As ConcurrentDictionary(Of MethodSymbol, Boolean) = New ConcurrentDictionary(Of MethodSymbol, Boolean)(ReferenceEqualityComparer.Instance)
Emit\SymbolTranslator.vb (2)
20Private ReadOnly _translatedImportsMap As New ConcurrentDictionary(Of SourceFile, ImmutableArray(Of Cci.UsedNamespaceOrType))(ReferenceEqualityComparer.Instance) 43Interlocked.CompareExchange(_addedEmbeddedSymbols, New ConcurrentSet(Of Symbol)(ReferenceEqualityComparer.Instance), Nothing)
Lowering\LambdaRewriter\LambdaRewriter.Analysis.vb (7)
52Friend lambdaParent As Dictionary(Of LambdaSymbol, MethodSymbol) = New Dictionary(Of LambdaSymbol, MethodSymbol)(ReferenceEqualityComparer.Instance) 59Friend variableScope As Dictionary(Of Symbol, BoundNode) = New Dictionary(Of Symbol, BoundNode)(ReferenceEqualityComparer.Instance) 64Friend labelBlock As Dictionary(Of LabelSymbol, BoundNode) = New Dictionary(Of LabelSymbol, BoundNode)(ReferenceEqualityComparer.Instance) 105Friend capturedVariables As HashSet(Of Symbol) = New HashSet(Of Symbol)(ReferenceEqualityComparer.Instance) 110Friend capturedVariablesByLambda As MultiDictionary(Of LambdaSymbol, Symbol) = New MultiDictionary(Of LambdaSymbol, Symbol)(ReferenceEqualityComparer.Instance) 115Friend ReadOnly declaredInsideExpressionLambda As New HashSet(Of Symbol)(ReferenceEqualityComparer.Instance) 169lambdaScopes = New Dictionary(Of LambdaSymbol, BoundNode)(ReferenceEqualityComparer.Instance)
Lowering\LocalRewriter\LocalRewriter.vb (2)
47Private ReadOnly _unstructuredExceptionHandlingResumableStatements As New Dictionary(Of SyntaxNode, BoundStatement)(ReferenceEqualityComparer.Instance) 56Private _rewrittenNodes As New HashSet(Of BoundNode)(ReferenceEqualityComparer.Instance)
Lowering\LocalRewriter\LocalRewriter_LocalDeclaration.vb (1)
134_staticLocalMap = New Dictionary(Of LocalSymbol, KeyValuePair(Of SynthesizedStaticLocalBackingField, SynthesizedStaticLocalBackingField))(ReferenceEqualityComparer.Instance)
Lowering\MethodToClassRewriter\MethodToClassRewriter.vb (2)
30Protected ReadOnly LocalMap As Dictionary(Of LocalSymbol, LocalSymbol) = New Dictionary(Of LocalSymbol, LocalSymbol)(ReferenceEqualityComparer.Instance) 36Protected ReadOnly ParameterMap As Dictionary(Of ParameterSymbol, ParameterSymbol) = New Dictionary(Of ParameterSymbol, ParameterSymbol)(ReferenceEqualityComparer.Instance)
Operations\VisualBasicOperationFactory.vb (1)
47New ConcurrentDictionary(Of BoundValuePlaceholderBase, BoundNode)(concurrencyLevel:=2, capacity:=10, comparer:=ReferenceEqualityComparer.Instance),
Parser\BlockContexts\CompilationUnitContext.vb (3)
168New HashSet(Of IfDirectiveTriviaSyntax)(ReferenceEqualityComparer.Instance) 177New HashSet(Of RegionDirectiveTriviaSyntax)(ReferenceEqualityComparer.Instance) 209Private ReadOnly _processedNodesWithoutDuplication As HashSet(Of VisualBasicSyntaxNode) = New HashSet(Of VisualBasicSyntaxNode)(ReferenceEqualityComparer.Instance)
Semantics\OverloadResolution.vb (1)
3691asyncLambdaSubToFunctionMismatch = New HashSet(Of BoundExpression)(ReferenceEqualityComparer.Instance)
Semantics\TypeInference\TypeArgumentInference.vb (1)
2209_asyncLambdaSubToFunctionMismatch = New HashSet(Of BoundExpression)(ReferenceEqualityComparer.Instance)
Symbols\Source\SourceModuleSymbol.vb (1)
1166result = New Dictionary(Of NamedTypeSymbol, SynthesizedMyGroupCollectionPropertySymbol)(ReferenceEqualityComparer.Instance)
Symbols\Tuples\TupleTypeSymbol.vb (2)
723Dim tupleFieldIndex = currentFieldsForElements.IndexOf(field, ReferenceEqualityComparer.Instance) 889Dim smallDictionary As SmallDictionary(Of Symbol, Symbol) = New SmallDictionary(Of Symbol, Symbol)(ReferenceEqualityComparer.Instance)
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (3)
SymbolsTests\InstantiatingGenerics.vb (3)
63Assert.True(constructedFromTypeArguments.SequenceEqual(constructedFromTypeParameters, ReferenceEqualityComparer.Instance)) 82Assert.True(typeParameters.SequenceEqual(constructedFromTypeParameters, ReferenceEqualityComparer.Instance)) 84Assert.Equal(instantiation Is constructedFrom, typeArguments.SequenceEqual(typeParameters, ReferenceEqualityComparer.Instance))