2 implementations of IFieldSymbol
Microsoft.CodeAnalysis.CSharp (1)
Microsoft.CodeAnalysis.VisualBasic (1)
1271 references to IFieldSymbol
ILLink.RoslynAnalyzer (31)
Microsoft.Analyzers.Local (2)
Microsoft.AspNetCore.App.Analyzers (1)
Microsoft.AspNetCore.Components.Analyzers (2)
Microsoft.AspNetCore.Components.SdkAnalyzers (1)
Microsoft.AspNetCore.Mvc.Api.Analyzers (1)
Microsoft.CodeAnalysis (26)
Generated\Operations.Generated.cs (6)
936IFieldSymbol Field { get; }
2352ImmutableArray<IFieldSymbol> InitializedFields { get; }
5345internal FieldReferenceOperation(IFieldSymbol field, bool isDeclaration, IOperation? instance, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit)
5353public IFieldSymbol Field { get; }
7510internal FieldInitializerOperation(ImmutableArray<IFieldSymbol> initializedFields, ImmutableArray<ILocalSymbol> locals, IOperation value, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit)
7515public ImmutableArray<IFieldSymbol> InitializedFields { get; }
Microsoft.CodeAnalysis.CodeStyle (86)
src\Analyzers\Core\Analyzers\MakeFieldReadonly\AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (13)
42var fieldStateMap = new ConcurrentDictionary<IFieldSymbol, (bool isCandidate, bool written)>();
88var field = (IFieldSymbol)symbolContext.Symbol;
117if (member is IFieldSymbol field && fieldStateMap.TryRemove(field.OriginalDefinition, out var value))
141if (member is IFieldSymbol field &&
157bool IsCandidateField(IFieldSymbol symbol)
188static bool IsDataContractSerializable(IFieldSymbol symbol, INamedTypeSymbol? dataContractAttribute, INamedTypeSymbol? dataMemberAttribute)
198void UpdateFieldStateOnWrite(IFieldSymbol field)
207(bool isCandidate, bool written) TryGetOrInitializeFieldState(IFieldSymbol fieldSymbol, AnalyzerOptions options, CancellationToken cancellationToken)
221IFieldSymbol field,
240private static Location GetDiagnosticLocation(IFieldSymbol field)
263var field = fieldReference.Field;
299private static CodeStyleOption2<bool> GetCodeStyleOption(IFieldSymbol field, AnalyzerOptions options, out Location diagnosticLocation)
src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (20)
46private static readonly ObjectPool<ConcurrentDictionary<IFieldSymbol, ConcurrentSet<SyntaxNode>>> s_fieldToUsageLocationPool = new(() => []);
63protected static void AddFieldUsage(ConcurrentDictionary<IFieldSymbol, ConcurrentSet<SyntaxNode>> fieldWrites, IFieldSymbol field, SyntaxNode location)
66private static void ClearAndFree(ConcurrentDictionary<IFieldSymbol, ConcurrentSet<SyntaxNode>> multiMap)
100SemanticModel semanticModel, IMethodSymbol accessor, HashSet<string> fieldNames, HashSet<IFieldSymbol> result, CancellationToken cancellationToken);
103HashSet<string> fieldNames, ConcurrentDictionary<IFieldSymbol, ConcurrentSet<SyntaxNode>> ineligibleFieldUsageIfOutsideProperty, SemanticModel semanticModel, SyntaxNode codeBlock, CancellationToken cancellationToken);
131if (member is IFieldSymbol
229ConcurrentDictionary<IFieldSymbol, ConcurrentSet<SyntaxNode>> fieldReads,
230ConcurrentDictionary<IFieldSymbol, ConcurrentSet<SyntaxNode>> fieldWrites,
243if (semanticModel.GetSymbolInfo(identifierName, cancellationToken).Symbol is not IFieldSymbol field)
275using var _ = PooledHashSet<IFieldSymbol>.GetInstance(out var set);
291using var _ = PooledHashSet<IFieldSymbol>.GetInstance(out var set);
297private IFieldSymbol? CheckFieldAccessExpression(
316IFieldSymbol field,
483var getterField = getterFields.TrivialField ?? getterFields.NonTrivialFields.Single();
499protected IFieldSymbol? TryGetDirectlyAccessedFieldSymbol(
539ConcurrentDictionary<IFieldSymbol, ConcurrentSet<SyntaxNode>> ineligibleFieldUsageIfOutsideProperty,
540ConcurrentDictionary<IFieldSymbol, ConcurrentSet<SyntaxNode>> fieldReads,
541ConcurrentDictionary<IFieldSymbol, ConcurrentSet<SyntaxNode>> fieldWrites,
544using var _1 = PooledHashSet<IFieldSymbol>.GetInstance(out var reportedFields);
Microsoft.CodeAnalysis.CodeStyle.Fixes (58)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (9)
51public TDeclarationNode AddField<TDeclarationNode>(TDeclarationNode destination, IFieldSymbol field, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode
80public SyntaxNode CreateFieldDeclaration(IFieldSymbol field, CodeGenerationDestination destination, CodeGenerationContextInfo info, CancellationToken cancellationToken)
125protected abstract TDeclarationNode AddField<TDeclarationNode>(TDeclarationNode destination, IFieldSymbol field, TCodeGenerationContextInfo info, IList<bool>? availableIndices, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode;
145public abstract SyntaxNode CreateFieldDeclaration(IFieldSymbol field, CodeGenerationDestination destination, TCodeGenerationContextInfo info, CancellationToken cancellationToken);
347IFieldSymbol field => CreateFieldDeclaration(field, codeGenerationDestination, info, cancellationToken),
365IFieldSymbol field => AddField(currentDestination, field, info, availableIndices, cancellationToken),
376var field = members.OfType<IFieldSymbol>().FirstOrDefault();
402public Task<Document> AddFieldAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IFieldSymbol field, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (17)
13internal abstract class AbstractFlagsEnumGenerator : IComparer<(IFieldSymbol field, ulong value)>
66var allFieldsAndValues = new List<(IFieldSymbol field, ulong value)>();
69var usedFieldsAndValues = new List<(IFieldSymbol field, ulong value)>();
77List<(IFieldSymbol field, ulong value)> allFieldsAndValues,
78List<(IFieldSymbol field, ulong value)> usedFieldsAndValues)
128var zeroField = GetZeroField(allFieldsAndValues);
141SyntaxGenerator generator, IFieldSymbol field, INamedTypeSymbol enumType, SpecialType underlyingSpecialType)
156private static IFieldSymbol? GetZeroField(List<(IFieldSymbol field, ulong value)> allFieldsAndValues)
172List<(IFieldSymbol field, ulong value)> allFieldsAndValues)
176foreach (var field in enumType.GetMembers().OfType<IFieldSymbol>())
195foreach (var field in enumType.GetMembers().OfType<IFieldSymbol>())
211int IComparer<(IFieldSymbol field, ulong value)>.Compare((IFieldSymbol field, ulong value) x, (IFieldSymbol field, ulong value) y)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
506.OfType<IFieldSymbol>()
Microsoft.CodeAnalysis.CSharp (45)
Microsoft.CodeAnalysis.CSharp.CodeStyle (21)
src\Analyzers\CSharp\Analyzers\MakeStructFieldsWritable\CSharpMakeStructFieldsWritableDiagnosticAnalyzer.cs (1)
80.OfType<IFieldSymbol>()
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (38)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (1)
1464case IFieldSymbol field:
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (46)
CodeGen\CodeGenTupleTest.cs (34)
3645foreach (var item in type.TupleElements)
5883Assert.All(tupleWithoutNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
5960Assert.All(tupleWithoutNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
5979Assert.All(tupleWithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
5998Assert.All(tupleWithSomeNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
6016Assert.All(tupleWithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
6068Assert.All(tuple8WithoutNames.GetMembers().OfType<IFieldSymbol>().Where(f => f.Name != "Rest").Select(f => f.Locations.FirstOrDefault()),
6093Assert.All(tuple8WithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
6118Assert.All(tuple9WithoutNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
6144Assert.All(tuple9WithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
6176Assert.All(tuple9WithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
6200Assert.All(tupleWithoutNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
6600var tuple1 = (INamedTypeSymbol)comp.SourceModule.GlobalNamespace.GetMember<INamedTypeSymbol>("C").GetMember<IFieldSymbol>("F").Type;
6635var tuple1 = (INamedTypeSymbol)((IFieldSymbol)comp.GetMember("Program.F")).Type;
6677var tuple1 = (INamedTypeSymbol)((IFieldSymbol)comp.GetMember("Program.F")).Type;
6716var tuple1 = (INamedTypeSymbol)((IFieldSymbol)comp.GetMember("Program.F")).Type;
6757var tuple1 = (INamedTypeSymbol)((IFieldSymbol)comp.GetMember("Program.F")).Type;
6835var tuple1 = (INamedTypeSymbol)((IFieldSymbol)comp.GetMember("Program.F")).Type;
6865var tuple1 = (INamedTypeSymbol)((IFieldSymbol)comp.GetMember("Program.F")).Type;
6904var tuple1 = (INamedTypeSymbol)((IFieldSymbol)comp.GetMember("Program.F")).Type;
14252m1Tuple.GetMember<IFieldSymbol>("Rest").Type.ToTestDisplayString());
14259m1Tuple.GetMember<IFieldSymbol>("Rest").Type.ToTestDisplayString());
14268m2Tuple.GetMember<IFieldSymbol>("Rest").Type.ToTestDisplayString());
14270var f1Tuple = (INamedTypeSymbol)test.GetMember<IFieldSymbol>("F1").Type;
14277f1Tuple = (INamedTypeSymbol)((IFieldSymbol)symbolInfo.Symbol).Type;
14282f1Tuple.GetMember<IFieldSymbol>("Rest").Type.ToTestDisplayString());
14296p1Tuple.GetMember<IFieldSymbol>("Rest").Type.ToTestDisplayString());
14440e1Tuple.GetMember<IFieldSymbol>("Rest").Type.ToTestDisplayString());
22859AssertEx.SetEqual(xSymbol.GetMembers().OfType<IFieldSymbol>().Select(f => f.Name),
27419VerifyTypeFromVisualBasic((INamedTypeSymbol)((IFieldSymbol)containingType.GetMembers("F0").Single()).Type, TupleUnderlyingTypeValue.Null, "System.ValueTuple", "System.ValueTuple");
27420VerifyTypeFromVisualBasic((INamedTypeSymbol)((IFieldSymbol)containingType.GetMembers("F1").Single()).Type, TupleUnderlyingTypeValue.Distinct, "(System.Int32, System.Int32)", "(System.Int32, System.Int32)");
27421VerifyTypeFromVisualBasic((INamedTypeSymbol)((IFieldSymbol)containingType.GetMembers("F2").Single()).Type, TupleUnderlyingTypeValue.Distinct, "(System.Int32 A, System.Int32 B)", "(A As System.Int32, B As System.Int32)");
27422VerifyTypeFromVisualBasic((INamedTypeSymbol)((IFieldSymbol)containingType.GetMembers("F3").Single()).Type, TupleUnderlyingTypeValue.Distinct, "(System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object)", "(System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object)");
27423VerifyTypeFromVisualBasic((INamedTypeSymbol)((IFieldSymbol)containingType.GetMembers("F4").Single()).Type, TupleUnderlyingTypeValue.Distinct, "(System.Object, System.Object B, System.Object, System.Object D, System.Object, System.Object F, System.Object, System.Object H)", "(System.Object, B As System.Object, System.Object, D As System.Object, System.Object, F As System.Object, System.Object, H As System.Object)");
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (6)
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (36)
Microsoft.CodeAnalysis.CSharp.Features (87)
src\Analyzers\CSharp\Analyzers\MakeStructFieldsWritable\CSharpMakeStructFieldsWritableDiagnosticAnalyzer.cs (1)
80.OfType<IFieldSymbol>()
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (35)
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (106)
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
Microsoft.CodeAnalysis.CSharp.Workspaces (19)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (1)
1464case IFieldSymbol field:
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (6)
Microsoft.CodeAnalysis.EditorFeatures (1)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (91)
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (2)
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (1)
Microsoft.CodeAnalysis.Features (172)
EncapsulateField\AbstractEncapsulateFieldService.cs (21)
41protected abstract Task<ImmutableArray<IFieldSymbol>> GetFieldsAsync(Document document, TextSpan span, CancellationToken cancellationToken);
50var firstField = fields[0];
73foreach (var field in fields)
81private ImmutableArray<CodeAction> EncapsulateAllFields(Document document, ImmutableArray<IFieldSymbol> fields)
93private ImmutableArray<CodeAction> EncapsulateOneField(Document document, IFieldSymbol field)
110Document document, ImmutableArray<IFieldSymbol> fields,
140private async Task<Solution> EncapsulateFieldsInCurrentProcessAsync(Document document, ImmutableArray<IFieldSymbol> fields, bool updateReferences, CancellationToken cancellationToken)
146foreach (var field in fields)
153if (field.GetSymbolKey(cancellationToken).Resolve(compilation, cancellationToken: cancellationToken).Symbol is not IFieldSymbol currentField)
168IFieldSymbol field,
172var originalField = field;
186field = (IFieldSymbol)field.GetSymbolKey(cancellationToken).Resolve(compilation, cancellationToken: cancellationToken).Symbol!;
207field = (IFieldSymbol)semanticModel.GetRequiredDeclaredSymbol(newDeclaration, cancellationToken);
230bool updateReferences, Solution solution, Document document, IFieldSymbol field, string finalFieldName, string generatedPropertyName, CancellationToken cancellationToken)
254field = (IFieldSymbol)field.GetSymbolKey(cancellationToken).Resolve(compilation, cancellationToken: cancellationToken).Symbol!;
276IFieldSymbol field,
318IFieldSymbol field,
339IFieldSymbol field,
362protected abstract (string fieldName, string propertyName) GenerateFieldAndPropertyNames(IFieldSymbol field);
377protected static IMethodSymbol CreateSet(string originalFieldName, IFieldSymbol field, SyntaxGenerator factory)
396protected static IMethodSymbol CreateGet(string originalFieldName, IFieldSymbol field, SyntaxGenerator factory)
ReplacePropertyWithMethods\AbstractReplacePropertyWithMethodsService.cs (5)
30Document document, IPropertySymbol property, SyntaxNode propertyDeclaration, IFieldSymbol propertyBackingField, string desiredGetMethodName, string desiredSetMethodName, CancellationToken cancellationToken);
39protected static SyntaxNode GetFieldReference(SyntaxGenerator generator, IFieldSymbol propertyBackingField)
57IPropertySymbol property, IFieldSymbol propertyBackingField,
82private readonly IFieldSymbol _propertyBackingField;
99IFieldSymbol propertyBackingField,
ReplacePropertyWithMethods\ReplacePropertyWithMethodsCodeRefactoringProvider.cs (9)
119private static ImmutableDictionary<IPropertySymbol, IFieldSymbol?> CreateDefinitionToBackingFieldMap(IEnumerable<ReferencedSymbol> propertyReferences)
121var definitionToBackingField = ImmutableDictionary.CreateBuilder<IPropertySymbol, IFieldSymbol?>(SymbolEquivalenceComparer.Instance);
127var backingField = GetBackingField(property);
160private static IFieldSymbol? GetBackingField(IPropertySymbol property)
201ImmutableDictionary<IPropertySymbol, IFieldSymbol?> propertyToBackingField,
221ImmutableDictionary<IPropertySymbol, IFieldSymbol?> propertyToBackingField,
242IDictionary<IPropertySymbol, IFieldSymbol?> propertyToBackingField,
300ImmutableDictionary<IPropertySymbol, IFieldSymbol?> definitionToBackingField,
350IDictionary<IPropertySymbol, IFieldSymbol?> definitionToBackingField,
src\Analyzers\Core\Analyzers\MakeFieldReadonly\AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (13)
42var fieldStateMap = new ConcurrentDictionary<IFieldSymbol, (bool isCandidate, bool written)>();
88var field = (IFieldSymbol)symbolContext.Symbol;
117if (member is IFieldSymbol field && fieldStateMap.TryRemove(field.OriginalDefinition, out var value))
141if (member is IFieldSymbol field &&
157bool IsCandidateField(IFieldSymbol symbol)
188static bool IsDataContractSerializable(IFieldSymbol symbol, INamedTypeSymbol? dataContractAttribute, INamedTypeSymbol? dataMemberAttribute)
198void UpdateFieldStateOnWrite(IFieldSymbol field)
207(bool isCandidate, bool written) TryGetOrInitializeFieldState(IFieldSymbol fieldSymbol, AnalyzerOptions options, CancellationToken cancellationToken)
221IFieldSymbol field,
240private static Location GetDiagnosticLocation(IFieldSymbol field)
263var field = fieldReference.Field;
299private static CodeStyleOption2<bool> GetCodeStyleOption(IFieldSymbol field, AnalyzerOptions options, out Location diagnosticLocation)
src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (20)
46private static readonly ObjectPool<ConcurrentDictionary<IFieldSymbol, ConcurrentSet<SyntaxNode>>> s_fieldToUsageLocationPool = new(() => []);
63protected static void AddFieldUsage(ConcurrentDictionary<IFieldSymbol, ConcurrentSet<SyntaxNode>> fieldWrites, IFieldSymbol field, SyntaxNode location)
66private static void ClearAndFree(ConcurrentDictionary<IFieldSymbol, ConcurrentSet<SyntaxNode>> multiMap)
100SemanticModel semanticModel, IMethodSymbol accessor, HashSet<string> fieldNames, HashSet<IFieldSymbol> result, CancellationToken cancellationToken);
103HashSet<string> fieldNames, ConcurrentDictionary<IFieldSymbol, ConcurrentSet<SyntaxNode>> ineligibleFieldUsageIfOutsideProperty, SemanticModel semanticModel, SyntaxNode codeBlock, CancellationToken cancellationToken);
131if (member is IFieldSymbol
229ConcurrentDictionary<IFieldSymbol, ConcurrentSet<SyntaxNode>> fieldReads,
230ConcurrentDictionary<IFieldSymbol, ConcurrentSet<SyntaxNode>> fieldWrites,
243if (semanticModel.GetSymbolInfo(identifierName, cancellationToken).Symbol is not IFieldSymbol field)
275using var _ = PooledHashSet<IFieldSymbol>.GetInstance(out var set);
291using var _ = PooledHashSet<IFieldSymbol>.GetInstance(out var set);
297private IFieldSymbol? CheckFieldAccessExpression(
316IFieldSymbol field,
483var getterField = getterFields.TrivialField ?? getterFields.NonTrivialFields.Single();
499protected IFieldSymbol? TryGetDirectlyAccessedFieldSymbol(
539ConcurrentDictionary<IFieldSymbol, ConcurrentSet<SyntaxNode>> ineligibleFieldUsageIfOutsideProperty,
540ConcurrentDictionary<IFieldSymbol, ConcurrentSet<SyntaxNode>> fieldReads,
541ConcurrentDictionary<IFieldSymbol, ConcurrentSet<SyntaxNode>> fieldWrites,
544using var _1 = PooledHashSet<IFieldSymbol>.GetInstance(out var reportedFields);
Microsoft.CodeAnalysis.Features.UnitTests (5)
Microsoft.CodeAnalysis.Remote.ServiceHub (3)
Microsoft.CodeAnalysis.Test.Utilities (24)
Diagnostics\CouldHaveMoreSpecificTypeAnalyzer.cs (8)
47Dictionary<IFieldSymbol, HashSet<INamedTypeSymbol>> fieldsSourceTypes = new Dictionary<IFieldSymbol, HashSet<INamedTypeSymbol>>();
140foreach (IFieldSymbol initializedField in initializer.InitializedFields)
151foreach (IFieldSymbol field in fieldsSourceTypes.Keys)
232private static void AssignTo(IOperation target, Dictionary<ILocalSymbol, HashSet<INamedTypeSymbol>> localsSourceTypes, Dictionary<IFieldSymbol, HashSet<INamedTypeSymbol>> fieldsSourceTypes, IOperation sourceValue)
237private static void AssignTo(IOperation target, Dictionary<ILocalSymbol, HashSet<INamedTypeSymbol>> localsSourceTypes, Dictionary<IFieldSymbol, HashSet<INamedTypeSymbol>> fieldsSourceTypes, ITypeSymbol sourceType)
247IFieldSymbol targetField = ((IFieldReferenceOperation)target).Field;
298private void Report(CompilationAnalysisContext context, IFieldSymbol field, ITypeSymbol moreSpecificType, DiagnosticDescriptor descriptor)
Microsoft.CodeAnalysis.UnitTests (1)
Microsoft.CodeAnalysis.VisualBasic (37)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (2)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (11)
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (33)
CodeGen\CodeGenTuples.vb (33)
5777Assert.True(DirectCast(mFirst, IFieldSymbol).IsExplicitlyNamedTupleElement)
5796Assert.False(DirectCast(mItem1, IFieldSymbol).IsExplicitlyNamedTupleElement)
6898Assert.All(tupleWithoutNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()),
6951Assert.All(tupleWithoutNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()),
6971Assert.All(tupleWithoutNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()),
6992Assert.All(tupleWithSomeNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()),
7010Assert.All(tupleWithoutNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()),
7035Assert.All(tuple8WithoutNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()),
7060Assert.All(tuple8WithNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()),
7085Assert.All(tuple9WithoutNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()),
7110Assert.All(tuple9WithNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()),
7135Assert.All(tuple9WithNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()),
7159Assert.All(tupleWithoutNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()),
7544Dim tuple1 = DirectCast(DirectCast(comp.GetMember("Program.F"), IFieldSymbol).Type, INamedTypeSymbol)
7576Dim tuple1 = DirectCast(DirectCast(comp.GetMember("Program.F"), IFieldSymbol).Type, INamedTypeSymbol)
7608Dim tuple1 = DirectCast(DirectCast(comp.GetMember("Program.F"), IFieldSymbol).Type, INamedTypeSymbol)
7643Dim tuple1 = DirectCast(DirectCast(comp.GetMember("Program.F"), IFieldSymbol).Type, INamedTypeSymbol)
7669Dim tuple1 = DirectCast(DirectCast(comp.GetMember("Program.F"), IFieldSymbol).Type, INamedTypeSymbol)
7704Dim tuple1 = DirectCast(DirectCast(comp.GetMember("Program.F"), IFieldSymbol).Type, INamedTypeSymbol)
15384Assert.False(DirectCast(m3Item8, IFieldSymbol).IsExplicitlyNamedTupleElement)
15546Assert.False(DirectCast(m4Item8, IFieldSymbol).IsExplicitlyNamedTupleElement)
15566Assert.True(DirectCast(m4h4, IFieldSymbol).IsExplicitlyNamedTupleElement)
15800Assert.True(DirectCast(m5Item8, IFieldSymbol).IsExplicitlyNamedTupleElement)
16155Assert.False(DirectCast(m8Item8, IFieldSymbol).IsExplicitlyNamedTupleElement)
16175Assert.True(DirectCast(m8Item1, IFieldSymbol).IsExplicitlyNamedTupleElement)
16352Assert.False(DirectCast(m1Item1, IFieldSymbol).IsExplicitlyNamedTupleElement)
16375Assert.False(DirectCast(m2Item1, IFieldSymbol).IsExplicitlyNamedTupleElement)
16395Assert.True(DirectCast(m2a2, IFieldSymbol).IsExplicitlyNamedTupleElement)
23122VerifyTypeFromCSharp(DirectCast(DirectCast(containingType.GetMembers("F0").Single(), IFieldSymbol).Type, INamedTypeSymbol), TupleUnderlyingTypeValue.Nothing, "System.ValueTuple", "()")
23123VerifyTypeFromCSharp(DirectCast(DirectCast(containingType.GetMembers("F1").Single(), IFieldSymbol).Type, INamedTypeSymbol), TupleUnderlyingTypeValue.Nothing, "(System.Int32, System.Int32)", "(System.Int32, System.Int32)")
23124VerifyTypeFromCSharp(DirectCast(DirectCast(containingType.GetMembers("F2").Single(), IFieldSymbol).Type, INamedTypeSymbol), TupleUnderlyingTypeValue.Distinct, "(System.Int32 A, System.Int32 B)", "(A As System.Int32, B As System.Int32)")
23125VerifyTypeFromCSharp(DirectCast(DirectCast(containingType.GetMembers("F3").Single(), IFieldSymbol).Type, INamedTypeSymbol), TupleUnderlyingTypeValue.Nothing, "(System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object)", "(System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object)")
23126VerifyTypeFromCSharp(DirectCast(DirectCast(containingType.GetMembers("F4").Single(), IFieldSymbol).Type, INamedTypeSymbol), TupleUnderlyingTypeValue.Distinct, "(System.Object, System.Object B, System.Object, System.Object D, System.Object, System.Object F, System.Object, System.Object H)", "(System.Object, B As System.Object, System.Object, D As System.Object, System.Object, F As System.Object, System.Object, H As System.Object)")
Microsoft.CodeAnalysis.VisualBasic.Features (24)
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (5)
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (1)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (17)
Microsoft.CodeAnalysis.VisualBasic.Workspaces.UnitTests (3)
Microsoft.CodeAnalysis.Workspaces (96)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (9)
51public TDeclarationNode AddField<TDeclarationNode>(TDeclarationNode destination, IFieldSymbol field, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode
80public SyntaxNode CreateFieldDeclaration(IFieldSymbol field, CodeGenerationDestination destination, CodeGenerationContextInfo info, CancellationToken cancellationToken)
125protected abstract TDeclarationNode AddField<TDeclarationNode>(TDeclarationNode destination, IFieldSymbol field, TCodeGenerationContextInfo info, IList<bool>? availableIndices, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode;
145public abstract SyntaxNode CreateFieldDeclaration(IFieldSymbol field, CodeGenerationDestination destination, TCodeGenerationContextInfo info, CancellationToken cancellationToken);
347IFieldSymbol field => CreateFieldDeclaration(field, codeGenerationDestination, info, cancellationToken),
365IFieldSymbol field => AddField(currentDestination, field, info, availableIndices, cancellationToken),
376var field = members.OfType<IFieldSymbol>().FirstOrDefault();
402public Task<Document> AddFieldAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IFieldSymbol field, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (17)
13internal abstract class AbstractFlagsEnumGenerator : IComparer<(IFieldSymbol field, ulong value)>
66var allFieldsAndValues = new List<(IFieldSymbol field, ulong value)>();
69var usedFieldsAndValues = new List<(IFieldSymbol field, ulong value)>();
77List<(IFieldSymbol field, ulong value)> allFieldsAndValues,
78List<(IFieldSymbol field, ulong value)> usedFieldsAndValues)
128var zeroField = GetZeroField(allFieldsAndValues);
141SyntaxGenerator generator, IFieldSymbol field, INamedTypeSymbol enumType, SpecialType underlyingSpecialType)
156private static IFieldSymbol? GetZeroField(List<(IFieldSymbol field, ulong value)> allFieldsAndValues)
172List<(IFieldSymbol field, ulong value)> allFieldsAndValues)
176foreach (var field in enumType.GetMembers().OfType<IFieldSymbol>())
195foreach (var field in enumType.GetMembers().OfType<IFieldSymbol>())
211int IComparer<(IFieldSymbol field, ulong value)>.Compare((IFieldSymbol field, ulong value) x, (IFieldSymbol field, ulong value) y)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
506.OfType<IFieldSymbol>()
Microsoft.CodeAnalysis.Workspaces.UnitTests (26)
UtilityTest\DocumentationCommentIdTests.cs (10)
127CheckDeclarationId<IFieldSymbol>("F:Acme.ValueType.total", compilation, s => s.Name == "total");
128CheckDeclarationId<IFieldSymbol>("F:Acme.Widget.NestedClass.value", compilation, s => s.Name == "value");
129CheckDeclarationId<IFieldSymbol>("F:Acme.Widget.message", compilation, s => s.Name == "message");
130CheckDeclarationId<IFieldSymbol>("F:Acme.Widget.defaultColor", compilation, s => s.Name == "defaultColor");
131CheckDeclarationId<IFieldSymbol>("F:Acme.Widget.PI", compilation, s => s.Name == "PI");
132CheckDeclarationId<IFieldSymbol>("F:Acme.Widget.monthlyAverage", compilation, s => s.Name == "monthlyAverage");
133CheckDeclarationId<IFieldSymbol>("F:Acme.Widget.array1", compilation, s => s.Name == "array1");
134CheckDeclarationId<IFieldSymbol>("F:Acme.Widget.array2", compilation, s => s.Name == "array2");
135CheckDeclarationId<IFieldSymbol>("F:Acme.Widget.pCount", compilation, s => s.Name == "pCount");
136CheckDeclarationId<IFieldSymbol>("F:Acme.Widget.ppValues", compilation, s => s.Name == "ppValues");
Microsoft.Extensions.Logging.Generators (2)
Microsoft.Gen.ComplianceReports (2)
Microsoft.Gen.Logging (2)
Microsoft.Gen.Metrics (3)
Microsoft.Gen.MetricsReports (3)
Microsoft.Interop.LibraryImportGenerator (1)
Microsoft.Interop.SourceGeneration (2)
Microsoft.ML.InternalCodeAnalyzer (5)
Microsoft.VisualStudio.LanguageServices (6)
Microsoft.VisualStudio.LanguageServices.CSharp (11)
CodeModel\CSharpCodeModelService_Prototype.cs (7)
31return GetVariablePrototype((IFieldSymbol)symbol, flags);
60return GetVariablePrototype(variableDeclarator, (IFieldSymbol)symbol, flags);
62return GetVariablePrototype(enumMember, (IFieldSymbol)symbol, flags);
223private string GetVariablePrototype(IFieldSymbol symbol, PrototypeFlags flags)
244private string GetVariablePrototype(VariableDeclaratorSyntax node, IFieldSymbol symbol, PrototypeFlags flags)
274private string GetVariablePrototype(EnumMemberDeclarationSyntax node, IFieldSymbol symbol, PrototypeFlags flags)
477private void AppendVariablePrototype(StringBuilder builder, IFieldSymbol symbol, PrototypeFlags flags, string baseName)
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (1)
Microsoft.VisualStudio.LanguageServices.VisualBasic (5)
Roslyn.Test.PdbUtilities (1)
SemanticSearch.BuildTask (5)
System.Text.Json.SourceGeneration (10)
System.Text.RegularExpressions.Generator (1)
System.Windows.Forms.PrivateSourceGenerators (1)