Base:
property
ContainingType
Microsoft.CodeAnalysis.CSharp.Symbol.ContainingType
155 references to ContainingType
Microsoft.CodeAnalysis.CSharp (131)
Lowering\ClosureConversion\ClosureConversion.cs (1)
1528
translatedLambdaContainer = synthesizedMethod.
ContainingType
;
Lowering\ClosureConversion\SynthesizedClosureMethod.cs (1)
54
var lambdaFrame =
ContainingType
as SynthesizedClosureEnvironment;
Symbols\Extensions\SynthesizedExtensionMarker.cs (2)
41
var F = new SyntheticBoundNodeFactory(this,
ContainingType
.GetNonNullSyntaxNode(), compilationState, diagnostics);
107
ContainingType
.TypeParameters.Any(static (p, name) => p.Name == name, name))
Symbols\Source\SourceConstructorSymbol.cs (6)
187
else if (
ContainingType
.IsSealed && this.DeclaredAccessibility.HasProtected() && !this.IsOverride)
189
diagnostics.Add(AccessCheck.GetProtectedMemberInSealedTypeError(
ContainingType
), location, this);
191
else if (
ContainingType
.IsStatic && methodKind == MethodKind.Constructor)
195
else if (IsPartial && !
ContainingType
.IsPartial())
222
if (this.
ContainingType
is SourceMemberContainerTypeSymbol { AnyMemberHasAttributes: true })
237
: ((SourceMemberContainerTypeSymbol)
ContainingType
).IsNullableEnabledForConstructorsAndInitializers(IsStatic);
Symbols\Source\SourceConstructorSymbolBase.cs (4)
66
ContainingType
.Name == ((ConstructorDeclarationSyntax)this.SyntaxNode).Identifier.ValueText)
74
if (this.IsVararg && (IsGenericMethod ||
ContainingType
.IsGenericType || _lazyParameters.Length > 0 && _lazyParameters[_lazyParameters.Length - 1].IsParams))
220
var containingType = (SourceNamedTypeSymbol)this.
ContainingType
;
249
if (
ContainingType
.IsWellKnownSetsRequiredMembersAttribute())
Symbols\Source\SourceDelegateMethodSymbol.cs (2)
356
: base((SourceNamedTypeSymbol)invoke.
ContainingType
, iAsyncResultType, syntax, MethodKind.Ordinary, RefKind.None, DeclarationModifiers.Virtual | DeclarationModifiers.Public)
394
: base((SourceNamedTypeSymbol)invoke.
ContainingType
, invoke.ReturnTypeWithAnnotations, syntax, MethodKind.Ordinary, invoke.RefKind, DeclarationModifiers.Virtual | DeclarationModifiers.Public)
Symbols\Source\SourceDestructorSymbol.cs (1)
173
return (object)this.
ContainingType
.BaseTypeNoUseSiteDiagnostics == null;
Symbols\Source\SourceMemberMethodSymbol.cs (3)
381
if (this.GetIsNewExtensionMember() &&
ContainingType
.ExtensionParameter is { } extensionParameter)
395
NamedTypeSymbol containingType =
ContainingType
;
984
if (IsDeclaredReadOnly && !
ContainingType
.IsReadOnly)
Symbols\Source\SourceOrdinaryMethodOrUserDefinedOperatorSymbol.cs (2)
66
if (!
ContainingType
.IsPartial())
139
TypeSymbol.CheckModifierMismatchOnImplementingMember(this.
ContainingType
, this, overriddenOrExplicitlyImplementedMethod, isExplicit: true, diagnostics);
Symbols\Source\SourceOrdinaryMethodSymbol.cs (26)
143
(this.
ContainingType
.SpecialType == SpecialType.System_TypedReference || this.
ContainingType
.SpecialType == SpecialType.System_ArgIterator))
228
else if ((object)
ContainingType
.ContainingType != null)
230
diagnostics.Add(ErrorCode.ERR_ExtensionMethodsDecl, _location,
ContainingType
.Name);
232
else if (!
ContainingType
.IsScriptClass && !(
ContainingType
.IsStatic &&
ContainingType
.Arity == 0))
251
else if (
ContainingType
is { IsExtension: true, ExtensionParameter.Name: "" } && !IsStatic)
424
var sourceContainer = this.
ContainingType
as SourceMemberContainerTypeSymbol;
824
Debug.Assert(!IsStatic ||
ContainingType
.IsInterface || (!IsAbstract && !IsVirtual)); // Otherwise should have been reported and cleared earlier.
826
bool isExplicitInterfaceImplementationInInterface = isExplicitInterfaceImplementation &&
ContainingType
.IsInterface;
863
else if (IsSealed &&
ContainingType
.TypeKind == TypeKind.Struct)
871
diagnostics.Add(ErrorFacts.GetStaticClassReturnCode(
ContainingType
.IsInterfaceType()), location, ReturnType);
885
else if (IsAbstract &&
ContainingType
.TypeKind == TypeKind.Struct)
890
else if (IsVirtual &&
ContainingType
.TypeKind == TypeKind.Struct)
900
else if (IsAbstract && !
ContainingType
.IsAbstract && (
ContainingType
.TypeKind == TypeKind.Class ||
ContainingType
.TypeKind == TypeKind.Submission))
903
diagnostics.Add(ErrorCode.ERR_AbstractInConcreteClass, location, this,
ContainingType
);
905
else if (IsVirtual &&
ContainingType
.IsSealed)
908
diagnostics.Add(ErrorCode.ERR_NewVirtualInSealed, location, this,
ContainingType
);
918
else if (
ContainingType
.IsSealed && this.DeclaredAccessibility.HasProtected() && !this.IsOverride)
920
diagnostics.Add(AccessCheck.GetProtectedMemberInSealedTypeError(
ContainingType
), location, this);
922
else if (
ContainingType
.IsStatic && !IsStatic)
926
else if (isVararg && (IsGenericMethod ||
ContainingType
.IsGenericType || Parameters.Length > 0 && Parameters[Parameters.Length - 1].IsParams))
1155
var tpEnclosing =
ContainingType
.FindEnclosingTypeParameter(name);
Symbols\Source\SourcePropertyAccessorSymbol.cs (11)
482
return
ContainingType
.IsStructType() &&
530
if (IsAbstract && !
ContainingType
.IsAbstract && (
ContainingType
.TypeKind == TypeKind.Class ||
ContainingType
.TypeKind == TypeKind.Submission))
533
diagnostics.Add(ErrorCode.ERR_AbstractInConcreteClass, location, this,
ContainingType
);
535
else if (IsVirtual &&
ContainingType
.IsSealed &&
ContainingType
.TypeKind != TypeKind.Struct) // error CS0106 on struct already
538
diagnostics.Add(ErrorCode.ERR_NewVirtualInSealed, location, this,
ContainingType
);
544
else if (
ContainingType
.IsSealed && localAccessibility.HasProtected() && !this.IsOverride)
546
diagnostics.Add(AccessCheck.GetProtectedMemberInSealedTypeError(
ContainingType
), location, this);
558
else if (
ContainingType
.IsExtension && IsInitOnly)
Symbols\Source\SourceUserDefinedOperatorSymbolBase.cs (21)
63
if (this.
ContainingType
.IsInterface &&
72
if (this.
ContainingType
.IsStatic)
81
if (this.
ContainingType
is { IsExtension: true, ExtensionParameter.Type.IsStatic: true })
145
else if (IsSealed && !IsOverride && !(IsExplicitInterfaceImplementation &&
ContainingType
.IsInterface && IsAbstract))
154
else if (IsAbstract && !
ContainingType
.IsAbstract && !
ContainingType
.IsInterface)
157
diagnostics.Add(ErrorCode.ERR_AbstractInConcreteClass, location, this,
ContainingType
);
159
else if (IsVirtual &&
ContainingType
.IsSealed)
162
diagnostics.Add(ErrorCode.ERR_NewVirtualInSealed, location, this,
ContainingType
);
372
if (this.
ContainingType
.IsStatic)
385
if (
ContainingType
is { IsExtension: true, ExtensionParameter: { Type.IsStatic: false } extensionParameter } && !IsStatic &&
577
return
ContainingType
.IsInterface && (IsAbstract || IsVirtual);
668
if ((
ContainingType
.SpecialType == SpecialType.System_Nullable_T)
806
(
ContainingType
.IsExtension ?
875
(
ContainingType
.IsExtension ?
895
if (
ContainingType
is { IsExtension: true, ExtensionParameter.Type: var extendedType })
921
return type.Equals(this.
ContainingType
, ComparisonForUserDefinedOperators);
935
return IsSelfConstrainedTypeParameter(type, this.
ContainingType
);
950
(
ContainingType
.IsExtension ? ErrorCode.ERR_BadExtensionShiftOperatorSignature : ErrorCode.ERR_BadShiftOperatorSignature),
972
(
ContainingType
.IsExtension ? ErrorCode.ERR_BadExtensionBinaryOperatorSignature : ErrorCode.ERR_BadBinaryOperatorSignature),
984
diagnostics.Add(ErrorCode.ERR_BadAbstractEqualityOperatorSignature, this.GetFirstLocation(), this.
ContainingType
);
Symbols\Synthesized\Records\SynthesizedPrimaryConstructor.cs (1)
89
public new SourceMemberContainerTypeSymbol ContainingType => (SourceMemberContainerTypeSymbol)base.
ContainingType
;
Symbols\Synthesized\Records\SynthesizedRecordBaseEquals.cs (4)
32
TypeWithAnnotations.Create(
ContainingType
.BaseTypeNoUseSiteDiagnostics, NullableAnnotation.Annotated),
45
!overridden.ContainingType.Equals(
ContainingType
.BaseTypeNoUseSiteDiagnostics, TypeCompareKind.AllIgnoreOptions))
47
diagnostics.Add(ErrorCode.ERR_DoesNotOverrideBaseMethod, GetFirstLocation(), this,
ContainingType
.BaseTypeNoUseSiteDiagnostics);
67
ContainingType
.GetMembersUnordered().OfType<SynthesizedRecordObjEquals>().Single(),
Symbols\Synthesized\Records\SynthesizedRecordClone.cs (5)
98
return (ReturnType: !ContainingAssembly.RuntimeSupportsCovariantReturnsOfClasses && VirtualCloneInBase(
ContainingType
) is { } baseClone ?
100
TypeWithAnnotations.Create(isNullableEnabled: true,
ContainingType
),
110
var F = new SyntheticBoundNodeFactory(this,
ContainingType
.GetNonNullSyntaxNode(), compilationState, diagnostics);
120
var members =
ContainingType
.InstanceConstructors;
125
ctor.Parameters[0].Type.Equals(
ContainingType
, TypeCompareKind.AllIgnoreOptions))
Symbols\Synthesized\Records\SynthesizedRecordDeconstruct.cs (1)
51
var F = new SyntheticBoundNodeFactory(this,
ContainingType
.GetNonNullSyntaxNode(), compilationState, diagnostics);
Symbols\Synthesized\Records\SynthesizedRecordEqualityContractProperty.cs (1)
173
F.CloseMethod(F.Block(F.Return(F.Typeof(
ContainingType
, ReturnType))));
Symbols\Synthesized\Records\SynthesizedRecordEqualityOperator.cs (4)
34
var F = new SyntheticBoundNodeFactory(this,
ContainingType
.GetNonNullSyntaxNode(), compilationState, diagnostics);
43
foreach (var member in
ContainingType
.GetMembers(WellKnownMemberNames.ObjectEquals))
47
candidate.Parameters[0].Type.Equals(
ContainingType
, TypeCompareKind.AllIgnoreOptions))
65
if (
ContainingType
.IsRecordStruct)
Symbols\Synthesized\Records\SynthesizedRecordEqualityOperatorBase.cs (3)
70
var annotation =
ContainingType
.IsRecordStruct ? NullableAnnotation.Oblivious : NullableAnnotation.Annotated;
74
TypeWithAnnotations.Create(
ContainingType
, annotation),
77
TypeWithAnnotations.Create(
ContainingType
, annotation),
Symbols\Synthesized\Records\SynthesizedRecordEquals.cs (8)
36
var annotation =
ContainingType
.IsRecordStruct ? NullableAnnotation.Oblivious : NullableAnnotation.Annotated;
40
TypeWithAnnotations.Create(
ContainingType
, annotation),
48
var F = new SyntheticBoundNodeFactory(this,
ContainingType
.GetNonNullSyntaxNode(), compilationState, diagnostics);
58
bool isRecordStruct =
ContainingType
.IsRecordStruct;
67
else if (
ContainingType
.BaseTypeNoUseSiteDiagnostics.IsObjectType())
105
MethodSymbol? baseEquals =
ContainingType
.GetMembersUnordered().OfType<SynthesizedRecordBaseEquals>().Single().OverriddenMethod;
107
if (baseEquals is null || !baseEquals.ContainingType.Equals(
ContainingType
.BaseTypeNoUseSiteDiagnostics, TypeCompareKind.AllIgnoreOptions) ||
132
foreach (var f in
ContainingType
.GetFieldsToEmit())
Symbols\Synthesized\Records\SynthesizedRecordGetHashCode.cs (3)
50
if (
ContainingType
.IsRecordStruct)
54
else if (
ContainingType
.BaseTypeNoUseSiteDiagnostics.IsObjectType())
94
foreach (var f in
ContainingType
.GetFieldsToEmit())
Symbols\Synthesized\Records\SynthesizedRecordInequalityOperator.cs (2)
36
var F = new SyntheticBoundNodeFactory(this,
ContainingType
.GetNonNullSyntaxNode(), compilationState, diagnostics);
41
F.CloseMethod(F.Block(F.Return(F.Not(F.Call(receiver: null,
ContainingType
.GetMembers(WellKnownMemberNames.EqualityOperatorName).OfType<SynthesizedRecordEqualityOperator>().Single(),
Symbols\Synthesized\Records\SynthesizedRecordObjEquals.cs (5)
31
var annotation =
ContainingType
.IsRecordStruct ? NullableAnnotation.Oblivious : NullableAnnotation.Annotated;
57
if (
ContainingType
.IsRecordStruct)
62
F.Is(paramAccess,
ContainingType
),
63
F.Call(F.This(), _typedRecordEquals, F.Convert(
ContainingType
, paramAccess)));
69
expression = F.Call(F.This(), _typedRecordEquals, F.As(paramAccess,
ContainingType
));
Symbols\Synthesized\Records\SynthesizedRecordPrintMembers.cs (9)
93
var annotation =
ContainingType
.IsRecordStruct ? NullableAnnotation.Oblivious : NullableAnnotation.NotAnnotated;
110
!overridden.ContainingType.Equals(
ContainingType
.BaseTypeNoUseSiteDiagnostics, TypeCompareKind.AllIgnoreOptions))
112
diagnostics.Add(ErrorCode.ERR_DoesNotOverrideBaseMethod, GetFirstLocation(), this,
ContainingType
.BaseTypeNoUseSiteDiagnostics);
118
var F = new SyntheticBoundNodeFactory(this,
ContainingType
.GetNonNullSyntaxNode(), compilationState, diagnostics);
121
ImmutableArray<Symbol> printableMembers =
ContainingType
.GetMembers().WhereAsArray(m => isPrintable(m));
132
if (
ContainingType
.BaseTypeNoUseSiteDiagnostics.IsObjectType() ||
ContainingType
.IsRecordStruct)
142
if (!
ContainingType
.IsRecordStruct)
164
var basePrintCall = F.Call(receiver: F.Base(
ContainingType
.BaseTypeNoUseSiteDiagnostics), basePrintMethod, builder);
Symbols\Synthesized\Records\SynthesizedRecordToString.cs (3)
42
var annotation =
ContainingType
.IsRecordStruct ? NullableAnnotation.Oblivious : NullableAnnotation.NotAnnotated;
55
CSharpCompilation compilation =
ContainingType
.DeclaringCompilation;
66
block.Add(makeAppendString(F, builderLocal,
ContainingType
.Name));
Symbols\Synthesized\SynthesizedEventAccessorSymbol.cs (1)
109
if (!IsAbstract && !AssociatedEvent.IsWindowsRuntimeEvent && !
ContainingType
.IsStructType() &&
Symbols\Synthesized\SynthesizedSimpleProgramEntryPointSymbol.cs (1)
227
result = new InContainerBinder(
ContainingType
, result);
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (2)
FlowAnalysis\FlowTestBase.cs (2)
27
if (sourceSymbol == null || sourceSymbol.
ContainingType
.IsDelegateType())
32
var compilationState = new TypeCompilationState(sourceSymbol.
ContainingType
, compilation, null);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (21)
Semantics\ImplicitlyTypeArraysTests.cs (1)
38
var block = MethodCompiler.BindSynthesizedMethodBody(method, new TypeCompilationState(method.
ContainingType
, compilation, null), diagnostics);
Semantics\OperatorTests.cs (1)
3204
var block = MethodCompiler.BindSynthesizedMethodBody(method, new TypeCompilationState(method.
ContainingType
, compilation, null), diagnostics);
Semantics\OverloadResolutionTestBase.cs (1)
37
var block = MethodCompiler.BindSynthesizedMethodBody(method, new TypeCompilationState(method.
ContainingType
, compilation, null), diagnostics);
Semantics\TopLevelStatementsTests.cs (18)
52
Assert.True(entryPoint.
ContainingType
.CanBeReferencedByName);
54
Assert.Equal("Program", entryPoint.
ContainingType
.Name);
9055
Assert.True(entryPoint.
ContainingType
.CanBeReferencedByName);
9057
Assert.Equal("Program", entryPoint.
ContainingType
.Name);
9058
Assert.Equal(Accessibility.Internal, entryPoint.
ContainingType
.DeclaredAccessibility);
9110
Assert.True(entryPoint.
ContainingType
.CanBeReferencedByName);
9112
Assert.Equal("Program", entryPoint.
ContainingType
.Name);
9113
Assert.Equal(Accessibility.Public, entryPoint.
ContainingType
.DeclaredAccessibility);
9152
Assert.True(entryPoint.
ContainingType
.CanBeReferencedByName);
9154
Assert.Equal("Program", entryPoint.
ContainingType
.Name);
9155
Assert.Equal(Accessibility.Public, entryPoint.
ContainingType
.DeclaredAccessibility);
9177
Assert.Equal(Accessibility.Internal, entryPoint.
ContainingType
.DeclaredAccessibility);
9199
Assert.Equal(Accessibility.Internal, entryPoint.
ContainingType
.DeclaredAccessibility);
9228
Assert.Equal(Accessibility.Internal, entryPoint.
ContainingType
.DeclaredAccessibility);
9230
Assert.True(entryPoint.
ContainingType
.IsReferenceType);
9326
Assert.Equal("Base", entryPoint.
ContainingType
.BaseType().ToTestDisplayString());
9327
Assert.Equal(Accessibility.Internal, entryPoint.
ContainingType
.DeclaredAccessibility);
9328
Assert.False(entryPoint.
ContainingType
.IsStatic);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (1)
Symbols\Source\ExpressionBodiedMethodTests.cs (1)
290
var implements = method.
ContainingType
.FindImplementationForInterfaceMember(iM);