104 references to CollectionExpressionTypeKind
Microsoft.CodeAnalysis.CSharp (104)
Binder\Binder.ValueChecks.cs (5)
4548
var
collectionTypeKind = ConversionsBase.GetCollectionExpressionTypeKind(_compilation, expr.Type, out var elementType);
4552
case
CollectionExpressionTypeKind
.ReadOnlySpan:
4555
case
CollectionExpressionTypeKind
.Span:
4557
case
CollectionExpressionTypeKind
.CollectionBuilder:
4579
case
CollectionExpressionTypeKind
.ImplementsIEnumerable:
Binder\Binder_Attributes.cs (1)
915
&& node.Conversion.GetCollectionExpressionTypeKind(out _, out _, out _) ==
CollectionExpressionTypeKind
.Array)
Binder\Semantics\Conversions\Conversion.cs (6)
110
CollectionExpressionTypeKind
collectionExpressionTypeKind, TypeSymbol elementType,
115
Debug.Assert(collectionExpressionTypeKind !=
CollectionExpressionTypeKind
.None);
123
internal readonly
CollectionExpressionTypeKind
CollectionExpressionTypeKind;
130
CollectionExpressionTypeKind
collectionExpressionTypeKind, TypeSymbol elementType,
547
internal
CollectionExpressionTypeKind
GetCollectionExpressionTypeKind(out TypeSymbol? elementType, out MethodSymbol? constructor, out bool isExpanded)
560
return
CollectionExpressionTypeKind
.None;
Binder\Semantics\Conversions\Conversions.cs (5)
163
var
collectionTypeKind = GetCollectionExpressionTypeKind(Compilation, targetType, out TypeWithAnnotations elementTypeWithAnnotations);
167
case
CollectionExpressionTypeKind
.None:
170
case
CollectionExpressionTypeKind
.ImplementsIEnumerable:
171
case
CollectionExpressionTypeKind
.CollectionBuilder:
189
if (collectionTypeKind ==
CollectionExpressionTypeKind
.ImplementsIEnumerable)
Binder\Semantics\Conversions\ConversionsBase.cs (8)
1656
internal static
CollectionExpressionTypeKind
GetCollectionExpressionTypeKind(CSharpCompilation compilation, TypeSymbol destination, out TypeWithAnnotations elementType)
1665
return
CollectionExpressionTypeKind
.Array;
1670
return
CollectionExpressionTypeKind
.Span;
1674
return
CollectionExpressionTypeKind
.ReadOnlySpan;
1679
return
CollectionExpressionTypeKind
.CollectionBuilder;
1690
return
CollectionExpressionTypeKind
.ImplementsIEnumerable;
1694
return
CollectionExpressionTypeKind
.ArrayInterface;
1698
return
CollectionExpressionTypeKind
.None;
Binder\Semantics\OverloadResolution\OverloadResolution.cs (37)
1323
var
collectionTypeKind = ConversionsBase.GetCollectionExpressionTypeKind(binder.Compilation, type, out elementType);
1327
case
CollectionExpressionTypeKind
.None:
1330
case
CollectionExpressionTypeKind
.ImplementsIEnumerable:
1331
case
CollectionExpressionTypeKind
.CollectionBuilder:
1341
if (collectionTypeKind ==
CollectionExpressionTypeKind
.ImplementsIEnumerable)
2993
var
kind1 = conv1.GetCollectionExpressionTypeKind(out TypeSymbol elementType1, out _, out _);
2994
var
kind2 = conv2.GetCollectionExpressionTypeKind(out TypeSymbol elementType2, out _, out _);
3023
TypeSymbol t1,
CollectionExpressionTypeKind
kind1, TypeSymbol elementType1, ImmutableArray<Conversion> underlyingElementConversions1,
3024
TypeSymbol t2,
CollectionExpressionTypeKind
kind2, TypeSymbol elementType2, ImmutableArray<Conversion> underlyingElementConversions2,
3035
var t1IsSpanType = kind1 is
CollectionExpressionTypeKind
.ReadOnlySpan or
CollectionExpressionTypeKind
.Span;
3036
var t2IsSpanType = kind2 is
CollectionExpressionTypeKind
.ReadOnlySpan or
CollectionExpressionTypeKind
.Span;
3116
case (
CollectionExpressionTypeKind
.ReadOnlySpan,
CollectionExpressionTypeKind
.Span):
3117
case (
CollectionExpressionTypeKind
.ReadOnlySpan or
CollectionExpressionTypeKind
.Span, _) when IsSZArrayOrArrayInterface(t2, out _):
3120
case (
CollectionExpressionTypeKind
.Span,
CollectionExpressionTypeKind
.ReadOnlySpan):
3121
case (_,
CollectionExpressionTypeKind
.ReadOnlySpan or
CollectionExpressionTypeKind
.Span) when IsSZArrayOrArrayInterface(t1, out _):
3130
TypeSymbol t1,
CollectionExpressionTypeKind
kind1, TypeSymbol elementType1,
3131
TypeSymbol t2,
CollectionExpressionTypeKind
kind2, TypeSymbol elementType2,
3137
if (kind1 is
CollectionExpressionTypeKind
.ReadOnlySpan &&
3138
kind2 is
CollectionExpressionTypeKind
.Span)
3145
if (kind1 is (
CollectionExpressionTypeKind
.ReadOnlySpan or
CollectionExpressionTypeKind
.Span))
3152
Debug.Assert(kind1 is not (
CollectionExpressionTypeKind
.ReadOnlySpan or
CollectionExpressionTypeKind
.Span));
3153
if (kind2 is not (
CollectionExpressionTypeKind
.ReadOnlySpan or
CollectionExpressionTypeKind
.Span) &&
3167
CollectionExpressionTypeKind
kind1 = ConversionsBase.GetCollectionExpressionTypeKind(Compilation, t1, out TypeWithAnnotations elementType1);
3168
CollectionExpressionTypeKind
kind2 = ConversionsBase.GetCollectionExpressionTypeKind(Compilation, t2, out TypeWithAnnotations elementType2);
3170
if (kind1 is
CollectionExpressionTypeKind
.CollectionBuilder or
CollectionExpressionTypeKind
.ImplementsIEnumerable)
3175
if (kind2 is
CollectionExpressionTypeKind
.CollectionBuilder or
CollectionExpressionTypeKind
.ImplementsIEnumerable)
FlowAnalysis\NullableWalker.cs (5)
3793
static NullableFlowState getResultState(BoundCollectionExpression node,
CollectionExpressionTypeKind
collectionKind)
3795
if (collectionKind is
CollectionExpressionTypeKind
.CollectionBuilder)
3808
(
CollectionExpressionTypeKind
, TypeWithAnnotations) getCollectionDetails(BoundCollectionExpression node, TypeSymbol collectionType)
3810
var
collectionKind = ConversionsBase.GetCollectionExpressionTypeKind(this.compilation, collectionType, out var targetElementType);
3811
if (collectionKind is
CollectionExpressionTypeKind
.CollectionBuilder)
FlowAnalysis\NullableWalker.DebugVerifier.cs (2)
128
bool hasElementType = node.CollectionTypeKind is not (
CollectionExpressionTypeKind
.None or
CollectionExpressionTypeKind
.ImplementsIEnumerable);
Generated\BoundNodes.xml.Generated.cs (3)
6433
public 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)
6452
public
CollectionExpressionTypeKind
CollectionTypeKind { get; }
6464
public 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)
42
var
collectionTypeKind = conversion.GetCollectionExpressionTypeKind(out var elementType, out _, out _);
45
case
CollectionExpressionTypeKind
.ImplementsIEnumerable:
59
case
CollectionExpressionTypeKind
.Array:
60
case
CollectionExpressionTypeKind
.Span:
61
case
CollectionExpressionTypeKind
.ReadOnlySpan:
64
case
CollectionExpressionTypeKind
.CollectionBuilder:
86
case
CollectionExpressionTypeKind
.ArrayInterface:
236
CollectionExpressionTypeKind
.Array,
243
private BoundExpression VisitArrayOrSpanCollectionExpression(BoundCollectionExpression node,
CollectionExpressionTypeKind
collectionTypeKind, TypeSymbol collectionType, TypeWithAnnotations elementType)
260
Debug.Assert(collectionTypeKind is
CollectionExpressionTypeKind
.Span or
CollectionExpressionTypeKind
.ReadOnlySpan);
262
collectionTypeKind ==
CollectionExpressionTypeKind
.Span ? WellKnownType.System_Span_T : WellKnownType.System_ReadOnlySpan_T), TypeCompareKind.AllIgnoreOptions));
271
if (collectionTypeKind ==
CollectionExpressionTypeKind
.ReadOnlySpan &&
289
asReadOnlySpan: collectionTypeKind ==
CollectionExpressionTypeKind
.ReadOnlySpan);
295
collectionTypeKind ==
CollectionExpressionTypeKind
.Span ? WellKnownMember.System_Span_T__ctor_Array : WellKnownMember.System_ReadOnlySpan_T__ctor_Array)!).AsMember(spanType);
476
: VisitArrayOrSpanCollectionExpression(node,
CollectionExpressionTypeKind
.ReadOnlySpan, spanType, elementType);
501
internal static bool IsAllocatingRefStructCollectionExpression(BoundCollectionExpressionBase node,
CollectionExpressionTypeKind
collectionKind, TypeSymbol? elementType, CSharpCompilation compilation)
503
return collectionKind is
CollectionExpressionTypeKind
.Span or
CollectionExpressionTypeKind
.ReadOnlySpan
506
&& !(collectionKind ==
CollectionExpressionTypeKind
.ReadOnlySpan && ShouldUseRuntimeHelpersCreateSpan(node, elementType))
Operations\CSharpOperationFactory.cs (7)
1242
case
CollectionExpressionTypeKind
.None:
1243
case
CollectionExpressionTypeKind
.Array:
1244
case
CollectionExpressionTypeKind
.ArrayInterface:
1245
case
CollectionExpressionTypeKind
.ReadOnlySpan:
1246
case
CollectionExpressionTypeKind
.Span:
1248
case
CollectionExpressionTypeKind
.ImplementsIEnumerable:
1250
case
CollectionExpressionTypeKind
.CollectionBuilder:
Symbols\Source\SourceComplexParameterSymbol.cs (5)
1556
var
collectionTypeKind = ConversionsBase.GetCollectionExpressionTypeKind(DeclaringCompilation, Type, out TypeWithAnnotations elementTypeWithAnnotations);
1561
case
CollectionExpressionTypeKind
.None:
1565
case
CollectionExpressionTypeKind
.ImplementsIEnumerable:
1624
case
CollectionExpressionTypeKind
.CollectionBuilder:
1653
if (collectionTypeKind !=
CollectionExpressionTypeKind
.Array)