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