Binder\Binder_Attributes.cs (19)
30ImmutableArray<Binder> binders, ImmutableArray<AttributeSyntax> attributesToBind, Symbol ownerSymbol, NamedTypeSymbol[] boundAttributeTypes,
55var boundTypeSymbol = (NamedTypeSymbol)boundType.Type;
74ImmutableArray<NamedTypeSymbol> boundAttributeTypes,
91NamedTypeSymbol boundAttributeType = boundAttributeTypes[i];
127AttributeSyntax node, NamedTypeSymbol boundAttributeType,
138internal BoundAttribute BindAttribute(AttributeSyntax node, NamedTypeSymbol attributeType, Symbol? attributedMember, BindingDiagnosticBag diagnostics)
155private static BoundAttribute BindAttributeCore(Binder binder, AttributeSyntax node, NamedTypeSymbol attributeType, Symbol? attributedMember, BindingDiagnosticBag diagnostics)
168NamedTypeSymbol attributeTypeForBinding = attributeType;
174if (errorType.CandidateSymbols.Length == 1 && errorType.CandidateSymbols[0] is NamedTypeSymbol)
176attributeTypeForBinding = (NamedTypeSymbol)errorType.CandidateSymbols[0];
284var attributeType = (NamedTypeSymbol)boundAttribute.Type;
411protected bool IsAttributeConditionallyOmitted(NamedTypeSymbol attributeType, SyntaxTree? syntaxTree, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
432var baseType = attributeType.BaseTypeWithDefinitionUseSiteDiagnostics(ref useSiteInfo);
451NamedTypeSymbol attributeType,
514private BoundAssignmentOperator BindNamedAttributeArgument(AttributeArgumentSyntax namedArgument, NamedTypeSymbol attributeType, BindingDiagnosticBag diagnostics)
592private Symbol BindNamedAttributeArgumentName(AttributeArgumentSyntax namedArgument, NamedTypeSymbol attributeType, BindingDiagnosticBag diagnostics, out bool wasError, out LookupResultKind resultKind)
607private TypeSymbol BindNamedAttributeArgumentType(AttributeArgumentSyntax namedArgument, Symbol namedArgumentNameSymbol, NamedTypeSymbol attributeType, BindingDiagnosticBag diagnostics)
Binder\Binder_Conversions.cs (41)
114NamedTypeSymbol.ReportTupleNamesMismatchesIfAny(destination, sourceTuple, diagnostics);
200BindUnconvertedInterpolatedExpressionToHandlerType(source, (NamedTypeSymbol)destination, diagnostics),
537.AsMember((NamedTypeSymbol)destination)
538.Construct([((NamedTypeSymbol)source.Type).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0]])
613var sourceElementType = ((NamedTypeSymbol)source).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Type;
614var destinationElementType = ((NamedTypeSymbol)destination).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Type;
646((NamedTypeSymbol)parameter.Type).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Type.Equals(typeArgument.Type, TypeCompareKind.ConsiderEverything) &&
648((NamedTypeSymbol)method.ReturnType).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Type.Equals(((NamedTypeSymbol)arg.destination).TypeParameters[0], TypeCompareKind.ConsiderEverything));
656Debug.Assert(((NamedTypeSymbol)readOnlySpanType).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].SpecialType is SpecialType.System_Char);
662TryFindSingleMethod(memoryExtensionsType.GetSymbol<NamedTypeSymbol>(), WellKnownMemberNames.AsSpanMethodName, 0,
783return binder.BindClassCreationExpression(syntax, type.Name, typeNode: syntax, (NamedTypeSymbol)type, arguments, diagnostics, initializerOpt, wasTargetTyped: true);
787return binder.BindDelegateCreationExpression(syntax, (NamedTypeSymbol)type, arguments, initializerOpt, wasTargetTyped: true, diagnostics);
789return binder.BindInterfaceCreationExpression(syntax, (NamedTypeSymbol)type, diagnostics, typeNode: syntax, arguments, initializerOpt, wasTargetTyped: true);
855var namedType = (NamedTypeSymbol)targetType;
885if (targetType is NamedTypeSymbol namedType &&
886HasParamsCollectionTypeInProgress(namedType, out NamedTypeSymbol? inProgress, out MethodSymbol? inProgressConstructor))
1034NamedTypeSymbol namedType,
1042var targetTypeOriginalDefinition = namedType.OriginalDefinition;
1061var parameterType = (NamedTypeSymbol)collectionBuilderMethod.Parameters[0].Type;
1087if (targetType is NamedTypeSymbol namedType)
1115if (targetType is NamedTypeSymbol namedType)
1215private bool HasParamsCollectionTypeInProgress(NamedTypeSymbol toCheck,
1216[NotNullWhen(returnValue: true)] out NamedTypeSymbol? inProgress,
1242NamedTypeSymbol? namedType = targetType as NamedTypeSymbol;
1833NamedTypeSymbol targetType,
1894var spanTypeArg = ((NamedTypeSymbol)methodWithTargetTypeParameters.Parameters[0].Type).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Type;
2222var boundLambda = unboundLambda.Bind((NamedTypeSymbol)destination, isExpressionTree: destination.IsGenericOrNonGenericExpressionType(out _)).WithInAnonymousFunctionConversion();
2311var delegateType = targetType.GetDelegateType();
2443NamedTypeSymbol targetType = (NamedTypeSymbol)destinationWithoutNullable;
2446NamedTypeSymbol.ReportTupleNamesMismatchesIfAny(targetType, sourceTuple, diagnostics);
2454if (sourceTuple.Type is NamedTypeSymbol { IsTupleType: true } sourceType)
2811Debug.Assert(delegateType is NamedTypeSymbol { TypeKind: TypeKind.Delegate, DelegateInvokeMethod: { HasUseSiteError: false } }
2817NamedTypeSymbol { DelegateInvokeMethod: { } invokeMethod } => invokeMethod,
3052NamedTypeSymbol delegateType,
3198var underlyingType = ((NamedTypeSymbol)destination).EnumUnderlyingType;
Binder\Binder_Expressions.cs (76)
51var containingType = memberOpt?.ContainingType;
225internal NamedTypeSymbol CreateErrorType(string name = "")
415var delegateType = expr.GetInferredDelegateType(ref useSiteInfo);
978var tupleType = NamedTypeSymbol.CreateTuple(
1056NamedTypeSymbol tupleTypeOpt = null;
1064tupleTypeOpt = NamedTypeSymbol.CreateTuple(node.Location, elements, locations, elementNames,
1070NamedTypeSymbol.VerifyTupleTypePresent(elements.Length, node, this.Compilation, diagnostics);
1204if (name == null || NamedTypeSymbol.IsTupleElementNameReserved(name) != -1)
1629symbol = ConstructNamedTypeUnlessTypeArgumentOmitted(node, (NamedTypeSymbol)symbol, typeArgumentList, typeArgumentsWithAnnotations, diagnostics);
1656var type = BindNativeIntegerSymbolIfAny(identifier, diagnostics);
1727if (symbol.ContainingSymbol is NamedTypeSymbol { OriginalDefinition: var symbolContainerDefinition } &&
1735NamedTypeSymbol baseToCheck = containingTypeDefinition.BaseTypeNoUseSiteDiagnostics;
1908var currentType = this.ContainingType;
2088primaryCtor.ContainingSymbol is NamedTypeSymbol { IsRecord: false, IsRecordStruct: false } ||
2255var currentType = this.ContainingType;
2257NamedTypeSymbol declaringType = member.ContainingType;
2318private BoundExpression TryBindInteractiveReceiver(SyntaxNode syntax, NamedTypeSymbol memberDeclaringType)
2469private BoundThisReference ThisReference(SyntaxNode node, NamedTypeSymbol thisTypeOpt, bool hasErrors = false, bool wasCompilerGenerated = false)
2569NamedTypeSymbol nullableType = GetSpecialType(SpecialType.System_Nullable_T, diagnostics, node);
2649NamedTypeSymbol nullableType = GetSpecialType(SpecialType.System_Nullable_T, diagnostics, node);
2676NamedTypeSymbol nullableType = GetSpecialType(SpecialType.System_Nullable_T, diagnostics, operand);
2776!MethodGroupConversionDoesNotExistOrHasErrors((BoundMethodGroup)operand, (NamedTypeSymbol)targetType, syntax.Location, diagnostics, out _))
3693Debug.Assert(handlerType is NamedTypeSymbol { IsInterpolatedStringHandlerType: true });
3887(NamedTypeSymbol)handlerType,
4552var spanType = GetWellKnownType(WellKnownType.System_Span_T, diagnostics, node);
4773NamedTypeSymbol containingType = constructor.ContainingType;
4794NamedTypeSymbol initializerType = containingType;
4910NamedTypeSymbol initializerType,
4933NamedTypeSymbol baseType = constructor.ContainingType.BaseTypeNoUseSiteDiagnostics;
5052static void validateRecordCopyConstructor(MethodSymbol constructor, NamedTypeSymbol baseType, MethodSymbol resultMember, Location errorLocation, BindingDiagnosticBag diagnostics)
5154return BindClassCreationExpression(node, (NamedTypeSymbol)type, GetName(node.Type), diagnostics, originalType);
5157return BindDelegateCreationExpression(node, (NamedTypeSymbol)type, diagnostics);
5160return BindInterfaceCreationExpression(node, (NamedTypeSymbol)type, diagnostics);
5278private BoundExpression BindDelegateCreationExpression(ObjectCreationExpressionSyntax node, NamedTypeSymbol type, BindingDiagnosticBag diagnostics)
5287private BoundExpression BindDelegateCreationExpression(SyntaxNode node, NamedTypeSymbol type, AnalyzedArguments analyzedArguments, InitializerExpressionSyntax initializerOpt, bool wasTargetTyped, BindingDiagnosticBag diagnostics)
5399var sourceDelegate = (NamedTypeSymbol)argument.Type;
5456private BoundExpression BindClassCreationExpression(ObjectCreationExpressionSyntax node, NamedTypeSymbol type, string typeName, BindingDiagnosticBag diagnostics, TypeSymbol initializerType = null)
5491NamedTypeSymbol type,
6248NamedTypeSymbol collectionsIEnumerableType = this.GetSpecialType(SpecialType.System_Collections_IEnumerable, diagnostics, node);
6580NamedTypeSymbol containingType = this.ContainingType;
6614NamedTypeSymbol type,
6710NamedTypeSymbol type,
6795NamedTypeSymbol type,
6852private BoundObjectInitializerExpressionBase MakeBoundInitializerOpt(SyntaxNode typeNode, NamedTypeSymbol type, InitializerExpressionSyntax initializerSyntaxOpt, TypeSymbol initializerTypeOpt, BindingDiagnosticBag diagnostics)
6865private BoundExpression BindInterfaceCreationExpression(ObjectCreationExpressionSyntax node, NamedTypeSymbol type, BindingDiagnosticBag diagnostics)
6874private BoundExpression BindInterfaceCreationExpression(SyntaxNode node, NamedTypeSymbol type, BindingDiagnosticBag diagnostics, SyntaxNode typeNode, AnalyzedArguments analyzedArguments, InitializerExpressionSyntax initializerOpt, bool wasTargetTyped)
6888NamedTypeSymbol coClassType = type.ComImportCoClass;
6900private BoundExpression BindComImportCoClassCreationExpression(SyntaxNode node, NamedTypeSymbol interfaceType, NamedTypeSymbol coClassType, BindingDiagnosticBag diagnostics, SyntaxNode typeNode, AnalyzedArguments analyzedArguments, InitializerExpressionSyntax initializerOpt, bool wasTargetTyped)
6983NamedTypeSymbol interfaceType,
6984NamedTypeSymbol coClassType,
7093NamedTypeSymbol typeContainingConstructors,
7222private ImmutableArray<MethodSymbol> GetAccessibleConstructorsForOverloadResolution(NamedTypeSymbol type, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
7228private ImmutableArray<MethodSymbol> GetAccessibleConstructorsForOverloadResolution(NamedTypeSymbol type, bool allowProtectedConstructorsOfBaseType, out ImmutableArray<MethodSymbol> allInstanceConstructors, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
7235type = type.GetNonErrorGuess() as NamedTypeSymbol ?? type;
7242private static ConstantValue FoldParameterlessValueTypeConstructor(NamedTypeSymbol type)
7350var type = GetWellKnownType(WellKnownType.System_ReadOnlySpan_T, diagnostics, node).Construct(GetSpecialType(SpecialType.System_Byte, diagnostics, node));
7785var type = (NamedTypeSymbol)sym;
8100var namedType = ((NamedTypeSymbol)type).ConstructedFrom;
8291var type = (NamedTypeSymbol)symbol;
8520NamedTypeSymbol type = fieldSymbol.ContainingType;
8621NamedTypeSymbol enumType = null;
8641enumType = (NamedTypeSymbol)fieldType;
8646NamedTypeSymbol underlyingType = enumType.EnumUnderlyingType;
8665var containingType = this.ContainingType;
9370var int32 = GetSpecialType(SpecialType.System_Int32, diagnostics, node);
9442NamedTypeSymbol int32 = GetSpecialType(SpecialType.System_Int32, diagnostics, node);
10460internal NamedTypeSymbol? GetMethodGroupDelegateType(BoundMethodGroup node)
10789internal NamedTypeSymbol? GetMethodGroupOrLambdaDelegateType(
10848var delegateType = Compilation.GetWellKnownType(wkDelegateType);
10881static bool checkConstraints(CSharpCompilation compilation, ConversionsBase conversions, NamedTypeSymbol delegateType, ImmutableArray<TypeWithAnnotations> typeArguments)
Binder\Binder_InterpolatedString.cs (15)
41var stringType = GetSpecialType(SpecialType.System_String, diagnostics, node);
55var intType = GetSpecialType(SpecialType.System_Int32, diagnostics, node);
264return BindUnconvertedInterpolatedExpressionToFactory(unconvertedInterpolatedString, parts, (NamedTypeSymbol)unconvertedInterpolatedString.Type, factoryMethod: "Format", unconvertedInterpolatedString.Type, diagnostics);
284var interpolatedStringHandlerType = Compilation.GetWellKnownType(WellKnownType.System_Runtime_CompilerServices_DefaultInterpolatedStringHandler);
334NamedTypeSymbol factoryType,
450var interpolatedStringHandlerType = Compilation.GetWellKnownType(WellKnownType.System_Runtime_CompilerServices_DefaultInterpolatedStringHandler);
517var @string = GetSpecialType(SpecialType.System_String, diagnostics, rootSyntax);
557NamedTypeSymbol interpolatedStringHandlerType,
576NamedTypeSymbol interpolatedStringHandlerType,
603NamedTypeSymbol interpolatedStringHandlerType,
635NamedTypeSymbol interpolatedStringHandlerType,
711var intType = GetSpecialType(SpecialType.System_Int32, diagnostics, syntax);
722var boolType = GetSpecialType(SpecialType.System_Boolean, diagnostics, syntax);
817static void populateArguments(SyntaxNode syntax, ImmutableArray<BoundInterpolatedStringArgumentPlaceholder> additionalConstructorArguments, int baseStringLength, int numFormatHoles, NamedTypeSymbol intType, ArrayBuilder<BoundExpression> argumentsBuilder)
853var objectType = GetSpecialType(SpecialType.System_Object, diagnostics, unconvertedInterpolatedString.Syntax);
Binder\Binder_Lookup.cs (66)
189this.LookupMembersInInterface(result, (NamedTypeSymbol)type, name, arity, basesBeingResolved, options, originalBinder, diagnose, ref useSiteInfo);
700var namedType = (NamedTypeSymbol)symbol;
811PooledHashSet<NamedTypeSymbol> visited = null;
821NamedTypeSymbol namedType = currentType as NamedTypeSymbol;
875NamedTypeSymbol type,
912NamedTypeSymbol idictSymbol, iroDictSymbol, iListSymbol, iCollectionSymbol, inccSymbol, inpcSymbol;
916foreach (var iface in type.AllInterfacesWithDefinitionUseSiteDiagnostics(ref useSiteInfo))
957private void GetWellKnownWinRTMemberInterfaces(out NamedTypeSymbol idictSymbol, out NamedTypeSymbol iroDictSymbol, out NamedTypeSymbol iListSymbol, out NamedTypeSymbol iCollectionSymbol, out NamedTypeSymbol inccSymbol, out NamedTypeSymbol inpcSymbol)
967private static bool ShouldAddWinRTMembersForInterface(NamedTypeSymbol iface, NamedTypeSymbol idictSymbol, NamedTypeSymbol iroDictSymbol, NamedTypeSymbol iListSymbol, NamedTypeSymbol iCollectionSymbol, NamedTypeSymbol inccSymbol, NamedTypeSymbol inpcSymbol)
969var iFaceOriginal = iface.OriginalDefinition;
1014NamedTypeSymbol type,
1036private static ImmutableArray<NamedTypeSymbol> GetBaseInterfaces(NamedTypeSymbol type, ConsList<TypeSymbol> basesBeingResolved, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
1045return ImmutableArray<NamedTypeSymbol>.Empty;
1052return ImmutableArray<NamedTypeSymbol>.Empty;
1068var cycleGuard = ConsList<NamedTypeSymbol>.Empty.Prepend(type.OriginalDefinition);
1072var result = ArrayBuilder<NamedTypeSymbol>.GetInstance();
1073var visited = new HashSet<NamedTypeSymbol>(Symbols.SymbolEqualityComparer.ConsiderEverything);
1089static void addAllInterfaces(NamedTypeSymbol @interface, HashSet<NamedTypeSymbol> visited, ArrayBuilder<NamedTypeSymbol> result, ConsList<TypeSymbol> basesBeingResolved, ConsList<NamedTypeSymbol> cycleGuard)
1091NamedTypeSymbol originalDefinition;
1097ImmutableArray<NamedTypeSymbol> baseInterfaces = @interface.GetDeclaredInterfaces(basesBeingResolved);
1104var baseInterface = baseInterfaces[i];
1117ImmutableArray<NamedTypeSymbol> interfaces,
1130HashSet<NamedTypeSymbol> seenInterfaces = null;
1133seenInterfaces = new HashSet<NamedTypeSymbol>(Symbols.SymbolEqualityComparer.IgnoringNullable);
1136foreach (NamedTypeSymbol baseInterface in interfaces)
1150private void LookupMembersInInterface(LookupResult current, NamedTypeSymbol type, string name, int arity, ConsList<TypeSymbol> basesBeingResolved, LookupOptions options, Binder originalBinder, bool diagnose, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
1187private static bool IsDerivedType(NamedTypeSymbol baseType, NamedTypeSymbol derivedType, ConsList<TypeSymbol> basesBeingResolved, CSharpCompilation compilation, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
1193for (NamedTypeSymbol b = derivedType.BaseTypeWithDefinitionUseSiteDiagnostics(ref useSiteInfo); (object)b != null; b = b.BaseTypeWithDefinitionUseSiteDiagnostics(ref useSiteInfo))
1200PooledHashSet<NamedTypeSymbol> visited = null;
1202for (var b = (NamedTypeSymbol)derivedType.GetNextBaseTypeNoUseSiteDiagnostics(basesBeingResolved, compilation, ref visited);
1204b = (NamedTypeSymbol)b.GetNextBaseTypeNoUseSiteDiagnostics(basesBeingResolved, compilation, ref visited))
1297return nsOrType.GetTypeMembers(name).Cast<NamedTypeSymbol, Symbol>();
1301return ((NamedTypeSymbol)nsOrType).GetEarlyAttributeDecodingMembers(name);
1325return ((NamedTypeSymbol)nsOrType).GetEarlyAttributeDecodingMembers();
1339while (symbol is not null and not NamedTypeSymbol { IsFileLocal: true })
1356var symbolFileIdentifier = ((NamedTypeSymbol)symbol).AssociatedFileIdentifier;
1772NamedTypeSymbol namedType = (NamedTypeSymbol)symbol;
1972private void AddWinRTMembersLookupSymbolsInfo(LookupSymbolsInfo result, NamedTypeSymbol type, LookupOptions options, Binder originalBinder, TypeSymbol accessThroughType)
1974NamedTypeSymbol idictSymbol, iroDictSymbol, iListSymbol, iCollectionSymbol, inccSymbol, inpcSymbol;
1978foreach (var iface in type.AllInterfacesNoUseSiteDiagnostics)
1989PooledHashSet<NamedTypeSymbol> visited = null;
1998NamedTypeSymbol namedType = type as NamedTypeSymbol;
2024foreach (var baseInterface in type.AllInterfacesNoUseSiteDiagnostics)
2040NamedTypeSymbol effectiveBaseClass = type.EffectiveBaseClassNoUseSiteDiagnostics;
2043foreach (var baseInterface in type.AllEffectiveInterfacesNoUseSiteDiagnostics)
Binder\Binder_Patterns.cs (9)
224var systemRangeType = GetWellKnownType(WellKnownType.System_Range, diagnostics, node);
383var systemIndexType = GetWellKnownType(WellKnownType.System_Index, diagnostics, node);
1005ShouldUseITupleForRecursivePattern(node, declType, diagnostics, out var iTupleType, out var iTupleGetLength, out var iTupleGetItem))
1179foundField = CheckIsTupleElement(subpatternSyntax.NameColon.Name, (NamedTypeSymbol)declType, name, i, diagnostics);
1199[NotNullWhen(true)] out NamedTypeSymbol? iTupleType,
1237[NotNullWhen(true)] out NamedTypeSymbol? iTupleType,
1284bool hasBaseInterface(TypeSymbol type, NamedTypeSymbol possibleBaseInterface)
1296private static FieldSymbol? CheckIsTupleElement(SyntaxNode node, NamedTypeSymbol tupleType, string name, int tupleIndex, BindingDiagnosticBag diagnostics)
1401ShouldUseITuple(node, strippedInputType, diagnostics, out var iTupleType, out var iTupleGetLength, out var iTupleGetItem))
Binder\Binder_Symbols.cs (37)
555var type = (NamedTypeSymbol)constructedType.Type;
570var type = BindPredefinedTypeSymbol(predefinedType, diagnostics);
734return NamedTypeSymbol.CreateTuple(syntax.Location,
790int reserved = NamedTypeSymbol.IsTupleElementNameReserved(name);
809private NamedTypeSymbol BindPredefinedTypeSymbol(PredefinedTypeSyntax node, BindingDiagnosticBag diagnostics)
991private NamedTypeSymbol BindNativeIntegerSymbolIfAny(IdentifierNameSyntax node, BindingDiagnosticBag diagnostics)
1209NamedTypeSymbol unconstructedType = LookupGenericTypeName(
1211NamedTypeSymbol resultType;
1259private NamedTypeSymbol LookupGenericTypeName(
1299NamedTypeSymbol type = lookupResultSymbol as NamedTypeSymbol;
1372private NamedTypeSymbol ConstructNamedTypeUnlessTypeArgumentOmitted(SyntaxNode typeSyntax, NamedTypeSymbol type, SeparatedSyntaxList<TypeSyntax> typeArgumentsSyntax, ImmutableArray<TypeWithAnnotations> typeArguments, BindingDiagnosticBag diagnostics)
1550private NamedTypeSymbol ConstructNamedType(
1551NamedTypeSymbol type,
1594((NamedTypeSymbol)left).IsUnboundGenericType;
1601left = ((NamedTypeSymbol)left).OriginalDefinition;
1620var namedTypeRight = right.Symbol as NamedTypeSymbol;
1631internal NamedTypeSymbol GetSpecialType(SpecialType typeId, BindingDiagnosticBag diagnostics, SyntaxNode node)
1636internal static NamedTypeSymbol GetSpecialType(CSharpCompilation compilation, SpecialType typeId, SyntaxNode node, BindingDiagnosticBag diagnostics)
1638NamedTypeSymbol typeSymbol = compilation.GetSpecialType(typeId);
1644internal static NamedTypeSymbol GetSpecialType(CSharpCompilation compilation, SpecialType typeId, Location location, BindingDiagnosticBag diagnostics)
1646NamedTypeSymbol typeSymbol = compilation.GetSpecialType(typeId);
1750internal NamedTypeSymbol GetWellKnownType(WellKnownType type, BindingDiagnosticBag diagnostics, SyntaxNode node)
1759internal NamedTypeSymbol GetWellKnownType(WellKnownType type, BindingDiagnosticBag diagnostics, Location location)
1768internal static NamedTypeSymbol GetWellKnownType(CSharpCompilation compilation, WellKnownType type, BindingDiagnosticBag diagnostics, SyntaxNode node)
1773internal static NamedTypeSymbol GetWellKnownType(CSharpCompilation compilation, WellKnownType type, BindingDiagnosticBag diagnostics, Location location)
1775NamedTypeSymbol typeSymbol = compilation.GetWellKnownType(type);
1785internal NamedTypeSymbol GetWellKnownType(WellKnownType type, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
1787NamedTypeSymbol typeSymbol = this.Compilation.GetWellKnownType(type);
2184Compilation.IsAttributeType((NamedTypeSymbol)first) &&
2185Compilation.IsAttributeType((NamedTypeSymbol)second))
2248Emit.NoPia.EmbeddedTypesManager.IsValidEmbeddableType((NamedTypeSymbol)singleResult, where, diagnostics.DiagnosticBag);
2504if (symbol is NamedTypeSymbol { IsFileLocal: true })
2621var forwardedType =
Binder\ForEachLoopBinder.cs (13)
711nullableValueGetter = nullableValueGetter.AsMember((NamedTypeSymbol)collectionExprType);
835NamedTypeSymbol spanType = GetWellKnownType(wellKnownSpan, diagnostics, collectionExpr.Syntax);
1067NamedTypeSymbol collectionType = (NamedTypeSymbol)builder.CollectionType;
1127moveNextMethod = moveNextAsync.AsMember((NamedTypeSymbol)enumeratorType);
1139builder.CurrentPropertyGetter = currentPropertyGetter.AsMember((NamedTypeSymbol)enumeratorType);
1259NamedTypeSymbol targetInterface = isAsync ? this.Compilation.GetWellKnownType(WellKnownType.System_IAsyncDisposable) : this.Compilation.GetSpecialType(SpecialType.System_IDisposable);
1758NamedTypeSymbol implementedIEnumerable = GetIEnumerableOfT(type, isAsync, Compilation, ref useSiteInfo, out foundMultiple, out bool needSupportForRefStructInterfaces);
1787internal static NamedTypeSymbol GetIEnumerableOfT(
1791NamedTypeSymbol implementedIEnumerable = null;
1811private static void GetIEnumerableOfT(ImmutableArray<NamedTypeSymbol> interfaces, bool isAsync, CSharpCompilation compilation, ref NamedTypeSymbol result, ref bool foundMultiple)
1820foreach (NamedTypeSymbol @interface in interfaces)
Binder\InSubmissionClassBinder.cs (3)
26internal InSubmissionClassBinder(NamedTypeSymbol submissionClass, Binder next, CompilationUnitSyntax declarationSyntax, bool inUsings)
52this.LookupMembersInSubmissions(result, (NamedTypeSymbol)Container, _declarationSyntax, _inUsings, name, arity, basesBeingResolved, options, originalBinder, diagnose, ref useSiteInfo);
57this.AddMemberLookupSymbolsInfoInSubmissions(result, (NamedTypeSymbol)Container, _inUsings, options, originalBinder);
Binder\Semantics\AccessCheck.cs (40)
39NamedTypeSymbol within,
54NamedTypeSymbol within,
145Debug.Assert(within is NamedTypeSymbol || within is AssemblySymbol);
158return IsNamedTypeAccessible((NamedTypeSymbol)symbol, within, ref useSiteInfo, basesBeingResolved);
223private static bool IsNamedTypeAccessible(NamedTypeSymbol type, Symbol within, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, ConsList<TypeSymbol> basesBeingResolved = null)
225Debug.Assert(within is NamedTypeSymbol || within is AssemblySymbol);
246var containingType = type.ContainingType;
261Debug.Assert(within is NamedTypeSymbol || within is AssemblySymbol);
281var withinType = within as NamedTypeSymbol;
298NamedTypeSymbol containingType, // the symbol's containing type
307Debug.Assert(within is NamedTypeSymbol || within is AssemblySymbol);
342NamedTypeSymbol containingType, // the symbol's containing type
353var originalContainingType = containingType.OriginalDefinition;
354var withinType = within as NamedTypeSymbol;
416NamedTypeSymbol withinType,
418NamedTypeSymbol originalContainingType,
459var current = withinType.OriginalDefinition;
494NamedTypeSymbol originalContainingType)
496Debug.Assert(within is NamedTypeSymbol || within is AssemblySymbol);
498var withinType = within as NamedTypeSymbol;
514NamedTypeSymbol withinType,
515NamedTypeSymbol originalContainingType)
523var current = withinType.OriginalDefinition;
545NamedTypeSymbol baseType,
553PooledHashSet<NamedTypeSymbol> interfacesLookedAt = null;
554ArrayBuilder<NamedTypeSymbol> baseInterfaces = null;
559interfacesLookedAt = PooledHashSet<NamedTypeSymbol>.GetInstance();
560baseInterfaces = ArrayBuilder<NamedTypeSymbol>.GetInstance();
563PooledHashSet<NamedTypeSymbol> visited = null;
605NamedTypeSymbol currentBase = baseInterfaces.Pop();
635static void getBaseInterfaces(TypeSymbol derived, ArrayBuilder<NamedTypeSymbol> baseInterfaces, PooledHashSet<NamedTypeSymbol> interfacesLookedAt, ConsList<TypeSymbol> basesBeingResolved)
642ImmutableArray<NamedTypeSymbol> declaredInterfaces;
650case NamedTypeSymbol namedType:
659foreach (var @interface in declaredInterfaces)
661NamedTypeSymbol definition = @interface.OriginalDefinition;
696internal static ErrorCode GetProtectedMemberInSealedTypeError(NamedTypeSymbol containingType)
Binder\Semantics\Conversions\ConversionsBase.cs (59)
960var d = derivedType as NamedTypeSymbol;
966foreach (var iface in d.AllInterfacesWithDefinitionUseSiteDiagnostics(ref useSiteInfo))
1150HasIdentityConversionInternal(((NamedTypeSymbol)destination.OriginalDefinition).Construct(ImmutableArray.Create(elementType)), destination))
1477var delegateType = (NamedTypeSymbol)type;
1588private static LambdaConversionResult IsAnonymousFunctionCompatibleWithExpressionTree(UnboundLambda anonymousFunction, NamedTypeSymbol type, CSharpCompilation compilation)
1621var multicastDelegateType = corLibrary.GetSpecialType(SpecialType.System_MulticastDelegate);
1637return IsAnonymousFunctionCompatibleWithExpressionTree(anonymousFunction, (NamedTypeSymbol)type, compilation);
1676else if ((destination as NamedTypeSymbol)?.HasCollectionBuilderAttribute(out _, out _) == true)
1710if (targetType is NamedTypeSymbol { Arity: 1 } namedType
1899private static bool HasIdentityConversionToAny(NamedTypeSymbol type, ArrayBuilder<(NamedTypeSymbol ParticipatingType, TypeParameterSymbol ConstrainedToTypeOpt)> targetTypes)
2580NamedTypeSymbol destinationAgg = (NamedTypeSymbol)destination;
2820var derivedType = this.corLibrary.GetDeclaredSpecialType(SpecialType.System_MulticastDelegate);
2832var sourceDelegate = sourceType.GetInternalDelegateType();
2838var destinationDelegate = destinationType.GetInternalDelegateType();
2919var effectiveBaseClass = source.EffectiveBaseClass(ref useSiteInfo);
2954foreach (var i in source.AllEffectiveInterfacesWithDefinitionUseSiteDiagnostics(ref useSiteInfo))
2979var d = derivedType as NamedTypeSymbol;
2985foreach (var i in d.AllInterfacesWithDefinitionUseSiteDiagnostics(ref useSiteInfo))
2996internal bool ImplementsVarianceCompatibleInterface(NamedTypeSymbol derivedType, TypeSymbol baseType, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
3001internal bool HasImplicitConversionToOrImplementsVarianceCompatibleInterface(TypeSymbol typeToCheck, NamedTypeSymbol targetInterfaceType, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, out bool needSupportForRefStructInterfaces)
3021private bool IsRefLikeOrAllowsRefLikeTypeImplementingVarianceCompatibleInterface(TypeSymbol typeToCheck, NamedTypeSymbol targetInterfaceType, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
3035internal bool HasImplicitConversionToOrImplementsVarianceCompatibleInterface(BoundExpression expressionToCheck, NamedTypeSymbol targetInterfaceType, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, out bool needSupportForRefStructInterfaces)
3073NamedTypeSymbol? s = source as NamedTypeSymbol;
3074NamedTypeSymbol? d = destination as NamedTypeSymbol;
3092NamedTypeSymbol? s = source as NamedTypeSymbol;
3093NamedTypeSymbol? d = destination as NamedTypeSymbol;
3107private bool HasVariantConversion(NamedTypeSymbol source, NamedTypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
3138private ThreeState HasVariantConversionQuick(NamedTypeSymbol source, NamedTypeSymbol destination)
3148NamedTypeSymbol typeSymbol = source.OriginalDefinition;
3157private bool HasVariantConversionNoCycleCheck(NamedTypeSymbol source, NamedTypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
3236static bool isTypeIEquatable(NamedTypeSymbol type)
3551for (var type = t.EffectiveBaseClass(ref useSiteInfo); (object)type != null; type = type.BaseTypeWithDefinitionUseSiteDiagnostics(ref useSiteInfo))
3603for (var type = t.EffectiveBaseClass(ref useSiteInfo); (object)type != null; type = type.BaseTypeWithDefinitionUseSiteDiagnostics(ref useSiteInfo))
3669var sourceType = (NamedTypeSymbol)source;
3670var destinationType = (NamedTypeSymbol)destination;
3671var original = sourceType.OriginalDefinition;
3754foreach (var iface in this.corLibrary.GetDeclaredSpecialType(SpecialType.System_Array).AllInterfacesWithDefinitionUseSiteDiagnostics(ref useSiteInfo))
3771if (HasExplicitReferenceConversion(sourceArray.ElementType, ((NamedTypeSymbol)destination).TypeArgumentWithDefinitionUseSiteDiagnostics(0, ref useSiteInfo).Type, ref useSiteInfo))
3791var sourceElement = ((NamedTypeSymbol)source).TypeArgumentWithDefinitionUseSiteDiagnostics(0, ref useSiteInfo).Type;
3966var spanElementType = ((NamedTypeSymbol)destination).TypeArgumentsWithDefinitionUseSiteDiagnostics(ref useSiteInfo)[0];
3973var spanElementType = ((NamedTypeSymbol)destination).TypeArgumentsWithDefinitionUseSiteDiagnostics(ref useSiteInfo)[0];
3983var sourceElementType = ((NamedTypeSymbol)source).TypeArgumentsWithDefinitionUseSiteDiagnostics(ref useSiteInfo)[0];
3984var destinationElementType = ((NamedTypeSymbol)destination).TypeArgumentsWithDefinitionUseSiteDiagnostics(ref useSiteInfo)[0];
3993var spanElementType = ((NamedTypeSymbol)destination).TypeArgumentsWithDefinitionUseSiteDiagnostics(ref useSiteInfo)[0];
4029var spanElementType = ((NamedTypeSymbol)destination).TypeArgumentsWithDefinitionUseSiteDiagnostics(ref useSiteInfo)[0];
Binder\Semantics\Conversions\UserDefinedExplicitConversions.cs (7)
36var d = ArrayBuilder<(NamedTypeSymbol ParticipatingType, TypeParameterSymbol ConstrainedToTypeOpt)>.GetInstance();
74private static void ComputeUserDefinedExplicitConversionTypeSet(TypeSymbol source, TypeSymbol target, ArrayBuilder<(NamedTypeSymbol ParticipatingType, TypeParameterSymbol ConstrainedToTypeOpt)> d, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
90ArrayBuilder<(NamedTypeSymbol ParticipatingType, TypeParameterSymbol ConstrainedToTypeOpt)> d,
102foreach ((NamedTypeSymbol declaringType, TypeParameterSymbol constrainedToTypeOpt) in d)
117foreach ((NamedTypeSymbol declaringType, TypeParameterSymbol constrainedToTypeOpt) in d)
128NamedTypeSymbol declaringType,
147NamedTypeSymbol declaringType,
Binder\Semantics\Conversions\UserDefinedImplicitConversions.cs (9)
80var d = ArrayBuilder<(NamedTypeSymbol ParticipatingType, TypeParameterSymbol ConstrainedToTypeOpt)>.GetInstance();
118private static void ComputeUserDefinedImplicitConversionTypeSet(TypeSymbol s, TypeSymbol t, ArrayBuilder<(NamedTypeSymbol ParticipatingType, TypeParameterSymbol ConstrainedToTypeOpt)> d, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
146ArrayBuilder<(NamedTypeSymbol ParticipatingType, TypeParameterSymbol ConstrainedToTypeOpt)> d,
255foreach ((NamedTypeSymbol declaringType, TypeParameterSymbol constrainedToTypeOpt) in d)
270foreach ((NamedTypeSymbol declaringType, TypeParameterSymbol constrainedToTypeOpt) in d)
281NamedTypeSymbol declaringType,
880private NamedTypeSymbol MakeNullableType(TypeSymbol type)
882var nullable = this.corLibrary.GetDeclaredSpecialType(SpecialType.System_Nullable_T);
956var d = ArrayBuilder<(NamedTypeSymbol ParticipatingType, TypeParameterSymbol ConstrainedToTypeOpt)>.GetInstance();
Binder\Semantics\OverloadResolution\MethodTypeInference.cs (64)
59private static readonly ObjectPool<PooledDictionary<NamedTypeSymbol, NamedTypeSymbol>> s_poolInstance
60= PooledDictionary<NamedTypeSymbol, NamedTypeSymbol>.CreatePool(Symbols.SymbolEqualityComparer.IgnoringNullable);
62internal static PooledDictionary<NamedTypeSymbol, NamedTypeSymbol> GetInstance()
135private readonly NamedTypeSymbol _constructedContainingTypeOfMethod;
173NamedTypeSymbol constructedContainingTypeOfMethod,
318NamedTypeSymbol constructedContainingTypeOfMethod,
705var destination = (NamedTypeSymbol)target.Type;
901var destination = (NamedTypeSymbol)formalType.Type;
1059NamedTypeSymbol n => n.DelegateInvokeMethod,
1382var delegateType = target.Type.GetDelegateType();
1440NamedTypeSymbol n => (n.DelegateInvokeMethod, false),
1541var delegateType = target.Type.GetDelegateType();
1739return ((NamedTypeSymbol)type).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0];
1779ExactOrBoundsInference(kind, ((NamedTypeSymbol)source.Type).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0], ((NamedTypeSymbol)target.Type).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0], ref useSiteInfo);
1837var namedSource = source.Type as NamedTypeSymbol;
1843var namedTarget = target.Type as NamedTypeSymbol;
1912private void ExactTypeArgumentInference(NamedTypeSymbol source, NamedTypeSymbol target, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
2080return ((NamedTypeSymbol)target).TypeArgumentWithDefinitionUseSiteDiagnostics(0, ref useSiteInfo);
2169var constructedTarget = target as NamedTypeSymbol;
2189var constructedSource = source as NamedTypeSymbol;
2228private bool LowerBoundClassInference(TypeSymbol source, NamedTypeSymbol target, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
2250NamedTypeSymbol sourceBase = null;
2273private bool LowerBoundInterfaceInference(TypeSymbol source, NamedTypeSymbol target, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
2291ImmutableArray<NamedTypeSymbol> allInterfaces;
2314NamedTypeSymbol matchingInterface = GetInterfaceInferenceBound(allInterfaces, target);
2323internal static ImmutableArray<NamedTypeSymbol> ModuloReferenceTypeNullabilityDifferences(ImmutableArray<NamedTypeSymbol> interfaces, VarianceKind variance)
2327foreach (var @interface in interfaces)
2331var merged = (NamedTypeSymbol)found.MergeEquivalentTypes(@interface, variance);
2345private void LowerBoundTypeArgumentInference(NamedTypeSymbol source, NamedTypeSymbol target, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
2572var constructedSource = source as NamedTypeSymbol;
2588var constructedTarget = target as NamedTypeSymbol;
2625private bool UpperBoundClassInference(NamedTypeSymbol source, TypeSymbol target, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
2639var targetBase = target.BaseTypeWithDefinitionUseSiteDiagnostics(ref useSiteInfo);
2654private bool UpperBoundInterfaceInference(NamedTypeSymbol source, TypeSymbol target, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
2680ImmutableArray<NamedTypeSymbol> allInterfaces = target.AllInterfacesWithDefinitionUseSiteDiagnostics(ref useSiteInfo);
2685NamedTypeSymbol bestInterface = GetInterfaceInferenceBound(allInterfaces, source);
2695private void UpperBoundTypeArgumentInference(NamedTypeSymbol source, NamedTypeSymbol target, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
2961var resultType = functionType.GetInternalDelegateType();
2964var expressionOfTType = compilation.GetWellKnownType(WellKnownType.System_Linq_Expressions_Expression_T);
3033private TypeWithAnnotations InferReturnType(BoundExpression source, NamedTypeSymbol target, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
3088var fixedDelegate = (NamedTypeSymbol)GetFixedDelegateOrFunctionPointer(target);
3127private static NamedTypeSymbol GetInterfaceInferenceBound(ImmutableArray<NamedTypeSymbol> interfaces, NamedTypeSymbol target)
3130NamedTypeSymbol matchingInterface = null;
3131foreach (var currentInterface in interfaces)
Binder\Semantics\OverloadResolution\OverloadResolution.cs (31)
203members.All(static m => m.ContainingSymbol is NamedTypeSymbol { BaseTypeNoUseSiteDiagnostics.SpecialType: SpecialType.System_Object }));
369Dictionary<NamedTypeSymbol, ArrayBuilder<TMember>> containingTypeMapOpt = null;
717Debug.Assert(unmanagedCallingConventionTypes.All(u => FunctionPointerTypeSymbol.IsCallingConventionModifier((NamedTypeSymbol)u)));
889private static Dictionary<NamedTypeSymbol, ArrayBuilder<TMember>> PartitionMembersByContainingType<TMember>(ArrayBuilder<TMember> members) where TMember : Symbol
891Dictionary<NamedTypeSymbol, ArrayBuilder<TMember>> containingTypeMap = new Dictionary<NamedTypeSymbol, ArrayBuilder<TMember>>();
895NamedTypeSymbol containingType = member.ContainingType;
907private static void ClearContainingTypeMap<TMember>(ref Dictionary<NamedTypeSymbol, ArrayBuilder<TMember>> containingTypeMapOpt) where TMember : Symbol
1052Dictionary<NamedTypeSymbol, ArrayBuilder<TMember>> containingTypeMapOpt,
1116NamedTypeSymbol memberContainingType = member.ContainingType;
1119NamedTypeSymbol otherType = pair.Key;
1428NamedTypeSymbol memberContainingType = member.ContainingType;
1431NamedTypeSymbol otherContainingType = otherMember.ContainingType;
1634if (currentType.IsInterfaceType() && type.IsInterfaceType() && currentType.AllInterfacesWithDefinitionUseSiteDiagnostics(ref useSiteInfo).Contains((NamedTypeSymbol)type))
1862var resultsByContainingType = PooledDictionary<NamedTypeSymbol, OneOrMany<TMemberResolution>>.GetInstance();
2785var n1 = t1 as NamedTypeSymbol;
2786var n2 = t2 as NamedTypeSymbol;
3227NamedTypeSymbol d;
3250y = ((NamedTypeSymbol)y).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Type;
3329var destination = (NamedTypeSymbol)targetType;
3469return BetterConversionTargetCore(((NamedTypeSymbol)type1).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Type,
3470((NamedTypeSymbol)type2).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Type,
3483NamedTypeSymbol d1;
3487NamedTypeSymbol d2;
3576private bool IsMethodGroupConversionIncompatibleWithDelegate(BoundMethodGroup node, NamedTypeSymbol delegateType, Conversion conv)
3598NamedTypeSymbol d1;
3602NamedTypeSymbol d2;
4445&& parameters.ParameterTypes[argumentPosition].Type is NamedTypeSymbol { IsInterpolatedStringHandlerType: true, IsValueType: true })
BoundTree\UnboundLambda.cs (33)
146var delegateType = Type.GetDelegateType();
164internal LambdaSymbol CreateLambdaSymbol(NamedTypeSymbol delegateType, Symbol containingSymbol) =>
303NamedTypeSymbol? taskType = null;
304var delegateReturnType = delegateType?.GetDelegateType()?.DelegateInvokeMethod?.ReturnType as NamedTypeSymbol;
449public BoundLambda Bind(NamedTypeSymbol delegateType, bool isExpressionTree)
455public BoundLambda BindForReturnTypeInference(NamedTypeSymbol delegateType)
468public TypeWithAnnotations InferReturnType(ConversionsBase conversions, NamedTypeSymbol delegateType, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, out bool inferredFromFunctionType)
504Constraint = "Avoid " + nameof(ConcurrentDictionary<(NamedTypeSymbol, bool), BoundLambda>) + " which has a large default size, but this cache is normally small.")]
505private ImmutableDictionary<(NamedTypeSymbol Type, bool IsExpressionLambda), BoundLambda>? _bindingCache;
521_bindingCache = ImmutableDictionary<(NamedTypeSymbol Type, bool IsExpressionLambda), BoundLambda>.Empty.WithComparers(BindingCacheComparer.Instance);
597public BoundLambda Bind(NamedTypeSymbol delegateType, bool isTargetExpressionTree)
633private static MethodSymbol? DelegateInvokeMethod(NamedTypeSymbol? delegateType)
697internal NamedTypeSymbol? InferDelegateType()
774private BoundLambda ReallyBind(NamedTypeSymbol delegateType, bool inExpressionTree)
897internal LambdaSymbol CreateLambdaSymbol(NamedTypeSymbol delegateType, Symbol containingSymbol)
931NamedTypeSymbol? delegateType,
1006public BoundLambda BindForReturnTypeInference(NamedTypeSymbol delegateType)
1027public readonly NamedTypeSymbol? TaskLikeReturnTypeOpt;
1031private ReturnInferenceCacheKey(ImmutableArray<TypeWithAnnotations> parameterTypes, ImmutableArray<RefKind> parameterRefKinds, NamedTypeSymbol? taskLikeReturnTypeOpt)
1078public static ReturnInferenceCacheKey Create(NamedTypeSymbol? delegateType, bool isAsync)
1080GetFields(delegateType, isAsync, out var parameterTypes, out var parameterRefKinds, out var taskLikeReturnTypeOpt);
1089NamedTypeSymbol? delegateType,
1093out NamedTypeSymbol? taskLikeReturnTypeOpt)
1121var delegateReturnType = invoke.ReturnType as NamedTypeSymbol;
1190var delegateType = (NamedTypeSymbol?)lambda.Type;
1197NamedTypeSymbol? delegateType,
1414private sealed class BindingCacheComparer : IEqualityComparer<(NamedTypeSymbol Type, bool IsExpressionTree)>
1418public bool Equals([AllowNull] (NamedTypeSymbol Type, bool IsExpressionTree) x, [AllowNull] (NamedTypeSymbol Type, bool IsExpressionTree) y)
1421public int GetHashCode([DisallowNull] (NamedTypeSymbol Type, bool IsExpressionTree) obj)
CodeGen\EmitArrayInitializer.cs (4)
398private bool TryEmitOptimizedReadonlySpanCreation(NamedTypeSymbol spanType, BoundExpression wrappedExpression, bool used, BoundExpression inPlaceTarget, out bool avoidInPlace, BoundExpression? start = null, BoundExpression? length = null)
632bool tryEmitAsCachedArrayFromBlob(NamedTypeSymbol spanType, BoundExpression wrappedExpression, int elementCount, ImmutableArray<byte> data, ref ArrayTypeSymbol arrayType, TypeSymbol elementType)
682bool tryEmitAsCachedArrayOfConstants(BoundArrayCreation arrayCreation, ArrayTypeSymbol arrayType, TypeSymbol elementType, NamedTypeSymbol spanType, bool used, BoundExpression? inPlaceTarget, out bool avoidInPlace)
756void emitEmptyReadonlySpan(NamedTypeSymbol spanType, BoundExpression wrappedExpression, bool used, BoundExpression? inPlaceTarget)
Compilation\AttributeSemanticModel.cs (5)
23NamedTypeSymbol attributeType,
39public static AttributeSemanticModel Create(PublicSemanticModel containingSemanticModel, AttributeSyntax syntax, NamedTypeSymbol attributeType, AliasSymbol aliasOpt, Symbol? attributeTarget, Binder rootBinder, ImmutableDictionary<Symbol, Symbol>? parentRemappedSymbolsOpt)
48public static SpeculativeSemanticModelWithMemberModel CreateSpeculative(SyntaxTreeSemanticModel parentSemanticModel, AttributeSyntax syntax, NamedTypeSymbol attributeType, AliasSymbol aliasOpt, Binder rootBinder, ImmutableDictionary<Symbol, Symbol> parentRemappedSymbolsOpt, int position)
53private NamedTypeSymbol AttributeType
57return (NamedTypeSymbol)MemberSymbol;
Compilation\CSharpCompilation.cs (25)
59private NamedTypeSymbol? _lazyScriptClass = ErrorTypeSymbol.UnknownResultType;
150private ConcurrentCache<TypeSymbol, NamedTypeSymbol>? _lazyTypeToNullableVersion;
1529internal new NamedTypeSymbol? ScriptClass
1656internal NamedTypeSymbol GetSpecialType(ExtendedSpecialType specialType)
1663NamedTypeSymbol result;
1678private ConcurrentCache<TypeSymbol, NamedTypeSymbol> TypeToNullableVersion
1682return InterlockedOperations.Initialize(ref _lazyTypeToNullableVersion, static () => new ConcurrentCache<TypeSymbol, NamedTypeSymbol>(size: 100));
1693internal NamedTypeSymbol GetOrCreateNullableType(TypeSymbol typeArgument)
1817internal new NamedTypeSymbol? GetTypeByMetadataName(string fullyQualifiedMetadataName)
1819var result = this.Assembly.GetTypeByMetadataName(fullyQualifiedMetadataName, includeReferences: true, isWellKnownType: false, conflicts: out var _);
1839internal new NamedTypeSymbol ObjectType
1922NamedTypeSymbol? mainType;
1926var scriptClass = this.ScriptClass;
1945mainType = mainTypeOrNamespace as NamedTypeSymbol;
2172if (!(method.ReturnType is NamedTypeSymbol namedType))
2403AccessCheck.IsSymbolAccessible(symbol0, (NamedTypeSymbol)within0, ref discardedUseSiteInfo, throughType0);
3575case NamedTypeSymbol namedType:
3582public override void VisitNamedType(NamedTypeSymbol symbol)
4091var internalType = type.EnsureCSharpSymbolOrNull($"{nameof(callingConventionTypes)}[{index}]");
4106internal new NamedTypeSymbol CreateNativeIntegerTypeSymbol(bool signed)
4126return NamedTypeSymbol.CreateTuple(
4143NamedTypeSymbol csharpUnderlyingTuple = underlyingType.EnsureCSharpSymbolOrNull(nameof(underlyingType));
4154var tupleType = NamedTypeSymbol.CreateTuple(
4422=> IsReadOnlySpanType(type) && ((NamedTypeSymbol)type).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].SpecialType == SpecialType.System_Byte;
Compilation\CSharpSemanticModel.cs (19)
413NamedTypeSymbol attributeType = (NamedTypeSymbol)binder.BindType(attribute.Name, BindingDiagnosticBag.Discarded, out aliasOpt).Type;
1595if ((object)containingType != null && containingType.Kind == SymbolKind.NamedType && ((NamedTypeSymbol)containingType).IsScriptClass)
2772var attributeType = (NamedTypeSymbol)binder.BindType(attribute.Name, BindingDiagnosticBag.Discarded, out aliasOpt).Type;
3590var namedType = (NamedTypeSymbol)attribute.Type;
3599if (candidateSymbols.Length == 1 && candidateSymbols[0] is NamedTypeSymbol)
3601namedType = (NamedTypeSymbol)candidateSymbols[0];
3682NamedTypeSymbol containingType = binder.ContainingType;
3730private static ParameterSymbol GetThisParameter(TypeSymbol typeOfThis, NamedTypeSymbol containingType, Symbol containingMember, out LookupResultKind resultKind)
3864var objectType = binaryOperator.Type.ContainingAssembly.GetSpecialType(SpecialType.System_Object);
3969NamedTypeSymbol typeSymbol = null;
3990typeSymbol = (NamedTypeSymbol)unwrappedSymbols[0];
4001typeSymbol = unwrappedSymbols[0] as NamedTypeSymbol;
4015NamedTypeSymbol typeSymbolOpt,
5151return (GetSymbolInfo(tupleTypeSyntax, cancellationToken).Symbol.GetSymbol() as NamedTypeSymbol)?.TupleElements.ElementAtOrDefault(tupleTypeSyntax.Elements.IndexOf(declarationSyntax)).GetPublicSymbol();
5173typeDeclaration, namedType.GetSymbol<NamedTypeSymbol>());
5229protected static SynthesizedPrimaryConstructor TryGetSynthesizedPrimaryConstructor(TypeDeclarationSyntax node, NamedTypeSymbol type)
Emitter\Model\PEModuleBuilder.cs (50)
26internal abstract class PEModuleBuilder : PEModuleBuilder<CSharpCompilation, SourceModuleSymbol, AssemblySymbol, TypeSymbol, NamedTypeSymbol, MethodSymbol, SyntaxNode, NoPia.EmbeddedTypesManager, ModuleCompilationState>
48private Dictionary<FieldSymbol, NamedTypeSymbol> _fixedImplementationTypes;
211internal sealed override IEnumerable<Cci.INestedTypeDefinition> GetSynthesizedNestedTypes(NamedTypeSymbol container)
495internal virtual NamedTypeSymbol GetDynamicOperationContextType(NamedTypeSymbol contextType)
575yield return ((NamedTypeSymbol)member).GetCciAdapter();
655internal static HashSet<NamedTypeSymbol> GetForwardedTypes(SourceAssemblySymbol sourceAssembly, ArrayBuilder<Cci.ExportedType>? builder)
657var seenTopLevelForwardedTypes = new HashSet<NamedTypeSymbol>();
672var exportedNamesMap = new Dictionary<string, NamedTypeSymbol>(StringOrdinalComparer.Instance);
676var type = (NamedTypeSymbol)exportedType.Type.GetInternalSymbol();
705NamedTypeSymbol contender;
737HashSet<NamedTypeSymbol> seenTopLevelTypes,
738CommonAssemblyWellKnownAttributeData<NamedTypeSymbol> wellKnownAttributeData,
744var stack = ArrayBuilder<(NamedTypeSymbol type, int parentIndex)>.GetInstance();
747IEnumerable<NamedTypeSymbol> orderedForwardedTypes = wellKnownAttributeData.ForwardedTypes;
754foreach (NamedTypeSymbol forwardedType in orderedForwardedTypes)
756NamedTypeSymbol originalDefinition = forwardedType.OriginalDefinition;
789ImmutableArray<NamedTypeSymbol> nested = type.GetTypeMembers(); // Ordered.
814private NamedTypeSymbol GetUntranslatedSpecialType(SpecialType specialType, SyntaxNode syntaxNodeOpt, DiagnosticBag diagnostics)
846var namedType = typeRef.GetInternalSymbol() as NamedTypeSymbol;
955NamedTypeSymbol namedTypeSymbol,
1016NamedTypeSymbol container = namedTypeSymbol.ContainingType;
1060else if (namedTypeSymbol.NativeIntegerUnderlyingType is NamedTypeSymbol underlyingType)
1077private void CheckTupleUnderlyingType(NamedTypeSymbol namedTypeSymbol, SyntaxNode syntaxNodeOpt, DiagnosticBag diagnostics)
1083var declaredBase = namedTypeSymbol.BaseTypeNoUseSiteDiagnostics;
1112public static bool IsGenericType(NamedTypeSymbol toCheck)
1152return Translate((NamedTypeSymbol)typeSymbol, syntaxNodeOpt, diagnostics);
1250NamedTypeSymbol container = methodSymbol.ContainingType;
1324NamedTypeSymbol container = methodSymbol.ContainingType;
1463public NamedTypeSymbol SetFixedImplementationType(SourceMemberFieldSymbol field)
1467Interlocked.CompareExchange(ref _fixedImplementationTypes, new Dictionary<FieldSymbol, NamedTypeSymbol>(), null);
1472NamedTypeSymbol result;
1578NamedTypeSymbol byteType = Compilation.GetSpecialType(SpecialType.System_Byte);
1599NamedTypeSymbol byteType = Compilation.GetSpecialType(SpecialType.System_Byte);
1662NamedTypeSymbol booleanType = Compilation.GetSpecialType(SpecialType.System_Boolean);
1904internal MethodSymbol EnsureInlineArrayAsSpanExists(SyntaxNode syntaxNode, NamedTypeSymbol spanType, NamedTypeSymbol intType, DiagnosticBag diagnostics)
1921internal NamedTypeSymbol EnsureInlineArrayTypeExists(SyntaxNode syntaxNode, SyntheticBoundNodeFactory factory, int arrayLength, DiagnosticBag diagnostics)
1941return (NamedTypeSymbol)typeAdapter.GetInternalSymbol()!;
1944internal NamedTypeSymbol EnsureReadOnlyListTypeExists(SyntaxNode syntaxNode, SynthesizedReadOnlyListKind kind, DiagnosticBag diagnostics)
1952NamedTypeSymbol typeSymbol;
1962typeSymbol = (NamedTypeSymbol)typeAdapter.GetInternalSymbol()!;
1973internal MethodSymbol EnsureInlineArrayAsReadOnlySpanExists(SyntaxNode syntaxNode, NamedTypeSymbol spanType, NamedTypeSymbol intType, DiagnosticBag diagnostics)
1990internal MethodSymbol EnsureInlineArrayElementRefExists(SyntaxNode syntaxNode, NamedTypeSymbol intType, DiagnosticBag diagnostics)
2006internal MethodSymbol EnsureInlineArrayElementRefReadOnlyExists(SyntaxNode syntaxNode, NamedTypeSymbol intType, DiagnosticBag diagnostics)
2068public sealed override ImmutableArray<NamedTypeSymbol> GetEmbeddedTypes(DiagnosticBag diagnostics)
2079internal virtual ImmutableArray<NamedTypeSymbol> GetEmbeddedTypes(BindingDiagnosticBag diagnostics)
FlowAnalysis\EmptyStructTypeCache.cs (18)
19private SmallDictionary<NamedTypeSymbol, bool> _cache;
28private SmallDictionary<NamedTypeSymbol, bool> Cache
32return _cache ?? (_cache = new SmallDictionary<NamedTypeSymbol, bool>(Symbols.SymbolEqualityComparer.ConsiderEverything));
80return IsEmptyStructType(type, ConsList<NamedTypeSymbol>.Empty);
88private bool IsEmptyStructType(TypeSymbol type, ConsList<NamedTypeSymbol> typesWithMembersOfThisType)
90var nts = type as NamedTypeSymbol;
110private bool CheckStruct(ConsList<NamedTypeSymbol> typesWithMembersOfThisType, NamedTypeSymbol nts)
116typesWithMembersOfThisType = new ConsList<NamedTypeSymbol>(nts, typesWithMembersOfThisType);
126var nts = type.OriginalDefinition as NamedTypeSymbol;
134private bool CheckStructInstanceFields(ConsList<NamedTypeSymbol> typesWithMembersOfThisType, NamedTypeSymbol type)
164var nts = type as NamedTypeSymbol;
173public IEnumerable<FieldSymbol> GetStructFields(NamedTypeSymbol type, bool includeStatic)
191private FieldSymbol GetActualField(Symbol member, NamedTypeSymbol type)
FlowAnalysis\NullableWalker.cs (76)
905static ImmutableArray<Symbol> membersToBeInitialized(NamedTypeSymbol containingType, bool includeAllMembers, bool includeCurrentTypeRequiredMembers, bool includeBaseRequiredMembers)
1102var type = method.ContainingType;
1839if (node is BoundLambda boundLambda && originalSymbol is LambdaSymbol l && updatedSymbol is NamedTypeSymbol n)
3003type = ((NamedTypeSymbol)returnType.Type).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.Single();
3584return type.IsErrorType() || type.IsDynamic() || type.HasUseSiteError || (type.IsAnonymousType && canIgnoreAnonymousType((NamedTypeSymbol)type));
3586static bool canIgnoreAnonymousType(NamedTypeSymbol type)
3602(LambdaSymbol l, NamedTypeSymbol n) _ when n.IsDelegateType() => AreLambdaAndNewDelegateSimilar(l, n),
3610private static bool AreLambdaAndNewDelegateSimilar(LambdaSymbol l, NamedTypeSymbol n)
3976var containingType = constructor?.ContainingType;
4442var members = ((NamedTypeSymbol)type).GetMembersUnordered();
4489var anonymousType = (NamedTypeSymbol)node.Type;
4577NamedTypeSymbol spanType => getSpanElementType(spanType),
4654NamedTypeSymbol spanType => setSpanElementType(spanType, inferredType),
4662static TypeWithAnnotations getSpanElementType(NamedTypeSymbol namedType)
4669static TypeSymbol setSpanElementType(NamedTypeSymbol namedType, TypeWithAnnotations elementType)
4828type = TypeWithAnnotations.Create(((NamedTypeSymbol)node.Type).OriginalDefinition.Construct(ImmutableArray.Create(type)));
5478var containingType = this._symbol?.ContainingType;
5499for (NamedTypeSymbol baseType = effectiveBase(type); !(baseType is null); baseType = baseType.BaseTypeNoUseSiteDiagnostics)
5504foreach (NamedTypeSymbol interfaceType in inheritedInterfaces(type))
5510static NamedTypeSymbol effectiveBase(TypeSymbol type) => type switch
5516static ImmutableArray<NamedTypeSymbol> inheritedInterfaces(TypeSymbol type) => type switch
5520_ => ImmutableArray<NamedTypeSymbol>.Empty,
6364var wellKnownType = wellKnownMethod.ContainingType;
6366var constructedType = wellKnownType.Construct(ImmutableArray.Create(parameterType));
7143var type = method.ContainingType;
8172var containingType = type as NamedTypeSymbol;
8192var symbolContainer = symbol.ContainingType;
8217foreach (var @interface in containingType.AllInterfacesNoUseSiteDiagnostics)
8243bool tryAsMemberOfSingleType(NamedTypeSymbol singleType, [NotNullWhen(true)] out Symbol? result)
8422var tupleOpt = (NamedTypeSymbol?)node.Type;
8461NamedTypeSymbol tupleType,
8469Debug.Assert(values.Length == (useRestField ? Math.Min(tupleType.TupleElements.Length, NamedTypeSymbol.ValueTupleRestPosition) : tupleType.TupleElements.Length));
8477n = Math.Min(n, NamedTypeSymbol.ValueTupleRestPosition - 1);
8485values.Length == NamedTypeSymbol.ValueTupleRestPosition &&
8486tupleType.GetMembers(NamedTypeSymbol.ValueTupleRestFieldName).FirstOrDefault() is FieldSymbol restField)
8488var argOrdinal = getArgumentOrdinalFromParameterOrdinal(NamedTypeSymbol.ValueTupleRestPosition - 1);
8536var valueTuple = operandType as NamedTypeSymbol;
8543var targetElements = ((NamedTypeSymbol)targetType).TupleElements;
8667private void ReportNullabilityMismatchWithTargetDelegate(Location location, NamedTypeSymbol delegateType, BoundLambda lambda)
8863NamedTypeSymbol { TypeKind: TypeKind.Delegate, DelegateInvokeMethod: { Parameters: { } parameters } signature } => (signature, parameters),
8872var delegateType = targetType.GetDelegateType();
9599Action<NamedTypeSymbol>? analysisCompletion;
9601var delegateType = (NamedTypeSymbol)node.Type;
9629TypeWithState setAnalyzedNullability(BoundDelegateCreationExpression node, NamedTypeSymbol delegateType, Action<NamedTypeSymbol>? analysisCompletion, bool isTargetTyped)
9646void setAnalyzedNullabilityAsContinuation(BoundDelegateCreationExpression node, Action<NamedTypeSymbol>? analysisCompletion)
9652var delegateType = (NamedTypeSymbol)resultTypeWithAnnotations.Type;
9660Action<NamedTypeSymbol>? visitMethodGroupArgument(BoundDelegateCreationExpression node, NamedTypeSymbol delegateType, BoundMethodGroup group)
9668Action<NamedTypeSymbol>? analyzeMethodGroupConversion(BoundDelegateCreationExpression node, NamedTypeSymbol delegateType, BoundMethodGroup group, bool isTargetTyped)
9689Action<NamedTypeSymbol>? analyzeMethodGroupConversionAsContinuation(BoundDelegateCreationExpression node, BoundMethodGroup group)
9691return (NamedTypeSymbol delegateType) =>
9697Action<NamedTypeSymbol>? visitLambdaArgument(NamedTypeSymbol delegateType, BoundLambda lambda, bool isTargetTyped)
9704Action<NamedTypeSymbol>? analyzeLambdaConversion(NamedTypeSymbol delegateType, BoundLambda lambda, bool isTargetTyped)
9721Action<NamedTypeSymbol> analyzeLambdaConversionAsContinuation(BoundLambda lambda)
9723return (NamedTypeSymbol delegateType) => analyzeLambdaConversion(delegateType, lambda, isTargetTyped: false);
9726Action<NamedTypeSymbol>? visitDelegateArgument(NamedTypeSymbol delegateType, BoundExpression arg, bool isTargetTyped)
9740Action<NamedTypeSymbol>? analyzeDelegateConversion(NamedTypeSymbol delegateType, BoundExpression arg, bool isTargetTyped)
9760Action<NamedTypeSymbol> analyzeDelegateConversionAsContinuation(BoundExpression arg)
9762return (NamedTypeSymbol delegateType) => analyzeDelegateConversion(delegateType, arg, isTargetTyped: false);
9863private void VisitLambda(BoundLambda node, NamedTypeSymbol? delegateTypeOpt, Optional<LocalState> initialState = default)
10400if (expr.Type is NamedTypeSymbol { IsTupleType: true } tupleType)
10829valueProperty = getValue?.AsMember((NamedTypeSymbol)containingType)?.AssociatedSymbol;
11000NamedTypeSymbol spanType = compilation.GetWellKnownType(wellKnownSpan);
11442var reinferredGetResult = _visitResult.RValueType.Type is NamedTypeSymbol taskAwaiterType
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (24)
72var immutableArrayOfTargetCollectionTypeEmpty = immutableArrayOfTEmpty.AsMember((NamedTypeSymbol)node.Type);
201var iCollectionOfElementType = iCollectionOfTType.Construct(((NamedTypeSymbol)targetEnumerableType).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics);
221Elements: [BoundCollectionExpressionSpreadElement { Expression: { Type: NamedTypeSymbol spreadType } expr }],
258var spanType = (NamedTypeSymbol)collectionType;
312var listToArray = ((MethodSymbol)_factory.WellKnownMember(WellKnownMember.System_Collections_Generic_List_T__ToArray)).AsMember((NamedTypeSymbol)list.Type);
392Debug.Assert(node.Type is NamedTypeSymbol);
397var collectionType = (NamedTypeSymbol)node.Type;
424var synthesizedType = _factory.ModuleBuilderOpt.EnsureReadOnlyListTypeExists(syntax, kind: kind, _diagnostics.DiagnosticBag).Construct(typeArgs);
465var spanType = (NamedTypeSymbol)constructMethod.Parameters[0].Type;
556var inlineArrayType = _factory.ModuleBuilderOpt.EnsureInlineArrayTypeExists(syntax, _factory, arrayLength, _diagnostics.DiagnosticBag).Construct(ImmutableArray.Create(elementType));
559var intType = _factory.SpecialType(SpecialType.System_Int32);
661return _factory.Call(rewrittenSpreadExpression, listToArrayMethod.AsMember((NamedTypeSymbol)spreadExpression.Type!));
671return _factory.Call(rewrittenSpreadExpression, toArrayMethod.AsMember((NamedTypeSymbol)rewrittenSpreadExpression.Type!));
824if (type is not NamedTypeSymbol namedType)
964var spreadLength = _factory.Call(spreadOperandAsSpan, getLengthMethod.AsMember((NamedTypeSymbol)spreadOperandAsSpan.Type!));
965var targetSlice = _factory.Call(spanTemp, spanSliceMethod.AsMember((NamedTypeSymbol)spanTemp.Type!), indexTemp, spreadLength);
966sideEffects.Add(_factory.Call(spreadOperandAsSpan, copyToMethod.AsMember((NamedTypeSymbol)spreadOperandAsSpan.Type!), targetSlice));
981var collectionType = _factory.WellKnownType(WellKnownType.System_Collections_Generic_List_T).Construct(typeArguments);
1063var spanGetItem = ((MethodSymbol)_factory.WellKnownMember(WellKnownMember.System_Span_T__get_Item)).AsMember((NamedTypeSymbol)spanTemp.Type);
1080Debug.Assert(spanTemp.Type is NamedTypeSymbol);
1084var elementType = ((NamedTypeSymbol)spanTemp.Type).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Type;
Lowering\LocalRewriter\LocalRewriter_TupleCreationExpression.cs (15)
40return MakeTupleCreationExpression(node.Syntax, (NamedTypeSymbol)node.Type, rewrittenArguments);
43private BoundExpression MakeTupleCreationExpression(SyntaxNode syntax, NamedTypeSymbol type, ImmutableArray<BoundExpression> rewrittenArguments)
47ArrayBuilder<NamedTypeSymbol> underlyingTupleTypeChain = ArrayBuilder<NamedTypeSymbol>.GetInstance();
48NamedTypeSymbol.GetUnderlyingTypeChain(type, underlyingTupleTypeChain);
53NamedTypeSymbol smallestType = underlyingTupleTypeChain.Pop();
55underlyingTupleTypeChain.Count * (NamedTypeSymbol.ValueTupleRestPosition - 1),
57var smallestCtor = (MethodSymbol?)NamedTypeSymbol.GetWellKnownMemberInType(smallestType.OriginalDefinition,
58NamedTypeSymbol.GetTupleCtor(smallestType.Arity),
73NamedTypeSymbol tuple8Type = underlyingTupleTypeChain.Peek();
74var tuple8Ctor = (MethodSymbol?)NamedTypeSymbol.GetWellKnownMemberInType(tuple8Type.OriginalDefinition,
75NamedTypeSymbol.GetTupleCtor(NamedTypeSymbol.ValueTupleRestPosition),
89(underlyingTupleTypeChain.Count - 1) * (NamedTypeSymbol.ValueTupleRestPosition - 1),
90NamedTypeSymbol.ValueTupleRestPosition - 1)
Lowering\StateMachineRewriter\CapturedSymbol.cs (6)
26public abstract BoundExpression Replacement<TArg>(SyntaxNode node, Func<NamedTypeSymbol, TArg, BoundExpression> makeFrame, TArg arg);
39public override BoundExpression Replacement<TArg>(SyntaxNode node, Func<NamedTypeSymbol, TArg, BoundExpression> makeFrame, TArg arg)
42var field = this.HoistedField.AsMember((NamedTypeSymbol)frame.Type);
57public override BoundExpression Replacement<TArg>(SyntaxNode node, Func<NamedTypeSymbol, TArg, BoundExpression> makeFrame, TArg arg)
60var field = this.HoistedField.AsMember((NamedTypeSymbol)frame.Type);
77public override BoundExpression Replacement<TArg>(SyntaxNode node, Func<NamedTypeSymbol, TArg, BoundExpression> makeFrame, TArg arg)
Lowering\StateMachineRewriter\StateMachineFieldSymbol.cs (4)
30public StateMachineFieldSymbol(NamedTypeSymbol stateMachineType, TypeWithAnnotations type, string name, bool isPublic, bool isThis)
36public StateMachineFieldSymbol(NamedTypeSymbol stateMachineType, TypeSymbol type, string name, SynthesizedLocalKind synthesizedKind, int slotIndex, bool isPublic)
41public StateMachineFieldSymbol(NamedTypeSymbol stateMachineType, TypeSymbol type, string name, LocalSlotDebugInfo slotDebugInfo, int slotIndex, bool isPublic) :
46public StateMachineFieldSymbol(NamedTypeSymbol stateMachineType, TypeWithAnnotations type, string name, LocalSlotDebugInfo slotDebugInfo, int slotIndex, bool isPublic)
Lowering\SyntheticBoundNodeFactory.cs (19)
52private NamedTypeSymbol? _currentType;
53public NamedTypeSymbol? CurrentType
114public SyntheticBoundNodeFactory(MethodSymbol? topLevelMethodOpt, NamedTypeSymbol? currentClassOpt, SyntaxNode node, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics, InstrumentationState? instrumentationState = null)
147public void AddNestedType(NamedTypeSymbol nestedType)
154public void OpenNestedType(NamedTypeSymbol nestedType)
202public void AddField(NamedTypeSymbol containingType, FieldSymbol field)
225public BoundBaseReference Base(NamedTypeSymbol baseType)
288public NamedTypeSymbol SpecialType(SpecialType st)
290NamedTypeSymbol specialType = Compilation.GetSpecialType(st);
300public NamedTypeSymbol WellKnownType(WellKnownType wt)
302NamedTypeSymbol wellKnownType = Compilation.GetWellKnownType(wt);
674var objectType = SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Object);
731public BoundObjectCreationExpression New(NamedTypeSymbol type, params BoundExpression[] args)
740public BoundObjectCreationExpression New(NamedTypeSymbol type, ImmutableArray<BoundExpression> args)
1187NamedTypeSymbol baseType = CurrentFunction.ThisParameter.Type.BaseTypeNoUseSiteDiagnostics;
1297NamedTypeSymbol constructorInfo = WellKnownType(Microsoft.CodeAnalysis.WellKnownType.System_Reflection_ConstructorInfo);
1430private MethodSymbol GetMethodFromHandleMethod(NamedTypeSymbol methodContainer, TypeSymbol systemReflectionMethodOrConstructorInfo)
1454private MethodSymbol GetFieldFromHandleMethod(NamedTypeSymbol fieldContainer)
1513return this.Call(arg, this.SpecialMethod(CodeAnalysis.SpecialMember.System_Nullable_T_get_Value).AsMember((NamedTypeSymbol)arg.Type));
Symbols\AssemblySymbol.cs (30)
322internal abstract NamedTypeSymbol? LookupDeclaredTopLevelMetadataType(ref MetadataTypeName emittedName);
334internal abstract NamedTypeSymbol LookupDeclaredOrForwardedTopLevelMetadataType(ref MetadataTypeName emittedName, ConsList<AssemblySymbol>? visitedAssemblies);
341public NamedTypeSymbol? ResolveForwardedType(string fullyQualifiedMetadataName)
355internal virtual NamedTypeSymbol? TryLookupForwardedMetadataTypeWithCycleDetection(ref MetadataTypeName emittedName, ConsList<AssemblySymbol>? visitedAssemblies)
372internal abstract IEnumerable<NamedTypeSymbol> GetAllTopLevelForwardedTypes();
380internal abstract NamedTypeSymbol GetDeclaredSpecialType(ExtendedSpecialType type);
386internal virtual void RegisterDeclaredSpecialType(NamedTypeSymbol corType)
406internal virtual NamedTypeSymbol GetNativeIntegerType(NamedTypeSymbol underlyingType)
604internal NamedTypeSymbol GetSpecialType(ExtendedSpecialType type)
621internal NamedTypeSymbol ObjectType
634internal NamedTypeSymbol GetPrimitiveType(Microsoft.Cci.PrimitiveTypeCode type)
645public NamedTypeSymbol? GetTypeByMetadataName(string fullyQualifiedMetadataName)
652var result = this.GetTypeByMetadataName(fullyQualifiedMetadataName, includeReferences: false, isWellKnownType: false, conflicts: out var _);
683internal NamedTypeSymbol? GetTypeByMetadataName(
692NamedTypeSymbol? type;
803var symbol = (NamedTypeSymbol?)GetTypeByReflectionType(nestedTypes[i].AsType());
842NamedTypeSymbol? symbol = GetTopLevelTypeByMetadataName(ref mdName, assemblyId, includeReferences: true, isWellKnownType: false, conflicts: out var _);
859private NamedTypeSymbol? ApplyGenericArguments(NamedTypeSymbol symbol, Type[] typeArguments, ref int currentTypeArgument)
886internal NamedTypeSymbol? GetTopLevelTypeByMetadataName(
905NamedTypeSymbol? result;
930NamedTypeSymbol? corLibCandidate = GetTopLevelTypeByMetadataName(CorLibrary, ref metadataName, assemblyOpt);
965NamedTypeSymbol? candidate = GetTopLevelTypeByMetadataName(assembly, ref metadataName, assemblyOpt);
1014bool isValidCandidate([NotNullWhen(true)] NamedTypeSymbol? candidate, bool isWellKnownType)
1022private bool IsInCorLib(NamedTypeSymbol type)
1027private bool IsValidWellKnownType(NamedTypeSymbol? result)
1040private static NamedTypeSymbol? GetTopLevelTypeByMetadataName(AssemblySymbol assembly, ref MetadataTypeName metadataName, AssemblyIdentity? assemblyOpt)
1047var result = assembly.LookupDeclaredTopLevelMetadataType(ref metadataName);
Symbols\Attributes\SourceAttributeData.cs (9)
21private readonly NamedTypeSymbol _attributeClass;
33NamedTypeSymbol attributeClass,
61internal SourceAttributeData(CSharpCompilation compilation, AttributeSyntax attributeSyntax, NamedTypeSymbol attributeClass, MethodSymbol? attributeConstructor, bool hasErrors)
78NamedTypeSymbol attributeClass,
89public override NamedTypeSymbol AttributeClass
224internal static int GetTargetAttributeSignatureIndex(CSharpCompilation compilation, NamedTypeSymbol attributeClass, MethodSymbol? attributeConstructor, AttributeDescription description)
295var namedType = (NamedTypeSymbol)parameterType;
473internal static bool IsTargetAttribute(NamedTypeSymbol attributeClass, string namespaceName, string typeName)
Symbols\BaseTypeAnalysis.cs (13)
18internal static bool TypeDependsOn(NamedTypeSymbol depends, NamedTypeSymbol on)
33private static void TypeDependsClosure(NamedTypeSymbol type, CSharpCompilation currentCompilation, HashSet<Symbol> partialClosure)
45foreach (var bt in type.GetDeclaredInterfaces(null))
63internal static bool StructDependsOn(NamedTypeSymbol depends, NamedTypeSymbol on)
78private static void StructDependsClosure(NamedTypeSymbol type, HashSet<Symbol> partialClosure, NamedTypeSymbol on)
103StructDependsClosure((NamedTypeSymbol)fieldType, partialClosure, on);
124internal static ManagedKind GetManagedKind(NamedTypeSymbol type, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
153static (bool definitelyManaged, bool hasGenerics) dependsOnDefinitelyManagedType(NamedTypeSymbol type, HashSet<Symbol> partialClosure, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
197NamedTypeSymbol fieldNamedType = fieldType as NamedTypeSymbol;
Symbols\ConstraintsHelper.cs (32)
141ImmutableArray<NamedTypeSymbol> interfaces;
143NamedTypeSymbol effectiveBaseClass = corLibrary.GetSpecialType(typeParameter.HasValueTypeConstraint ? SpecialType.System_ValueType : SpecialType.System_Object);
148interfaces = ImmutableArray<NamedTypeSymbol>.Empty;
153var interfacesBuilder = ArrayBuilder<NamedTypeSymbol>.GetInstance();
163NamedTypeSymbol constraintEffectiveBase;
227AddInterface(interfacesBuilder, (NamedTypeSymbol)constraintType.Type);
233constraintEffectiveBase = (NamedTypeSymbol)constraintType.Type;
275constraintEffectiveBase = (NamedTypeSymbol)constraintType.Type;
589((NamedTypeSymbol)type).CheckConstraints(args);
599this NamedTypeSymbol tuple,
618var underlyingTupleTypeChain = ArrayBuilder<NamedTypeSymbol>.GetInstance();
619NamedTypeSymbol.GetUnderlyingTypeChain(tuple, underlyingTupleTypeChain);
640offset += NamedTypeSymbol.ValueTupleRestIndex;
656var location = ordinal == NamedTypeSymbol.ValueTupleRestIndex ? typeSyntax.Location : elementLocations[ordinal + offset];
670this NamedTypeSymbol type,
711public static bool CheckConstraints(this NamedTypeSymbol type, in CheckConstraintsArgs args)
752private static bool HasDuplicateInterfaces(NamedTypeSymbol type, ConsList<TypeSymbol> basesBeingResolved)
781foreach (var i in array)
836NamedTypeSymbol type,
1066if (typeArgument.Type is NamedTypeSymbol { IsInterface: true } iface && SelfOrBaseHasStaticAbstractMember(iface, ref useSiteInfo, out Symbol member))
1343if (conversions.HasBoxingConversion(typeArgument.Type.IsNullableType() ? ((NamedTypeSymbol)typeArgument.Type).ConstructedFrom : typeArgument.Type,
1349if (typeArgument.Type is NamedTypeSymbol { IsRefLikeType: true } refLike &&
1381private static bool SelfOrBaseHasStaticAbstractMember(NamedTypeSymbol iface, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, out Symbol memberWithoutImplementation)
1428private static void AddInterfaces(ArrayBuilder<NamedTypeSymbol> builder, ImmutableArray<NamedTypeSymbol> interfaces)
1430foreach (var @interface in interfaces)
1436private static void AddInterface(ArrayBuilder<NamedTypeSymbol> builder, NamedTypeSymbol @interface)
1457return SatisfiesPublicParameterlessConstructor((NamedTypeSymbol)typeArgument, synthesizedIfMissing: true);
1469return SatisfiesPublicParameterlessConstructor((NamedTypeSymbol)typeArgument, synthesizedIfMissing: false);
1486private static ConstructorConstraintError SatisfiesPublicParameterlessConstructor(NamedTypeSymbol type, bool synthesizedIfMissing)
1549public static bool RequiresChecking(NamedTypeSymbol type)
Symbols\FunctionTypeSymbol.cs (24)
37private static readonly NamedTypeSymbol Uninitialized = new UnsupportedMetadataTypeSymbol();
40private readonly Func<Binder, BoundExpression, NamedTypeSymbol?>? _calculateDelegate;
43private NamedTypeSymbol? _lazyDelegateType;
45internal static FunctionTypeSymbol? CreateIfFeatureEnabled(SyntaxNode syntax, Binder binder, Func<Binder, BoundExpression, NamedTypeSymbol?> calculateDelegate)
52private FunctionTypeSymbol(Binder binder, Func<Binder, BoundExpression, NamedTypeSymbol?> calculateDelegate)
59internal FunctionTypeSymbol(NamedTypeSymbol delegateType)
77internal NamedTypeSymbol? GetInternalDelegateType()
85var delegateType = _calculateDelegate(_binder, _expression);
86var result = Interlocked.CompareExchange(ref _lazyDelegateType, delegateType, Uninitialized);
124internal override NamedTypeSymbol? BaseTypeNoUseSiteDiagnostics => null;
140public override ImmutableArray<NamedTypeSymbol> GetTypeMembers() => throw ExceptionUtilities.Unreachable();
142public override ImmutableArray<NamedTypeSymbol> GetTypeMembers(ReadOnlyMemory<char> name) => throw ExceptionUtilities.Unreachable();
158internal override ImmutableArray<NamedTypeSymbol> InterfacesNoUseSiteDiagnostics(ConsList<TypeSymbol>? basesBeingResolved = null) => ImmutableArray<NamedTypeSymbol>.Empty;
164var thisDelegateType = GetInternalDelegateType();
166var otherDelegateType = otherType.GetInternalDelegateType();
173var mergedDelegateType = (NamedTypeSymbol)thisDelegateType.MergeEquivalentTypes(otherDelegateType, variance);
181var thisDelegateType = GetInternalDelegateType();
186return WithDelegateType((NamedTypeSymbol)thisDelegateType.SetNullabilityForReferenceTypes(transform));
189private FunctionTypeSymbol WithDelegateType(NamedTypeSymbol delegateType)
191var thisDelegateType = GetInternalDelegateType();
214var thisDelegateType = GetInternalDelegateType();
215var otherDelegateType = otherType.GetInternalDelegateType();
Symbols\Metadata\PE\PENamedTypeSymbol.cs (53)
73private NamedTypeSymbol _lazyBaseType = ErrorTypeSymbol.UnknownResultType;
74private ImmutableArray<NamedTypeSymbol> _lazyInterfaces = default(ImmutableArray<NamedTypeSymbol>);
75private NamedTypeSymbol _lazyDeclaredBaseType = ErrorTypeSymbol.UnknownResultType;
76private ImmutableArray<NamedTypeSymbol> _lazyDeclaredInterfaces = default(ImmutableArray<NamedTypeSymbol>);
133internal NamedTypeSymbol lazyEnumUnderlyingType;
144internal NamedTypeSymbol lazyComImportCoClassType = ErrorTypeSymbol.UnknownResultType;
470internal override NamedTypeSymbol BaseTypeNoUseSiteDiagnostics
483internal override ImmutableArray<NamedTypeSymbol> InterfacesNoUseSiteDiagnostics(ConsList<TypeSymbol> basesBeingResolved = null)
487ImmutableInterlocked.InterlockedCompareExchange(ref _lazyInterfaces, MakeAcyclicInterfaces(), default(ImmutableArray<NamedTypeSymbol>));
493internal override ImmutableArray<NamedTypeSymbol> GetInterfacesToEmit()
498internal override NamedTypeSymbol GetDeclaredBaseType(ConsList<TypeSymbol> basesBeingResolved)
503private NamedTypeSymbol GetDeclaredBaseType(bool skipTransformsIfNecessary)
507var baseType = MakeDeclaredBaseType();
521baseType = (NamedTypeSymbol)NullableTypeDecoder.TransformType(TypeWithAnnotations.Create(decodedType), _handle, moduleSymbol, accessSymbol: this, nullableContext: this).Type;
530internal override ImmutableArray<NamedTypeSymbol> GetDeclaredInterfaces(ConsList<TypeSymbol> basesBeingResolved)
534ImmutableInterlocked.InterlockedCompareExchange(ref _lazyDeclaredInterfaces, MakeDeclaredInterfaces(), default(ImmutableArray<NamedTypeSymbol>));
540private NamedTypeSymbol MakeDeclaredBaseType()
550return (NamedTypeSymbol)new MetadataDecoder(moduleSymbol, this).GetTypeOfToken(token);
562private ImmutableArray<NamedTypeSymbol> MakeDeclaredInterfaces()
571var symbols = ArrayBuilder<NamedTypeSymbol>.GetInstance(interfaceImpls.Count);
583var namedTypeSymbol = typeSymbol as NamedTypeSymbol ?? new UnsupportedMetadataTypeSymbol(); // interface list contains a bad type
590return ImmutableArray<NamedTypeSymbol>.Empty;
594return ImmutableArray.Create<NamedTypeSymbol>(new UnsupportedMetadataTypeSymbol(mrEx));
598public override NamedTypeSymbol ConstructedFrom
614public override NamedTypeSymbol ContainingType
618return _container as NamedTypeSymbol;
679public override NamedTypeSymbol EnumUnderlyingType
1205NamedTypeSymbol underlyingType = null;
1234underlyingType = (NamedTypeSymbol)type;
1543internal override ImmutableArray<NamedTypeSymbol> GetTypeMembersUnordered()
1548public override ImmutableArray<NamedTypeSymbol> GetTypeMembers()
1554private ImmutableArray<NamedTypeSymbol> GetMemberTypesPrivate()
1556var builder = ArrayBuilder<NamedTypeSymbol>.GetInstance();
1585public override ImmutableArray<NamedTypeSymbol> GetTypeMembers(ReadOnlyMemory<char> name)
1593return StaticCast<NamedTypeSymbol>.From(t);
1596return ImmutableArray<NamedTypeSymbol>.Empty;
1599public override ImmutableArray<NamedTypeSymbol> GetTypeMembers(ReadOnlyMemory<char> name, int arity)
1822private NamedTypeSymbol MakeAcyclicBaseType()
1824NamedTypeSymbol declaredBase = GetDeclaredBaseType(null);
1841private ImmutableArray<NamedTypeSymbol> MakeAcyclicInterfaces()
2343internal override NamedTypeSymbol ComImportCoClass
2361var coClassType = ((object)type != null && (type.TypeKind == TypeKind.Class || type.IsErrorType())) ? (NamedTypeSymbol)type : null;
2555protected override NamedTypeSymbol WithTupleDataCore(TupleExtraData newData)
2583internal override NamedTypeSymbol AsNativeInteger()
2594internal override NamedTypeSymbol NativeIntegerUnderlyingType => null;
2640protected sealed override NamedTypeSymbol WithTupleDataCore(TupleExtraData newData)
2685internal sealed override NamedTypeSymbol AsNativeInteger() => throw ExceptionUtilities.Unreachable();
2687internal sealed override NamedTypeSymbol NativeIntegerUnderlyingType => null;
2737var container = this.ContainingType;
Symbols\NamedTypeSymbol.cs (49)
96public abstract NamedTypeSymbol ConstructedFrom { get; }
102public virtual NamedTypeSymbol EnumUnderlyingType
110public override NamedTypeSymbol ContainingType
118return this.ContainingSymbol as NamedTypeSymbol;
677public abstract override ImmutableArray<NamedTypeSymbol> GetTypeMembers();
685public abstract override ImmutableArray<NamedTypeSymbol> GetTypeMembers(ReadOnlyMemory<char> name, int arity);
768internal abstract NamedTypeSymbol GetDeclaredBaseType(ConsList<TypeSymbol> basesBeingResolved);
770internal abstract ImmutableArray<NamedTypeSymbol> GetDeclaredInterfaces(ConsList<TypeSymbol> basesBeingResolved);
806NamedTypeSymbol other = t2 as NamedTypeSymbol;
810var thisOriginalDefinition = this.OriginalDefinition;
811var otherOriginalDefinition = other.OriginalDefinition;
845private bool EqualsComplicatedCases(NamedTypeSymbol other, TypeCompareKind comparison)
901bool tupleNamesEquals(NamedTypeSymbol other, TypeCompareKind comparison)
981NamedTypeSymbol result = haveChanges ? this.WithTypeArguments(allTypeArguments.ToImmutable()) : this;
986internal NamedTypeSymbol WithTypeArguments(ImmutableArray<TypeWithAnnotations> allTypeArguments)
988var definition = this.OriginalDefinition;
1004bool haveChanges = MergeEquivalentTypeArguments(this, (NamedTypeSymbol)other, variance, allTypeParameters, allTypeArguments);
1006NamedTypeSymbol result;
1020return IsTupleType ? MergeTupleNames((NamedTypeSymbol)other, result) : result;
1030NamedTypeSymbol typeA,
1031NamedTypeSymbol typeB,
1042var definition = typeA.OriginalDefinition;
1105public NamedTypeSymbol Construct(params TypeSymbol[] typeArguments)
1116public NamedTypeSymbol Construct(ImmutableArray<TypeSymbol> typeArguments)
1126public NamedTypeSymbol Construct(IEnumerable<TypeSymbol> typeArguments)
1135public NamedTypeSymbol ConstructUnboundGenericType()
1140internal NamedTypeSymbol GetUnboundGenericTypeOrSelf()
1166private NamedTypeSymbol ConstructWithoutModifiers(ImmutableArray<TypeSymbol> typeArguments, bool unbound)
1182internal NamedTypeSymbol Construct(ImmutableArray<TypeWithAnnotations> typeArguments)
1187internal NamedTypeSymbol Construct(ImmutableArray<TypeWithAnnotations> typeArguments, bool unbound)
1224protected virtual NamedTypeSymbol ConstructCore(ImmutableArray<TypeWithAnnotations> typeArguments, bool unbound)
1236for (var current = this; !ReferenceEquals(current, null); current = current.ContainingType)
1267var outer = ContainingType;
1288var outer = ContainingType;
1307var outer = ContainingType;
1326public new virtual NamedTypeSymbol OriginalDefinition
1352internal virtual NamedTypeSymbol AsMember(NamedTypeSymbol newOwner)
1381NamedTypeSymbol currentType = this;
1426NamedTypeSymbol @base = this.BaseTypeNoUseSiteDiagnostics;
1463var @base = this.BaseTypeNoUseSiteDiagnostics;
1527var baseType = this.BaseTypeNoUseSiteDiagnostics;
1596internal virtual NamedTypeSymbol ComImportCoClass
1660typeToCheck = ((NamedTypeSymbol)typeToCheck).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[ValueTupleRestPosition - 1].Type;
1664arity = (typeToCheck as NamedTypeSymbol)?.Arity ?? 0;
1666if (arity > 0 && arity < ValueTupleRestPosition && ((NamedTypeSymbol)typeToCheck).IsTupleTypeOfCardinality(out tupleCardinality))
1685internal abstract NamedTypeSymbol AsNativeInteger();
1692internal abstract NamedTypeSymbol NativeIntegerUnderlyingType { get; }
Symbols\Retargeting\RetargetingSymbolTranslator.cs (56)
57return new RetargetingNamedTypeSymbol(this, (NamedTypeSymbol)symbol);
164Debug.Assert(symbol.Kind != SymbolKind.NamedType || ((NamedTypeSymbol)symbol).PrimitiveTypeCode == Cci.PrimitiveTypeCode.NotPrimitive);
180public TypeWithAnnotations Retarget(TypeWithAnnotations underlyingType, RetargetOptions options, NamedTypeSymbol asDynamicIfNoPiaContainingType = null)
205private NamedTypeSymbol RetargetNamedTypeDefinition(NamedTypeSymbol type, RetargetOptions options)
211var result = RetargetNamedTypeDefinition(type.NativeIntegerUnderlyingType, options);
276private NamedTypeSymbol RetargetNamedTypeDefinitionFromUnderlyingAssembly(NamedTypeSymbol type)
285var container = type.ContainingType;
292return (NamedTypeSymbol)this.SymbolMap.GetOrAdd(type, new UnsupportedMetadataTypeSymbol());
298return (NamedTypeSymbol)this.SymbolMap.GetOrAdd(type, _retargetingModule._createRetargetingNamedType);
310private NamedTypeSymbol RetargetNoPiaLocalType(NamedTypeSymbol type)
312NamedTypeSymbol cached;
320NamedTypeSymbol result;
401private static NamedTypeSymbol RetargetNamedTypeDefinition(PENamedTypeSymbol type, PEModuleSymbol addedModule)
410return (NamedTypeSymbol)cached;
413NamedTypeSymbol? result;
415NamedTypeSymbol containingType = type.ContainingType;
423NamedTypeSymbol scope = RetargetNamedTypeDefinition((PENamedTypeSymbol)containingType, addedModule);
440private static NamedTypeSymbol PerformTypeRetargeting(
442NamedTypeSymbol type)
444NamedTypeSymbol? result;
449NamedTypeSymbol containingType = type.ContainingType;
450NamedTypeSymbol? result1;
458NamedTypeSymbol scope = PerformTypeRetargeting(ref destination, containingType);
483public NamedTypeSymbol Retarget(NamedTypeSymbol type, RetargetOptions options)
485NamedTypeSymbol originalDefinition = type.OriginalDefinition;
487NamedTypeSymbol newDefinition = RetargetNamedTypeDefinition(originalDefinition, options);
514NamedTypeSymbol genericType = type;
551NamedTypeSymbol constructedType;
662var namedType = (NamedTypeSymbol)symbol;
720NamedTypeSymbol oldModifierSymbol = ((CSharpCustomModifier)oldModifier).ModifierSymbol;
721NamedTypeSymbol newModifierSymbol = Retarget(oldModifierSymbol, RetargetOptions.RetargetPrimitiveTypesByName); // should be retargeted by name
834public ImmutableArray<NamedTypeSymbol> Retarget(ImmutableArray<NamedTypeSymbol> sequence)
891var containingType = method.ContainingType;
892var retargetedType = Retarget(containingType, RetargetOptions.RetargetPrimitiveTypesByName);
939var containingType = property.ContainingType;
940var retargetedType = Retarget(containingType, RetargetOptions.RetargetPrimitiveTypesByName);
955var containingType = @event.ContainingType;
956var retargetedType = Retarget(containingType, RetargetOptions.RetargetPrimitiveTypesByName);
964private MethodSymbol FindMethodInRetargetedType(MethodSymbol method, NamedTypeSymbol retargetedType, IEqualityComparer<MethodSymbol> retargetedMethodComparer)
971private readonly NamedTypeSymbol _retargetedType;
974private RetargetedTypeMethodFinder(RetargetingModuleSymbol retargetingModule, NamedTypeSymbol retargetedType, MethodSymbol toFind) :
981public static MethodSymbol Find(RetargetingSymbolTranslator translator, MethodSymbol method, NamedTypeSymbol retargetedType, IEqualityComparer<MethodSymbol> retargetedMethodComparer)
998NamedTypeSymbol retargetedType,
1055NamedTypeSymbol containingType = _toFind.ContainingType;
1056NamedTypeSymbol retargetedContainingType = _retargetedType;
1074private PropertySymbol FindPropertyInRetargetedType(PropertySymbol property, NamedTypeSymbol retargetedType, IEqualityComparer<PropertySymbol> retargetedPropertyComparer)
1110private EventSymbol FindEventInRetargetedType(EventSymbol @event, NamedTypeSymbol retargetedType)
1163NamedTypeSymbol oldAttributeType = oldAttributeData.AttributeClass;
1164NamedTypeSymbol newAttributeType;
1329public override Symbol VisitNamedType(NamedTypeSymbol symbol, RetargetOptions options)
Symbols\Source\SourceComplexParameterSymbol.cs (7)
621internal override void EarlyDecodeWellKnownAttributeType(NamedTypeSymbol attributeType, AttributeSyntax attributeSyntax)
644internal override (CSharpAttributeData?, BoundAttribute?) EarlyDecodeWellKnownAttribute(ref EarlyDecodeWellKnownAttributeArguments<EarlyWellKnownAttributeBinder, NamedTypeSymbol, AttributeSyntax, AttributeLocation> arguments)
708private (CSharpAttributeData?, BoundAttribute?) EarlyDecodeAttributeForDefaultParameterValue(AttributeDescription description, ref EarlyDecodeWellKnownAttributeArguments<EarlyWellKnownAttributeBinder, NamedTypeSymbol, AttributeSyntax, AttributeLocation> arguments)
981((NamedTypeSymbol)arg.TypeInternal).EnumUnderlyingType.SpecialType :
1247if (Type is not NamedTypeSymbol { IsInterpolatedStringHandlerType: true } handlerType)
1637MethodSymbol? collectionBuilderMethod = binder.GetAndValidateCollectionBuilderMethod(syntax, (NamedTypeSymbol)Type, diagnostics, elementType: out _);
1643if (ContainingSymbol.ContainingSymbol is NamedTypeSymbol) // No need to check for lambdas or local function
Symbols\Source\SourceDestructorSymbol.cs (2)
64private static (DeclarationModifiers, Flags) MakeModifiersAndFlags(NamedTypeSymbol containingType, DestructorDeclarationSyntax syntax, bool isNullableAnalysisEnabled, Location location, BindingDiagnosticBag diagnostics, out bool modifierErrors)
129private static DeclarationModifiers MakeModifiers(NamedTypeSymbol containingType, SyntaxTokenList modifiers, Location location, BindingDiagnosticBag diagnostics, out bool modifierErrors)
Symbols\Source\SourceMemberContainerSymbol.cs (41)
209private static readonly Dictionary<ReadOnlyMemory<char>, ImmutableArray<NamedTypeSymbol>> s_emptyTypeMembers =
210new Dictionary<ReadOnlyMemory<char>, ImmutableArray<NamedTypeSymbol>>(EmptyReadOnlyMemoryOfCharComparer.Instance);
212private Dictionary<ReadOnlyMemory<char>, ImmutableArray<NamedTypeSymbol>>? _lazyTypeMembers;
262var containingType = this.ContainingType;
305if (((NamedTypeSymbol)containingSymbol).IsInterface)
581var discarded = this.EnumUnderlyingType;
755public sealed override NamedTypeSymbol? ContainingType
759return _containingSymbol as NamedTypeSymbol;
1274internal override ImmutableArray<NamedTypeSymbol> GetTypeMembersUnordered()
1279public override ImmutableArray<NamedTypeSymbol> GetTypeMembers()
1284public override ImmutableArray<NamedTypeSymbol> GetTypeMembers(ReadOnlyMemory<char> name)
1286ImmutableArray<NamedTypeSymbol> members;
1292return ImmutableArray<NamedTypeSymbol>.Empty;
1295public override ImmutableArray<NamedTypeSymbol> GetTypeMembers(ReadOnlyMemory<char> name, int arity)
1300private Dictionary<ReadOnlyMemory<char>, ImmutableArray<NamedTypeSymbol>> GetTypeMembersDictionary()
1318private Dictionary<ReadOnlyMemory<char>, ImmutableArray<NamedTypeSymbol>> MakeTypeMembers(BindingDiagnosticBag diagnostics)
1320var symbols = ArrayBuilder<NamedTypeSymbol>.GetInstance();
1681if (member is NamedTypeSymbol type)
1825var baseType = BaseTypeNoUseSiteDiagnostics;
1894bool hasBaseTypeOrInterface(Func<NamedTypeSymbol, bool> predicate)
2406BaseTypeAnalysis.StructDependsOn((NamedTypeSymbol)type, this) &&
2679var instanceMap = new Dictionary<NamedTypeSymbol, NamedTypeSymbol>(ReferenceEqualityComparer.Instance);
2700var type = (NamedTypeSymbol)f.Type;
2711private static bool InfiniteFlatteningGraph(SourceMemberContainerTypeSymbol top, NamedTypeSymbol t, Dictionary<NamedTypeSymbol, NamedTypeSymbol> instanceMap)
2714var tOriginal = t.OriginalDefinition;
2715if (instanceMap.TryGetValue(tOriginal, out var oldInstance))
2729var type = (NamedTypeSymbol)f.Type;
2856Dictionary<ReadOnlyMemory<char>, ImmutableArray<NamedTypeSymbol>> typesByName)
2858foreach ((ReadOnlyMemory<char> name, ImmutableArray<NamedTypeSymbol> types) in typesByName)
3451ImmutableArray<Symbol> types = GetTypeMembers(name).Cast<NamedTypeSymbol, Symbol>();
4495var currentBaseType = this.BaseTypeNoUseSiteDiagnostics;
5283var baseType = BaseTypeNoUseSiteDiagnostics;
5288foreach (var @interface in GetInterfacesToEmit())
5321NamedTypeSymbol baseType = this.BaseTypeNoUseSiteDiagnostics;
5399foreach (var type in this.GetTypeMembers())
5419public sealed override NamedTypeSymbol ConstructedFrom
Symbols\Source\SourceNamedTypeSymbol_Bases.cs (53)
24private Tuple<NamedTypeSymbol, ImmutableArray<NamedTypeSymbol>> _lazyDeclaredBases;
26private NamedTypeSymbol _lazyBaseType = ErrorTypeSymbol.UnknownResultType;
27private ImmutableArray<NamedTypeSymbol> _lazyInterfaces;
35internal sealed override NamedTypeSymbol BaseTypeNoUseSiteDiagnostics
46var tmp = ContainingType.BaseTypeNoUseSiteDiagnostics;
50var acyclicBase = this.MakeAcyclicBaseType(diagnostics);
66internal sealed override ImmutableArray<NamedTypeSymbol> InterfacesNoUseSiteDiagnostics(ConsList<TypeSymbol> basesBeingResolved)
72return ImmutableArray<NamedTypeSymbol>.Empty;
77if (ImmutableInterlocked.InterlockedCompareExchange(ref _lazyInterfaces, acyclicInterfaces, default(ImmutableArray<NamedTypeSymbol>)).IsDefault)
89var localBase = this.BaseTypeNoUseSiteDiagnostics;
168MultiDictionary<NamedTypeSymbol, NamedTypeSymbol>.ValueSet set = pair.Value;
177NamedTypeSymbol other = pair.Key;
212private SourceLocation FindBaseRefSyntax(NamedTypeSymbol baseSym)
255internal Tuple<NamedTypeSymbol, ImmutableArray<NamedTypeSymbol>> GetDeclaredBases(ConsList<TypeSymbol> basesBeingResolved)
270internal override NamedTypeSymbol GetDeclaredBaseType(ConsList<TypeSymbol> basesBeingResolved)
275internal override ImmutableArray<NamedTypeSymbol> GetDeclaredInterfaces(ConsList<TypeSymbol> basesBeingResolved)
280private Tuple<NamedTypeSymbol, ImmutableArray<NamedTypeSymbol>> MakeDeclaredBases(ConsList<TypeSymbol> basesBeingResolved, BindingDiagnosticBag diagnostics)
285return new Tuple<NamedTypeSymbol, ImmutableArray<NamedTypeSymbol>>(null, ImmutableArray<NamedTypeSymbol>.Empty);
291var baseInterfaces = ArrayBuilder<NamedTypeSymbol>.GetInstance();
293NamedTypeSymbol baseType = null;
296var interfaceLocations = SpecializedSymbolCollections.GetPooledSymbolDictionaryInstance<NamedTypeSymbol, SourceLocation>();
300Tuple<NamedTypeSymbol, ImmutableArray<NamedTypeSymbol>> one = MakeOneDeclaredBases(newBasesBeingResolved, decl, diagnostics);
303var partBase = one.Item1;
358foreach (var t in partInterfaces)
372var type = DeclaringCompilation.GetWellKnownType(WellKnownType.System_IEquatable_T).Construct(this);
423return new Tuple<NamedTypeSymbol, ImmutableArray<NamedTypeSymbol>>(baseType, baseInterfacesRO);
438private Tuple<NamedTypeSymbol, ImmutableArray<NamedTypeSymbol>> MakeOneDeclaredBases(ConsList<TypeSymbol> newBasesBeingResolved, SingleTypeDeclaration decl, BindingDiagnosticBag diagnostics)
446NamedTypeSymbol localBase = null;
447var localInterfaces = ArrayBuilder<NamedTypeSymbol>.GetInstance();
526localBase = (NamedTypeSymbol)baseType;
580localInterfaces.Add((NamedTypeSymbol)baseType);
588localBase = (NamedTypeSymbol)baseType;
606localInterfaces.Add((NamedTypeSymbol)baseType);
628return new Tuple<NamedTypeSymbol, ImmutableArray<NamedTypeSymbol>>(localBase, localInterfaces.ToImmutableAndFree());
658private ImmutableArray<NamedTypeSymbol> MakeAcyclicInterfaces(ConsList<TypeSymbol> basesBeingResolved, BindingDiagnosticBag diagnostics)
665return ImmutableArray<NamedTypeSymbol>.Empty;
671ArrayBuilder<NamedTypeSymbol> result = isInterface ? ArrayBuilder<NamedTypeSymbol>.GetInstance() : null;
672foreach (var t in declaredInterfaces)
694foreach (var @interface in t.AllInterfacesNoUseSiteDiagnostics)
709private NamedTypeSymbol MakeAcyclicBaseType(BindingDiagnosticBag diagnostics)
713NamedTypeSymbol declaredBase;
763NamedTypeSymbol current = declaredBase;
Symbols\Source\SourceOrdinaryMethodSymbol.cs (7)
23NamedTypeSymbol containingType,
48NamedTypeSymbol containingType,
90NamedTypeSymbol containingType, Location location, MethodDeclarationSyntax syntax, MethodKind methodKind,
424private static DeclarationModifiers MakeDeclarationModifiers(MethodDeclarationSyntax syntax, NamedTypeSymbol containingType, Location location, DeclarationModifiers allowedModifiers, BindingDiagnosticBag diagnostics)
687private static (DeclarationModifiers mods, bool hasExplicitAccessMod) MakeModifiers(MethodDeclarationSyntax syntax, NamedTypeSymbol containingType, MethodKind methodKind, bool hasBody, Location location, BindingDiagnosticBag diagnostics)
918NamedTypeSymbol containingType,
975NamedTypeSymbol containingType,
Symbols\Source\SourcePropertyAccessorSymbol.cs (9)
29NamedTypeSymbol containingType,
66NamedTypeSymbol containingType,
87NamedTypeSymbol containingType,
113NamedTypeSymbol containingType,
140NamedTypeSymbol containingType,
174NamedTypeSymbol containingType,
223NamedTypeSymbol containingType, SourcePropertySymbolBase property, DeclarationModifiers propertyModifiers, Location location,
391var isInitOnlyType = Binder.GetWellKnownType(this.DeclaringCompilation,
492private static DeclarationModifiers MakeModifiers(NamedTypeSymbol containingType, SyntaxTokenList modifiers, bool isExplicitInterfaceImplementation,
Symbols\Symbol_Attributes.cs (18)
67var namedType = (NamedTypeSymbol)this;
122internal virtual void EarlyDecodeWellKnownAttributeType(NamedTypeSymbol attributeType, AttributeSyntax attributeSyntax)
142internal virtual (CSharpAttributeData?, BoundAttribute?) EarlyDecodeWellKnownAttribute(ref EarlyDecodeWellKnownAttributeArguments<EarlyWellKnownAttributeBinder, NamedTypeSymbol, AttributeSyntax, AttributeLocation> arguments)
148ref EarlyDecodeWellKnownAttributeArguments<EarlyWellKnownAttributeBinder, NamedTypeSymbol, AttributeSyntax, AttributeLocation> arguments,
333var attributeTypesBuilder = new NamedTypeSymbol[totalAttributesCount];
349ImmutableArray<NamedTypeSymbol> boundAttributeTypes = attributeTypesBuilder.AsImmutableOrNull();
551var boundTypeSymbol = (NamedTypeSymbol)boundType.Type;
767ImmutableArray<NamedTypeSymbol> boundAttributeTypes,
780var arguments = new EarlyDecodeWellKnownAttributeArguments<EarlyWellKnownAttributeBinder, NamedTypeSymbol, AttributeSyntax, AttributeLocation>();
785NamedTypeSymbol boundAttributeType = boundAttributeTypes[i];
814private void EarlyDecodeWellKnownAttributeTypes(ImmutableArray<NamedTypeSymbol> attributeTypes, ImmutableArray<AttributeSyntax> attributeSyntaxList)
821var attributeType = attributeTypes[i];
851HashSet<NamedTypeSymbol> uniqueAttributeTypes = new HashSet<NamedTypeSymbol>();
892HashSet<NamedTypeSymbol> uniqueAttributeTypes)
896NamedTypeSymbol attributeType = attribute.AttributeClass;
Symbols\Synthesized\SynthesizedEntryPointSymbol.cs (8)
25private readonly NamedTypeSymbol _containingType;
29var containingType = initializerMethod.ContainingType;
33var systemObject = Binder.GetSpecialType(compilation, SpecialType.System_Object, DummySyntax(), diagnostics);
43var systemVoid = Binder.GetSpecialType(compilation, SpecialType.System_Void, DummySyntax(), diagnostics);
48private SynthesizedEntryPointSymbol(NamedTypeSymbol containingType)
341internal AsyncForwardEntryPoint(CSharpCompilation compilation, NamedTypeSymbol containingType, MethodSymbol userMain) :
446internal ScriptEntryPoint(NamedTypeSymbol containingType, TypeWithAnnotations returnType) :
535internal SubmissionEntryPoint(NamedTypeSymbol containingType, TypeWithAnnotations returnType, TypeSymbol submissionArrayType) :
Symbols\Tuples\TupleTypeSymbol.cs (54)
30internal static NamedTypeSymbol CreateTuple(
53NamedTypeSymbol underlyingType = getTupleUnderlyingType(elementTypesWithAnnotations, syntax, compilation, diagnostics);
62var constructedType = CreateTuple(underlyingType, elementNames, errorPositions, elementLocations, locations);
74static NamedTypeSymbol getTupleUnderlyingType(ImmutableArray<TypeWithAnnotations> elementTypes, CSharpSyntaxNode? syntax, CSharpCompilation compilation, BindingDiagnosticBag? diagnostics)
80NamedTypeSymbol firstTupleType = compilation.GetWellKnownType(GetTupleType(remainder));
86NamedTypeSymbol? chainedTupleType = null;
100public static NamedTypeSymbol CreateTuple(
101NamedTypeSymbol tupleCompatibleType,
111internal NamedTypeSymbol WithTupleDataFrom(NamedTypeSymbol original)
121internal NamedTypeSymbol? TupleUnderlyingType
127internal NamedTypeSymbol WithElementTypes(ImmutableArray<TypeWithAnnotations> newElementTypes)
132NamedTypeSymbol firstTupleType;
133NamedTypeSymbol? chainedTupleType;
134if (Arity < NamedTypeSymbol.ValueTupleRestPosition)
142var underlyingType = this;
145underlyingType = ((NamedTypeSymbol)underlyingType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[NamedTypeSymbol.ValueTupleRestIndex].Type);
147while (underlyingType.Arity >= NamedTypeSymbol.ValueTupleRestPosition);
161internal NamedTypeSymbol WithElementNames(ImmutableArray<string?> newElementNames,
171private NamedTypeSymbol WithTupleData(TupleExtraData newData)
196protected abstract NamedTypeSymbol WithTupleDataCore(TupleExtraData newData);
204internal static void GetUnderlyingTypeChain(NamedTypeSymbol underlyingTupleType, ArrayBuilder<NamedTypeSymbol> underlyingTupleTypeChain)
206NamedTypeSymbol currentType = underlyingTupleType;
211if (currentType.Arity == NamedTypeSymbol.ValueTupleRestPosition)
213currentType = (NamedTypeSymbol)currentType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[NamedTypeSymbol.ValueTupleRestPosition - 1].Type;
232private static NamedTypeSymbol ConstructTupleUnderlyingType(NamedTypeSymbol firstTupleType, NamedTypeSymbol? chainedTupleTypeOpt, ImmutableArray<TypeWithAnnotations> elementTypes)
240NamedTypeSymbol currentSymbol = firstTupleType.Construct(ImmutableArray.Create(elementTypes, (chainLength - 1) * (ValueTupleRestPosition - 1), remainder));
252private static void ReportUseSiteAndObsoleteDiagnostics(CSharpSyntaxNode? syntax, BindingDiagnosticBag diagnostics, NamedTypeSymbol firstTupleType)
268NamedTypeSymbol firstTupleType = compilation.GetWellKnownType(GetTupleType(remainder));
273NamedTypeSymbol chainedTupleType = compilation.GetWellKnownType(GetTupleType(ValueTupleRestPosition));
487internal static Symbol? GetWellKnownMemberInType(NamedTypeSymbol type, WellKnownMember relativeMember, BindingDiagnosticBag diagnostics, SyntaxNode? syntax)
516static Symbol? GetWellKnownMemberInType(NamedTypeSymbol type, WellKnownMember relativeMember)
579NamedTypeSymbol currentValueTuple = this;
711var oldUnderlying = currentValueTuple;
712currentValueTuple = (NamedTypeSymbol)oldUnderlying.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[ValueTupleRestIndex].Type;
738NamedTypeSymbol container = getNestedTupleUnderlyingType(this, fieldChainLength - 1).OriginalDefinition;
788static NamedTypeSymbol getNestedTupleUnderlyingType(NamedTypeSymbol topLevelUnderlyingType, int depth)
790NamedTypeSymbol found = topLevelUnderlyingType;
793found = (NamedTypeSymbol)found.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[ValueTupleRestPosition - 1].Type;
854private TypeSymbol MergeTupleNames(NamedTypeSymbol other, NamedTypeSymbol mergedType)
918internal NamedTypeSymbol TupleUnderlyingType { get; }
920internal TupleExtraData(NamedTypeSymbol underlyingType)
930internal TupleExtraData(NamedTypeSymbol underlyingType, ImmutableArray<string?> elementNames,
968public ImmutableArray<TypeWithAnnotations> TupleElementTypesWithAnnotations(NamedTypeSymbol tuple)
978static ImmutableArray<TypeWithAnnotations> collectTupleElementTypesWithAnnotations(NamedTypeSymbol tuple)
1000public ImmutableArray<FieldSymbol> TupleElements(NamedTypeSymbol tuple)
1010ImmutableArray<FieldSymbol> collectTupleElementFields(NamedTypeSymbol tuple)
Symbols\TypeSymbol.cs (60)
48internal ImmutableArray<NamedTypeSymbol> allInterfaces;
53internal MultiDictionary<NamedTypeSymbol, NamedTypeSymbol> interfacesAndTheirBaseInterfaces;
55internal static readonly MultiDictionary<NamedTypeSymbol, NamedTypeSymbol> EmptyInterfacesAndTheirBaseInterfaces =
56new MultiDictionary<NamedTypeSymbol, NamedTypeSymbol>(0, SymbolEqualityComparer.CLRSignature);
160internal abstract NamedTypeSymbol BaseTypeNoUseSiteDiagnostics { get; }
162internal NamedTypeSymbol BaseTypeWithDefinitionUseSiteDiagnostics(ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
164var result = BaseTypeNoUseSiteDiagnostics;
174internal NamedTypeSymbol BaseTypeOriginalDefinition(ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
176var result = BaseTypeNoUseSiteDiagnostics;
191internal abstract ImmutableArray<NamedTypeSymbol> InterfacesNoUseSiteDiagnostics(ConsList<TypeSymbol> basesBeingResolved = null);
203internal ImmutableArray<NamedTypeSymbol> AllInterfacesNoUseSiteDiagnostics
211internal ImmutableArray<NamedTypeSymbol> AllInterfacesWithDefinitionUseSiteDiagnostics(ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
224foreach (var iface in result)
261var t = this.BaseTypeWithDefinitionUseSiteDiagnostics(ref useSiteInfo);
317protected virtual ImmutableArray<NamedTypeSymbol> GetAllInterfaces()
322return ImmutableArray<NamedTypeSymbol>.Empty;
337protected virtual ImmutableArray<NamedTypeSymbol> MakeAllInterfaces()
339var result = ArrayBuilder<NamedTypeSymbol>.GetInstance();
340var visited = new HashSet<NamedTypeSymbol>(SymbolEqualityComparer.ConsiderEverything);
354static void addAllInterfaces(NamedTypeSymbol @interface, HashSet<NamedTypeSymbol> visited, ArrayBuilder<NamedTypeSymbol> result)
358ImmutableArray<NamedTypeSymbol> baseInterfaces = @interface.InterfacesNoUseSiteDiagnostics();
361var baseInterface = baseInterfaces[i];
380internal MultiDictionary<NamedTypeSymbol, NamedTypeSymbol> InterfacesAndTheirBaseInterfacesNoUseSiteDiagnostics
400internal MultiDictionary<NamedTypeSymbol, NamedTypeSymbol> InterfacesAndTheirBaseInterfacesWithDefinitionUseSiteDiagnostics(ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
415private static MultiDictionary<NamedTypeSymbol, NamedTypeSymbol> MakeInterfacesAndTheirBaseInterfaces(ImmutableArray<NamedTypeSymbol> declaredInterfaces)
417var resultBuilder = new MultiDictionary<NamedTypeSymbol, NamedTypeSymbol>(declaredInterfaces.Length, SymbolEqualityComparer.CLRSignature, SymbolEqualityComparer.ConsiderEverything);
418foreach (var @interface in declaredInterfaces)
422foreach (var baseInterface in @interface.AllInterfacesNoUseSiteDiagnostics)
457return FindMostSpecificImplementation(interfaceMember, (NamedTypeSymbol)this, ref discardedUseSiteInfo);
730var interfaceType = interfaceMember.ContainingType;
809NamedTypeSymbol interfaceType = interfaceMember.ContainingType;
1007if (implementingType is NamedTypeSymbol named &&
1101private static Symbol FindMostSpecificImplementation(Symbol interfaceMember, NamedTypeSymbol implementingInterface, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
1149ImmutableArray<NamedTypeSymbol> allInterfaces = implementingType.AllInterfacesWithDefinitionUseSiteDiagnostics(ref useSiteInfo);
1235NamedTypeSymbol implementingInterface = inplementingAccessor1.ContainingType;
1256ImmutableArray<NamedTypeSymbol> allInterfaces,
1261var implementations = ArrayBuilder<(MultiDictionary<Symbol, Symbol>.ValueSet MethodSet, MultiDictionary<NamedTypeSymbol, NamedTypeSymbol> Bases)>.GetInstance();
1263foreach (var interfaceType in allInterfaces)
1280(MultiDictionary<Symbol, Symbol>.ValueSet methodSet, MultiDictionary<NamedTypeSymbol, NamedTypeSymbol> bases) = implementations[i];
1282NamedTypeSymbol previousContainingType = previous.ContainingType;
1314MultiDictionary<NamedTypeSymbol, NamedTypeSymbol> bases = interfaceType.InterfacesAndTheirBaseInterfacesWithDefinitionUseSiteDiagnostics(ref useSiteInfo);
1373internal static MultiDictionary<Symbol, Symbol>.ValueSet FindImplementationInInterface(Symbol interfaceMember, NamedTypeSymbol interfaceType)
1377NamedTypeSymbol containingType = interfaceMember.ContainingType;
2074var @interface = interfaceMember.ContainingType;
2138var @interface = interfaceMember.ContainingType;
2523foreach (FieldSymbol field in ((NamedTypeSymbol)this).OriginalDefinition.GetFieldsToEmit())
2541elementField = elementField.AsMember((NamedTypeSymbol)this);
Symbols\TypeSymbolExtensions.cs (61)
28foreach (NamedTypeSymbol @interface in subType.AllInterfacesWithDefinitionUseSiteDiagnostics(ref useSiteInfo))
159if (type is NamedTypeSymbol nt
174RoslynDebug.Assert(type is NamedTypeSymbol); //not testing Kind because it may be an ErrorType
176return ((NamedTypeSymbol)type).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0];
214public static NamedTypeSymbol? GetEnumUnderlyingType(this TypeSymbol? type)
216return (type is NamedTypeSymbol namedType) ? namedType.EnumUnderlyingType : null;
227var underlyingType = type.GetEnumUnderlyingType();
329return type.Kind == SymbolKind.NamedType && ((NamedTypeSymbol)type).IsInterface;
380if (type is NamedTypeSymbol
416internal static ImmutableArray<NamedTypeSymbol> GetAllInterfacesOrEffectiveInterfaces(this TypeSymbol type)
430return ImmutableArray<NamedTypeSymbol>.Empty;
437public static NamedTypeSymbol? GetDelegateType(this TypeSymbol? type)
442type = ((NamedTypeSymbol)type).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Type;
445return type.IsDelegateType() ? (NamedTypeSymbol)type : null;
478if (_type.OriginalDefinition is NamedTypeSymbol type)
518if (!(type is NamedTypeSymbol t))
600elementTypes = ((NamedTypeSymbol)type).TupleElementTypesWithAnnotations;
707return !IsAsRestrictive((NamedTypeSymbol)type, sym, ref useSiteInfo);
782var containingType = current.ContainingType;
889var typeArguments = ((NamedTypeSymbol)current).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics;
1042var parent1 = s1.ContainingType;
1052for (var parent2 = s2.ContainingType; (object)parent2 != null; parent2 = parent2.ContainingType)
1064var parent2 = s2.ContainingType;
1076var parent1 = s1.ContainingType;
1094for (var parent2 = s2.ContainingType; (object)parent2 != null; parent2 = parent2.ContainingType)
1154NamedTypeSymbol parent1 = s1.ContainingType;
1161var parent1OriginalDefinition = parent1.OriginalDefinition;
1162for (var parent2 = s2.ContainingType; (object)parent2 != null; parent2 = parent2.ContainingType)
1183return type is NamedTypeSymbol { IsUnboundGenericType: true };
1186public static bool IsTopLevelType(this NamedTypeSymbol type)
1367return type is NamedTypeSymbol
1380return type is NamedTypeSymbol
1393return type is NamedTypeSymbol
1404return type is NamedTypeSymbol
1415return type is NamedTypeSymbol
1481var foundType = type.VisitType(predicate: (type, _, _) => type is NamedTypeSymbol { IsFileLocal: true }, arg: (object?)null);
1485internal static string? GetFileLocalTypeMetadataNamePrefix(this NamedTypeSymbol type)
1523return ((NamedTypeSymbol)type).EnumUnderlyingType.SpecialType.IsValidVolatileFieldType();
1567internal static int ComputeHashCode(this NamedTypeSymbol type)
1609static bool wasConstructedForAnnotations(NamedTypeSymbol type)
1642public static TypeSymbol AsDynamicIfNoPia(this TypeSymbol type, NamedTypeSymbol containingType)
1647public static bool TryAsDynamicIfNoPia(this TypeSymbol type, NamedTypeSymbol containingType, [NotNullWhen(true)] out TypeSymbol? result)
1684internal static ImmutableArray<TypeParameterSymbol> GetAllTypeParameters(this NamedTypeSymbol type)
1701internal static void GetAllTypeParameters(this NamedTypeSymbol type, ArrayBuilder<TypeParameterSymbol> result)
1703var containingType = type.ContainingType;
1716internal static TypeParameterSymbol? FindEnclosingTypeParameter(this NamedTypeSymbol type, string name)
1773internal static bool HasNameQualifier(this NamedTypeSymbol type, string qualifiedName)
1830var namedType = type as NamedTypeSymbol;
1848if (!(type is NamedTypeSymbol { Arity: 1 } namedType))
1861if (!(type is NamedTypeSymbol { Arity: 1 } namedType))
1871if (!(type is NamedTypeSymbol { Arity: 1 } namedType))
1889internal static bool IsCustomTaskType(this NamedTypeSymbol type, [NotNullWhen(true)] out TypeSymbol? builderArgument)
1922var namedType = (NamedTypeSymbol)type;
1963private static bool NormalizeTaskTypesInNamedType(CSharpCompilation compilation, ref NamedTypeSymbol type)
1986var originalType = type;
1987var originalDefinition = originalType.OriginalDefinition;
1999var taskType = compilation.GetWellKnownType(
2136return typeSymbol is NamedTypeSymbol { Name: WellKnownMemberNames.LockTypeName, Arity: 0, ContainingType: null } &&
2169return type is NamedTypeSymbol { Name: "INumberBase", IsInterface: true, Arity: 1, ContainingType: null } &&
Utilities\TypeSymbolExtensions.cs (14)
52var namedType = (NamedTypeSymbol)type;
135var namedType = (NamedTypeSymbol)type;
179internal static TypeSymbol GetNextBaseTypeNoUseSiteDiagnostics(this TypeSymbol type, ConsList<TypeSymbol> basesBeingResolved, CSharpCompilation compilation, ref PooledHashSet<NamedTypeSymbol> visited)
190return GetNextDeclaredBase((NamedTypeSymbol)type, basesBeingResolved, compilation, ref visited);
209private static TypeSymbol GetNextDeclaredBase(NamedTypeSymbol type, ConsList<TypeSymbol> basesBeingResolved, CSharpCompilation compilation, ref PooledHashSet<NamedTypeSymbol> visited)
225var nextType = type.GetDeclaredBaseType(basesBeingResolved);
234var origType = type.OriginalDefinition;
243visited = visited ?? PooledHashSet<NamedTypeSymbol>.GetInstance();
254private static void SetKnownToHaveNoDeclaredBaseCycles(ref PooledHashSet<NamedTypeSymbol> visited)
268private static NamedTypeSymbol GetDefaultBaseOrNull(NamedTypeSymbol type, CSharpCompilation compilation)