183 references to Kind
Microsoft.CodeAnalysis.CSharp (183)
Binder\Binder_Await.cs (1)
477var result = conversion is { IsImplicit: true, Kind: ConversionKind.Identity or ConversionKind.ImplicitReference };
Binder\Binder_Conversions.cs (14)
184if (conversion.Kind == ConversionKind.FunctionType) 200if (conversion.Kind == ConversionKind.SwitchExpression) 216if (conversion.Kind == ConversionKind.ConditionalExpression) 232if (conversion.Kind == ConversionKind.InterpolatedString) 239if (conversion.Kind == ConversionKind.InterpolatedStringHandler) 323if (conversion.Kind == ConversionKind.DefaultLiteral) 333if (conversion.Kind is ConversionKind.ImplicitReference or ConversionKind.ExplicitReference && 942Debug.Assert(_conversion.Kind is ConversionKind.NoConversion); 1605switch (conversion.Kind) 2841Debug.Assert(conversion.Kind == ConversionKind.FunctionType); 3100switch (conversion.Kind) 3121throw ExceptionUtilities.UnexpectedValue(conversion.Kind); 3844if (conversion.Kind == ConversionKind.DefaultLiteral) 3863switch (conversion.Kind)
Binder\Binder_Deconstruct.cs (1)
309Debug.Assert(nestedConversion.Kind == ConversionKind.Deconstruction);
Binder\Binder_Operators.cs (8)
500if (conversion.Kind is not ConversionKind.Identity) 502Debug.Assert(conversion.Kind is ConversionKind.ImplicitReference); 3606if (conversion.Kind is not ConversionKind.Identity) 3608Debug.Assert(conversion.Kind is ConversionKind.ImplicitReference); 4988return new BoundIsOperator(node, operand, typeExpression, conv.Kind, resultType); 5009ReportIsOperatorDiagnostics(node, diagnostics, inputType, targetType, conversion.Kind, operand.ConstantValueOpt); 5010return new BoundIsOperator(node, operand, typeExpression, conversion.Kind, resultType); 5506bool hasErrors = ReportAsOperatorConversionDiagnostics(node, diagnostics, this.Compilation, operandType, targetType, conversion.Kind, operand.ConstantValueOpt);
Binder\Binder_Patterns.cs (1)
1429ConstantValue result = Binder.GetIsOperatorConstantResult(expressionType, patternType, conversion.Kind, operandConstantValue, operandCouldBeNull);
Binder\Binder_Statements.cs (4)
1993if (conversion.Kind != ConversionKind.Identity) 2295else if (conversion.Kind == ConversionKind.ExplicitNumeric && sourceConstantValueOpt != null && sourceConstantValueOpt != ConstantValue.Bad && 2723if (conversion.Kind == ConversionKind.Identity) 3214if (conversion.Kind != ConversionKind.Identity)
Binder\ForEachLoopBinder.cs (2)
486if (elementConversionClassification.Kind != ConversionKind.Identity && IterationVariable.RefKind is RefKind.Ref or RefKind.RefReadOnly) 595(collectionConversionClassification.Kind == ConversionKind.ExplicitReference && collectionExpr.Type.SpecialType == SpecialType.System_String));
Binder\RefSafetyAnalysis.cs (1)
1132Debug.Assert(conversion.Kind == ConversionKind.Deconstruction);
Binder\Semantics\Conversions\Conversion.cs (48)
225return new Conversion(this.Kind, conversionMethod, isExtensionMethod: IsExtensionMethod); 380return nestedConversion.Kind switch 643return Kind != ConversionKind.NoConversion; 657return Kind.IsImplicitConversion(); 686return Kind == ConversionKind.Identity; 697return Kind == ConversionKind.StackAllocToPointerType || Kind == ConversionKind.StackAllocToSpanType; 711return Kind == ConversionKind.ImplicitNumeric || Kind == ConversionKind.ExplicitNumeric; 725return Kind == ConversionKind.ImplicitEnumeration || Kind == ConversionKind.ExplicitEnumeration; 736return Kind == ConversionKind.ImplicitThrow; 747return Kind == ConversionKind.ObjectCreation; 754public bool IsCollectionExpression => Kind == ConversionKind.CollectionExpression; 763return Kind == ConversionKind.SwitchExpression; 774return Kind == ConversionKind.ConditionalExpression; 789return Kind == ConversionKind.InterpolatedString; 800return Kind == ConversionKind.InterpolatedStringHandler; 811return Kind == ConversionKind.InlineArray; 825return Kind == ConversionKind.ImplicitNullable || Kind == ConversionKind.ExplicitNullable; 836return Kind == ConversionKind.ImplicitTupleLiteral || Kind == ConversionKind.ExplicitTupleLiteral; 847return Kind == ConversionKind.ImplicitTuple || Kind == ConversionKind.ExplicitTuple; 861return Kind == ConversionKind.ImplicitReference || Kind == ConversionKind.ExplicitReference; 875return Kind is ConversionKind.ImplicitSpan or ConversionKind.ExplicitSpan; 889return Kind.IsUserDefinedConversion(); 901return Kind.IsUnionConversion(); 915return Kind == ConversionKind.Boxing; 929return Kind == ConversionKind.Unboxing; 943return Kind == ConversionKind.NullLiteral; 954return Kind == ConversionKind.DefaultLiteral; 968return Kind.IsDynamic(); 982return Kind == ConversionKind.ImplicitConstant; 996return Kind == ConversionKind.AnonymousFunction; 1010return Kind == ConversionKind.MethodGroup; 1035return this.Kind.IsPointerConversion(); 1056return Kind == ConversionKind.IntPtr; 1113return this.Kind == ConversionKind.NoConversion ? LookupResultKind.Empty : LookupResultKind.Viable; 1224/// Returns a string that represents the <see cref="Kind"/> of the conversion. 1226/// <returns>A string that represents the <see cref="Kind"/> of the conversion.</returns> 1229return this.Kind.ToString(); 1249return this.Kind == other.Kind && Equals(this._uncommonData, other._uncommonData); 1258return Hash.Combine(this._uncommonData, (int)this.Kind); 1310return new TreeDumperNode("conversion", self.Kind, sub);
Binder\Semantics\Conversions\ConversionsBase.cs (12)
647Debug.Assert(isStandardImplicitConversionFromExpression(conversion.Kind)); 662{ Kind: ConversionKind.CollectionExpression } => true, 663{ Kind: ConversionKind.ImplicitNullable, UnderlyingConversions: [{ Kind: ConversionKind.CollectionExpression }] } => true, 698Debug.Assert(conversion.Kind == ConversionKind.NoConversion || IsStandardImplicitConversionFromType(conversion.Kind)); 902switch (oppositeConversion.Kind) 947throw ExceptionUtilities.UnexpectedValue(oppositeConversion.Kind); 1026switch (implicitConversion.Kind) 1909return conversion.Kind != ConversionKind.NoConversion && 2019switch (conversion.Kind) 2041Debug.Assert(conversion.Kind == ConversionKind.NoConversion);
Binder\Semantics\Conversions\UserDefinedImplicitConversions.cs (1)
606return IsEncompassingImplicitConversionKind(result.Kind) ? result : Conversion.NoConversion;
Binder\Semantics\OverloadResolution\OverloadResolution.cs (14)
2218if (allSame && Conversions.ClassifyImplicitConversionFromType(type1Normalized, type2Normalized, ref useSiteInfo).Kind != ConversionKind.Identity) 2227if (Conversions.ClassifyImplicitConversionFromType(type1Normalized, type2Normalized, ref useSiteInfo).Kind != ConversionKind.Identity) 2340if (Conversions.ClassifyImplicitConversionFromType(type1Normalized, type2Normalized, ref useSiteInfo).Kind != ConversionKind.Identity) 2715return conversionsOpt.Any(static c => c.Kind == ConversionKind.FunctionType); 2925return conv1.Kind == ConversionKind.Identity ? BetterResult.Left : BetterResult.Neither; 2929return conv2.Kind == ConversionKind.Identity ? BetterResult.Right : BetterResult.Neither; 2979switch ((conv1.Kind, conv2.Kind)) 2990switch ((conv1.Kind, conv2.Kind)) 3028if (conv1.Kind == ConversionKind.CollectionExpression && 3029conv2.Kind == ConversionKind.CollectionExpression) 3034switch ((conv1.Kind, conv2.Kind))
Binder\SwitchBinder.cs (1)
439Debug.Assert(conversion.Kind == ConversionKind.ImplicitUserDefined);
BoundTree\BoundConversion.cs (2)
85Debug.Assert(ConversionsBase.IsEncompassingImplicitConversionKind(Conversion.Kind) || 191Debug.Assert(ConversionsBase.IsEncompassingImplicitConversionKind(Conversion.Kind));
BoundTree\BoundExpression.cs (1)
473get { return this.Conversion.Kind; }
Compilation\CSharpSemanticModel.cs (2)
2185else if (highestBoundExpr is BoundConversion { ConversionKind: ConversionKind.ImplicitNullable, Conversion.UnderlyingConversions: [{ Kind: ConversionKind.CollectionExpression }] } boundConversion) 2209if (conversion.Kind == ConversionKind.AnonymousFunction)
Compilation\DeconstructionInfo.cs (3)
38return _conversion.Kind == ConversionKind.Deconstruction 51return _conversion.Kind == ConversionKind.Deconstruction 64if (_conversion.Kind != ConversionKind.Deconstruction)
FlowAnalysis\NullableWalker.cs (18)
2195switch (conv.Conversion.Kind) 2652var conversionKind = conversion.Conversion.Kind; 2908Debug.Assert(conversion.Kind is ConversionKind.Identity or ConversionKind.ImplicitReference); 5769if (conversion.Kind is ConversionKind.Identity or ConversionKind.ImplicitReference) 8221if (conversion is { IsValid: true, Kind: ConversionKind.ImplicitUserDefined }) // Looking at unit-tests ImplicitConversions_07 and ImplicitConversion_Params, the behavior looks good without special handling for Union conversions here. 9506Debug.Assert(conversion.Kind == ConversionKind.ImplicitTuple || conversion.Kind == ConversionKind.ExplicitTuple); 9527switch (conversion.Kind) 9870switch (conversion.Kind) 10107switch (conversion.Kind) 10134switch (conversion.Kind) 10442Debug.Assert(conversion.Kind == ConversionKind.ExplicitUserDefined || conversion.Kind == ConversionKind.ImplicitUserDefined); 11427Debug.Assert(conversion.Kind == ConversionKind.Deconstruction); 11609underlyingConversion.Kind == ConversionKind.ImplicitNullable && 12434(conversion.Kind == ConversionKind.ExplicitReference && resultType.SpecialType == SpecialType.System_String)) 12632if (conversion.Kind == ConversionKind.NoConversion) 13161switch (BoundNode.GetConversion(node.OperandConversion, node.OperandPlaceholder).Kind)
FlowAnalysis\NullableWalker_Patterns.cs (2)
710switch (_conversions.WithNullability(false).ClassifyConversionFromType(e.Input.Type, e.Type, isChecked: false, ref discardedUseSiteInfo).Kind) 874return _conversions.WithNullability(false).ClassifyConversionFromType(derivedType, baseType, isChecked: false, ref discardedUseSiteInfo).Kind switch
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (1)
628var kind = _bound.Compilation.Conversions.ClassifyConversionFromType(oldType, newType, isChecked: false, ref useSiteInfo).Kind;
Lowering\LocalRewriter\LocalRewriter.DecisionDagRewriter.cs (1)
213switch (conversion.Kind)
Lowering\LocalRewriter\LocalRewriter.PatternLocalRewriter.cs (2)
236if (conversion.Kind == ConversionKind.ExplicitNullable && 520(conv.IsIdentity || conv.Kind == ConversionKind.ImplicitReference || conv.IsBoxing) &&
Lowering\LocalRewriter\LocalRewriter_AsOperator.cs (1)
51ConstantValue constantValue = Binder.GetAsOperatorConstantResult(rewrittenOperand.Type, rewrittenType, conversion.Kind, rewrittenOperand.ConstantValueOpt);
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (6)
31Debug.Assert(conversion.Kind == ConversionKind.CollectionExpression); 216if (conversion.Kind is not (ConversionKind.Identity or ConversionKind.ImplicitReference)) 223return conversion.Kind is ConversionKind.Identity or ConversionKind.ImplicitReference; 383var conversionKind = compilation.Conversions.ClassifyConversionFromType(arrayType, constructorParameterType, isChecked: false, ref discardedUseSiteInfo).Kind; 769? spreadElementConversion.Kind is ConversionKind.Identity or ConversionKind.ImplicitReference 770: spreadElementConversion.Kind is ConversionKind.Identity;
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (14)
61case ConversionKind.ImplicitNullable when node.Conversion.UnderlyingConversions[0].Kind is ConversionKind.CollectionExpression: 316switch (conversion.Kind) 441return RewriteDecimalConversion(syntax, rewrittenOperand, rewrittenOperand.Type, rewrittenType, @checked, conversion.Kind.IsImplicitConversion(), constantValueOpt); 544return _dynamicFactory.MakeDynamicConversion(rewrittenOperand, explicitCastInCode || conversion.Kind == ConversionKind.ExplicitDynamic, conversion.IsArrayIndex, @checked, rewrittenType).ToExpression(); 661Debug.Assert(conversion.Kind is ConversionKind.ImplicitSpan); 693Debug.Assert(conversion.Kind is ConversionKind.ImplicitSpan); 712Debug.Assert(conversion.Kind is ConversionKind.ImplicitSpan); 887if (conversion.Kind.IsUserDefinedConversion()) 1076case BoundConversion { Conversion: { Kind: ConversionKind.ImplicitNullable }, Operand: var convertedArgument } 1081case BoundConversion { Conversion: { Kind: ConversionKind.ImplicitNullable, UnderlyingConversions: var underlying }, Operand: var convertedArgument } conversion 1082when underlying.Length == 1 && underlying[0].Kind == ConversionKind.ImplicitTuple && !convertedArgument.Type!.IsNullableType(): 1199var conversionKind = conversion.Kind.IsImplicitConversion() ? ConversionKind.ImplicitUserDefined : ConversionKind.ExplicitUserDefined; 1871switch (conversion.Kind) 1910throw ExceptionUtilities.UnexpectedValue(conversion.Kind);
Lowering\LocalRewriter\LocalRewriter_DeconstructionAssignmentOperator.cs (4)
20Debug.Assert(right.Conversion.Kind == ConversionKind.Deconstruction); 219Debug.Assert(conversion.Kind == ConversionKind.Deconstruction); 307if ((tupleConversion.Conversion.Kind == ConversionKind.ImplicitTupleLiteral || tupleConversion.Conversion.Kind == ConversionKind.Identity)
Lowering\LocalRewriter\LocalRewriter_NullCoalescingOperator.cs (2)
92BoundNode.GetConversion(leftConversion, leftPlaceholder) is { Kind: ConversionKind.Identity or ConversionKind.ImplicitReference }) 99if (BoundNode.GetConversion(leftConversion, leftPlaceholder) is { IsIdentity: true } or { Kind: ConversionKind.ExplicitNullable })
Lowering\LocalRewriter\LocalRewriter_StringInterpolation.cs (1)
240if (arg is BoundConversion { Conversion: { Kind: ConversionKind.InterpolatedStringHandler }, ExplicitCastInCode: false, Operand: var operand })
Lowering\LocalRewriter\LocalRewriter_TupleBinaryOperator.cs (6)
49case BoundConversion { Conversion: { Kind: ConversionKind.Identity }, Operand: var o }: 51case BoundConversion { Conversion: { Kind: ConversionKind.ImplicitTupleLiteral }, Operand: var o }: 56case BoundConversion { Conversion: { Kind: var kind } c, Operand: var o } conversion when 89case BoundConversion { Conversion: { Kind: var kind }, Operand: var o } when 193case BoundConversion { Conversion: { Kind: ConversionKind.DefaultLiteral } }: // This conversion can be performed lazily, but need not be saved. It is treated as non-side-effecting. 196case BoundConversion { Conversion: { Kind: var conversionKind } conversion } when conversionMustBePerformedOnOriginalExpression(conversionKind):
Lowering\SyntheticBoundNodeFactory.cs (7)
576Debug.Assert(conversion.Kind != ConversionKind.NoConversion); 577CodeGen.CodeGenerator.AssertIsEmitConversionKind(conversion.Kind); 578if (conversion.Kind != ConversionKind.Identity) 664return new BoundIsOperator(this.Syntax, operand, Type(type), c.Kind, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean)) { WasCompilerGenerated = true }; 1512CodeGen.CodeGenerator.AssertIsEmitConversionKind(c.Kind); 1522CodeGen.CodeGenerator.AssertIsEmitConversionKind(conversion.Kind); 1529if (conversion.Kind == ConversionKind.ImplicitReference && arg.IsLiteralNull())
Symbols\Source\SourceComplexParameterSymbol.cs (1)
1039else if (!compilation.Conversions.ClassifyConversionFromType((TypeSymbol)arg.TypeInternal, this.Type, isChecked: false, ref useSiteInfo).Kind.IsImplicitConversion())
Symbols\Source\SourceMemberContainerSymbol_ImplementationChecks.cs (1)
1403return conversions.ClassifyImplicitConversionFromType(sourceType, targetType, ref discardedUseSiteInfo).Kind != ConversionKind.NoConversion;