1 override of IsExtension
Microsoft.CodeAnalysis.CSharp (1)
Symbols\Metadata\PE\PENamedTypeSymbol.cs (1)
2011
public override bool
IsExtension
=> _lazyUncommonProperties?.extensionInfo is { };
120 references to IsExtension
Microsoft.CodeAnalysis.CSharp (112)
Binder\Binder_Crefs.cs (1)
300
if (!nested.
IsExtension
|| nested.Arity != extensionArity || nested.ExtensionParameter is null)
Binder\Binder_Expressions.cs (1)
507
|| this.ContainingMemberOrLambda is TypeSymbol {
IsExtension
: true });
Binder\Binder_NameConflicts.cs (2)
70
if (tp.ContainingSymbol is NamedTypeSymbol {
IsExtension
: true })
90
if (parameters[0] is { ContainingSymbol: NamedTypeSymbol {
IsExtension
: true }, Name: var receiverName } && receiverName == name)
Binder\Binder_Operators.cs (1)
3731
Debug.Assert(extensionDeclaration.
IsExtension
);
Binder\Binder_Statements.cs (1)
3879
if (containingType.IsStructType() || containingType.IsEnumType() || containingType.
IsExtension
)
Binder\Binder_Symbols.cs (1)
353
&& containing is not TypeSymbol {
IsExtension
: true })
Binder\BinderFactory.BinderFactoryVisitor.cs (2)
785
if (typeSymbol.
IsExtension
)
1255
Debug.Assert(type.
IsExtension
);
Binder\InMethodBinder.cs (1)
296
if (parameter.ContainingSymbol is NamedTypeSymbol {
IsExtension
: true })
Binder\Semantics\AccessCheck.cs (2)
332
containingType.
IsExtension
&& containingType.ContainingType is { } extensionEnclosingType ? extensionEnclosingType : containingType,
699
return containingType.
IsExtension
? ErrorCode.ERR_ProtectedInExtension
Binder\Semantics\Operators\BinaryOperatorOverloadResolution.cs (1)
1499
Debug.Assert(extensionDeclaration.
IsExtension
);
Binder\Semantics\Operators\UnaryOperatorOverloadResolution.cs (1)
148
Debug.Assert(extensionDeclaration.
IsExtension
);
Binder\WithClassTypeParametersBinder.cs (1)
70
if (_namedType.
IsExtension
)
Compilation\SyntaxTreeSemanticModel.cs (1)
1402
if (symbol is TypeSymbol {
IsExtension
: true } && symbol.HasLocationContainedWithin(this.SyntaxTree, declarationSpan, out var wasZeroWidthMatch))
Compiler\DocumentationCommentCompiler.cs (3)
227
if (symbol.
IsExtension
&& (SourceNamedTypeSymbol)symbol.ContainingType is { } containingType)
245
if (member is NamedTypeSymbol {
IsExtension
: true })
308
Debug.Assert(extension.
IsExtension
);
Compiler\MethodCompiler.cs (2)
502
if (containingType.
IsExtension
&& ((SourceNamedTypeSymbol)containingType).TryGetOrCreateExtensionMarker() is { } marker)
554
if (containingType.
IsExtension
&&
DocumentationComments\DocumentationCommentIDVisitor.cs (1)
73
if (symbol.
IsExtension
)
DocumentationComments\DocumentationCommentIDVisitor.PartVisitor.cs (3)
179
if ((object)containingSymbol != null && (containingSymbol.Name.Length != 0 || containingSymbol is NamedTypeSymbol {
IsExtension
: true }))
185
builder.Append(symbol.
IsExtension
? symbol.ExtensionGroupingName : symbol.Name);
193
if (!symbol.
IsExtension
)
Emitter\Model\MethodSymbolAdapter.cs (4)
419
return !AdaptedMethodSymbol.ContainingType.
IsExtension
&& AdaptedMethodSymbol.IsExternal;
446
return !AdaptedMethodSymbol.ContainingType.
IsExtension
&& AdaptedMethodSymbol.GetDllImportData() != null;
455
return AdaptedMethodSymbol.ContainingType.
IsExtension
? null : AdaptedMethodSymbol.GetDllImportData();
462
return AdaptedMethodSymbol.ContainingType.
IsExtension
? default : AdaptedMethodSymbol.ImplementationAttributes;
Emitter\Model\NamedTypeSymbolAdapter.cs (3)
293
if (AdaptedNamedTypeSymbol.IsScriptClass || AdaptedNamedTypeSymbol.
IsExtension
)
660
if (type.
IsExtension
)
798
if (AdaptedNamedTypeSymbol.
IsExtension
)
Emitter\Model\PEModuleBuilder.cs (5)
385
if (!((NamedTypeSymbol)member).
IsExtension
) // Tracked by https://github.com/dotnet/roslyn/issues/78963 : Figure out what to do about extensions, if anything
2123
Debug.Assert(container is not NamedTypeSymbol {
IsExtension
: true } || nestedType.GetInternalSymbol() is FixedFieldImplementationType);
2129
Debug.Assert(container is not NamedTypeSymbol {
IsExtension
: true });
2135
Debug.Assert(container is not NamedTypeSymbol {
IsExtension
: true });
2141
Debug.Assert(container is not NamedTypeSymbol {
IsExtension
: true });
FlowAnalysis\NullableWalker.cs (1)
9775
var newExtensionFormOffset = parameterOpt?.ContainingType.
IsExtension
is true ? 1 : 0;
Lowering\LocalRewriter\DelegateCacheContainer.cs (1)
35
(owner.ContainingType is {
IsExtension
: true } extensionType ? extensionType.TypeParameters : []).Concat(
Lowering\LocalRewriter\DelegateCacheRewriter.cs (2)
151
if (enclosingSymbol is NamedTypeSymbol {
IsExtension
: true, Arity: > 0 })
192
if (enclosingSymbol is NamedTypeSymbol {
IsExtension
: true, Arity: > 0 } extensionType &&
Lowering\LocalRewriter\DynamicSiteContainer.cs (2)
19
(topLevelMethod.ContainingSymbol is NamedTypeSymbol {
IsExtension
: true } extensionType ? extensionType.TypeParameters : []).Concat(
31
if (containingSymbol is NamedTypeSymbol {
IsExtension
: true })
Lowering\LocalRewriter\LocalRewriter_Call.cs (1)
57
Debug.Assert(!_factory.CurrentType.
IsExtension
); // When binding a simple name for a call, you cannot get a member inside an extension type
Symbols\Extensions\SynthesizedExtensionMarker.cs (1)
30
Debug.Assert(extensionType.
IsExtension
);
Symbols\MemberSymbolExtensions.cs (2)
98
return member is { ContainingSymbol: TypeSymbol {
IsExtension
: true }, OriginalDefinition: not SynthesizedExtensionMarker };
103
return member.ContainingSymbol is TypeSymbol {
IsExtension
: true };
Symbols\Metadata\PE\PEParameterSymbol.cs (1)
905
if (ContainingSymbol is { IsStatic: false, ContainingSymbol: TypeSymbol {
IsExtension
: true, ExtensionParameter.Name: var extensionParameterName } }
Symbols\NamespaceSymbol.cs (1)
373
if (nestedType.
IsExtension
)
Symbols\PublicModel\TypeSymbol.cs (2)
29
if (UnderlyingTypeSymbol.
IsExtension
)
153
bool ITypeSymbol.IsExtension => UnderlyingTypeSymbol.
IsExtension
;
Symbols\Retargeting\RetargetingNamedTypeSymbol.cs (1)
112
Debug.Assert(this.
IsExtension
);
Symbols\Source\ExtensionGroupingInfo.cs (11)
35
if (!type.
IsExtension
)
75
if (!type1.
IsExtension
)
83
if (!type2.
IsExtension
)
113
Debug.Assert(extension.
IsExtension
);
173
Debug.Assert(extension.
IsExtension
);
194
Debug.Assert(extension.
IsExtension
);
214
Debug.Assert(extension1.
IsExtension
);
215
Debug.Assert(extension2.
IsExtension
);
249
Debug.Assert(extension1.
IsExtension
);
250
Debug.Assert(extension2.
IsExtension
);
461
Debug.Assert(extension.
IsExtension
);
Symbols\Source\SourceDestructorSymbol.cs (1)
32
if (syntax.Identifier.ValueText != containingType.Name && !containingType.
IsExtension
)
Symbols\Source\SourceMemberContainerSymbol.cs (11)
615
if (this.
IsExtension
)
648
if (this.
IsExtension
)
1353
if (!t.
IsExtension
)
1850
else if (
IsExtension
)
1951
if (
IsExtension
)
2384
if (
IsExtension
)
2418
IEnumerable<IGrouping<string, NamedTypeSymbol>> extensionsByReceiverType = GetTypeMembers("").Where(static t => t.
IsExtension
).GroupBy(static t => ((SourceNamedTypeSymbol)t).ExtensionGroupingName);
2526
if (this.
IsExtension
)
2862
Debug.Assert(!this.
IsExtension
);
3932
if (!this.
IsExtension
)
5868
if (
IsExtension
)
Symbols\Source\SourceMemberMethodSymbol.cs (1)
397
if (containingType is {
IsExtension
: true, ContainingType: { } enclosing })
Symbols\Source\SourceNamedTypeSymbol.cs (5)
1417
if (this.
IsExtension
)
1829
return
IsExtension
1839
return
IsExtension
1998
if (
IsExtension
&& ContainingType?.
IsExtension
!= true)
Symbols\Source\SourceNamedTypeSymbol_Extension.cs (8)
43
Debug.Assert(this.
IsExtension
&& this.IsDefinition);
266
if (typeParameter.ContainingType.
IsExtension
)
369
Debug.Assert(this.
IsExtension
&& this.IsDefinition);
1015
if (!
IsExtension
)
1033
Debug.Assert(this.
IsExtension
);
1066
Debug.Assert(
IsExtension
);
1102
Debug.Assert(
IsExtension
);
1121
Debug.Assert(
IsExtension
);
Symbols\Source\SourceNamespaceSymbol.cs (1)
316
if (nts?.
IsExtension
== true) continue;
Symbols\Source\SourceOrdinaryMethodSymbol.cs (3)
251
else if (ContainingType is {
IsExtension
: true, ExtensionParameter.Name: "" } && !IsStatic)
711
bool isExtension = containingType.
IsExtension
;
1161
if (tpEnclosing.ContainingSymbol is NamedTypeSymbol {
IsExtension
: true })
Symbols\Source\SourceParameterSymbol.cs (1)
111
Debug.Assert((owner.Kind == SymbolKind.Method) || (owner.Kind == SymbolKind.Property) || owner is TypeSymbol {
IsExtension
: true });
Symbols\Source\SourcePropertyAccessorSymbol.cs (1)
558
else if (ContainingType.
IsExtension
&& IsInitOnly)
Symbols\Source\SourcePropertySymbol.cs (3)
383
bool isExtension = containingType.
IsExtension
;
591
if (containingType is {
IsExtension
: true, ContainingType: { } enclosing })
674
if (containingTypeForFileTypeCheck is {
IsExtension
: true, ContainingType: { } enclosing })
Symbols\Source\SourcePropertySymbolBase.cs (1)
1143
else if (ContainingType is {
IsExtension
: true, ExtensionParameter.Name: "" } && !IsStatic)
Symbols\Source\SourceUserDefinedOperatorSymbolBase.cs (8)
81
if (this.ContainingType is {
IsExtension
: true, ExtensionParameter.Type.IsStatic: true })
178
bool inExtension = containingType.
IsExtension
;
385
if (ContainingType is {
IsExtension
: true, ExtensionParameter: { Type.IsStatic: false } extensionParameter } && !IsStatic &&
806
(ContainingType.
IsExtension
?
875
(ContainingType.
IsExtension
?
895
if (ContainingType is {
IsExtension
: true, ExtensionParameter.Type: var extendedType })
950
(ContainingType.
IsExtension
? ErrorCode.ERR_BadExtensionShiftOperatorSignature : ErrorCode.ERR_BadShiftOperatorSignature),
972
(ContainingType.
IsExtension
? ErrorCode.ERR_BadExtensionBinaryOperatorSignature : ErrorCode.ERR_BadBinaryOperatorSignature),
Symbols\SubstitutedNamedTypeSymbol.cs (1)
509
if (!this.
IsExtension
)
Symbols\Symbol.cs (2)
651
if (namedType.IsSubmissionClass || namedType.
IsExtension
)
1761
&& variable is ParameterSymbol { ContainingSymbol: TypeSymbol {
IsExtension
: true } })
Symbols\SymbolExtensions.cs (1)
825
return parameter.ContainingSymbol is TypeSymbol {
IsExtension
: true };
Symbols\TypeSymbol.cs (1)
565
/// Note: this may be null even if <see cref="
IsExtension
"/> is true, in error cases.
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (8)
Semantics\ExtensionTests.cs (3)
49446
Assert.False(comp.GlobalNamespace.GetTypeMember("E").GetTypeMembers().Single().
IsExtension
);
50364
Debug.Assert(extension.
IsExtension
);
50373
Debug.Assert(extension.
IsExtension
);
Semantics\ExtensionTests2.cs (5)
3271
Assert.False(extension.
IsExtension
);
3814
Assert.False(comp.GetTypeByMetadataName("E").GetTypeMembers().Single().
IsExtension
);
3872
Assert.False(comp.GetTypeByMetadataName("E").GetTypeMembers().Single().
IsExtension
);
3928
Assert.False(comp.GetTypeByMetadataName("E").GetTypeMembers().Single().
IsExtension
);
3989
Assert.False(comp.GetTypeByMetadataName("E").GetTypeMembers().Single().
IsExtension
);