104 references to CollectionExpressionTypeKind
Microsoft.CodeAnalysis.CSharp (104)
Binder\Binder.ValueChecks.cs (5)
4524var collectionTypeKind = ConversionsBase.GetCollectionExpressionTypeKind(_compilation, expr.Type, out var elementType); 4528case CollectionExpressionTypeKind.ReadOnlySpan: 4531case CollectionExpressionTypeKind.Span: 4533case CollectionExpressionTypeKind.CollectionBuilder: 4555case CollectionExpressionTypeKind.ImplementsIEnumerable:
Binder\Binder_Attributes.cs (1)
915&& node.Conversion.GetCollectionExpressionTypeKind(out _, out _, out _) == CollectionExpressionTypeKind.Array)
Binder\Semantics\Conversions\Conversion.cs (6)
110CollectionExpressionTypeKind collectionExpressionTypeKind, TypeSymbol elementType, 115Debug.Assert(collectionExpressionTypeKind != CollectionExpressionTypeKind.None); 123internal readonly CollectionExpressionTypeKind CollectionExpressionTypeKind; 130CollectionExpressionTypeKind collectionExpressionTypeKind, TypeSymbol elementType, 547internal CollectionExpressionTypeKind GetCollectionExpressionTypeKind(out TypeSymbol? elementType, out MethodSymbol? constructor, out bool isExpanded) 560return CollectionExpressionTypeKind.None;
Binder\Semantics\Conversions\Conversions.cs (5)
163var collectionTypeKind = GetCollectionExpressionTypeKind(Compilation, targetType, out TypeWithAnnotations elementTypeWithAnnotations); 167case CollectionExpressionTypeKind.None: 170case CollectionExpressionTypeKind.ImplementsIEnumerable: 171case CollectionExpressionTypeKind.CollectionBuilder: 189if (collectionTypeKind == CollectionExpressionTypeKind.ImplementsIEnumerable)
Binder\Semantics\Conversions\ConversionsBase.cs (8)
1656internal static CollectionExpressionTypeKind GetCollectionExpressionTypeKind(CSharpCompilation compilation, TypeSymbol destination, out TypeWithAnnotations elementType) 1665return CollectionExpressionTypeKind.Array; 1670return CollectionExpressionTypeKind.Span; 1674return CollectionExpressionTypeKind.ReadOnlySpan; 1679return CollectionExpressionTypeKind.CollectionBuilder; 1690return CollectionExpressionTypeKind.ImplementsIEnumerable; 1694return CollectionExpressionTypeKind.ArrayInterface; 1698return CollectionExpressionTypeKind.None;
Binder\Semantics\OverloadResolution\OverloadResolution.cs (37)
1323var collectionTypeKind = ConversionsBase.GetCollectionExpressionTypeKind(binder.Compilation, type, out elementType); 1327case CollectionExpressionTypeKind.None: 1330case CollectionExpressionTypeKind.ImplementsIEnumerable: 1331case CollectionExpressionTypeKind.CollectionBuilder: 1341if (collectionTypeKind == CollectionExpressionTypeKind.ImplementsIEnumerable) 3014var kind1 = conv1.GetCollectionExpressionTypeKind(out TypeSymbol elementType1, out _, out _); 3015var kind2 = conv2.GetCollectionExpressionTypeKind(out TypeSymbol elementType2, out _, out _); 3044TypeSymbol t1, CollectionExpressionTypeKind kind1, TypeSymbol elementType1, ImmutableArray<Conversion> underlyingElementConversions1, 3045TypeSymbol t2, CollectionExpressionTypeKind kind2, TypeSymbol elementType2, ImmutableArray<Conversion> underlyingElementConversions2, 3056var t1IsSpanType = kind1 is CollectionExpressionTypeKind.ReadOnlySpan or CollectionExpressionTypeKind.Span; 3057var t2IsSpanType = kind2 is CollectionExpressionTypeKind.ReadOnlySpan or CollectionExpressionTypeKind.Span; 3137case (CollectionExpressionTypeKind.ReadOnlySpan, CollectionExpressionTypeKind.Span): 3138case (CollectionExpressionTypeKind.ReadOnlySpan or CollectionExpressionTypeKind.Span, _) when IsSZArrayOrArrayInterface(t2, out _): 3141case (CollectionExpressionTypeKind.Span, CollectionExpressionTypeKind.ReadOnlySpan): 3142case (_, CollectionExpressionTypeKind.ReadOnlySpan or CollectionExpressionTypeKind.Span) when IsSZArrayOrArrayInterface(t1, out _): 3151TypeSymbol t1, CollectionExpressionTypeKind kind1, TypeSymbol elementType1, 3152TypeSymbol t2, CollectionExpressionTypeKind kind2, TypeSymbol elementType2, 3158if (kind1 is CollectionExpressionTypeKind.ReadOnlySpan && 3159kind2 is CollectionExpressionTypeKind.Span) 3166if (kind1 is (CollectionExpressionTypeKind.ReadOnlySpan or CollectionExpressionTypeKind.Span)) 3173Debug.Assert(kind1 is not (CollectionExpressionTypeKind.ReadOnlySpan or CollectionExpressionTypeKind.Span)); 3174if (kind2 is not (CollectionExpressionTypeKind.ReadOnlySpan or CollectionExpressionTypeKind.Span) && 3188CollectionExpressionTypeKind kind1 = ConversionsBase.GetCollectionExpressionTypeKind(Compilation, t1, out TypeWithAnnotations elementType1); 3189CollectionExpressionTypeKind kind2 = ConversionsBase.GetCollectionExpressionTypeKind(Compilation, t2, out TypeWithAnnotations elementType2); 3191if (kind1 is CollectionExpressionTypeKind.CollectionBuilder or CollectionExpressionTypeKind.ImplementsIEnumerable) 3196if (kind2 is CollectionExpressionTypeKind.CollectionBuilder or CollectionExpressionTypeKind.ImplementsIEnumerable)
FlowAnalysis\NullableWalker.cs (5)
3854static NullableFlowState getResultState(BoundCollectionExpression node, CollectionExpressionTypeKind collectionKind) 3856if (collectionKind is CollectionExpressionTypeKind.CollectionBuilder) 3869(CollectionExpressionTypeKind, TypeWithAnnotations) getCollectionDetails(BoundCollectionExpression node, TypeSymbol collectionType) 3871var collectionKind = ConversionsBase.GetCollectionExpressionTypeKind(this.compilation, collectionType, out var targetElementType); 3872if (collectionKind is CollectionExpressionTypeKind.CollectionBuilder)
FlowAnalysis\NullableWalker.DebugVerifier.cs (2)
128bool hasElementType = node.CollectionTypeKind is not (CollectionExpressionTypeKind.None or CollectionExpressionTypeKind.ImplementsIEnumerable);
Generated\BoundNodes.xml.Generated.cs (3)
6434public BoundCollectionExpression(SyntaxNode syntax, CollectionExpressionTypeKind collectionTypeKind, BoundObjectOrCollectionValuePlaceholder? placeholder, BoundExpression? collectionCreation, MethodSymbol? collectionBuilderMethod, BoundValuePlaceholder? collectionBuilderInvocationPlaceholder, BoundExpression? collectionBuilderInvocationConversion, bool wasTargetTyped, BoundUnconvertedCollectionExpression unconvertedCollectionExpression, ImmutableArray<BoundNode> elements, TypeSymbol type, bool hasErrors = false) 6453public CollectionExpressionTypeKind CollectionTypeKind { get; } 6465public BoundCollectionExpression Update(CollectionExpressionTypeKind collectionTypeKind, BoundObjectOrCollectionValuePlaceholder? placeholder, BoundExpression? collectionCreation, MethodSymbol? collectionBuilderMethod, BoundValuePlaceholder? collectionBuilderInvocationPlaceholder, BoundExpression? collectionBuilderInvocationConversion, bool wasTargetTyped, BoundUnconvertedCollectionExpression unconvertedCollectionExpression, ImmutableArray<BoundNode> elements, TypeSymbol type)
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (20)
42var collectionTypeKind = conversion.GetCollectionExpressionTypeKind(out var elementType, out _, out _); 45case CollectionExpressionTypeKind.ImplementsIEnumerable: 59case CollectionExpressionTypeKind.Array: 60case CollectionExpressionTypeKind.Span: 61case CollectionExpressionTypeKind.ReadOnlySpan: 64case CollectionExpressionTypeKind.CollectionBuilder: 86case CollectionExpressionTypeKind.ArrayInterface: 239CollectionExpressionTypeKind.Array, 246private BoundExpression VisitArrayOrSpanCollectionExpression(BoundCollectionExpression node, CollectionExpressionTypeKind collectionTypeKind, TypeSymbol collectionType, TypeWithAnnotations elementType) 263Debug.Assert(collectionTypeKind is CollectionExpressionTypeKind.Span or CollectionExpressionTypeKind.ReadOnlySpan); 265collectionTypeKind == CollectionExpressionTypeKind.Span ? WellKnownType.System_Span_T : WellKnownType.System_ReadOnlySpan_T), TypeCompareKind.AllIgnoreOptions)); 274if (collectionTypeKind == CollectionExpressionTypeKind.ReadOnlySpan && 292asReadOnlySpan: collectionTypeKind == CollectionExpressionTypeKind.ReadOnlySpan); 298collectionTypeKind == CollectionExpressionTypeKind.Span ? WellKnownMember.System_Span_T__ctor_Array : WellKnownMember.System_ReadOnlySpan_T__ctor_Array)!).AsMember(spanType); 491: VisitArrayOrSpanCollectionExpression(node, CollectionExpressionTypeKind.ReadOnlySpan, spanType, elementType); 516internal static bool IsAllocatingRefStructCollectionExpression(BoundCollectionExpressionBase node, CollectionExpressionTypeKind collectionKind, TypeSymbol? elementType, CSharpCompilation compilation) 518return collectionKind is CollectionExpressionTypeKind.Span or CollectionExpressionTypeKind.ReadOnlySpan 521&& !(collectionKind == CollectionExpressionTypeKind.ReadOnlySpan && ShouldUseRuntimeHelpersCreateSpan(node, elementType))
Operations\CSharpOperationFactory.cs (7)
1242case CollectionExpressionTypeKind.None: 1243case CollectionExpressionTypeKind.Array: 1244case CollectionExpressionTypeKind.ArrayInterface: 1245case CollectionExpressionTypeKind.ReadOnlySpan: 1246case CollectionExpressionTypeKind.Span: 1248case CollectionExpressionTypeKind.ImplementsIEnumerable: 1250case CollectionExpressionTypeKind.CollectionBuilder:
Symbols\Source\SourceComplexParameterSymbol.cs (5)
1562var collectionTypeKind = ConversionsBase.GetCollectionExpressionTypeKind(DeclaringCompilation, Type, out TypeWithAnnotations elementTypeWithAnnotations); 1567case CollectionExpressionTypeKind.None: 1571case CollectionExpressionTypeKind.ImplementsIEnumerable: 1630case CollectionExpressionTypeKind.CollectionBuilder: 1659if (collectionTypeKind != CollectionExpressionTypeKind.Array)