126 references to CollectionExpressionTypeKind
Microsoft.CodeAnalysis.CSharp (126)
Binder\Binder_Attributes.cs (1)
923
&& node.Conversion.GetCollectionExpressionTypeKind(out _, out _, out _) ==
CollectionExpressionTypeKind
.Array)
Binder\Binder_Conversions.cs (26)
916
CollectionExpressionTypeKind
collectionTypeKind, ImmutableArray<BoundNode> elements, BoundObjectOrCollectionValuePlaceholder? placeholder = null, BoundExpression? collectionCreation = null, MethodSymbol? collectionBuilderMethod = null, BoundCollectionBuilderElementsPlaceholder? collectionBuilderElementsPlaceholder = null)
938
var
collectionTypeKind = _conversion.GetCollectionExpressionTypeKind(out var elementType, out MethodSymbol? constructor, out bool isExpanded);
940
if (collectionTypeKind ==
CollectionExpressionTypeKind
.None)
951
if (collectionTypeKind !=
CollectionExpressionTypeKind
.ImplementsIEnumerable &&
968
CollectionExpressionTypeKind
collectionTypeKind,
986
if (collectionTypeKind ==
CollectionExpressionTypeKind
.ImplementsIEnumerable)
989
if (collectionTypeKind is
CollectionExpressionTypeKind
.ArrayInterface ||
1008
CollectionExpressionTypeKind
.Array or
CollectionExpressionTypeKind
.Span or
CollectionExpressionTypeKind
.ReadOnlySpan
1011
CollectionExpressionTypeKind
.ArrayInterface
1014
CollectionExpressionTypeKind
.CollectionBuilder
1084
CollectionExpressionTypeKind
.ImplementsIEnumerable,
1218
CollectionExpressionTypeKind
collectionTypeKind,
1224
case
CollectionExpressionTypeKind
.Span:
1228
case
CollectionExpressionTypeKind
.ReadOnlySpan:
1258
CollectionExpressionTypeKind
.ArrayInterface,
1347
CollectionExpressionTypeKind
.CollectionBuilder,
2228
if (expr.CollectionTypeKind is
CollectionExpressionTypeKind
.ImplementsIEnumerable)
2337
collectionTypeKind:
CollectionExpressionTypeKind
.None,
2359
var
collectionTypeKind = ConversionsBase.GetCollectionExpressionTypeKind(Compilation, targetType, out TypeWithAnnotations elementTypeWithAnnotations);
2362
case
CollectionExpressionTypeKind
.ImplementsIEnumerable:
2363
case
CollectionExpressionTypeKind
.CollectionBuilder:
2369
collectionTypeKind ==
CollectionExpressionTypeKind
.CollectionBuilder ?
2382
if (collectionTypeKind !=
CollectionExpressionTypeKind
.None)
2388
if (collectionTypeKind ==
CollectionExpressionTypeKind
.ImplementsIEnumerable)
Binder\Binder.ValueChecks.cs (5)
4786
var
collectionTypeKind = ConversionsBase.GetCollectionExpressionTypeKind(_compilation, expr.Type, out var elementType);
4789
case
CollectionExpressionTypeKind
.ReadOnlySpan:
4798
case
CollectionExpressionTypeKind
.Span:
4802
case
CollectionExpressionTypeKind
.CollectionBuilder:
4813
case
CollectionExpressionTypeKind
.ImplementsIEnumerable:
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,
583
internal
CollectionExpressionTypeKind
GetCollectionExpressionTypeKind(out TypeSymbol? elementType, out MethodSymbol? constructor, out bool isExpanded)
596
return
CollectionExpressionTypeKind
.None;
Binder\Semantics\Conversions\Conversions.cs (5)
165
var
collectionTypeKind = GetCollectionExpressionTypeKind(Compilation, targetType, out TypeWithAnnotations elementTypeWithAnnotations);
169
case
CollectionExpressionTypeKind
.None:
172
case
CollectionExpressionTypeKind
.ImplementsIEnumerable:
173
case
CollectionExpressionTypeKind
.CollectionBuilder:
191
if (collectionTypeKind ==
CollectionExpressionTypeKind
.ImplementsIEnumerable)
Binder\Semantics\Conversions\ConversionsBase.cs (8)
1669
internal static
CollectionExpressionTypeKind
GetCollectionExpressionTypeKind(CSharpCompilation compilation, TypeSymbol destination, out TypeWithAnnotations elementType)
1678
return
CollectionExpressionTypeKind
.Array;
1683
return
CollectionExpressionTypeKind
.Span;
1687
return
CollectionExpressionTypeKind
.ReadOnlySpan;
1692
return
CollectionExpressionTypeKind
.CollectionBuilder;
1703
return
CollectionExpressionTypeKind
.ImplementsIEnumerable;
1707
return
CollectionExpressionTypeKind
.ArrayInterface;
1711
return
CollectionExpressionTypeKind
.None;
Binder\Semantics\OverloadResolution\OverloadResolution.cs (37)
1342
var
collectionTypeKind = ConversionsBase.GetCollectionExpressionTypeKind(binder.Compilation, type, out elementType);
1346
case
CollectionExpressionTypeKind
.None:
1349
case
CollectionExpressionTypeKind
.ImplementsIEnumerable:
1350
case
CollectionExpressionTypeKind
.CollectionBuilder:
1360
if (collectionTypeKind ==
CollectionExpressionTypeKind
.ImplementsIEnumerable)
3055
var
kind1 = conv1.GetCollectionExpressionTypeKind(out TypeSymbol elementType1, out _, out _);
3056
var
kind2 = conv2.GetCollectionExpressionTypeKind(out TypeSymbol elementType2, out _, out _);
3085
TypeSymbol t1,
CollectionExpressionTypeKind
kind1, TypeSymbol elementType1, ImmutableArray<Conversion> underlyingElementConversions1,
3086
TypeSymbol t2,
CollectionExpressionTypeKind
kind2, TypeSymbol elementType2, ImmutableArray<Conversion> underlyingElementConversions2,
3097
var t1IsSpanType = kind1 is
CollectionExpressionTypeKind
.ReadOnlySpan or
CollectionExpressionTypeKind
.Span;
3098
var t2IsSpanType = kind2 is
CollectionExpressionTypeKind
.ReadOnlySpan or
CollectionExpressionTypeKind
.Span;
3178
case (
CollectionExpressionTypeKind
.ReadOnlySpan,
CollectionExpressionTypeKind
.Span):
3179
case (
CollectionExpressionTypeKind
.ReadOnlySpan or
CollectionExpressionTypeKind
.Span, _) when IsSZArrayOrArrayInterface(t2, out _):
3182
case (
CollectionExpressionTypeKind
.Span,
CollectionExpressionTypeKind
.ReadOnlySpan):
3183
case (_,
CollectionExpressionTypeKind
.ReadOnlySpan or
CollectionExpressionTypeKind
.Span) when IsSZArrayOrArrayInterface(t1, out _):
3192
TypeSymbol t1,
CollectionExpressionTypeKind
kind1, TypeSymbol elementType1,
3193
TypeSymbol t2,
CollectionExpressionTypeKind
kind2, TypeSymbol elementType2,
3199
if (kind1 is
CollectionExpressionTypeKind
.ReadOnlySpan &&
3200
kind2 is
CollectionExpressionTypeKind
.Span)
3207
if (kind1 is (
CollectionExpressionTypeKind
.ReadOnlySpan or
CollectionExpressionTypeKind
.Span))
3214
Debug.Assert(kind1 is not (
CollectionExpressionTypeKind
.ReadOnlySpan or
CollectionExpressionTypeKind
.Span));
3215
if (kind2 is not (
CollectionExpressionTypeKind
.ReadOnlySpan or
CollectionExpressionTypeKind
.Span) &&
3229
CollectionExpressionTypeKind
kind1 = ConversionsBase.GetCollectionExpressionTypeKind(Compilation, t1, out TypeWithAnnotations elementType1);
3230
CollectionExpressionTypeKind
kind2 = ConversionsBase.GetCollectionExpressionTypeKind(Compilation, t2, out TypeWithAnnotations elementType2);
3232
if (kind1 is
CollectionExpressionTypeKind
.CollectionBuilder or
CollectionExpressionTypeKind
.ImplementsIEnumerable)
3237
if (kind2 is
CollectionExpressionTypeKind
.CollectionBuilder or
CollectionExpressionTypeKind
.ImplementsIEnumerable)
BoundTree\BoundCollectionExpression.cs (2)
19
Debug.Assert(this.CollectionTypeKind ==
CollectionExpressionTypeKind
.CollectionBuilder);
31
Debug.Assert(this.CollectionTypeKind !=
CollectionExpressionTypeKind
.CollectionBuilder);
FlowAnalysis\NullableWalker.cs (7)
4032
node.CollectionTypeKind ==
CollectionExpressionTypeKind
.ImplementsIEnumerable)
4271
static NullableFlowState getResultState(BoundCollectionExpression node,
CollectionExpressionTypeKind
collectionKind)
4273
if (collectionKind is
CollectionExpressionTypeKind
.CollectionBuilder)
4286
(
CollectionExpressionTypeKind
, TypeWithAnnotations) getCollectionDetails(BoundCollectionExpression node, TypeSymbol collectionType)
4288
var
collectionKind = ConversionsBase.GetCollectionExpressionTypeKind(this.compilation, collectionType, out var targetElementType);
4289
if (collectionKind is
CollectionExpressionTypeKind
.CollectionBuilder)
4298
else if (collectionKind is
CollectionExpressionTypeKind
.ImplementsIEnumerable)
Generated\BoundNodes.xml.Generated.cs (3)
6546
public BoundCollectionExpression(SyntaxNode syntax,
CollectionExpressionTypeKind
collectionTypeKind, BoundObjectOrCollectionValuePlaceholder? placeholder, BoundExpression? collectionCreation, MethodSymbol? collectionBuilderMethod, BoundCollectionBuilderElementsPlaceholder? collectionBuilderElementsPlaceholder, bool wasTargetTyped, bool hasWithElement, BoundUnconvertedCollectionExpression unconvertedCollectionExpression, ImmutableArray<BoundNode> elements, TypeSymbol type, bool hasErrors = false)
6569
public
CollectionExpressionTypeKind
CollectionTypeKind { get; }
6581
public BoundCollectionExpression Update(
CollectionExpressionTypeKind
collectionTypeKind, BoundObjectOrCollectionValuePlaceholder? placeholder, BoundExpression? collectionCreation, MethodSymbol? collectionBuilderMethod, BoundCollectionBuilderElementsPlaceholder? collectionBuilderElementsPlaceholder, bool wasTargetTyped, bool hasWithElement, BoundUnconvertedCollectionExpression unconvertedCollectionExpression, ImmutableArray<BoundNode> elements, TypeSymbol type)
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (14)
40
var
collectionTypeKind = conversion.GetCollectionExpressionTypeKind(out var elementType, out _, out _);
43
case
CollectionExpressionTypeKind
.ImplementsIEnumerable:
79
case
CollectionExpressionTypeKind
.Array:
80
case
CollectionExpressionTypeKind
.Span:
81
case
CollectionExpressionTypeKind
.ReadOnlySpan:
84
case
CollectionExpressionTypeKind
.CollectionBuilder:
95
case
CollectionExpressionTypeKind
.ArrayInterface:
337
Debug.Assert(!IsAllocatingRefStructCollectionExpression(node,
CollectionExpressionTypeKind
.ReadOnlySpan, elementType.Type, _compilation));
347
Debug.Assert(!IsAllocatingRefStructCollectionExpression(node, isReadOnlySpan ?
CollectionExpressionTypeKind
.ReadOnlySpan :
CollectionExpressionTypeKind
.Span, elementType.Type, _compilation));
663
internal static bool IsAllocatingRefStructCollectionExpression(BoundCollectionExpressionBase node,
CollectionExpressionTypeKind
collectionKind, TypeSymbol? elementType, CSharpCompilation compilation)
665
return collectionKind is
CollectionExpressionTypeKind
.Span or
CollectionExpressionTypeKind
.ReadOnlySpan
668
&& !(collectionKind ==
CollectionExpressionTypeKind
.ReadOnlySpan && ShouldUseRuntimeHelpersCreateSpan(node, elementType))
Operations\CSharpOperationFactory.cs (7)
1278
case
CollectionExpressionTypeKind
.None:
1279
case
CollectionExpressionTypeKind
.Array:
1280
case
CollectionExpressionTypeKind
.ReadOnlySpan:
1281
case
CollectionExpressionTypeKind
.Span:
1283
case
CollectionExpressionTypeKind
.ArrayInterface:
1284
case
CollectionExpressionTypeKind
.ImplementsIEnumerable:
1286
case
CollectionExpressionTypeKind
.CollectionBuilder:
Symbols\Source\SourceComplexParameterSymbol.cs (5)
1613
var
collectionTypeKind = ConversionsBase.GetCollectionExpressionTypeKind(DeclaringCompilation, Type, out TypeWithAnnotations elementTypeWithAnnotations);
1618
case
CollectionExpressionTypeKind
.None:
1622
case
CollectionExpressionTypeKind
.ImplementsIEnumerable:
1683
case
CollectionExpressionTypeKind
.CollectionBuilder:
1720
if (collectionTypeKind !=
CollectionExpressionTypeKind
.Array)