161 references to Kind
Microsoft.CodeAnalysis.CSharp (161)
Binder\Binder_Conversions.cs (7)
143
if (conversion.
Kind
== ConversionKind.FunctionType)
159
if (conversion.
Kind
== ConversionKind.SwitchExpression)
174
if (conversion.
Kind
== ConversionKind.ConditionalExpression)
189
if (conversion.
Kind
== ConversionKind.InterpolatedString)
196
if (conversion.
Kind
== ConversionKind.InterpolatedStringHandler)
270
if (conversion.
Kind
== ConversionKind.DefaultLiteral)
280
if (conversion.
Kind
is ConversionKind.ImplicitReference or ConversionKind.ExplicitReference &&
Binder\Binder_Deconstruct.cs (1)
308
Debug.Assert(nestedConversion.
Kind
== ConversionKind.Deconstruction);
Binder\Binder_Operators.cs (4)
3308
return new BoundIsOperator(node, operand, typeExpression, conv.
Kind
, resultType);
3330
ReportIsOperatorDiagnostics(node, diagnostics, operandType, targetType, conversion.
Kind
, operand.ConstantValueOpt);
3331
return new BoundIsOperator(node, operand, typeExpression, conversion.
Kind
, resultType);
3826
bool hasErrors = ReportAsOperatorConversionDiagnostics(node, diagnostics, this.Compilation, operandType, targetType, conversion.
Kind
, operand.ConstantValueOpt);
Binder\Binder_Patterns.cs (1)
828
ConstantValue result = Binder.GetIsOperatorConstantResult(expressionType, patternType, conversion.
Kind
, operandConstantValue, operandCouldBeNull);
Binder\Binder_Statements.cs (4)
1948
if (conversion.
Kind
!= ConversionKind.Identity)
2246
else if (conversion.
Kind
== ConversionKind.ExplicitNumeric && sourceConstantValueOpt != null && sourceConstantValueOpt != ConstantValue.Bad &&
2674
if (conversion.
Kind
== ConversionKind.Identity)
3161
if (conversion.
Kind
!= ConversionKind.Identity)
Binder\ForEachLoopBinder.cs (2)
471
if (elementConversionClassification.
Kind
!= ConversionKind.Identity && IterationVariable.RefKind is RefKind.Ref or RefKind.RefReadOnly)
574
(collectionConversionClassification.
Kind
== ConversionKind.ExplicitReference && collectionExpr.Type.SpecialType == SpecialType.System_String));
Binder\RefSafetyAnalysis.cs (1)
923
Debug.Assert(conversion.
Kind
== ConversionKind.Deconstruction);
Binder\Semantics\Conversions\Conversion.cs (47)
197
return new Conversion(this.
Kind
, conversionMethod, isExtensionMethod: IsExtensionMethod);
352
return nestedConversion.
Kind
switch
604
return
Kind
!= ConversionKind.NoConversion;
618
return
Kind
.IsImplicitConversion();
647
return
Kind
== ConversionKind.Identity;
658
return
Kind
== ConversionKind.StackAllocToPointerType ||
Kind
== ConversionKind.StackAllocToSpanType;
672
return
Kind
== ConversionKind.ImplicitNumeric ||
Kind
== ConversionKind.ExplicitNumeric;
686
return
Kind
== ConversionKind.ImplicitEnumeration ||
Kind
== ConversionKind.ExplicitEnumeration;
697
return
Kind
== ConversionKind.ImplicitThrow;
708
return
Kind
== ConversionKind.ObjectCreation;
715
public bool IsCollectionExpression =>
Kind
== ConversionKind.CollectionExpression;
724
return
Kind
== ConversionKind.SwitchExpression;
735
return
Kind
== ConversionKind.ConditionalExpression;
750
return
Kind
== ConversionKind.InterpolatedString;
761
return
Kind
== ConversionKind.InterpolatedStringHandler;
772
return
Kind
== ConversionKind.InlineArray;
786
return
Kind
== ConversionKind.ImplicitNullable ||
Kind
== ConversionKind.ExplicitNullable;
797
return
Kind
== ConversionKind.ImplicitTupleLiteral ||
Kind
== ConversionKind.ExplicitTupleLiteral;
808
return
Kind
== ConversionKind.ImplicitTuple ||
Kind
== ConversionKind.ExplicitTuple;
822
return
Kind
== ConversionKind.ImplicitReference ||
Kind
== ConversionKind.ExplicitReference;
836
return
Kind
is ConversionKind.ImplicitSpan or ConversionKind.ExplicitSpan;
850
return
Kind
.IsUserDefinedConversion();
864
return
Kind
== ConversionKind.Boxing;
878
return
Kind
== ConversionKind.Unboxing;
892
return
Kind
== ConversionKind.NullLiteral;
903
return
Kind
== ConversionKind.DefaultLiteral;
917
return
Kind
.IsDynamic();
931
return
Kind
== ConversionKind.ImplicitConstant;
945
return
Kind
== ConversionKind.AnonymousFunction;
959
return
Kind
== ConversionKind.MethodGroup;
984
return this.
Kind
.IsPointerConversion();
1005
return
Kind
== ConversionKind.IntPtr;
1061
return this.
Kind
== ConversionKind.NoConversion ? LookupResultKind.Empty : LookupResultKind.Viable;
1158
/// Returns a string that represents the <see cref="
Kind
"/> of the conversion.
1160
/// <returns>A string that represents the <see cref="
Kind
"/> of the conversion.</returns>
1163
return this.
Kind
.ToString();
1183
return this.
Kind
== other.
Kind
&& this.Method == other.Method;
1192
return Hash.Combine(this.Method, (int)this.
Kind
);
1244
return new TreeDumperNode("conversion", self.
Kind
, sub);
Binder\Semantics\Conversions\ConversionsBase.cs (12)
647
Debug.Assert(isStandardImplicitConversionFromExpression(conversion.
Kind
));
662
{
Kind
: ConversionKind.CollectionExpression } => true,
663
{
Kind
: ConversionKind.ImplicitNullable, UnderlyingConversions: [{
Kind
: ConversionKind.CollectionExpression }] } => true,
698
Debug.Assert(conversion.
Kind
== ConversionKind.NoConversion || IsStandardImplicitConversionFromType(conversion.
Kind
));
888
switch (oppositeConversion.
Kind
)
933
throw ExceptionUtilities.UnexpectedValue(oppositeConversion.
Kind
);
1012
switch (implicitConversion.
Kind
)
1896
ClassifyImplicitConversionFromType(source.Type, destination.Type, ref discardedUseSiteInfo).
Kind
!= ConversionKind.NoConversion;
2005
switch (conversion.
Kind
)
2027
Debug.Assert(conversion.
Kind
== ConversionKind.NoConversion);
Binder\Semantics\Conversions\UserDefinedImplicitConversions.cs (1)
601
return IsEncompassingImplicitConversionKind(result.
Kind
) ? result : Conversion.NoConversion;
Binder\Semantics\OverloadResolution\OverloadResolution.cs (14)
2191
if (allSame && Conversions.ClassifyImplicitConversionFromType(type1Normalized, type2Normalized, ref useSiteInfo).
Kind
!= ConversionKind.Identity)
2200
if (Conversions.ClassifyImplicitConversionFromType(type1Normalized, type2Normalized, ref useSiteInfo).
Kind
!= ConversionKind.Identity)
2313
if (Conversions.ClassifyImplicitConversionFromType(type1Normalized, type2Normalized, ref useSiteInfo).
Kind
!= ConversionKind.Identity)
2590
return conversionsOpt.Any(static c => c.
Kind
== ConversionKind.FunctionType);
2863
return conv1.
Kind
== ConversionKind.Identity ? BetterResult.Left : BetterResult.Neither;
2867
return conv2.
Kind
== ConversionKind.Identity ? BetterResult.Right : BetterResult.Neither;
2917
switch ((conv1.
Kind
, conv2.
Kind
))
2928
switch ((conv1.
Kind
, conv2.
Kind
))
2966
if (conv1.
Kind
== ConversionKind.CollectionExpression &&
2967
conv2.
Kind
== ConversionKind.CollectionExpression)
2972
switch ((conv1.
Kind
, conv2.
Kind
))
Binder\SwitchBinder.cs (1)
417
Debug.Assert(conversion.
Kind
== ConversionKind.ImplicitUserDefined);
BoundTree\BoundExpression.cs (1)
455
get { return this.Conversion.
Kind
; }
Compilation\CSharpSemanticModel.cs (2)
2174
else if (highestBoundExpr is BoundConversion { ConversionKind: ConversionKind.ImplicitNullable, Conversion.UnderlyingConversions: [{
Kind
: ConversionKind.CollectionExpression }] } boundConversion)
2198
if (conversion.
Kind
== ConversionKind.AnonymousFunction)
Compilation\DeconstructionInfo.cs (3)
38
return _conversion.
Kind
== ConversionKind.Deconstruction
51
return _conversion.
Kind
== ConversionKind.Deconstruction
64
if (_conversion.
Kind
!= ConversionKind.Deconstruction)
FlowAnalysis\NullableWalker.cs (17)
2036
switch (conv.Conversion.
Kind
)
2493
var conversionKind = conversion.Conversion.
Kind
;
2722
Debug.Assert(conversion.
Kind
is ConversionKind.Identity or ConversionKind.ImplicitReference);
7368
if (conversion is { IsValid: true,
Kind
: ConversionKind.ImplicitUserDefined })
8535
Debug.Assert(conversion.
Kind
== ConversionKind.ImplicitTuple || conversion.
Kind
== ConversionKind.ExplicitTuple);
8556
switch (conversion.
Kind
)
8840
switch (conversion.
Kind
)
9040
switch (conversion.
Kind
)
9087
var previousKind = conversion.
Kind
;
9347
Debug.Assert(conversion.
Kind
== ConversionKind.ExplicitUserDefined || conversion.
Kind
== ConversionKind.ImplicitUserDefined);
10136
Debug.Assert(conversion.
Kind
== ConversionKind.Deconstruction);
10316
underlyingConversion.
Kind
== ConversionKind.ImplicitNullable &&
10921
(conversion.
Kind
== ConversionKind.ExplicitReference && resultType.SpecialType == SpecialType.System_String))
11126
if (conversion.
Kind
== ConversionKind.NoConversion)
11546
switch (BoundNode.GetConversion(node.OperandConversion, node.OperandPlaceholder).
Kind
)
FlowAnalysis\NullableWalker_Patterns.cs (2)
464
switch (_conversions.WithNullability(false).ClassifyConversionFromType(inputType, e.Type, isChecked: false, ref discardedUseSiteInfo).
Kind
)
763
return _conversions.WithNullability(false).ClassifyConversionFromType(derivedType, baseType, isChecked: false, ref discardedUseSiteInfo).
Kind
switch
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (1)
621
var kind = _bound.Compilation.Conversions.ClassifyConversionFromType(oldType, newType, isChecked: false, ref useSiteInfo).
Kind
;
Lowering\LocalRewriter\LocalRewriter.DecisionDagRewriter.cs (1)
213
switch (conversion.
Kind
)
Lowering\LocalRewriter\LocalRewriter.PatternLocalRewriter.cs (2)
218
if (conversion.
Kind
== ConversionKind.ExplicitNullable &&
485
(conv.IsIdentity || conv.
Kind
== ConversionKind.ImplicitReference || conv.IsBoxing) &&
Lowering\LocalRewriter\LocalRewriter_AsOperator.cs (1)
51
ConstantValue constantValue = Binder.GetAsOperatorConstantResult(rewrittenOperand.Type, rewrittenType, conversion.
Kind
, rewrittenOperand.ConstantValueOpt);
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (3)
33
Debug.Assert(conversion.
Kind
== ConversionKind.CollectionExpression);
204
if (conversion.
Kind
is not (ConversionKind.Identity or ConversionKind.ImplicitReference))
211
return conversion.
Kind
is ConversionKind.Identity or ConversionKind.ImplicitReference;
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (13)
61
case ConversionKind.ImplicitNullable when node.Conversion.UnderlyingConversions[0].
Kind
is ConversionKind.CollectionExpression:
317
switch (conversion.
Kind
)
436
return RewriteDecimalConversion(syntax, rewrittenOperand, rewrittenOperand.Type, rewrittenType, @checked, conversion.
Kind
.IsImplicitConversion(), constantValueOpt);
538
return _dynamicFactory.MakeDynamicConversion(rewrittenOperand, explicitCastInCode || conversion.
Kind
== ConversionKind.ExplicitDynamic, conversion.IsArrayIndex, @checked, rewrittenType).ToExpression();
649
Debug.Assert(conversion.
Kind
is ConversionKind.ImplicitSpan);
681
Debug.Assert(conversion.
Kind
is ConversionKind.ImplicitSpan);
700
Debug.Assert(conversion.
Kind
is ConversionKind.ImplicitSpan);
868
if (conversion.
Kind
.IsUserDefinedConversion())
1007
case BoundConversion { Conversion: {
Kind
: ConversionKind.ImplicitNullable }, Operand: var convertedArgument }
1012
case BoundConversion { Conversion: {
Kind
: ConversionKind.ImplicitNullable, UnderlyingConversions: var underlying }, Operand: var convertedArgument } conversion
1013
when underlying.Length == 1 && underlying[0].
Kind
== ConversionKind.ImplicitTuple && !convertedArgument.Type!.IsNullableType():
1131
var conversionKind = conversion.
Kind
.IsImplicitConversion() ? ConversionKind.ImplicitUserDefined : ConversionKind.ExplicitUserDefined;
1754
switch (conversion.
Kind
)
Lowering\LocalRewriter\LocalRewriter_DeconstructionAssignmentOperator.cs (4)
20
Debug.Assert(right.Conversion.
Kind
== ConversionKind.Deconstruction);
219
Debug.Assert(conversion.
Kind
== ConversionKind.Deconstruction);
307
if ((tupleConversion.Conversion.
Kind
== ConversionKind.ImplicitTupleLiteral || tupleConversion.Conversion.
Kind
== ConversionKind.Identity)
Lowering\LocalRewriter\LocalRewriter_NullCoalescingOperator.cs (2)
92
BoundNode.GetConversion(leftConversion, leftPlaceholder) is {
Kind
: ConversionKind.Identity or ConversionKind.ImplicitReference })
99
if (BoundNode.GetConversion(leftConversion, leftPlaceholder) is { IsIdentity: true } or {
Kind
: ConversionKind.ExplicitNullable })
Lowering\LocalRewriter\LocalRewriter_StringInterpolation.cs (1)
240
if (arg is BoundConversion { Conversion: {
Kind
: ConversionKind.InterpolatedStringHandler }, ExplicitCastInCode: false, Operand: var operand })
Lowering\LocalRewriter\LocalRewriter_TupleBinaryOperator.cs (6)
49
case BoundConversion { Conversion: {
Kind
: ConversionKind.Identity }, Operand: var o }:
51
case BoundConversion { Conversion: {
Kind
: ConversionKind.ImplicitTupleLiteral }, Operand: var o }:
56
case BoundConversion { Conversion: {
Kind
: var kind } c, Operand: var o } conversion when
88
case BoundConversion { Conversion: {
Kind
: var kind }, Operand: var o } when
190
case BoundConversion { Conversion: {
Kind
: ConversionKind.DefaultLiteral } }: // This conversion can be performed lazily, but need not be saved. It is treated as non-side-effecting.
193
case BoundConversion { Conversion: {
Kind
: var conversionKind } conversion } when conversionMustBePerformedOnOriginalExpression(conversionKind):
Lowering\SyntheticBoundNodeFactory.cs (5)
558
Debug.Assert(conversion.
Kind
!= ConversionKind.NoConversion);
559
if (conversion.
Kind
!= ConversionKind.Identity)
645
return new BoundIsOperator(this.Syntax, operand, Type(type), c.
Kind
, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean)) { WasCompilerGenerated = true };
1501
if (conversion.
Kind
== ConversionKind.ImplicitReference && arg.IsLiteralNull())
1507
if (conversion.
Kind
== ConversionKind.ExplicitNullable &&
Symbols\Source\SourceComplexParameterSymbol.cs (1)
1015
else if (!compilation.Conversions.ClassifyConversionFromType((TypeSymbol)arg.TypeInternal, this.Type, isChecked: false, ref useSiteInfo).
Kind
.IsImplicitConversion())
Symbols\Source\SourceMemberContainerSymbol_ImplementationChecks.cs (1)
1367
return conversions.ClassifyImplicitConversionFromType(sourceType, targetType, ref discardedUseSiteInfo).
Kind
!= ConversionKind.NoConversion;