Binder\Binder.ValueChecks.cs (17)
68internal static MethodInfo Create(PropertySymbol property)
76internal static MethodInfo Create(PropertySymbol property, AccessorKind accessorKind) =>
1998var propertySymbol = GetPropertySymbol(expr, out receiver, out propertySyntax);
2884case PropertySymbol property:
3854var indexerSymbol = indexerAccess.Indexer;
3869var indexerSymbol = indexerAccess.Indexer;
4129var indexerSymbol = indexerAccess.Indexer;
4153var indexerSymbol = indexerAccess.Indexer;
4241var propertySymbol = propertyAccess.PropertySymbol;
4495var indexerSymbol = indexerAccess.Indexer;
4510var indexerSymbol = indexerAccess.Indexer;
4937PropertySymbol { IsIndexer: true } indexer => getIndexerEscape(indexer, left, rightEscape),
4938PropertySymbol property => getPropertyEscape(property, rightEscape),
4955PropertySymbol indexer,
5012PropertySymbol property,
5220var indexerSymbol = indexerAccess.Indexer;
5239var indexerSymbol = indexerAccess.Indexer;
Binder\Binder_Expressions.cs (45)
1567ContainingMember() is MethodSymbol { MethodKind: MethodKind.PropertyGet or MethodKind.PropertySet, AssociatedSymbol: PropertySymbol { IsIndexer: false } })
2192return BindPropertyAccess(node, receiver, (PropertySymbol)symbol, diagnostics, resultKind, hasErrors: isError);
6189PropertySymbol propertySymbol,
7730leftType = ((PropertySymbol)leftSymbol).Type;
8263case PropertySymbol propertySymbol:
8557resultType = ((PropertySymbol)symbolOpt).Type;
8712result = BindPropertyAccess(node, left, (PropertySymbol)symbol, diagnostics, lookupResult.Kind, hasErrors: wasError);
8873OverloadResolutionResult<PropertySymbol>? propertyResult = arity != 0 || acceptOnlyMethods ? null : resolveProperties(left, lookupResult, binder, ref actualReceiverArguments, ref useSiteInfo);
9031static OverloadResolutionResult<PropertySymbol>? resolveProperties(
9038ArrayBuilder<PropertySymbol>? properties = null;
9041if (member is PropertySymbol property)
9043properties ??= ArrayBuilder<PropertySymbol>.GetInstance();
9059OverloadResolutionResult<PropertySymbol> overloadResolutionResult = OverloadResolutionResult<PropertySymbol>.GetInstance();
9070OverloadResolutionResult<PropertySymbol> propertyResult,
9090PropertySymbol representativeProperty = propertyResult.PickRepresentativeMember();
9300PropertySymbol propertySymbol,
9595foreach (PropertySymbol property in members)
9939return BindDynamicIndexer(node, expr, arguments, ImmutableArray<PropertySymbol>.Empty, diagnostics);
10263ArrayBuilder<PropertySymbol> indexerGroup = ArrayBuilder<PropertySymbol>.GetInstance();
10267indexerGroup.Add((PropertySymbol)symbol);
10278private static readonly Func<PropertySymbol, bool> s_isIndexedPropertyWithNonOptionalArguments = property =>
10329private BoundExpression BindIndexedPropertyAccess(SyntaxNode syntax, BoundExpression receiver, ImmutableArray<PropertySymbol> propertyGroup, AnalyzedArguments arguments, BindingDiagnosticBag diagnostics)
10334var properties = ArrayBuilder<PropertySymbol>.GetInstance();
10346ImmutableArray<PropertySymbol> applicableProperties,
10389ArrayBuilder<PropertySymbol> propertyGroup,
10394OverloadResolutionResult<PropertySymbol> overloadResolutionResult = OverloadResolutionResult<PropertySymbol>.GetInstance();
10429ArrayBuilder<PropertySymbol> propertyGroup,
10431OverloadResolutionResult<PropertySymbol> overloadResolutionResult,
10442ImmutableArray<PropertySymbol> candidates = propertyGroup.ToImmutable();
10457var candidate = candidates[0];
10478PropertySymbol property = (candidates.Length == 1) ? candidates[0] : CreateErrorPropertySymbol(candidates);
10491MemberResolutionResult<PropertySymbol> resolutionResult = overloadResolutionResult.ValidResult;
10492PropertySymbol property = resolutionResult.Member;
10503this.CheckAndCoerceArguments<PropertySymbol>(syntax, resolutionResult, analyzedArguments, diagnostics, receiver, invokedAsExtensionMethod: false, out argsToParams);
10686candidate is PropertySymbol property &&
10696var properties = ArrayBuilder<PropertySymbol>.GetInstance();
10803if (TryLookupLengthOrCount(syntax, receiverPlaceholder.Type, lookupResult, out var lengthOrCountProperty, diagnostics))
10823[NotNullWhen(true)] out PropertySymbol? lengthOrCountProperty,
10835bool tryLookupLengthOrCount(SyntaxNode syntax, string propertyName, [NotNullWhen(true)] out PropertySymbol? valid, BindingDiagnosticBag diagnostics)
10851lookupResult.Symbols[0] is PropertySymbol property &&
10870private ErrorPropertySymbol CreateErrorPropertySymbol(ImmutableArray<PropertySymbol> propertyGroup)
10873var candidate = propertyGroup[0];
Binder\Binder_Patterns.cs (24)
36internal static PropertySymbol? GetUnionTypeValueProperty(NamedTypeSymbol inputUnionType, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
48if (isSuitableProperty(member, out PropertySymbol? valueProperty))
64static PropertySymbol? reportDiagnosticAndReturnProperty(NamedTypeSymbol memberProvider, PropertySymbol? valueProperty, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
79static bool isSuitableProperty(Symbol m, [NotNullWhen(true)] out PropertySymbol? valueProperty)
81if (m is PropertySymbol prop && hasUnionValueSignature(prop))
91static bool hasUnionValueSignature(PropertySymbol property)
105private delegate bool IsSuitableUnionProperty(Symbol m, [NotNullWhen(true)] out PropertySymbol? member);
107private static PropertySymbol? TryGetOwnOrInheritedUnionProperty(NamedTypeSymbol inputUnionType, string memberName, IsSuitableUnionProperty isSuitableUnionMember, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
113if (getMemberDeclaredInType(declaringType, memberName, isSuitableUnionMember, out PropertySymbol? member))
137static bool getMemberDeclaredInType(NamedTypeSymbol declaringType, string memberName, IsSuitableUnionProperty isSuitableUnionMember, [NotNullWhen(true)] out PropertySymbol? member)
152internal static PropertySymbol? GetUnionTypeValuePropertyNoUseSiteDiagnostics(NamedTypeSymbol inputUnionType)
163internal static PropertySymbol? GetUnionTypeHasValueProperty(NamedTypeSymbol inputUnionType)
173if (isSuitableProperty(member, out PropertySymbol? valueProperty))
187static PropertySymbol? checkAndReturnProperty(PropertySymbol? hasValueProperty)
197static bool isSuitableProperty(Symbol m, [NotNullWhen(true)] out PropertySymbol? hasValueProperty)
199if (m is PropertySymbol prop && hasHasValueSignature(prop))
209static bool hasHasValueSignature(PropertySymbol property)
437internal static bool IsUnionTypeHasValueProperty(NamedTypeSymbol unionType, PropertySymbol property)
807private bool IsCountableAndIndexable(SyntaxNode node, TypeSymbol inputType, out PropertySymbol? lengthProperty)
824hasErrors |= !TryGetSpecialTypeMember(Compilation, SpecialMember.System_Array__Length, node, diagnostics, out PropertySymbol lengthProperty);
2160isLengthOrCount = IsCountableAndIndexable(node, receiverType, out PropertySymbol? lengthProperty) &&
2213case PropertySymbol property:
FlowAnalysis\NullableWalker.cs (41)
705predicate: member => member is PropertySymbol { IsRequired: true },
708var property = (PropertySymbol)member;
783symbol = (Symbol?)(f.AssociatedSymbol as PropertySymbol) ?? f;
794case PropertySymbol p when forcePropertyAnalysis:
866case PropertySymbol { IsRequired: true }:
868case PropertySymbol:
981var prop = symbolToInitialize as PropertySymbol ?? (symbolToInitialize as FieldSymbol)?.AssociatedSymbol as PropertySymbol;
1018if (requiredMember is PropertySymbol { IsAbstract: true } abstractProperty)
1021&& isFilterableOverrideOfAbstractProperty((PropertySymbol)overridingMember))
1043var property = (PropertySymbol)requiredMember;
1068static bool isFilterableOverrideOfAbstractProperty(PropertySymbol property)
2067case PropertySymbol { Name: WellKnownMemberNames.ValuePropertyName } property when
2088case PropertySymbol:
2137var propSymbol = propAccess.PropertySymbol;
2848if (method is SourcePropertyAccessorSymbol { AssociatedSymbol: PropertySymbol prop } && (object)backingField.AssociatedSymbol == prop)
4451if (isSuitableUnionConstruction(type, constructor, out PropertySymbol? valueProperty))
4461static bool isSuitableUnionConstruction(TypeSymbol type, [NotNullWhen(true)] MethodSymbol? constructor, [NotNullWhen(true)] out PropertySymbol? valueProperty)
4494private void SetUnionValueStateFromConstructorArgument(BoundExpression argument, TypeWithState argumentTypeWithState, int containingSlot, PropertySymbol valueProperty)
4604ImmutableArray<ParameterSymbol> parameters = ((PropertySymbol?)symbol)?.Parameters ?? default;
4686argumentsCompletion?.Invoke(argumentResults, ((PropertySymbol?)symbol)?.Parameters ?? default, null);
4712if (symbol is not PropertySymbol { IsStatic: false } property
5049var property = AnonymousTypeManager.GetAnonymousTypeProperty(anonymousType, i);
5070static BoundAnonymousPropertyDeclaration? getDeclaration(BoundAnonymousObjectCreationExpression node, PropertySymbol currentProperty, ref int currentDeclarationIndex)
6081if ((member is PropertySymbol { IsIndexedProperty: false } || member.Kind == SymbolKind.Field) &&
7532PropertySymbol? property,
11275private bool IsPropertyOutputMoreStrictThanInput(PropertySymbol property)
11296var property = left switch
11349var annotations = memberSymbol switch { PropertySymbol prop => prop.GetFlowAnalysisAnnotations(), FieldSymbol field => GetFieldAnnotations(field), _ => FlowAnalysisAnnotations.None };
12108private ReinferenceResult<PropertySymbol> ReInferAndVisitExtensionPropertyAccess(BoundNode node, PropertySymbol property, BoundExpression receiver)
12129var property = node.PropertySymbol;
12135ReinferenceResult<PropertySymbol> reinferenceResult = ReInferAndVisitExtensionPropertyAccess(node, property, node.ReceiverOpt);
12175var indexer = node.Indexer;
12179indexer = (PropertySymbol)AsMemberOfType(receiverType, indexer);
12251PropertySymbol? unionValue = null;
12257if (member is PropertySymbol { Name: WellKnownMemberNames.HasValuePropertyName } property &&
12315var getMethod = ((PropertySymbol)member.OriginalDefinition).GetMethod;
Generated\BoundNodes.xml.Generated.cs (54)
325public BoundPropertyEqualsValue(SyntaxNode syntax, PropertySymbol property, ImmutableArray<LocalSymbol> locals, BoundExpression value, bool hasErrors = false)
336public PropertySymbol Property { get; }
341public BoundPropertyEqualsValue Update(PropertySymbol property, ImmutableArray<LocalSymbol> locals, BoundExpression value)
2180public BoundAwaitableInfo(SyntaxNode syntax, BoundAwaitableValuePlaceholder? awaitableInstancePlaceholder, bool isDynamic, BoundExpression? getAwaiter, PropertySymbol? isCompleted, MethodSymbol? getResult, BoundCall? runtimeAsyncAwaitCall, BoundAwaitableValuePlaceholder? runtimeAsyncAwaitCallPlaceholder, bool hasErrors = false)
2199public PropertySymbol? IsCompleted { get; }
2207public BoundAwaitableInfo Update(BoundAwaitableValuePlaceholder? awaitableInstancePlaceholder, bool isDynamic, BoundExpression? getAwaiter, PropertySymbol? isCompleted, MethodSymbol? getResult, BoundCall? runtimeAsyncAwaitCall, BoundAwaitableValuePlaceholder? runtimeAsyncAwaitCallPlaceholder)
5533public BoundDagPropertyEvaluation(SyntaxNode syntax, PropertySymbol property, bool isLengthOrCount, BoundDagTemp input, bool hasErrors = false)
5544public PropertySymbol Property { get; }
5550public BoundDagPropertyEvaluation Update(PropertySymbol property, bool isLengthOrCount, BoundDagTemp input)
5564public BoundDagIndexEvaluation(SyntaxNode syntax, PropertySymbol property, int index, BoundDagTemp input, bool hasErrors = false)
5575public PropertySymbol Property { get; }
5581public BoundDagIndexEvaluation Update(PropertySymbol property, int index, BoundDagTemp input)
6205public BoundPropertyGroup(SyntaxNode syntax, ImmutableArray<PropertySymbol> properties, BoundExpression? receiverOpt, LookupResultKind resultKind, bool hasErrors = false)
6214public ImmutableArray<PropertySymbol> Properties { get; }
6219public BoundPropertyGroup Update(ImmutableArray<PropertySymbol> properties, BoundExpression? receiverOpt, LookupResultKind resultKind)
7149public BoundAnonymousPropertyDeclaration(SyntaxNode syntax, PropertySymbol property, TypeSymbol type, bool hasErrors)
7159public BoundAnonymousPropertyDeclaration(SyntaxNode syntax, PropertySymbol property, TypeSymbol type)
7170public PropertySymbol Property { get; }
7175public BoundAnonymousPropertyDeclaration Update(PropertySymbol property, TypeSymbol type)
7473public BoundPropertyAccess(SyntaxNode syntax, BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, PropertySymbol propertySymbol, AccessorKind autoPropertyAccessorKind, LookupResultKind resultKind, TypeSymbol type, bool hasErrors = false)
7490public PropertySymbol PropertySymbol { get; }
7497public BoundPropertyAccess Update(BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, PropertySymbol propertySymbol, AccessorKind autoPropertyAccessorKind, LookupResultKind resultKind, TypeSymbol type)
7547public BoundIndexerAccess(SyntaxNode syntax, BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, PropertySymbol indexer, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, bool expanded, AccessorKind accessorKind, ImmutableArray<int> argsToParamsOpt, BitVector defaultArguments, ImmutableArray<PropertySymbol> originalIndexersOpt, TypeSymbol type, bool hasErrors = false)
7571public PropertySymbol Indexer { get; }
7579public ImmutableArray<PropertySymbol> OriginalIndexersOpt { get; }
7584public BoundIndexerAccess Update(BoundExpression? receiverOpt, ThreeState initialBindingReceiverIsSubjectToCloning, PropertySymbol indexer, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, bool expanded, AccessorKind accessorKind, ImmutableArray<int> argsToParamsOpt, BitVector defaultArguments, ImmutableArray<PropertySymbol> originalIndexersOpt, TypeSymbol type)
7688public BoundDynamicIndexerAccess(SyntaxNode syntax, BoundExpression receiver, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<PropertySymbol> applicableIndexers, TypeSymbol type, bool hasErrors = false)
7709public ImmutableArray<PropertySymbol> ApplicableIndexers { get; }
7714public BoundDynamicIndexerAccess Update(BoundExpression receiver, ImmutableArray<BoundExpression> arguments, ImmutableArray<string?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<PropertySymbol> applicableIndexers, TypeSymbol type)
11117PropertySymbol property = this.VisitPropertySymbol(node.Property);
11458PropertySymbol? isCompleted = this.VisitPropertySymbol(node.IsCompleted);
12033PropertySymbol property = this.VisitPropertySymbol(node.Property);
12039PropertySymbol property = this.VisitPropertySymbol(node.Property);
12163ImmutableArray<PropertySymbol> properties = this.VisitSymbols<PropertySymbol>(node.Properties);
12332PropertySymbol property = this.VisitPropertySymbol(node.Property);
12393PropertySymbol propertySymbol = this.VisitPropertySymbol(node.PropertySymbol);
12407PropertySymbol indexer = this.VisitPropertySymbol(node.Indexer);
12408ImmutableArray<PropertySymbol> originalIndexersOpt = this.VisitSymbols<PropertySymbol>(node.OriginalIndexersOpt);
12434ImmutableArray<PropertySymbol> applicableIndexers = this.VisitSymbols<PropertySymbol>(node.ApplicableIndexers);
12729PropertySymbol property = GetUpdatedSymbol(node, node.Property);
13438PropertySymbol? isCompleted = GetUpdatedSymbol(node, node.IsCompleted);
14182PropertySymbol property = GetUpdatedSymbol(node, node.Property);
14189PropertySymbol property = GetUpdatedSymbol(node, node.Property);
14405ImmutableArray<PropertySymbol> properties = GetUpdatedArray(node, node.Properties);
14782PropertySymbol property = GetUpdatedSymbol(node, node.Property);
14942PropertySymbol propertySymbol = GetUpdatedSymbol(node, node.PropertySymbol);
14978PropertySymbol indexer = GetUpdatedSymbol(node, node.Indexer);
14979ImmutableArray<PropertySymbol> originalIndexersOpt = GetUpdatedArray(node, node.OriginalIndexersOpt);
15016ImmutableArray<PropertySymbol> applicableIndexers = GetUpdatedArray(node, node.ApplicableIndexers);
Symbols\Compilation_WellKnownMembers.cs (8)
251internal static Symbol? GetRuntimeMember(NamedTypeSymbol declaringType, in MemberDescriptor descriptor, SignatureComparer<MethodSymbol, FieldSymbol, PropertySymbol, TypeSymbol, ParameterSymbol> comparer, AssemblySymbol? accessWithinOpt)
257internal static Symbol? GetRuntimeMember(ImmutableArray<Symbol> members, in MemberDescriptor descriptor, SignatureComparer<MethodSymbol, FieldSymbol, PropertySymbol, TypeSymbol, ParameterSymbol> comparer, AssemblySymbol? accessWithinOpt)
336PropertySymbol property = (PropertySymbol)member;
1103internal class SpecialMembersSignatureComparer : SignatureComparer<MethodSymbol, FieldSymbol, PropertySymbol, TypeSymbol, ParameterSymbol>
1132protected override TypeSymbol GetPropertyType(PropertySymbol property)
1178protected override ImmutableArray<ParameterSymbol> GetParameters(PropertySymbol property)
1222protected override bool IsByRefProperty(PropertySymbol property)
Symbols\Source\SourceMemberContainerSymbol.cs (26)
1843else if (member is FieldSymbol { AssociatedSymbol: SourcePropertySymbolBase { PartialDefinitionPart: PropertySymbol definition } implementation } &&
2410var indexersBySignature = new Dictionary<PropertySymbol, PropertySymbol>(MemberSignatureComparer.DuplicateSourceComparer);
2422PropertySymbol indexer = (PropertySymbol)symbol;
2472PropertySymbol indexer,
2475Dictionary<PropertySymbol, PropertySymbol> indexersBySignature,
2509if (indexersBySignature.TryGetValue(indexer, out var prevIndexerBySignature))
2720var propertySymbol = (PropertySymbol)symbol;
4523PropertySymbol propertySymbol,
4608private static Location GetAccessorOrPropertyLocation(PropertySymbol propertySymbol, bool getNotSet)
4627private static bool ParametersMatchPropertyAccessor(PropertySymbol propertySymbol, bool getNotSet, ImmutableArray<ParameterSymbol> methodParams)
4830if (!((PropertySymbol)member).IsIndexer)
5098PropertySymbol? equalityContract = isRecordClass ? addEqualityContract() : null;
5124Debug.Assert(isRecordClass || !members.Any(m => m is PropertySymbol { GetMethod.IsEffectivelyReadOnly: false }));
5135Debug.Assert(positionalMembers.All(p => p is PropertySymbol or FieldSymbol));
5387ImmutableArray<PropertySymbol>.Empty);
5411else if (existingMember is PropertySymbol { IsStatic: false, GetMethod: { } } prop
5469MethodSymbol addGetHashCode(PropertySymbol? equalityContract)
5503PropertySymbol addEqualityContract()
5513ImmutableArray<PropertySymbol>.Empty);
5515PropertySymbol equalityContract;
5525equalityContract = (PropertySymbol)existingEqualityContractProperty;
5562MethodSymbol addThisEquals(PropertySymbol? equalityContract)
Symbols\Synthesized\ReadOnlyListType\SynthesizedReadOnlyListTypeSymbol.cs (16)
327(PropertySymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_ICollection__Count)!,
332(PropertySymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_ICollection__IsSynchronized)!,
337(PropertySymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_ICollection__SyncRoot)!,
347(PropertySymbol)((MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__get_Item)!).AssociatedSymbol,
353(PropertySymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__IsFixedSize)!,
358(PropertySymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_IList__IsReadOnly)!,
405((PropertySymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IReadOnlyCollection_T__Count)!).AsMember(iReadOnlyCollectionT),
410((PropertySymbol)((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IReadOnlyList_T__get_Item)!).AssociatedSymbol).AsMember(iReadOnlyListT),
416((PropertySymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_ICollection_T__Count)!).AsMember(iCollectionT),
421((PropertySymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_ICollection_T__IsReadOnly)!).AsMember(iCollectionT),
451((PropertySymbol)((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IList_T__get_Item)!).AssociatedSymbol).AsMember(iListT),
525var listMember = (PropertySymbol)containingType.GetFieldTypeMember(WellKnownMember.System_Collections_Generic_List_T__Count);
710var listMember = (PropertySymbol)((MethodSymbol)containingType.GetFieldTypeMember(WellKnownMember.System_Collections_Generic_List_T__get_Item)).AssociatedSymbol;
770static void addProperty(ArrayBuilder<Symbol> builder, PropertySymbol property)