24 overrides of ContainingType
Microsoft.CodeAnalysis.CSharp (24)
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.FieldSymbol.cs (1)
110public override NamedTypeSymbol ContainingType
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.PropertySymbol.cs (1)
171public override NamedTypeSymbol ContainingType
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.SynthesizedMethodBase.cs (1)
46public override NamedTypeSymbol ContainingType
Symbols\Metadata\PE\PEEventSymbol.cs (1)
225public override NamedTypeSymbol ContainingType
Symbols\Metadata\PE\PEFieldSymbol.cs (1)
170public override NamedTypeSymbol ContainingType
Symbols\Metadata\PE\PEMethodSymbol.cs (1)
446public override NamedTypeSymbol ContainingType => _containingType;
Symbols\Metadata\PE\PEPropertySymbol.cs (1)
406public override NamedTypeSymbol ContainingType
Symbols\NamedTypeSymbol.cs (1)
109public override NamedTypeSymbol ContainingType
Symbols\NamespaceSymbol.cs (1)
90public sealed override NamedTypeSymbol ContainingType
Symbols\Source\SourceEventSymbol.cs (1)
106public override NamedTypeSymbol ContainingType
Symbols\Source\SourceFieldSymbol.cs (1)
106public override NamedTypeSymbol ContainingType
Symbols\Source\SourceMemberMethodSymbol.cs (1)
528public override NamedTypeSymbol ContainingType
Symbols\Source\SourcePropertySymbolBase.cs (1)
535public override NamedTypeSymbol ContainingType
Symbols\SubstitutedFieldSymbol.cs (1)
46public override NamedTypeSymbol ContainingType
Symbols\SubstitutedMethodSymbol.cs (1)
198public override NamedTypeSymbol ContainingType
Symbols\SubstitutedPropertySymbol.cs (1)
47public override NamedTypeSymbol ContainingType
Symbols\Synthesized\Records\SynthesizedPrimaryConstructorParameterBackingFieldSymbol.cs (1)
68public override NamedTypeSymbol ContainingType
Symbols\Synthesized\SynthesizedBackingFieldSymbol.cs (1)
259public override NamedTypeSymbol ContainingType
Symbols\Synthesized\SynthesizedFieldSymbolBase.cs (1)
152public override NamedTypeSymbol ContainingType
Symbols\Synthesized\SynthesizedGlobalMethodSymbol.cs (1)
82public sealed override NamedTypeSymbol ContainingType
Symbols\Synthesized\SynthesizedImplementationMethod.cs (1)
120public sealed override NamedTypeSymbol ContainingType
Symbols\Synthesized\SynthesizedInstanceConstructor.cs (1)
60public sealed override NamedTypeSymbol ContainingType
Symbols\Synthesized\SynthesizedIntrinsicOperatorSymbol.cs (1)
321public override NamedTypeSymbol ContainingType
Symbols\Synthesized\SynthesizedStaticConstructor.cs (1)
30public override NamedTypeSymbol ContainingType
811 references to ContainingType
Microsoft.CodeAnalysis.CSharp (687)
Binder\Binder.cs (1)
432_ => member.ContainingType
Binder\Binder.ValueChecks.cs (21)
109return implementationMethod.AsMember(method.ContainingSymbol.ContainingType). 110ConstructIfGeneric(method.ContainingType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.Concat(method.TypeArgumentsWithAnnotations)); 1130getItemOrSliceHelper = getItemOrSliceHelper.AsMember(getItemOrSliceHelper.ContainingType.Construct(ImmutableArray.Create(elementAccess.Expression.Type.TryGetInlineArrayElementField().TypeWithAnnotations))); 1390if (RequiresAssignableVariable(valueKind) && !backingField.ContainingType.IsReferenceType && (this.ContainingMemberOrLambda as MethodSymbol)?.IsEffectivelyReadOnly == true) 1639if (fieldSymbol.IsStatic || fieldSymbol.ContainingType.IsReferenceType) 1665? TypeSymbol.Equals(fieldSymbol.ContainingType, containing.ContainingType, TypeCompareKind.AllIgnoreOptions) 1667: TypeSymbol.Equals(fieldSymbol.ContainingType.OriginalDefinition, containing.ContainingType.OriginalDefinition, TypeCompareKind.AllIgnoreOptions))) 1722if (fieldSymbol.IsStatic || fieldSymbol.ContainingType.IsReferenceType) 1744if (fieldSymbol.IsStatic || fieldSymbol.ContainingType.IsReferenceType) 1769if (eventSymbol.IsStatic || eventSymbol.ContainingType.IsReferenceType) 2344var extensionParameter = symbol.ContainingType.ExtensionParameter; 2763return method.ContainingType.IsRefLikeType; 3211if (!_underlyingParameter.ContainingType.IsInterface || _type.IsReferenceType) 3243if (!_underlyingParameter.ContainingType.IsInterface || _type.IsReferenceType) 3612if (eventSymbol.IsStatic || eventSymbol.ContainingType.IsReferenceType) 4255if (fieldSymbol.IsStatic || !fieldSymbol.ContainingType.IsRefLikeType) 4919if (fieldSymbol.IsStatic || !fieldSymbol.ContainingType.IsRefLikeType) 5502this._symbol.ContainingType, 5542_symbol.ContainingType,
Binder\Binder_Await.cs (1)
157if (containingMemberOrLambda.ContainingType.IsScriptClass)
Binder\Binder_Conversions.cs (3)
1069ReportDiagnosticsIfObsolete(diagnostics, collectionBuilderMethod.ContainingType, syntax, hasBaseReceiver: false); 1521member.ContainingType, 2996return method.ContainingType.ExtensionParameter;
Binder\Binder_Expressions.cs (16)
56var containingType = memberOpt?.ContainingType; 1483var implicitReceiver = field.IsStatic ? null : ThisReference(node, field.ContainingType, wasCompilerGenerated: true); 1958var declaringType = members[0].ContainingType; 2307NamedTypeSymbol declaringType = member.ContainingType; 4838NamedTypeSymbol containingType = constructor.ContainingType; 4998NamedTypeSymbol baseType = constructor.ContainingType.BaseTypeNoUseSiteDiagnostics; 5123if (resultMember is null || resultMember.ContainingType.SpecialType != SpecialType.System_Object) 5170return constructor.ContainingType is SourceNamedTypeSymbol sourceType && 6147constructor.ContainingType.HasRequiredMembersError) // An error will be reported on the constructor if from source, or a use-site diagnostic will be reported on the use if from metadata. 6152return constructor.ContainingType.AllRequiredMembers; 6666this.IsSymbolAccessibleConditional(constructor, containingType, ref useSiteInfo, constructor.ContainingType); 8050Debug.Assert(propertySymbol.ContainingType.ExtensionParameter is not null); 8054receiver = CheckAndConvertExtensionReceiver(receiver, propertySymbol.ContainingType.ExtensionParameter, diagnostics); 8864NamedTypeSymbol type = fieldSymbol.ContainingType; 9037if (symbol.ContainingType?.IsInterface == true) 10565return new ErrorPropertySymbol(candidate.ContainingType, propertyType, candidate.Name, candidate.IsIndexer, candidate.IsIndexedProperty);
Binder\Binder_Initializers.cs (3)
147Debug.Assert((ContainingMemberOrLambda is TypeSymbol containing && TypeSymbol.Equals(containing, fieldSymbol.ContainingType, TypeCompareKind.ConsiderEverything2)) || //should be the binder for the type 148fieldSymbol.ContainingType.IsImplicitClass); //however, we also allow fields in namespaces to help support script scenarios 152binder = new WithPrimaryConstructorParametersBinder(fieldSymbol.ContainingType, binder);
Binder\Binder_Invocation.cs (7)
1067if (call.ReceiverOpt.Type.IsRestrictedType() && !call.Method.ContainingType.IsInterface && !TypeSymbol.Equals(call.Method.ContainingType, call.ReceiverOpt.Type, TypeCompareKind.ConsiderEverything2)) 1069SymbolDistinguisher distinguisher = new SymbolDistinguisher(compilation, call.ReceiverOpt.Type, call.Method.ContainingType); 1075SymbolDistinguisher distinguisher = new SymbolDistinguisher(compilation, this.ContainingType, call.Method.ContainingType); 1292receiver = CheckAndConvertExtensionReceiver(receiver, method.ContainingType.ExtensionParameter, diagnostics); 1846TypeSymbol.Equals(containingMethod.ContainingType, method.ContainingType, TypeCompareKind.ConsiderEverything) &&
Binder\Binder_Lookup.cs (5)
1095((options & LookupOptions.NamespacesOrTypesOnly) == 0 || !(current.IsSingleViable && TypeSymbol.Equals(current.SingleSymbolOrDefault.ContainingType, type, TypeCompareKind.AllIgnoreOptions)))) // The nested type will shadow everything from bases 1304var hiddenContainer = sym.ContainingType; 1310var hidingContainer = hidingSym.ContainingType; 1319if (!IsDerivedType(baseType: hiddenContainer, derivedType: hidingSym.ContainingType, basesBeingResolved, this.Compilation, useSiteInfo: ref useSiteInfo) && 1407symbol = symbol.ContainingType;
Binder\Binder_Operators.cs (14)
477Debug.Assert(method.ContainingType.ExtensionParameter is not null); 496leftConversion = CreateConversion(node, leftPlaceholder, conversion, isCast: false, conversionGroupOpt: null, method.ContainingType.ExtensionParameter.Type, diagnostics); 1519Debug.Assert(!(signature.Method?.ContainingType?.IsInterface ?? false)); 1683NamedTypeSymbol t = (NamedTypeSymbol)signature.Method.ContainingType; 1694SourceUserDefinedOperatorSymbol.IsSelfConstrainedTypeParameter((definition = signature.Method.OriginalDefinition).ReturnType.StrippedType(), definition.ContainingType)); 1839NamespaceSymbol.AddExtensionContainersInType(signature.Method.OriginalDefinition.ContainingType.ContainingType, extensions); 1855Error(diagnostics, ErrorCode.ERR_MustHaveOpTF, syntax, signature.Method, signature.Method.OriginalDefinition.ContainingType.ContainingType); 2119if (operatorMethod.ContainingType.IsInterface && 3433Debug.Assert(method.ContainingType.ExtensionParameter is not null); 3452operandConversion = CreateConversion(node, operandPlaceholder, conversion, isCast: false, conversionGroupOpt: null, method.ContainingType.ExtensionParameter.Type, diagnostics); 3778return typeComparer.Equals(x.ContainingType, y.ContainingType) && 3788int result = typeComparer.GetHashCode(method.ContainingType); 3807if (methodOpt?.ContainingType?.IsInterface == true && methodOpt.IsStatic)
Binder\Binder_Statements.cs (9)
1279((object)fixedPatternMethod == null || fixedPatternMethod.ContainingType.SpecialType != SpecialType.System_String)) 1787new CSDiagnosticInfo(ErrorCode.ERR_BadEventUsage, leastOverridden, leastOverridden.ContainingType) : 1808TypeSymbol.Equals(sourceProperty.ContainingType, fromMember.ContainingType, TypeCompareKind.AllIgnoreOptions) && 1815if (!propertySymbol.IsDefinition && propertySymbol.ContainingType.Equals(propertySymbol.ContainingType.OriginalDefinition, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)) 3852NamedTypeSymbol containingType = constructor.ContainingType; 3953NamedTypeSymbol baseType = constructor.ContainingType.BaseTypeNoUseSiteDiagnostics; 3982if (!AccessCheck.IsSymbolAccessible(baseConstructor, constructor.ContainingType, ref useSiteInfo)) 3993BoundExpression receiver = new BoundThisReference(syntax, constructor.ContainingType) { WasCompilerGenerated = true };
Binder\Binder_Symbols.cs (1)
1781symbol.MergeUseSiteInfo(ref info, symbol.ContainingType.GetUseSiteInfo());
Binder\BinderFactory.BinderFactoryVisitor.cs (2)
1246nextBinder = new WithExtensionParameterBinder(method.ContainingType, nextBinder); 1285nextBinder = new WithExtensionParameterBinder(property.ContainingType, nextBinder);
Binder\DecisionDagBuilder.cs (2)
330var iTupleType = getLengthProperty.ContainingType; 365while (input.Source is BoundDagTypeEvaluation source && isDerivedType(source.Input.Type, symbol.ContainingType))
Binder\ForEachLoopBinder.cs (2)
252else if (getEnumeratorMethod.GetIsNewExtensionMember() && getEnumeratorMethod.ContainingType.ExtensionParameter.RefKind == RefKind.Ref) 1048builder.CollectionType = builder.GetEnumeratorInfo.Method.ContainingType.ExtensionParameter.Type;
Binder\InMethodBinder.cs (2)
338typeParameters = _methodSymbol.ContainingType.TypeParameters.Concat(typeParameters); 340if (_methodSymbol.ContainingType.ExtensionParameter is { Name: not "" } receiver)
Binder\LockBinder.cs (1)
88!TypeSymbol.Equals(scopeType.ContainingType, lockType, TypeCompareKind.ConsiderEverything))
Binder\RefSafetyAnalysis.cs (3)
44var type = symbol.ContainingType; 672return method.ContainingType.ExtensionParameter; 1203resultType: node.EnumeratorInfoOpt.GetEnumeratorInfo.Method.ContainingType,
Binder\Semantics\AccessCheck.cs (2)
106symbol = symbol.ContainingType; 212return IsMemberAccessible(symbol.ContainingType, symbol.DeclaredAccessibility, within, throughTypeOpt, out failedThroughTypeCheck, compilation, ref useSiteInfo);
Binder\Semantics\Conversions\Conversions.cs (3)
347thisParameter = method.ContainingType.ExtensionParameter; 361else if (method.ContainingType.IsNullableType() && !method.IsOverride) 485if (method.ContainingType.IsNullableType() && !method.IsOverride)
Binder\Semantics\Operators\BinaryOperatorOverloadResolution.cs (9)
847equalsIgnoringNullableAndDynamic(op.Signature.Method.ContainingType, existingSignature.Method.ContainingType)) 1516NamedTypeSymbol extension = method.ContainingType; 1586Debug.Assert(candidate.Method.ContainingType.ExtensionParameter is not null); 1604var extensionParameter = method.ContainingType.ExtensionParameter; 1613Debug.Assert(candidate.Method.ContainingType.ExtensionParameter is not null); 1617if (!candidate.Method.ContainingType.ExtensionParameter.Type.IsValidNullableTypeArgument() || 1618!Conversions.ConvertExtensionMethodThisArg(MakeNullable(candidate.Method.ContainingType.ExtensionParameter.Type), operand.Type, ref useSiteInfo, isMethodGroupConversion: false).Exists) 1623else if (!Conversions.ConvertExtensionMethodThisArg(candidate.Method.ContainingType.ExtensionParameter.Type, operand.Type, ref useSiteInfo, isMethodGroupConversion: false).Exists)
Binder\Semantics\Operators\UnaryOperatorOverloadResolution.cs (11)
165NamedTypeSymbol extension = method.ContainingType; 227Debug.Assert(candidate.Method.ContainingType.ExtensionParameter is not null); 233if (!candidate.Method.ContainingType.ExtensionParameter.Type.IsValidNullableTypeArgument() || 234!Conversions.ConvertExtensionMethodThisArg(MakeNullable(candidate.Method.ContainingType.ExtensionParameter.Type), operand.Type, ref useSiteInfo, isMethodGroupConversion: false).Exists) 239else if (!Conversions.ConvertExtensionMethodThisArg(candidate.Method.ContainingType.ExtensionParameter.Type, operand.Type, ref useSiteInfo, isMethodGroupConversion: false).Exists) 259if (x.OriginalDefinition.ContainingType.ContainingType != (object)x.OriginalDefinition.ContainingType.ContainingType) 264var xExtension = x.OriginalDefinition.ContainingType; 266var yExtension = y.OriginalDefinition.ContainingType; 293int result = typeComparer.GetHashCode(op.OriginalDefinition.ContainingType.ContainingType); 295var extension = op.OriginalDefinition.ContainingType;
Binder\Semantics\OverloadResolution\MethodTypeInference.cs (1)
3281constructedFromMethod.ContainingType,
Binder\Semantics\OverloadResolution\OverloadResolution.cs (25)
815else if (member.GetIsNewExtensionMember() && member.ContainingType is { } extension && ConstraintsHelper.RequiresChecking(extension)) 906NamedTypeSymbol containingType = member.ContainingType; 1127NamedTypeSymbol memberContainingType = member.ContainingType; 1386checkOverrideContainingType && !moreDerivedOverride.ContainingType.IsDerivedFrom(member.ContainingType, TypeCompareKind.ConsiderEverything, ref useSiteInfo) || 1420if (!member.ContainingType.IsClassType()) 1439NamedTypeSymbol memberContainingType = member.ContainingType; 1442NamedTypeSymbol otherContainingType = otherMember.ContainingType; 1479|| (result.Member.GetIsNewExtensionMember() && !typeArgumentsAccessible(result.Member.ContainingType.GetMemberTypeArgumentsNoUseSiteDiagnostics(), ref useSiteInfo))) 1611if (IsLessDerivedThanAny(index: f, result.LeastOverriddenMember.ContainingType, results, ref useSiteInfo)) 1636var currentType = result.LeastOverriddenMember.ContainingType; 1705var type = result.LeastOverriddenMember.ContainingType; 1727if (member.ContainingType.IsInterfaceType()) 1894? memberWithPriority.ContainingType.ContainingType 1895: memberWithPriority.ContainingType; 2496if (m1.Member.ContainingType.TypeKind == TypeKind.Submission && m2.Member.ContainingType.TypeKind == TypeKind.Submission) 2596ParameterSymbol? extensionParameter = member.ContainingType.ExtensionParameter; 3893Debug.Assert(member.ContainingType.ExtensionParameter is not null); 3894hasSomeRefKinds |= member.ContainingType.ExtensionParameter.RefKind != RefKind.None; 4378? method.ContainingType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.Concat(method.TypeArgumentsWithAnnotations) 4384var result = property.ContainingType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics; 4416member.ContainingType, 4435if (member.ContainingType.Arity > 0) 4437var extensionTypeArguments = MethodTypeInferrer.InferTypeArgumentsFromReceiverType(member.ContainingType, args[0], _binder.Compilation, _binder.Conversions, ref useSiteInfo);
Binder\Semantics\OverloadResolution\OverloadResolution_ArgsToParameters.cs (1)
62return [symbol.ContainingType.ExtensionParameter.TypeWithAnnotations, .. symbol.GetParameterTypes()];
BoundTree\Constructors.cs (3)
62!fieldSymbol.ContainingType.IsValueType || 254: this(syntax, constructor, ImmutableArray.Create<BoundExpression>(arguments), default(ImmutableArray<string?>), default(ImmutableArray<RefKind>), false, default(ImmutableArray<int>), default(BitVector), null, null, constructor.ContainingType) 258: this(syntax, constructor, arguments, default(ImmutableArray<string?>), default(ImmutableArray<RefKind>), false, default(ImmutableArray<int>), default(BitVector), null, null, constructor.ContainingType)
CodeGen\CodeGenerator_HasHome.cs (1)
245if (!TypeSymbol.Equals(field.ContainingType, containingSymbol.ContainingSymbol as NamedTypeSymbol, TypeCompareKind.AllIgnoreOptions))
CodeGen\EmitConversion.cs (2)
354if (!method.IsStatic && method.IsMetadataVirtual() && !method.ContainingType.IsDelegateType() && !receiver.SuppressVirtualCalls) 361method = method.GetConstructedLeastOverriddenMethod(_method.ContainingType, requireSameReturnType: true);
CodeGen\EmitExpression.cs (13)
179var thisType = _method.ContainingType; 1150Debug.Assert(!field.IsConst || field.ContainingType.SpecialType == SpecialType.System_Decimal, 1656Debug.Assert(TypeSymbol.Equals(method.ContainingType, receiver.Type, TypeCompareKind.ConsiderEverything2)); 1661EmitSymbolToken(method.ContainingType, call.Syntax); 1879NamedTypeSymbol methodContainingType = method.ContainingType; 1980actualMethodTargetedByTheCall = method.GetConstructedLeastOverriddenMethod(_method.ContainingType, requireSameReturnType: true); 1983if (callKind == CallKind.ConstrainedCallVirt && actualMethodTargetedByTheCall.ContainingType.IsValueType) 2000if (IsThisReceiver(receiver) && actualMethodTargetedByTheCall.ContainingType.IsSealed && 2326Debug.Assert(method.ContainingType.IsVerifierValue(), "this is not a value type"); 2339var containingType = method.ContainingType; 2521if (originalDef.ContainingType.Name == NamedTypeSymbol.ValueTupleTypeName && 3726EmitSymbolToken(node.Method.ContainingType, node.Syntax); 3753EmitSymbolToken(node.Field.ContainingType, node.Syntax);
CodeGen\EmitStackAllocInitializer.cs (1)
74var readOnlySpan = spanGetItemDefinition.ContainingType.Construct(elementType);
Compilation\CSharpCompilation.cs (2)
2014if (candidate.IsGenericMethod || candidate.ContainingType.IsGenericType) 3105return IsDefinedOrImplementedInSourceTree(symbol.ContainingType, tree, span);
Compilation\InitializerSemanticModel.cs (2)
279Debug.Assert(MemberSymbol.ContainingType is SourceMemberContainerTypeSymbol); 280return MemberSymbol.ContainingType is SourceMemberContainerTypeSymbol type &&
Compilation\SyntaxTreeSemanticModel.cs (1)
1279outer = outer.GetFieldInitializerBinder(symbol, suppressBinderFlagsFieldInitializer: !this.IsRegularCSharp && symbol.ContainingType.IsScriptClass);
Compiler\ClsComplianceChecker.cs (10)
330CheckParameterCompliance(symbol.Parameters, symbol.ContainingType); 331CheckTypeParameterCompliance(symbol.TypeParameters, symbol.ContainingType); 375CheckParameterCompliance(symbol.Parameters, symbol.ContainingType); 501NamedTypeSymbol containingType = symbol.ContainingType; 545NamedTypeSymbol containingType = symbol.ContainingType; 738System.Diagnostics.Debug.Assert(method.ContainingType.TypeKind == TypeKind.Delegate); 739symbol = method.ContainingType; // Refer to the delegate type in diagnostics. 760if (!IsCompliantType(type, symbol.ContainingType)) 1174Symbol containing = (Symbol)symbol.ContainingType ?? symbol.ContainingAssembly; 1228symbol = symbol.ContainingType;
Compiler\DocumentationCommentCompiler.cs (3)
426var symbolForDocComments = symbol is SynthesizedRecordPropertySymbol ? symbol.ContainingType : symbol; 810symbol = symbol.ContainingType; 1238diagnostics.AddDependencies(symbol as TypeSymbol ?? symbol.ContainingType);
Compiler\MethodBodySynthesizer.cs (6)
37Debug.Assert((object)constructor.ContainingType.BaseTypeNoUseSiteDiagnostics == null || constructor.ContainingType.BaseTypeNoUseSiteDiagnostics.SpecialType == SpecialType.System_Object); 40BoundExpression receiver = new BoundThisReference(syntax, constructor.ContainingType) { WasCompilerGenerated = true }; 96var thisReference = new BoundThisReference(syntax, submissionConstructor.ContainingType) { WasCompilerGenerated = true }; 548method.ContainingType) 595NamedTypeSymbol baseType = method.ContainingType.BaseTypeNoUseSiteDiagnostics;
Compiler\MethodBodySynthesizer.Lowered.cs (3)
384NamedTypeSymbol equalityComparerType = system_Collections_Generic_EqualityComparer_T__GetHashCode.ContainingType; 418NamedTypeSymbol equalityComparerType = equalityComparer_Equals.ContainingType; 465BoundExpression invocation = F.Call(methodToInvoke.IsStatic ? null : (useBaseReference ? (BoundExpression)F.Base(baseType: methodToInvoke.ContainingType) : F.This()),
Compiler\MethodCompiler.cs (13)
248synthesizedEntryPoint = new SynthesizedEntryPointSymbol.AsyncForwardEntryPoint(compilation, entryPoint.ContainingType, entryPoint); 252moduleBeingBuilt.AddSynthesizedDefinition(entryPoint.ContainingType, synthesizedEntryPoint.GetCciAdapter()); 283new TypeCompilationState(synthesizedEntryPoint.ContainingType, compilation, moduleBeingBuilt), 859if (!interfaces.Contains(synthesizedExplicitImpl.ExplicitInterfaceImplementations[0].ContainingType, 933if (methodSymbol.IsAbstract || methodSymbol.ContainingType?.IsDelegateType() == true) 1059Debug.Assert(!prependedDefaultValueTypeConstructorInitializer || methodSymbol.ContainingType.IsStructType()); 1073((methodSymbol.ContainingType.IsStructType() && !methodSymbol.IsImplicitConstructor) || 1492method.ContainingType, 1535method.ContainingType, 1553method.ContainingType, 2453Debug.Assert(!method.ContainingType.IsDelegateType()); 2478if (ctorCall != null && !ctorCall.HasAnyErrors && ctorCall.Method != method && TypeSymbol.Equals(ctorCall.Method.ContainingType, method.ContainingType, TypeCompareKind.ConsiderEverything2))
Compiler\SynthesizedMetadataCompiler.cs (1)
80if (!interfaces.Contains(synthesizedExplicitImpl.ExplicitInterfaceImplementations[0].ContainingType,
DocumentationComments\DocumentationCommentIDVisitor.PartVisitor.cs (5)
68Visit(symbol.ContainingType, builder); 101Visit(symbol.ContainingType, builder); 127Visit(symbol.ContainingType, builder); 141Visit(symbol.ContainingType, builder); 164for (NamedTypeSymbol curr = containingSymbol.ContainingType; (object)curr != null; curr = curr.ContainingType)
Emitter\EditAndContinue\CSharpSymbolMatcher.cs (1)
541var otherType = (NamedTypeSymbol?)Visit(member.ContainingType);
Emitter\Model\EventSymbolAdapter.cs (2)
109return AdaptedEventSymbol.ContainingType.GetCciAdapter(); 129return AdaptedEventSymbol.ContainingType.GetCciAdapter();
Emitter\Model\FieldSymbolAdapter.cs (2)
97return moduleBeingBuilt.Translate(AdaptedFieldSymbol.ContainingType, 276return AdaptedFieldSymbol.ContainingType.GetCciAdapter();
Emitter\Model\MethodSymbolAdapter.cs (14)
58(!AdaptedMethodSymbol.IsGenericMethod || PEModuleBuilder.IsGenericType(AdaptedMethodSymbol.ContainingType))) 60Debug.Assert((object)AdaptedMethodSymbol.ContainingType != null && 61PEModuleBuilder.IsGenericType(AdaptedMethodSymbol.ContainingType)); 84NamedTypeSymbol containingType = AdaptedMethodSymbol.ContainingType; 276NamedTypeSymbol container = AdaptedMethodSymbol.ContainingType; 316return ((SourceMemberContainerTypeSymbol)AdaptedMethodSymbol.ContainingType.ContainingType).GetExtensionGroupingInfo().GetCorrespondingMarkerType(marker); 320var containingType = AdaptedMethodSymbol.ContainingType; 324return AdaptedMethodSymbol.ContainingType.GetCciAdapter(); 419return !AdaptedMethodSymbol.ContainingType.IsExtension && AdaptedMethodSymbol.IsExternal; 446return !AdaptedMethodSymbol.ContainingType.IsExtension && AdaptedMethodSymbol.GetDllImportData() != null; 455return AdaptedMethodSymbol.ContainingType.IsExtension ? null : AdaptedMethodSymbol.GetDllImportData(); 462return AdaptedMethodSymbol.ContainingType.IsExtension ? default : AdaptedMethodSymbol.ImplementationAttributes; 636return this.IsExtern || (object)ContainingType != null && ContainingType.TypeKind == TypeKind.Delegate;
Emitter\Model\NamedTypeSymbolAdapter.cs (2)
392Debug.Assert(body.ContainingType == (object)container); 395if (!interfaces.Contains(implemented.ContainingType, SymbolEqualityComparer.ConsiderEverything))
Emitter\Model\PEModuleBuilder.cs (4)
1187else if (!needDeclaration && IsGenericType(fieldSymbol.ContainingType)) 1253NamedTypeSymbol container = methodSymbol.ContainingType; 1327NamedTypeSymbol container = methodSymbol.ContainingType; 1435IsGenericType(container.ContainingType);
Emitter\Model\PropertySymbolAdapter.cs (4)
227var containingType = AdaptedPropertySymbol.ContainingType; 231return AdaptedPropertySymbol.ContainingType.GetCciAdapter(); 255var containingType = AdaptedPropertySymbol.ContainingType; 259return AdaptedPropertySymbol.ContainingType.GetCciAdapter();
Emitter\Model\SpecializedGenericMethodInstanceReference.cs (2)
27Debug.Assert(PEModuleBuilder.IsGenericType(underlyingMethod.ContainingType) && underlyingMethod.ContainingType.IsDefinition);
Emitter\Model\TypeMemberReference.cs (1)
21return moduleBeingBuilt.Translate(UnderlyingSymbol.ContainingType, (CSharpSyntaxNode)context.SyntaxNode, context.Diagnostics);
Emitter\NoPia\EmbeddedTypesManager.cs (3)
453var containerKind = field.AdaptedFieldSymbol.ContainingType.TypeKind; 460ReportNotEmbeddableSymbol(ErrorCode.ERR_InteropStructContainsMethods, field.AdaptedFieldSymbol.ContainingType, syntaxNodeOpt, diagnostics, this); 614NamedTypeSymbol namedType = member.AdaptedSymbol.ContainingType;
FlowAnalysis\AbstractFlowPass.cs (1)
2242fieldSymbol.ContainingType.TypeKind == TypeKind.Struct &&
FlowAnalysis\DefiniteAssignment.cs (5)
103&& CurrentSymbol is MethodSymbol { MethodKind: MethodKind.Constructor, ContainingType.TypeKind: TypeKind.Struct }; 1259Debug.Assert(CurrentSymbol is MethodSymbol { MethodKind: MethodKind.Constructor, ContainingType.TypeKind: TypeKind.Struct }); 1263NamedTypeSymbol containingType = thisParameter.ContainingType; 1312if (CurrentSymbol is not MethodSymbol { MethodKind: MethodKind.Constructor, ContainingType.TypeKind: TypeKind.Struct }) 1493if (fieldSymbol.ContainingType.IsReferenceType || fieldSymbol.IsStatic) return null;
FlowAnalysis\FlowAnalysisPass.cs (1)
114NamedTypeSymbol containingType = method.ContainingType;
FlowAnalysis\LocalDataFlowPass.cs (2)
165TypeSymbol containingType = symbol.ContainingType; 172while (!TypeSymbol.Equals(containingType, symbol.ContainingType, TypeCompareKind.ConsiderEverything))
FlowAnalysis\NullableWalker.cs (45)
669? method.ContainingType.GetMembersUnordered().SelectManyAsArray( 679foreach (var member in method.ContainingType.GetMembersUnordered()) 694if (chainedConstructorEnforcesRequiredMembers && !constructorEnforcesRequiredMembers && method.ContainingType.BaseTypeNoUseSiteDiagnostics is { } baseType) 914&& (!method.ContainingType.IsValueType 918return membersToBeInitialized(method.ContainingType, includeAllMembers: true, includeCurrentTypeRequiredMembers, includeBaseRequiredMembers); 923return membersToBeInitialized(method.ContainingType, includeAllMembers: method.IncludeFieldInitializersInBody(), includeCurrentTypeRequiredMembers, includeBaseRequiredMembers); 1019foreach (var member in property.ContainingType.GetMembers(notNullMemberName)) 1062foreach (var member in method.ContainingType.GetMembers(memberName)) 1098enforceMemberNotNullWhenIfAffected(returnStatement.Syntax, sense: true, members: method.ContainingType.GetMembers(memberName), state: pendingReturn.StateWhenTrue, otherState: pendingReturn.StateWhenFalse); 1103enforceMemberNotNullWhenIfAffected(returnStatement.Syntax, sense: false, members: method.ContainingType.GetMembers(memberName), state: pendingReturn.StateWhenFalse, otherState: pendingReturn.StateWhenTrue); 1129foreach (var member in method.ContainingType.GetMembers(memberName)) 1182var type = method.ContainingType; 1501&& method.ContainingType is SourceMemberContainerTypeSymbol containingType) 2255if ((constructor.IsStatic && containingSlot == 0 && constructor.ContainingType.Equals(symbol.ContainingType)) 2715TypeSymbol possibleBase = possibleMember.ContainingType; 3767(FieldSymbol { ContainingType: { IsTupleType: true }, TupleElementIndex: var oi } originalField, FieldSymbol { ContainingType: { IsTupleType: true }, TupleElementIndex: var ui } updatedField) => 4195var containingType = constructor?.ContainingType; 5386TypeSymbol methodContainer = method.ContainingType; 5395else if (method.ContainingType.Arity != 0) 5397NamedTypeSymbol extension = method.OriginalDefinition.ContainingType; 5759var containingType = this._symbol?.ContainingType; 6511Debug.Assert(node.Method.ContainingType.ExtensionParameter is not null); 6512annotations = node.Method.ContainingType.ExtensionParameter.FlowAnalysisAnnotations; 6663ParameterSymbol? extensionParameter = method.ContainingType.ExtensionParameter; 6698ParameterSymbol? extensionParameter = method.ContainingType.ExtensionParameter; 6787var wellKnownType = wellKnownMethod.ContainingType; 6808if (implementationMethod.ContainingType.IsInterface) 6839while (!baseType.Equals(implementationMethod.ContainingType) && method is object) 6841if (baseType.Equals(method.ContainingType)) 6855if (method is object && baseType.Equals(method.ContainingType)) 6980method.ContainingType.IsReferenceType) 7278if (member.ContainingType is { } extension && ConstraintsHelper.RequiresChecking(extension)) 7602var type = method.ContainingType; 8319definition.ContainingType, 8690var symbolContainer = symbol.ContainingType; 8702Debug.Assert(symbol.ContainingType.IsDefinition); 9775var newExtensionFormOffset = parameterOpt?.ContainingType.IsExtension is true ? 1 : 0; 10349ParameterSymbol? receiverParameter = isNewExtensionMethod ? method.ContainingType.ExtensionParameter : method.Parameters[0]; 10738var receiverParameter = isNewExtension ? deconstructMethod.ContainingType.ExtensionParameter : deconstructMethod.Parameters[0]; 11342var extensionParameter = property.ContainingType.ExtensionParameter; 11518if ((object)getMethod != null && getMethod.ContainingType.SpecialType == SpecialType.System_Nullable_T) 12019else if (method.ContainingType.Arity != 0) 12021NamedTypeSymbol extension = method.OriginalDefinition.ContainingType;
FlowAnalysis\ReadWriteWalker.cs (1)
178if (expr.FieldSymbol.ContainingType.IsReferenceType) return;
Lowering\AsyncRewriter\AsyncExceptionHandlerRewriter.cs (2)
40Debug.Assert(TypeSymbol.Equals(factory.CurrentType, (containingType ?? containingMethod.ContainingType), TypeCompareKind.ConsiderEverything2)); 449exceptionDispatchInfoCapture.ContainingType,
Lowering\AsyncRewriter\AsyncMethodToStateMachineRewriter.cs (1)
431? F.StaticCall(methodSymbol.ContainingType, methodSymbol, receiver)
Lowering\BoundTreeToDifferentEnclosingContextRewriter.cs (6)
180if (property.ContainingType.IsAnonymousType) 187.AsMember((NamedTypeSymbol)TypeMap.SubstituteType(property.ContainingType).AsTypeSymbolOnly()) 206if (method.ContainingType.IsAnonymousType) 209var newType = (NamedTypeSymbol)TypeMap.SubstituteType(method.ContainingType).AsTypeSymbolOnly(); 210if (ReferenceEquals(newType, method.ContainingType)) 231.AsMember((NamedTypeSymbol)TypeMap.SubstituteType(method.ContainingType).AsTypeSymbolOnly())
Lowering\ClosureConversion\ClosureConversion.cs (10)
330get { return _topLevelMethod.ContainingType; } 435translatedLambdaContainer = _topLevelMethod.ContainingType; 457translatedLambdaContainer = _topLevelMethod.ContainingType; 462Debug.Assert((object)translatedLambdaContainer != _topLevelMethod.ContainingType || 682Debug.Assert(TypeSymbol.Equals(frameType, constructor.ContainingType, TypeCompareKind.ConsiderEverything2)); 854return (!_currentMethod.IsStatic && TypeSymbol.Equals(_currentMethod.ContainingType, _topLevelMethod.ContainingType, TypeCompareKind.ConsiderEverything2)) 856: FramePointer(node.Syntax, _topLevelMethod.ContainingType); // technically, not the correct static type 1024var translatedLambdaContainer = synthesizedMethod.ContainingType; 1066receiver = new BoundTypeExpression(syntax, null, synthesizedMethod.ContainingType);
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (1)
767unquoted = _bound.Call(_bound.MethodInfo(method, createDelegate.ContainingType), createDelegate, _bound.Typeof(delegateType, createDelegate.Parameters[0].Type), receiver);
Lowering\DiagnosticsPass_ExpressionTrees.cs (2)
278Binder.ReportDiagnosticsIfObsolete(_diagnostics, node.EventSymbol.AssociatedField, node.Syntax, hasBaseReceiver, _containingSymbol, _containingSymbol.ContainingType, BinderFlags.None); 292Binder.ReportDiagnosticsIfObsolete(_diagnostics, node.Event, ((AssignmentExpressionSyntax)node.Syntax).Left, hasBaseReceiver, _containingSymbol, _containingSymbol.ContainingType, BinderFlags.None);
Lowering\DiagnosticsPass_Warnings.cs (4)
116TypeSymbol baseType = fieldAccess.FieldSymbol.ContainingType; 154if ((object)interlocked != null && TypeSymbol.Equals(interlocked, method.ContainingType, TypeCompareKind.ConsiderEverything2)) 238(object)method.ContainingType == null || 239!method.ContainingType.IsComImport)
Lowering\ExtensionMethodBodyRewriter.cs (1)
178.AsMember((NamedTypeSymbol)TypeMap.SubstituteType(symbol.ContainingType).AsTypeSymbolOnly());
Lowering\ExtensionMethodReferenceRewriter.cs (2)
158method = implementationMethod.AsMember(method.ContainingSymbol.ContainingType). 159ConstructIfGeneric(method.ContainingType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.Concat(method.TypeArgumentsWithAnnotations));
Lowering\InitializerRewriter.cs (1)
95new BoundThisReference(syntax, field.ContainingType);
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (1)
145var containingType = method.ContainingType;
Lowering\Instrumentation\LocalStateTracingInstrumenter.cs (1)
176if (IsSameOrNestedType(method.ContainingType, contextType))
Lowering\Instrumentation\ModuleCancellationInstrumenter.cs (4)
132lastArgumentType.Equals(_throwMethod.ContainingType, TypeCompareKind.ConsiderEverything)) 166foreach (var member in methodDefinition.ContainingType.GetMembers(method.Name)) 190lastParamType.Equals(_throwMethod.ContainingType, TypeCompareKind.ConsiderEverything) && 216var result = overload.AsMember(method.ContainingType);
Lowering\IteratorRewriter\IteratorFinallyMethodSymbol.cs (1)
206get { return ContainingType.Locations; }
Lowering\LocalRewriter\DelegateCacheContainer.cs (1)
35(owner.ContainingType is { IsExtension: true } extensionType ? extensionType.TypeParameters : []).Concat(
Lowering\LocalRewriter\DelegateCacheRewriter.cs (1)
226FindTypeParameters(method.ContainingType, result);
Lowering\LocalRewriter\LocalRewriter.cs (3)
72Debug.Assert(TypeSymbol.Equals(factory.CurrentType, (containingType ?? containingMethod.ContainingType), TypeCompareKind.ConsiderEverything2)); 925if (!lhsField.IsStatic && lhsField.ContainingType.IsStructType()) 1144ParameterSymbol? extensionParameter = member.ContainingType.ExtensionParameter;
Lowering\LocalRewriter\LocalRewriter.DecisionDagRewriter.cs (1)
175!method.ContainingType.SpecialType.IsPrimitiveRecursiveStruct();
Lowering\LocalRewriter\LocalRewriter.PatternLocalRewriter.cs (1)
177receiver = _factory.Type(method.ContainingType);
Lowering\LocalRewriter\LocalRewriter_Call.cs (11)
48NamedTypeSymbol firstContainer = node.ApplicableMethods.First().ContainingType; 49Debug.Assert(node.ApplicableMethods.All(m => !m.RequiresInstanceReceiver && TypeSymbol.Equals(m.ContainingType, firstContainer, TypeCompareKind.ConsiderEverything2))); 165Debug.Assert(!interceptor.ContainingType.IsGenericType); 170method.ContainingType.GetAllTypeArgumentsNoUseSiteDiagnostics(typeArgumentsBuilder); 204var isAccessible = AccessCheck.IsSymbolAccessible(interceptor, containingMethod.ContainingType, ref useSiteInfo); 468method.ContainingType.IsObjectType() && 952Debug.Assert(methodOrIndexer.ContainingType.ExtensionParameter is { }); 954RefKind receiverRefKind = methodOrIndexer.ContainingType.ExtensionParameter.RefKind; 1310Debug.Assert(methodOrIndexer.ContainingType.ExtensionParameter is not null); 1311return methodOrIndexer.ContainingType.ExtensionParameter.Type as NamedTypeSymbol; 1314return (NamedTypeSymbol?)methodOrIndexer.ContainingType;
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (1)
860var spanOfElementType = spanCtorArray.ContainingType.Construct(arrayType.ElementType);
Lowering\LocalRewriter\LocalRewriter_CompoundAssignmentOperator.cs (4)
258return symbol.GetIsNewExtensionMember() && !symbol.IsStatic && symbol.ContainingType.ExtensionParameter is { RefKind: RefKind.None, Type.IsReferenceType: false }; 516if (indexer.ContainingType.IsComImport) 617var memberContainingType = fieldOrEvent.ContainingType; 1051if (method.ContainingType?.IsNullableType() == true)
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (2)
568var receiver = (!method.RequiresInstanceReceiver && !oldNodeOpt.IsExtensionMethod && !method.IsAbstract && !method.IsVirtual) ? _factory.Type(method.ContainingType) : mg.ReceiverOpt; 1868Debug.Assert(!meth.ContainingType.IsInterface);
Lowering\LocalRewriter\LocalRewriter_DelegateCreationExpression.cs (1)
35var receiver = (!method.RequiresInstanceReceiver && !node.IsExtensionMethod && !method.IsAbstract && !method.IsVirtual) ? _factory.Type(method.ContainingType) : VisitExpression(mg.ReceiverOpt)!;
Lowering\LocalRewriter\LocalRewriter_Event.cs (4)
24if (rewrittenReceiverOpt != null && node.Event.ContainingAssembly.IsLinked && node.Event.ContainingType.IsInterfaceType()) 26var @interface = node.Event.ContainingType; 278_diagnostics.Add(new CSDiagnosticInfo(ErrorCode.ERR_MissingPredefinedMember, invocationListProperty.ContainingType, accessorName), syntax.Location); 310BoundExpression eventInfo = _factory.New(ctor, _factory.Typeof(node.Event.ContainingType, ctor.Parameters[0].Type), _factory.Literal(node.Event.MetadataName));
Lowering\LocalRewriter\LocalRewriter_Field.cs (4)
26if (fieldSymbol.ContainingType.IsTupleType) 55var tupleType = tupleField.ContainingType; 72if (!TypeSymbol.Equals(underlyingField.ContainingType, currentLinkType, TypeCompareKind.ConsiderEverything2)) 91while (!TypeSymbol.Equals(underlyingField.ContainingType, currentLinkType, TypeCompareKind.ConsiderEverything2));
Lowering\LocalRewriter\LocalRewriter_ForEachStatement.cs (2)
336idisposableTypeSymbol = disposeMethod.ContainingType; 498if (!receiver.Type.IsReferenceType && method.ContainingType.IsInterface)
Lowering\LocalRewriter\LocalRewriter_IndexerAccess.cs (2)
282MethodSymbol createSpan = getCreateSpanHelper(node, spanType: getItemOrSliceHelper.ContainingType, intType: (NamedTypeSymbol)getItemOrSliceHelper.Parameters[0].Type); 430NamedTypeSymbol spanType = getItemOrSliceHelper.ContainingType;
Lowering\LocalRewriter\LocalRewriter_Literal.cs (6)
73curMethod.ContainingType.SpecialType != SpecialType.System_Decimal) && 91if (useField is { HasUseSiteError: false, ContainingType: { HasUseSiteError: false } }) 133Debug.Assert(ctor.ContainingType.SpecialType == SpecialType.System_Decimal); 139constantValueOpt: constantValue, initializerExpressionOpt: null, type: ctor.ContainingType); 152Debug.Assert(ctor.ContainingType.SpecialType == SpecialType.System_DateTime); 159constantValueOpt: ConstantValue.NotAvailable, initializerExpressionOpt: null, type: ctor.ContainingType);
Lowering\LocalRewriter\LocalRewriter_NullCoalescingOperator.cs (1)
201if (method.IsStatic && method.ContainingType.SpecialType == SpecialType.System_String)
Lowering\LocalRewriter\LocalRewriter_ObjectCreationExpression.cs (2)
77rewrittenObjectCreation = node.Update(constructor, rewrittenArguments, argumentRefKindsOpt, MakeObjectCreationInitializerForExpressionTree(node.InitializerExpressionOpt), changeTypeOpt: constructor.ContainingType); 94rewrittenObjectCreation = node.Update(constructor, rewrittenArguments, argumentRefKindsOpt, newInitializerExpression: null, changeTypeOpt: constructor.ContainingType);
Lowering\LocalRewriter\LocalRewriter_ObjectOrCollectionInitializerExpression.cs (3)
700Debug.Assert(_compilation.Conversions.ClassifyConversionFromType(rewrittenReceiver.Type, memberSymbol.ContainingType, isChecked: false, ref discardedUseSiteInfo).IsImplicit || 701(memberSymbol.GetIsNewExtensionMember() && !memberSymbol.IsStatic && ConversionsBase.IsValidExtensionMethodThisArgConversion(_compilation.Conversions.ClassifyConversionFromType(rewrittenReceiver.Type, memberSymbol.ContainingType.ExtensionParameter!.Type, isChecked: false, ref discardedUseSiteInfo))) || 702_compilation.Conversions.HasImplicitConversionToOrImplementsVarianceCompatibleInterface(rewrittenReceiver.Type, memberSymbol.ContainingType, ref discardedUseSiteInfo, out _));
Lowering\LocalRewriter\LocalRewriter_StringConcat.cs (2)
445var readOnlySpanOfChar = readOnlySpanCtorRefParamGeneric.ContainingType.Construct(charType); 494type: readOnlySpanCtorRefParamChar.ContainingType);
Lowering\LocalRewriter\LoweredDynamicOperationFactory.cs (1)
596return _factory.ArrayOrEmpty(argumentInfoFactory.ContainingType, infos);
Lowering\MethodToClassRewriter.cs (8)
322.AsMember((NamedTypeSymbol)this.VisitType(node.Field.ContainingType)); 331.AsMember((NamedTypeSymbol)this.VisitType(node.FieldSymbol.ContainingType)); 360if (!property.ContainingType.IsAnonymousType) 364.AsMember((NamedTypeSymbol)TypeMap.SubstituteType(property.ContainingType).AsTypeSymbolOnly()); 368var newType = (NamedTypeSymbol)TypeMap.SubstituteType(property.ContainingType).AsTypeSymbolOnly(); 369if (ReferenceEquals(newType, property.ContainingType)) 391.AsMember((NamedTypeSymbol)TypeMap.SubstituteType(field.ContainingType).AsTypeSymbolOnly()); 436TypeMap? typeMap = methodBeingWrapped.ContainingType is SubstitutedNamedTypeSymbol substitutedType ? substitutedType.TypeSubstitution : TypeMap.Empty;
Lowering\SpillSequenceSpiller.cs (2)
419var receiver = Spill(builder, field.ReceiverOpt, fieldSymbol.ContainingType.IsValueType ? refKind : RefKind.None); 925if (field.FieldSymbol.ContainingType.IsReferenceType)
Lowering\StateMachineRewriter\IteratorAndAsyncCaptureWalker.cs (2)
64if (!method.IsStatic && method.ContainingType.TypeKind == TypeKind.Struct) 242case BoundFieldAccess { FieldSymbol: { IsStatic: false, ContainingType: { IsValueType: true } }, ReceiverOpt: BoundExpression receiver }:
Lowering\StateMachineRewriter\MethodToStateMachineRewriter.cs (2)
193get { return OriginalMethod.ContainingType; } 621var isFieldOfStruct = !field.FieldSymbol.ContainingType.IsReferenceType;
Lowering\StateMachineRewriter\StateMachineRewriter.cs (2)
63Debug.Assert(TypeSymbol.Equals(F.CurrentType, method.ContainingType, TypeCompareKind.ConsiderEverything2)); 239var containingType = method.ContainingType;
Lowering\StateMachineRewriter\StateMachineTypeSymbol.cs (2)
36get { return KickoffMethod.ContainingType; } 62var kickoffType = KickoffMethod.ContainingType;
Lowering\StateMachineRewriter\SynthesizedStateMachineProperty.cs (2)
25_name = ExplicitInterfaceHelpers.GetMemberName(interfacePropertyGetter.AssociatedSymbol.Name, interfacePropertyGetter.ContainingType, aliasQualifierOpt: null); 26var getterName = ExplicitInterfaceHelpers.GetMemberName(interfacePropertyGetter.Name, interfacePropertyGetter.ContainingType, aliasQualifierOpt: null);
Lowering\SyntheticBoundNodeFactory.cs (9)
76_currentType = value.ContainingType; 104: this(topLevelMethod, topLevelMethod.ContainingType, node, compilationState, diagnostics, instrumentationState) 134Debug.Assert(TopLevelMethod is null || TypeSymbol.Equals(TopLevelMethod.ContainingType, CurrentType, TypeCompareKind.ConsiderEverything2)); 143TypeSymbol.Equals(CurrentFunction.ContainingType, CurrentType, TypeCompareKind.ConsiderEverything2)); 774constructor.ContainingType) 1320GetMethodFromHandleMethod(ctor.ContainingType, constructorInfo), 1419if (!method.ContainingType.IsValueType || !Microsoft.CodeAnalysis.CSharp.CodeGen.CodeGenerator.MayUseCallForStructMethod(method)) 1427GetMethodFromHandleMethod(method.ContainingType, systemReflectionMethodInfo), 1443GetFieldFromHandleMethod(field.ContainingType),
Operations\CSharpOperationFactory.cs (1)
2583boundITuplePattern.GetLengthMethod.ContainingType.GetPublicSymbol(),
Symbols\AnonymousTypes\AnonymousTypeManager.SymbolCollection.cs (1)
101ReportErrorOnSymbol(symbol.ContainingType, diagnostics, ref hasError);
Symbols\AnonymousTypes\AnonymousTypeManager.Templates.cs (1)
780NamedTypeSymbol translatedType = TranslateAnonymousTypeSymbol(method.ContainingType);
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.FieldSymbol.cs (2)
107get { return _property.ContainingType; } 114return _property.ContainingType;
Symbols\ConstraintsHelper.cs (2)
937if (constructedContainingSymbol.GetIsNewExtensionMember() && constructedContainingSymbol.ContainingType is { Arity: > 0 } extension 1619|| (method.GetIsNewExtensionMember() && !method.ContainingType.IsDefinition));
Symbols\ConstructedMethodSymbol.cs (1)
20map: new TypeMap(constructedFrom.ContainingType, ((MethodSymbol)constructedFrom.OriginalDefinition).TypeParameters, typeArgumentsWithAnnotations),
Symbols\ErrorTypeSymbol.ErrorTypeParameterSymbol.cs (2)
197other.ContainingType.Equals(this.ContainingType, comparison);
Symbols\EventSymbol.cs (3)
350return TypeSymbol.Equals(this.ContainingType, other.ContainingType, compareKind) && ReferenceEquals(this.OriginalDefinition, other.OriginalDefinition); 356hash = Hash.Combine(this.ContainingType, hash);
Symbols\Extensions\SourceExtensionImplementationMethodSymbol.cs (4)
22: base(sourceMethod, TypeMap.Empty, sourceMethod.ContainingType.TypeParameters.Concat(sourceMethod.TypeParameters)) 25Debug.Assert(sourceMethod.IsStatic || sourceMethod.ContainingType.ExtensionParameter is not null); 67public sealed override Symbol ContainingSymbol => _originalMethod.ContainingType.ContainingSymbol; 128parameters.Add(new ExtensionMetadataMethodParameterSymbol(this, ((SourceNamedTypeSymbol)_originalMethod.ContainingType).ExtensionParameter!));
Symbols\FieldSymbol.cs (4)
438return ContainingType.IsTupleType ? this : null; 474if (!ContainingType.IsTupleType) 479if (!ContainingType.IsDefinition) 485int arity = ContainingType.Arity;
Symbols\MemberSymbolExtensions.cs (13)
111&& symbol.ContainingType.ExtensionParameter is { } foundExtensionParameter) 125return member.ContainingType.Arity + member.GetMemberArity(); 138? method.ContainingType.TypeParameters.Concat(method.TypeParameters) 145return property.ContainingType.TypeParameters; 157if (method.GetIsNewExtensionMember() && method.Arity > 0 && method.ContainingType.Arity > 0) 159Debug.Assert(originalTypeParameters.Length == method.Arity + method.ContainingType.Arity); 186if (symbol.GetIsNewExtensionMember() && symbol.ContainingType.ExtensionParameter is { } extensionParameter) 197bool hasExtensionParameter = symbol.GetIsNewExtensionMember() && symbol.ContainingType.ExtensionParameter is { }; 211NamedTypeSymbol extension = method.ContainingType; 232NamedTypeSymbol extension = property.ContainingType; 364Debug.Assert(symbol.ContainingType.IsInterface); 634&& !(methodSymbol.HasThisConstructorInitializer(out var initializerSyntax) && !methodSymbol.ContainingType.IsDefaultValueTypeConstructor(initializerSyntax)) 690method.ContainingType?.IsValueType == true &&
Symbols\Metadata\PE\PEMethodSymbol.cs (5)
804Debug.Assert(TypeSymbol.Equals(propertyOrEventSymbol.ContainingType, _containingType, TypeCompareKind.ConsiderEverything2)); 1364if (!method.ContainingType.IsInterface) 1368(method.ContainingType.SpecialType == SpecialType.System_Object && 1386if (method.ContainingType.IsInterface) 1397if (method.ContainingType.IsClassType())
Symbols\Metadata\PE\PENamedTypeSymbol.cs (1)
470Debug.Assert(method.ContainingType == (object)this);
Symbols\Metadata\PE\PEParameterSymbol.cs (3)
309typeSymbol = NativeIntegerTypeDecoder.TransformType(typeSymbol, handle, moduleSymbol, containingSymbol.ContainingType); 872&& ContainingType is PENamedTypeSymbol { IsExtension: true } containingPE 1219PEPropertySymbol => new MetadataDecoder(containingModule, (PENamedTypeSymbol)ContainingType),
Symbols\MethodSymbol.cs (7)
369internal virtual bool IsEffectivelyReadOnly => (IsDeclaredReadOnly || ContainingType?.IsReadOnly == true) && IsValidReadOnlyTarget; 371protected bool IsValidReadOnlyTarget => !IsStatic && ContainingType.IsStructType() && MethodKind != MethodKind.Constructor && !IsInitOnly; 657return MethodKind == MethodKind.Constructor && ContainingType.IsScriptClass; 823return this.ContainingType; 1051if (isGenericMethod(this) || ContainingType.IsGenericType) 1275if (methodToAttribute.ShouldCheckRequiredMembers() && methodToAttribute.ContainingType.HasAnyRequiredMembers) 1300return this.ContainingType.TryGetCorrespondingExtensionImplementationMethod(this);
Symbols\MethodSymbolExtensions.cs (2)
61else if (method.ContainingType.SpecialType == SpecialType.System_Object) 221method.ContainingType is NamedTypeSymbol containingType &&
Symbols\OverriddenOrHiddenMembersHelpers.cs (14)
114NamedTypeSymbol containingType = member.ContainingType; 183FindOverriddenOrHiddenMembers(member, member.ContainingType, memberIsFromSomeCompilation, out hiddenBuilder, 284if ((object)overriddenAccessor != null && IsOverriddenSymbolAccessible(overriddenAccessor, accessor.ContainingType) && 374if ((object)overriddenAccessor != null && IsOverriddenSymbolAccessible(overriddenAccessor, accessor.ContainingType) && 413NamedTypeSymbol containingType = member.ContainingType; 717(!representativeMember.ContainingType.IsDefinition || representativeMember.IsIndexer()); 792Debug.Assert(representativeMember.Kind == SymbolKind.Property || !representativeMember.ContainingType.IsDefinition); 796foreach (Symbol otherMember in representativeMember.ContainingType.GetMembers(representativeMember.Name)) 856Debug.Assert(representativeMember.Kind == SymbolKind.Property || !representativeMember.ContainingType.IsDefinition); 859foreach (Symbol otherMember in representativeMember.ContainingType.GetMembers(representativeMember.Name)) 975csharpOverriddenMethod.ContainingType.Equals(runtimeOverriddenMethod.ContainingType, TypeCompareKind.CLRSignatureCompareOptions); 991foreach (Symbol otherMethod in method.ContainingType.GetMembers(method.Name)) 1027NamedTypeSymbol containingType = method.ContainingType;
Symbols\OverriddenOrHiddenMembersResult.cs (2)
60NamedTypeSymbol overriddenByDefinitionContaining = overriddenByDefinitionMember.ContainingType; 62for (NamedTypeSymbol baseType = substitutedOverridingMember.ContainingType.BaseTypeNoUseSiteDiagnostics;
Symbols\ParameterSymbol.cs (1)
169(refKind == RefKind.Ref && ContainingSymbol.ContainingType.IsComImport));
Symbols\PropertySymbol.cs (5)
169var property = (PropertySymbol)this.GetLeastOverriddenMember(this.ContainingType); 181var property = (PropertySymbol)this.GetLeastOverriddenMember(this.ContainingType); 475return TypeSymbol.Equals(this.ContainingType, other.ContainingType, compareKind) && ReferenceEquals(this.OriginalDefinition, other.OriginalDefinition); 481hash = Hash.Combine(this.ContainingType, hash);
Symbols\PublicModel\Symbol.cs (1)
75return UnderlyingSymbol.ContainingType.GetPublicSymbol();
Symbols\Retargeting\RetargetingMethodSymbol.cs (1)
136new TypeWithAnnotations.Boxed(this.RetargetingTranslator.Retarget(_underlyingMethod.ReturnTypeWithAnnotations, RetargetOptions.RetargetPrimitiveTypesByTypeCode, this.ContainingType)),
Symbols\Retargeting\RetargetingNamedTypeSymbol.cs (1)
114Debug.Assert(method.ContainingType == (object)this);
Symbols\Retargeting\RetargetingPropertySymbol.cs (1)
70if (type.Type.TryAsDynamicIfNoPia(this.ContainingType, out TypeSymbol asDynamic))
Symbols\Retargeting\RetargetingSymbolTranslator.cs (5)
891var containingType = method.ContainingType; 939var containingType = property.ContainingType; 955var containingType = @event.ContainingType; 1055NamedTypeSymbol containingType = _toFind.ContainingType; 1167newAttributeType = newAttributeCtor.ContainingType;
Symbols\Source\ExplicitInterfaceHelpers.cs (5)
126var unsubstitutedInterfaceType = unsubstitutedPropertyImplemented.ContainingType; 189var containingType = implementingMember.ContainingType; 308if (!AccessCheck.IsSymbolAccessible(implementedMember, implementingMember.ContainingType, ref useSiteInfo, throughTypeOpt: null)) 332!AccessCheck.IsSymbolAccessible(accessor, implementingMember.ContainingType, ref useSiteInfo, throughTypeOpt: null)) 385NamedTypeSymbol explicitInterfaceType = implementedMember.ContainingType;
Symbols\Source\FieldSymbolWithAttributesAndModifiers.cs (4)
146var containingSourceType = (SourceMemberContainerTypeSymbol)ContainingType; 328if (this.ContainingType.Layout.Kind != LayoutKind.Explicit) 339if (this.ContainingType.Layout.Kind == LayoutKind.Explicit) 421AddSynthesizedAttribute(ref attributes, moduleBuilder.SynthesizeNullableAttributeIfNecessary(this, ContainingType.GetNullableContextValue(), type));
Symbols\Source\ModifierUtils.cs (4)
505if (symbol.ContainingType?.IsInterface == true && !symbol.ContainingAssembly.RuntimeSupportsDefaultInterfaceImplementation) 521case FieldSymbol when !symbol.IsAsRestrictive(symbol.ContainingType, ref useSiteInfo): 522case PropertySymbol { SetMethod: { } method } when !method.IsAsRestrictive(symbol.ContainingType, ref useSiteInfo): 524diagnostics.Add(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, errorLocation, symbol, symbol.ContainingType);
Symbols\Source\ParameterHelpers.cs (5)
219typeParameters = owner.ContainingType.TypeParameters.Concat(typeParameters); 221if (owner.ContainingType.ExtensionParameter is { Name: not "" } receiver) 526NamedTypeSymbol extension = extensionMember.ContainingType; 860|| (containingSymbol is FunctionPointerMethodSymbol or { ContainingType: not null }) 867ErrorFacts.GetStaticClassParameterCode(containingSymbol?.ContainingType?.IsInterfaceType() ?? false),
Symbols\Source\SourceAssemblySymbol.cs (5)
2232if ((object)forwardedType.ContainingType != null) 2234diagnostics.Add(ErrorCode.ERR_ForwardedTypeIsNested, GetAssemblyAttributeLocationForDiagnostic(arguments.AttributeSyntaxOpt), forwardedType, forwardedType.ContainingType); 2612var container = field.ContainingType as SourceMemberContainerTypeSymbol; 2706var containingType = field.ContainingType as SourceNamedTypeSymbol; 2767var containingType = field.ContainingType as SourceNamedTypeSymbol;
Symbols\Source\SourceComplexParameterSymbol.cs (2)
1270ParameterSymbol? extensionParameter = ContainingType.ExtensionParameter; 1678method.ContainingType.IsAtLeastAsVisibleAs(ContainingSymbol, ref useSiteInfo);
Symbols\Source\SourceEventAccessorSymbol.cs (1)
63name = ExplicitInterfaceHelpers.GetMemberName(accessorName, explicitlyImplementedEventOpt.ContainingType, aliasQualifierOpt);
Symbols\Source\SourceMemberContainerSymbol.cs (11)
916for (Symbol? container = this.ContainingType; !(container is null); container = container.ContainingType) 2211((ConstructorDeclarationSyntax)constructor.SyntaxRef.GetSyntax()).Identifier.ValueText != method1.ContainingType.Name) 2219((object)underlying1.ContainingType == underlying2.ContainingType || 2220((SourceNamedTypeSymbol)underlying1.ContainingType).ExtensionGroupingName == ((SourceNamedTypeSymbol)underlying2.ContainingType).ExtensionGroupingName) && 2256"~" + method1.ContainingType.Name : 2257(method1.IsConstructor() ? method1.ContainingType.Name : method1.Name); 2298if (!indexer.GetIsNewExtensionMember() && indexer.ContainingType.Arity > 0) 2301foreach (TypeParameterSymbol typeParameter in indexer.ContainingType.TypeParameters) 2961if (method.IsOverride && method.GetConstructedLeastOverriddenMethod(this, requireSameReturnType: false).ContainingType.SpecialType == Microsoft.CodeAnalysis.SpecialType.System_Object)
Symbols\Source\SourceMemberContainerSymbol_ImplementationChecks.cs (15)
256(!implementingMember.ContainingType.Equals(this, TypeCompareKind.ConsiderEverything) && 269wasImplementingMemberFound && implementingMember.ContainingType.IsInterface) 271HasBaseInterfaceDeclaringInterface(implementingMember.ContainingType, @interface, ref matchResult); 320if (synthesizedImplementation.ForwardingMethod is not null || TypeSymbol.Equals(implementingMember.ContainingType, this, TypeCompareKind.ConsiderEverything2)) 681if (symbol.ContainingType.IsInterface) 835NamedTypeSymbol overridingType = overridingMember.ContainingType; 874var overridingType = overridingMember.ContainingType; 929var leastOverriddenMember = overriddenMember.GetLeastOverriddenMember(overriddenMember.ContainingType); 1052var overridingType = overridingProperty.ContainingType; 1597if (!hidingMember.ContainingType.IsInterface) 1672if (!hiddenMember.IsAbstract || !hidingMember.ContainingType.IsAbstract) 1850IsOverrideOfPossibleImplementationUnderRuntimeRules(implementingMethod, @interfaceMethod.ContainingType)) 1874if (implementingMethod.ContainingType != (object)this) 1876if (implementingMethod.ContainingType.IsInterface || 1915NamedTypeSymbol type = implementingMethod.ContainingType;
Symbols\Source\SourceMethodSymbol.cs (4)
51else if (ContainingType is SourceMemberContainerTypeSymbol type) 113if (target.IsDeclaredReadOnly && !target.ContainingType.IsReadOnly) 178!target.ContainingType.IsImplicitlyDeclared && 237AddSynthesizedAttribute(ref attributes, moduleBuilder.SynthesizeExtensionMarkerAttribute(target, ((SourceNamedTypeSymbol)target.ContainingType).ExtensionMarkerName));
Symbols\Source\SourceMethodSymbolWithAttributes.cs (13)
599CSharpAttributeData.DecodeMemberNotNullAttribute<MethodWellKnownAttributeData>(ContainingType, ref arguments); 604CSharpAttributeData.DecodeMemberNotNullWhenAttribute<MethodWellKnownAttributeData>(ContainingType, ref arguments); 626if (ContainingType.IsInterface || IsExplicitInterfaceImplementation) 724else if (this.ContainingType.IsInterfaceType()) 844if (isAnyNestedMethodGeneric || ContainingType?.IsGenericType == true) 954Debug.Assert(ContainingType is object); 972if (IsGenericMethod || ContainingType.IsGenericType) 1352if (!this.GetIsNewExtensionMember() && ContainingType.IsGenericType) 1491diagnostics.Add(ErrorCode.ERR_ComImportWithImpl, this.GetFirstLocation(), this, ContainingType); 1503&& !this.ContainingType.IsComImport) 1559for (NamedTypeSymbol curr = this.ContainingType; (object)curr != null; curr = curr.ContainingType) 1651return this.ContainingType.IsInterface && 1743if (this.ContainingType.IsComImport && this.MethodKind == MethodKind.Constructor)
Symbols\Source\SourceNamedTypeSymbol.cs (1)
227diagnostics.Add(ErrorCode.WRN_TypeParameterSameAsOuterTypeParameter, location, name, tpEnclosing.ContainingType);
Symbols\Source\SourceNamedTypeSymbol_Extension.cs (5)
266if (typeParameter.ContainingType.IsExtension) 1035Debug.Assert(method.ContainingType == (object)this); 1167NamedTypeSymbol extension = extensionMember.ContainingType; 1189Debug.Assert(result.ContainingType.ExtensionParameter is not null); 1191Conversion conversion = compilation.Conversions.ConvertExtensionMethodThisArg(parameterType: result.ContainingType.ExtensionParameter.Type, receiverType, ref discardedUseSiteInfo, isMethodGroupConversion: false);
Symbols\Source\SourceOrdinaryMethodSymbol.cs (1)
1169diagnostics.Add(ErrorCode.WRN_TypeParameterSameAsOuterTypeParameter, location, name, tpEnclosing.ContainingType);
Symbols\Source\SourcePropertyAccessorSymbol.cs (1)
704name = ExplicitInterfaceHelpers.GetMemberName(accessorName, explicitlyImplementedPropertyOpt.ContainingType, aliasQualifierOpt);
Symbols\Source\SynthesizedAttributeData.cs (1)
47public override NamedTypeSymbol AttributeClass => _wellKnownMember.ContainingType;
Symbols\Source\ThisParameterSymbol.cs (2)
134internal ThisParameterSymbol(MethodSymbol forMethod) : this(forMethod, forMethod.ContainingType) 152if (ContainingType?.TypeKind != TypeKind.Struct)
Symbols\SubstitutedFieldSymbol.cs (2)
119return (object)other != null && TypeSymbol.Equals(_containingType, other.ContainingType, compareKind) && OriginalDefinition == other.OriginalDefinition; 131if (containingHashCode != this.OriginalDefinition.ContainingType.GetHashCode())
Symbols\SubstitutedMethodSymbol.cs (4)
44Debug.Assert(TypeSymbol.Equals(originalDefinition.ContainingType, containingSymbol.OriginalDefinition, TypeCompareKind.ConsiderEverything2)); 202return _containingSymbol is NamedTypeSymbol nt ? nt : _containingSymbol.ContainingType; 376if (containingHashCode == this.OriginalDefinition.ContainingType.GetHashCode() && 444if (!TypeSymbol.Equals(this.ContainingType, other.ContainingType, compareKind)) return false;
Symbols\Symbol.cs (5)
136return container.ContainingType; 257if (ContainingType?.TypeKind == TypeKind.Submission) 279if (ContainingType.TypeKind == TypeKind.Submission) 290Debug.Assert(ContainingType.TypeKind != TypeKind.Submission); 326return this.ContainingType;
Symbols\SymbolExtensions.cs (4)
41return symbol is NamedTypeSymbol && (object?)symbol.ContainingType != null; 180type = symbol.ContainingType; 303var upperLevelType = symbol.Kind == SymbolKind.NamedType ? (NamedTypeSymbol)symbol : symbol.ContainingType; 527return !symbol.IsSealed && (symbol.IsAbstract || symbol.IsVirtual) && (symbol.ContainingType?.IsInterface ?? false);
Symbols\Synthesized\ReadOnlyListType\SynthesizedReadOnlyListEnumeratorTypeSymbol.cs (4)
55var containingType = (SynthesizedReadOnlyListEnumeratorTypeSymbol)method.ContainingType; 67var containingType = (SynthesizedReadOnlyListEnumeratorTypeSymbol)method.ContainingType; 79var containingType = (SynthesizedReadOnlyListEnumeratorTypeSymbol)method.ContainingType; 98var containingType = (SynthesizedReadOnlyListEnumeratorTypeSymbol)method.ContainingType;
Symbols\Synthesized\ReadOnlyListType\SynthesizedReadOnlyListProperty.cs (1)
25Name = ExplicitInterfaceHelpers.GetMemberName(interfaceProperty.Name, interfaceProperty.ContainingType, aliasQualifierOpt: null);
Symbols\Synthesized\ReadOnlyListType\SynthesizedReadOnlyListTypeSymbol.cs (16)
474var containingType = (SynthesizedReadOnlyListTypeSymbol)method.ContainingType; 490interfaceMethod.ContainingType, 499var containingType = (SynthesizedReadOnlyListTypeSymbol)method.ContainingType; 558var containingType = (SynthesizedReadOnlyListTypeSymbol)method.ContainingType; 568else if (containingType.IsArray || !interfaceMethod.ContainingType.IsGenericType) 574interfaceMethod.ContainingType, 594var containingType = (SynthesizedReadOnlyListTypeSymbol)method.ContainingType; 602if (!interfaceMethod.ContainingType.IsGenericType) 622else if (containingType.IsArray || !interfaceMethod.ContainingType.IsGenericType) 628interfaceMethod.ContainingType, 651var containingType = (SynthesizedReadOnlyListTypeSymbol)method.ContainingType; 685var containingType = (SynthesizedReadOnlyListTypeSymbol)method.ContainingType; 699else if (containingType.IsArray || !interfaceMethod.ContainingType.IsGenericType) 705interfaceMethod.ContainingType, 748var equalityComparerType = equalityComparer_Equals.ContainingType; 774Debug.Assert(_field.Type.OriginalDefinition.Equals(symbol.ContainingType, TypeCompareKind.AllIgnoreOptions));
Symbols\Synthesized\Records\SynthesizedPrimaryConstructorParameterBackingFieldSymbol.cs (1)
69=> ParameterSymbol.ContainingSymbol.ContainingType;
Symbols\Synthesized\Records\SynthesizedRecordBaseEquals.cs (1)
45!overridden.ContainingType.Equals(ContainingType.BaseTypeNoUseSiteDiagnostics, TypeCompareKind.AllIgnoreOptions))
Symbols\Synthesized\Records\SynthesizedRecordCopyCtor.cs (2)
135if (member is MethodSymbol { ContainingType.IsRecord: true, MethodKind: MethodKind.Constructor } method) 145NamedTypeSymbol containingType = member.ContainingType;
Symbols\Synthesized\Records\SynthesizedRecordEqualityContractProperty.cs (4)
104if (overriding.ContainingType.BaseTypeNoUseSiteDiagnostics.IsObjectType()) 120!overridden.ContainingType.Equals(overriding.ContainingType.BaseTypeNoUseSiteDiagnostics, TypeCompareKind.AllIgnoreOptions)) 128diagnostics.Add(ErrorCode.ERR_DoesNotOverrideBaseEqualityContract, overriding.GetFirstLocation(), overriding, overriding.ContainingType.BaseTypeNoUseSiteDiagnostics);
Symbols\Synthesized\Records\SynthesizedRecordEquals.cs (2)
107if (baseEquals is null || !baseEquals.ContainingType.Equals(ContainingType.BaseTypeNoUseSiteDiagnostics, TypeCompareKind.AllIgnoreOptions) || 124F.Base(baseEquals.ContainingType),
Symbols\Synthesized\Records\SynthesizedRecordGetHashCode.cs (1)
88currentHashValue = F.Call(F.Base(overridden.ContainingType), overridden);
Symbols\Synthesized\Records\SynthesizedRecordObjectMethod.cs (1)
43if (overridden is object && !(overridden.ContainingType is SourceMemberContainerTypeSymbol { IsRecord: true } && overridden.ContainingModule == overriding.ContainingModule))
Symbols\Synthesized\Records\SynthesizedRecordPrintMembers.cs (3)
110!overridden.ContainingType.Equals(ContainingType.BaseTypeNoUseSiteDiagnostics, TypeCompareKind.AllIgnoreOptions)) 265NamedTypeSymbol baseType = overriding.ContainingType.BaseTypeNoUseSiteDiagnostics; 282!overridden.ContainingType.Equals(baseType, TypeCompareKind.AllIgnoreOptions))
Symbols\Synthesized\Records\SynthesizedRecordPropertySymbol.cs (1)
103parameter.ContainingType.GetMembersUnordered().Any((s, parameter) => (s as SynthesizedRecordPropertySymbol)?.BackingParameter == (object)parameter, parameter);
Symbols\Synthesized\SynthesizedBackingFieldSymbol.cs (1)
50if (!this.ContainingType.IsImplicitlyDeclared)
Symbols\Synthesized\SynthesizedEntryPointSymbol.cs (2)
29var containingType = initializerMethod.ContainingType; 259get { return ContainingType.AreLocalsZeroed; }
Symbols\Synthesized\SynthesizedImplementationMethod.cs (2)
38_name = name ?? ExplicitInterfaceHelpers.GetMemberName(interfaceMethod.Name, interfaceMethod.ContainingType, aliasQualifierOpt: null); 45var typeMap = interfaceMethod.ContainingType.TypeSubstitution ?? TypeMap.Empty;
Symbols\Synthesized\SynthesizedMethodSymbol.cs (1)
41return ContainingType.AreLocalsZeroed;
Symbols\Synthesized\SynthesizedSealedPropertyAccessor.cs (2)
52return _property.ContainingType; 95Debug.Assert(AccessCheck.IsSymbolAccessible(_overriddenAccessor, this.ContainingType, ref discardedUseSiteInfo));
Symbols\Tuples\TupleFieldSymbol.cs (4)
47Debug.Assert(container.Equals(underlyingField.ContainingType, TypeCompareKind.IgnoreDynamicAndTupleNames) || this is TupleVirtualElementFieldSymbol, 108NamedTypeSymbol originalContainer = ContainingType.OriginalDefinition; 268Debug.Assert(underlyingField.ContainingType.IsTupleType); 270Debug.Assert(name != underlyingField.Name || !container.Equals(underlyingField.ContainingType, TypeCompareKind.IgnoreDynamicAndTupleNames),
Symbols\Tuples\TupleTypeSymbol.cs (1)
1112if (TypeSymbol.Equals(underlyingMemberDefinition.ContainingType, TupleUnderlyingType.OriginalDefinition, TypeCompareKind.ConsiderEverything))
Symbols\TypeParameterSymbol.cs (2)
676return other.ContainingSymbol.ContainingType.Equals(this.ContainingSymbol.ContainingType, comparison);
Symbols\TypeSymbol.cs (21)
742var interfaceType = interfaceMember.ContainingType; 821NamedTypeSymbol interfaceType = interfaceMember.ContainingType; 1110return !symbolAndDiagnostics.Symbol.ContainingType.IsInterface; 1253NamedTypeSymbol implementingInterface = inplementingAccessor1.ContainingType; 1255if (implementingAccessor2 is object && !implementingInterface.Equals(implementingAccessor2.ContainingType, TypeCompareKind.ConsiderEverything)) 1300NamedTypeSymbol previousContainingType = previous.ContainingType; 1336if (bases.ContainsKey(implementations[i].MethodSet.First().ContainingType)) 1395NamedTypeSymbol containingType = interfaceMember.ContainingType; 1529currType.InterfacesAndTheirBaseInterfacesWithDefinitionUseSiteDiagnostics(ref useSiteInfo).ContainsKey(interfaceAccessor.ContainingType)) 1577if ((object)implementingPropertyOrEvent != null && !implementingPropertyOrEvent.ContainingType.IsInterface) 1608else if ((object)correspondingImplementingAccessor != null && ((object)implicitImpl == null || TypeSymbol.Equals(correspondingImplementingAccessor.ContainingType, implicitImpl.ContainingType, TypeCompareKind.ConsiderEverything2))) 1619interfaceMethod.ContainingType, 1740if (!implicitImpl.ContainingType.IsDefinition) 1742foreach (Symbol member in implicitImpl.ContainingType.GetMembers(implicitImpl.Name)) 2097var @interface = interfaceMember.ContainingType; 2156if (TypeSymbol.Equals(member.ContainingType, implementingType, TypeCompareKind.ConsiderEverything2)) 2162var @interface = interfaceMember.ContainingType; 2381x.ContainingType.Equals(y.ContainingType, TypeCompareKind.CLRSignatureCompareOptions); 2563if (elementField is not null && elementField.ContainingType.IsGenericType)
Symbols\TypeSymbolExtensions.cs (15)
783var containingType = current.ContainingType; 797RoslynDebug.Assert((object)current.ContainingType == null); 1044var parent1 = s1.ContainingType; 1054for (var parent2 = s2.ContainingType; (object)parent2 != null; parent2 = parent2.ContainingType) 1066var parent2 = s2.ContainingType; 1078var parent1 = s1.ContainingType; 1096for (var parent2 = s2.ContainingType; (object)parent2 != null; parent2 = parent2.ContainingType) 1119if (parent1.IsAccessibleViaInheritance(s2.ContainingType, ref useSiteInfo)) 1130parent1.IsAccessibleViaInheritance(s2.ContainingType, ref useSiteInfo)) 1141parent1.IsAccessibleViaInheritance(s2.ContainingType, ref useSiteInfo)) 1156NamedTypeSymbol parent1 = s1.ContainingType; 1164for (var parent2 = s2.ContainingType; (object)parent2 != null; parent2 = parent2.ContainingType) 2154if (typeSymbol.Name != name || typeSymbol.ContainingType is object) 2173=> typeSymbol.ContainingType is null && IsContainedInNamespace(typeSymbol, "System", "Runtime", "CompilerServices"); 2186=> typeSymbol.ContainingType is null && IsContainedInNamespace(typeSymbol, "System", "Diagnostics", "CodeAnalysis");
Symbols\VarianceSafety.cs (1)
101for (var container = member.ContainingType; container is object; container = container.ContainingType)
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (20)
CodeGen\CodeGenTupleTest.cs (16)
11246Assert.True(m1Item1.ContainingType.OriginalDefinition.TupleElements[0].Equals(m1Item1.OriginalDefinition, TypeCompareKind.ConsiderEverything)); 11266Assert.True(m2Item1.ContainingType.OriginalDefinition.TupleElements[0].Equals(m2Item1.OriginalDefinition, TypeCompareKind.ConsiderEverything)); 11289Assert.True(m2a2.ContainingType.OriginalDefinition.TupleElements[0].Equals(m1Item1.OriginalDefinition, TypeCompareKind.ConsiderEverything)); 12795Assert.True(m1Item1.ContainingType.OriginalDefinition.TupleElements[0].Equals(m1Item1.OriginalDefinition, TypeCompareKind.ConsiderEverything)); 12814Assert.True(m2Item1.ContainingType.OriginalDefinition.TupleElements[0].Equals(m2Item1.OriginalDefinition, TypeCompareKind.ConsiderEverything)); 13450Assert.True(sym.ContainingType.IsTupleType); 13459Assert.True(sym.ContainingType.IsTupleType); 13468Assert.True(sym.ContainingType.IsTupleType); 27066var toEmit = field.ContainingType.GetFieldsToEmit().Where(f => f.Name == "F1").Single(); 27150var toEmit = field.ContainingType.GetFieldsToEmit().Where(f => f.Name == "F1").Single(); 27224var toEmit = field.ContainingType.GetFieldsToEmit().Single(); 27302var toEmit = field.ContainingType.GetFieldsToEmit().Single(); 28635Assert.Same(tuple, item1Underlying.ContainingType); 28763Assert.Equal(isSourceSymbol ? "SourceNamedTypeSymbol" : "PENamedTypeSymbolGeneric", underlying.ContainingType.GetType().Name); 28774Assert.Equal("ConstructedNamedTypeSymbol", underlying.ContainingType.GetType().Name); 28934Assert.Equal("ConstructedNamedTypeSymbol", underlying.ContainingType.GetType().Name);
Emit\EmitMetadataTests.cs (4)
1183var containingType = property.ContainingType; 1185Assert.Equal(containingType, accessor.ContainingType); 1303var backingField = property.ContainingType.GetField(GeneratedNames.MakeBackingFieldName(property.Name)); 1318var method = property.ContainingType.GetMembers(accessor.Name).Single();
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (28)
RefStructInterfacesTests.cs (12)
22852Assert.False(m.ContainingType.TypeParameters.Single().AllowsRefLikeType); 22876Assert.Equal([true, false], m.ContainingType.TypeParameters.Select(t => t.AllowsRefLikeType)); 22934Assert.False(m.ContainingType.TypeParameters.Single().AllowsRefLikeType); 22965Assert.True(m.ContainingType.TypeParameters.Single().AllowsRefLikeType); 22996Assert.False(m.ContainingType.TypeParameters.Single().AllowsRefLikeType); 23027Assert.False(m.ContainingType.TypeParameters.Single().AllowsRefLikeType); 23059Assert.False(m.ContainingType.TypeParameters.Single().AllowsRefLikeType); 23090Assert.False(m.ContainingType.TypeParameters.Single().AllowsRefLikeType); 23121Assert.False(m.ContainingType.TypeParameters.Single().AllowsRefLikeType); 23175Assert.False(m.ContainingType.TypeParameters.Single().AllowsRefLikeType); 23206Assert.True(m.ContainingType.TypeParameters.Single().AllowsRefLikeType); 23230Assert.Equal([true, true], m.ContainingType.TypeParameters.Select(t => t.AllowsRefLikeType));
Semantics\CollectionExpressionTests.cs (2)
13344compareTypes(sourceType, ((MethodSymbol)arrayMemberData.Method).ContainingType); 13345compareTypes(sourceType, ((MethodSymbol)listMemberData.Method).ContainingType);
Semantics\ExtensionTests.cs (2)
5232Assert.True(implementation.ContainingType.MightContainExtensionMethods); 8302Assert.True(implementation.ContainingType.MightContainExtensionMethods);
Semantics\RecordTests.cs (8)
3502Assert.True(clone.ContainingType.IsSealed); 3503Assert.True(clone.ContainingType.IsAbstract); 3533Assert.True(clone.ContainingType.IsSealed); 3534Assert.True(clone.ContainingType.IsAbstract); 3565Assert.True(clone.ContainingType.IsSealed); 3566Assert.True(clone.ContainingType.IsAbstract); 3592Assert.True(clone.ContainingType.IsSealed); 3593Assert.True(clone.ContainingType.IsAbstract);
Symbols\UserDefinedCompoundAssignmentOperatorsTests.cs (4)
1484Assert.Equal(m.ContainingType.Name == "C2", m.IsAbstract); 8115Assert.Equal(m.ContainingType.IsInterface, m.IsVirtual); 9746Assert.Equal(m.ContainingType.Name == "C2", m.IsAbstract); 9805Assert.Equal(m.ContainingType.Name == "C2", m.IsAbstract);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (5)
Semantics\NativeIntegerTests.cs (1)
503Assert.Same(type, member.ContainingType);
Semantics\RefFieldTests.cs (1)
2045var containingType = fieldReferences[0].ContainingType;
Semantics\TopLevelStatementsTests.cs (3)
9505Assert.False(field.ContainingType.IsImplicitlyDeclared); 9514field.ContainingType.GetMembers().ToTestDisplayStrings()); 9523field.ContainingType.GetMembers().ToTestDisplayStrings());
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (67)
DocumentationComments\CrefTests.cs (5)
1670AssertEx.All(actualWinner.ContainingType.TypeArguments(), typeParam => TypeSymbol.Equals(typeParam, actualParameterType, TypeCompareKind.ConsiderEverything2)); //CONSIDER: Would be different in Dev11. 1675Assert.Equal(actualWinner.ContainingType.GetMembers(actualWinner.Name).Single(member => member != actualWinner), actualCandidates[1]); 1708Assert.Equal(actualParameterType, actualWinner.ContainingType.TypeArguments().Single()); 1709Assert.Equal(actualParameterType, actualWinner.ContainingType.ContainingType.TypeArguments().Single()); 1713Assert.Equal(actualWinner.ContainingType.GetMembers(actualWinner.Name).Single(member => member != actualWinner), actualCandidates[1]);
Symbols\CompilationCreationTests.cs (1)
2518Assert.Null(module3.ContainingType);
Symbols\DefaultInterfaceImplementationTests.cs (15)
34864Assert.NotSame(test1i1, test1i1m1.ContainingType); 34865Assert.NotSame(test1i1, test1i1m2.ContainingType); 34866Assert.NotSame(test2i1, test2i1m1.ContainingType); 34867Assert.NotSame(test2i1, test2i1m2.ContainingType); 34868Assert.NotSame(test2i2, test2i2m1.ContainingType); 34869Assert.NotSame(test2i2, test2i2m2.ContainingType); 39158Assert.NotSame(test1i1, test1i1m1.ContainingType); 39159Assert.NotSame(test2i1, test2i1m1.ContainingType); 39160Assert.NotSame(test2i2, test2i2m1.ContainingType); 41834Assert.NotSame(test1i1, test1i1m1.ContainingType); 41835Assert.NotSame(test2i1, test2i1m1.ContainingType); 41836Assert.NotSame(test2i2, test2i2m1.ContainingType); 51104Assert.Equal("I1", i1m1.ContainingType.Name); 68889Assert.Equal("I1", i1m1.ContainingType.Name); 68974Assert.Equal("I1", i1m1.ContainingType.Name);
Symbols\Metadata\MetadataMemberTests.cs (2)
260Assert.Equal(class1, p1.ContainingType); 357Assert.Equal(type1, p2.ContainingType);
Symbols\Metadata\PE\LoadingEvents.cs (2)
361var @interface = interfaceEvent.ContainingType; 370Assert.Equal(@interface, innerClassImplementingEvent.ContainingType.ConstructedFrom);
Symbols\Metadata\PE\LoadingGenericTypeParameters.cs (5)
51Assert.Equal(varC1, varC1_T.ContainingType); 88Assert.Equal(varC2, varC2_T.ContainingType); 103Assert.Equal(varC4, varC4_T.ContainingType); 118Assert.Equal(varTC2, varTC2_T1.ContainingType); 122Assert.Equal(varTC2, varTC2_T2.ContainingType);
Symbols\Metadata\PE\LoadingMethods.cs (2)
733var @interface = interfaceMethod.ContainingType; 742Assert.Equal(@interface, innerClassImplementingMethod.ContainingType.ConstructedFrom);
Symbols\Metadata\PE\LoadingProperties.cs (2)
195var @interface = interfaceProperty.ContainingType; 204Assert.Equal(@interface, innerClassImplementingProperty.ContainingType.ConstructedFrom);
Symbols\Metadata\PE\NoPiaLocalHideAndTypeSubstitutionTests.cs (1)
352Assert.Same(canonicalType, explicitImpl.ContainingType);
Symbols\OverriddenOrHiddenMembersTests.cs (3)
2921p.DeclaredAccessibility == (p.ContainingType.Name == "A" ? Accessibility.ProtectedOrInternal : Accessibility.Protected)); 2969p.DeclaredAccessibility == (p.ContainingType.Name == "A" ? Accessibility.ProtectedOrInternal : Accessibility.Protected)); 3285e.DeclaredAccessibility == (e.ContainingType.Name == "A" ? Accessibility.ProtectedOrInternal : Accessibility.Protected));
Symbols\RequiredMembersTests.cs (1)
45requiredTypes.Add((NamedTypeSymbol)member.ContainingType);
Symbols\Retargeting\RetargetExplicitInterfaceImplementation.cs (3)
89Assert.Equal(interfaceV1, method.ExplicitInterfaceImplementations.Single().ContainingType); 93Assert.Equal(interfaceV1, ((PropertySymbol)member).ExplicitInterfaceImplementations.Single().ContainingType); 96Assert.Equal(interfaceV1, ((EventSymbol)member).ExplicitInterfaceImplementations.Single().ContainingType);
Symbols\Source\CustomModifierCopyTests.cs (3)
532Assert.Same(baseClass, explicitImpl.ImplementingMethod.ContainingType); 545Assert.Same(baseClass, class2Method2SynthesizedExplicitImpl.ImplementingMethod.ContainingType); 567Assert.Same(baseClass, class3Method2SynthesizedExplicitImpl.ImplementingMethod.ContainingType);
Symbols\Source\MethodTests.cs (1)
1824Assert.Equal(substitutedInterface, explicitImpl.ContainingType);
Symbols\Source\PropertyTests.cs (4)
598Assert.Equal(type, accessor.ContainingType); 2517Assert.Equal(interfacePropertyGetter.ContainingType, getterOverride.ImplementedMethod.GetContainingType(context).GetInternalSymbol()); 2522Assert.Equal(interfacePropertySetter.ContainingType, setterOverride.ImplementedMethod.GetContainingType(context).GetInternalSymbol()); 2555Assert.Equal(interfacePropertyGetter.ContainingType, getterOverride.ImplementedMethod.GetContainingType(context).GetInternalSymbol());
Symbols\Source\RecordTests.cs (4)
174Assert.Equal(c, getAccessor.ContainingType); 181Assert.Equal(c, setAccessor.ContainingType); 208Assert.Equal(c, getAccessor.ContainingType); 214Assert.Equal(c, setAccessor.ContainingType);
Symbols\StaticAbstractMembersInInterfacesTests.cs (12)
4130Assert.Null(m01.ContainingType.FindImplementationForInterfaceMember(m01)); 4143Assert.Null(m01.ContainingType.FindImplementationForInterfaceMember(m01)); 4156Assert.Null(m01.ContainingType.FindImplementationForInterfaceMember(m01)); 4376Assert.Null(m01.ContainingType.FindImplementationForInterfaceMember(m01)); 4389Assert.Null(m01.ContainingType.FindImplementationForInterfaceMember(m01)); 4402Assert.Null(m01.ContainingType.FindImplementationForInterfaceMember(m01)); 4562Assert.Same(m01, m01.ContainingType.FindImplementationForInterfaceMember(m01)); 4575Assert.Same(m01, m01.ContainingType.FindImplementationForInterfaceMember(m01)); 4588Assert.Null(m01.ContainingType.FindImplementationForInterfaceMember(m01)); 4802Assert.Same(m01, m01.ContainingType.FindImplementationForInterfaceMember(m01)); 4815Assert.Same(m01, m01.ContainingType.FindImplementationForInterfaceMember(m01)); 4828Assert.Null(m01.ContainingType.FindImplementationForInterfaceMember(m01));
Symbols\SymbolExtensionTests.cs (1)
259method.ContainingType.VisitType(static (typeSymbol, typeParameters, _) =>
Microsoft.CodeAnalysis.CSharp.Test.Utilities (4)
CompilingTestBase.cs (1)
36TypeCompilationState compilationState = new TypeCompilationState(method.ContainingType, compilation, module);
Extensions.cs (1)
570Assert.Contains(accessor, propertyOrEvent.ContainingType.GetMembers(accessor.Name));
TestAttributesVisitor.cs (1)
211var containingType = attribute.AttributeConstructor!.ContainingType;
UsesIsNullableVisitor.cs (1)
175if (UsesIsNullable(type.ContainingType, inProgress))