73 instantiations of Conversion
Microsoft.CodeAnalysis.CSharp (73)
Binder\Semantics\Conversions\Conversion.cs (56)
134return new Conversion( 197return new Conversion(this.Kind, conversionMethod, isExtensionMethod: IsExtensionMethod); 205return new Conversion( 263return new Conversion(kind); 266internal static Conversion UnsetConversion => new Conversion(ConversionKind.UnsetConversionKind); 267internal static Conversion NoConversion => new Conversion(ConversionKind.NoConversion); 268internal static Conversion Identity => new Conversion(ConversionKind.Identity); 269internal static Conversion ImplicitConstant => new Conversion(ConversionKind.ImplicitConstant); 270internal static Conversion ImplicitNumeric => new Conversion(ConversionKind.ImplicitNumeric); 271internal static Conversion ImplicitReference => new Conversion(ConversionKind.ImplicitReference); 272internal static Conversion ImplicitEnumeration => new Conversion(ConversionKind.ImplicitEnumeration); 273internal static Conversion ImplicitThrow => new Conversion(ConversionKind.ImplicitThrow); 274internal static Conversion ObjectCreation => new Conversion(ConversionKind.ObjectCreation); 275internal static Conversion CollectionExpression => new Conversion(ConversionKind.CollectionExpression); 276internal static Conversion AnonymousFunction => new Conversion(ConversionKind.AnonymousFunction); 277internal static Conversion Boxing => new Conversion(ConversionKind.Boxing); 278internal static Conversion NullLiteral => new Conversion(ConversionKind.NullLiteral); 279internal static Conversion DefaultLiteral => new Conversion(ConversionKind.DefaultLiteral); 280internal static Conversion NullToPointer => new Conversion(ConversionKind.ImplicitNullToPointer); 281internal static Conversion PointerToVoid => new Conversion(ConversionKind.ImplicitPointerToVoid); 282internal static Conversion PointerToPointer => new Conversion(ConversionKind.ExplicitPointerToPointer); 283internal static Conversion PointerToInteger => new Conversion(ConversionKind.ExplicitPointerToInteger); 284internal static Conversion IntegerToPointer => new Conversion(ConversionKind.ExplicitIntegerToPointer); 285internal static Conversion Unboxing => new Conversion(ConversionKind.Unboxing); 286internal static Conversion ExplicitReference => new Conversion(ConversionKind.ExplicitReference); 287internal static Conversion IntPtr => new Conversion(ConversionKind.IntPtr); 288internal static Conversion ExplicitEnumeration => new Conversion(ConversionKind.ExplicitEnumeration); 289internal static Conversion ExplicitNumeric => new Conversion(ConversionKind.ExplicitNumeric); 290internal static Conversion ImplicitDynamic => new Conversion(ConversionKind.ImplicitDynamic); 291internal static Conversion ExplicitDynamic => new Conversion(ConversionKind.ExplicitDynamic); 292internal static Conversion InterpolatedString => new Conversion(ConversionKind.InterpolatedString); 293internal static Conversion InterpolatedStringHandler => new Conversion(ConversionKind.InterpolatedStringHandler); 294internal static Conversion Deconstruction => new Conversion(ConversionKind.Deconstruction); 295internal static Conversion PinnedObjectToPointer => new Conversion(ConversionKind.PinnedObjectToPointer); 296internal static Conversion ImplicitPointer => new Conversion(ConversionKind.ImplicitPointer); 297internal static Conversion FunctionType => new Conversion(ConversionKind.FunctionType); 298internal static Conversion InlineArray => new Conversion(ConversionKind.InlineArray); 299internal static Conversion ImplicitSpan => new Conversion(ConversionKind.ImplicitSpan); 300internal static Conversion ExplicitSpan => new Conversion(ConversionKind.ExplicitSpan); 312internal static readonly Conversion ExplicitNullableWithExplicitEnumerationUnderlying = new Conversion(ConversionKind.ExplicitNullable, ExplicitEnumerationUnderlying); 313internal static readonly Conversion ExplicitNullableWithPointerToIntegerUnderlying = new Conversion(ConversionKind.ExplicitNullable, PointerToIntegerUnderlying); 314internal static readonly Conversion ExplicitNullableWithIdentityUnderlying = new Conversion(ConversionKind.ExplicitNullable, IdentityUnderlying); 315internal static readonly Conversion ExplicitNullableWithImplicitNumericUnderlying = new Conversion(ConversionKind.ExplicitNullable, ImplicitNumericUnderlying); 316internal static readonly Conversion ExplicitNullableWithExplicitNumericUnderlying = new Conversion(ConversionKind.ExplicitNullable, ExplicitNumericUnderlying); 317internal static readonly Conversion ExplicitNullableWithImplicitConstantUnderlying = new Conversion(ConversionKind.ExplicitNullable, ImplicitConstantUnderlying); 319internal static readonly Conversion ImplicitNullableWithExplicitEnumerationUnderlying = new Conversion(ConversionKind.ImplicitNullable, ExplicitEnumerationUnderlying); 320internal static readonly Conversion ImplicitNullableWithPointerToIntegerUnderlying = new Conversion(ConversionKind.ImplicitNullable, PointerToIntegerUnderlying); 321internal static readonly Conversion ImplicitNullableWithIdentityUnderlying = new Conversion(ConversionKind.ImplicitNullable, IdentityUnderlying); 322internal static readonly Conversion ImplicitNullableWithImplicitNumericUnderlying = new Conversion(ConversionKind.ImplicitNullable, ImplicitNumericUnderlying); 323internal static readonly Conversion ImplicitNullableWithExplicitNumericUnderlying = new Conversion(ConversionKind.ImplicitNullable, ExplicitNumericUnderlying); 324internal static readonly Conversion ImplicitNullableWithImplicitConstantUnderlying = new Conversion(ConversionKind.ImplicitNullable, ImplicitConstantUnderlying); 340return new Conversion(ConversionKind.StackAllocToPointerType, ImmutableArray.Create(underlyingConversion)); 345return new Conversion(ConversionKind.StackAllocToSpanType, ImmutableArray.Create(underlyingConversion)); 360_ => new Conversion(kind, ImmutableArray.Create(nestedConversion)), 366return new Conversion(ConversionKind.SwitchExpression, innerConversions); 371return new Conversion(ConversionKind.ConditionalExpression, innerConversions);
Binder\Semantics\Conversions\Conversions.cs (1)
481return new Conversion(ConversionKind.MethodGroup, method, methodGroup.IsExtensionMethodGroup);
Binder\Semantics\Conversions\ConversionsBase.cs (8)
785return new Conversion(conversionResult, isImplicit: true); 875return new Conversion(conversionResult, isImplicit: false); 1176return new Conversion(ConversionKind.ImplicitNullable, ImmutableArray.Create(underlyingConversion)); 1312return new Conversion(ConversionKind.ImplicitNullable, ImmutableArray.Create(underlyingTupleConversion)); 1341return new Conversion(ConversionKind.ExplicitNullable, ImmutableArray.Create(underlyingTupleConversion)); 1750return new Conversion(result, isImplicit: true); 2275return new Conversion(ConversionKind.ImplicitNullable, ImmutableArray.Create(tupleConversion)); 2472return new Conversion(ConversionKind.ExplicitNullable, ImmutableArray.Create(tupleConversion));
Compilation\CSharpSemanticModel.cs (4)
2101conversion = new Conversion(ConversionKind.AnonymousFunction, lambda.Symbol, false); 2222conversion = new Conversion(ConversionKind.MethodGroup, delegateCreation.MethodOpt, delegateCreation.IsExtensionMethod); 2228conversion = new Conversion(ConversionKind.AnonymousFunction, lambda.Symbol, delegateCreation.IsExtensionMethod); 2234conversion = new Conversion(ConversionKind.AnonymousFunction, lambda.Symbol, delegateCreation.IsExtensionMethod);
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (4)
1132var result = new BoundConversion(syntax, rewrittenOperand, new Conversion(conversionKind, method, false), @checked, explicitCastInCode: explicitCastInCode, conversionGroup, constantValueOpt: null, rewrittenType); 1738var conversion = new Conversion(conversionKind, method, isExtensionMethod: false); 1783var resultConversion = new Conversion(result, conversion.IsImplicit); 1883return new Conversion(result, isImplicit);
1246 references to Conversion
ConfigurationSchemaGenerator (1)
RuntimeSource\Configuration.Binder\ConfigurationBindingGenerator.Parser.cs (1)
527Conversion conversion = _typeSymbols.Compilation.ClassifyConversion(source, dest);
Microsoft.AspNetCore.Components.Analyzers (3)
ComponentFacts.cs (1)
102var conversion = compilation.ClassifyConversion(symbols.IComponentType, type);
ComponentParameterAnalyzer.cs (1)
102var conversion = context.Compilation.ClassifyConversion(symbols.ParameterCaptureUnmatchedValuesRuntimeType, property.Type);
ComponentParameterUsageAnalyzer.cs (1)
89var conversion = context.Compilation.ClassifyConversion(propertyContainingType, assignmentContainingType);
Microsoft.AspNetCore.Components.SdkAnalyzers (3)
ComponentFacts.cs (1)
102var conversion = compilation.ClassifyConversion(symbols.IComponentType, type);
ComponentParameterAnalyzer.cs (1)
96var conversion = context.Compilation.ClassifyConversion(symbols.ParameterCaptureUnmatchedValuesRuntimeType, property.Type);
ComponentParameterUsageAnalyzer.cs (1)
89var conversion = context.Compilation.ClassifyConversion(propertyContainingType, assignmentContainingType);
Microsoft.CodeAnalysis.CSharp (834)
Binder\Binder.cs (1)
624internal void ReportDiagnosticsIfObsolete(BindingDiagnosticBag diagnostics, Conversion conversion, SyntaxNodeOrToken node, bool hasBaseReceiver)
Binder\Binder.ValueChecks.cs (1)
3948if (conversion.Conversion == Conversion.ImplicitThrow)
Binder\Binder_Await.cs (1)
416var conversion = this.Conversions.ClassifyImplicitConversionFromType(awaiterType, INotifyCompletion, ref useSiteInfo);
Binder\Binder_Conversions.cs (10)
26var conversion = Conversions.ClassifyConversionFromExpression(source, destination, isChecked: CheckOverflowAtRuntime, ref useSiteInfo); 34Conversion conversion, 44Conversion conversion, 56Conversion conversion, 82static bool filterConversion(Conversion conversion) 98Conversion conversion, 300void reportUseSiteDiagnostics(SyntaxNode syntax, Conversion conversion, BoundExpression source, TypeSymbol destination, BindingDiagnosticBag diagnostics) 314void ensureAllUnderlyingConversionsChecked(SyntaxNode syntax, BoundExpression source, Conversion conversion, bool wasCompilerGenerated, TypeSymbol destination, BindingDiagnosticBag diagnostics) 407void checkConstraintLanguageVersionAndRuntimeSupportForConversion(SyntaxNode syntax, Conversion conversion, BoundExpression source, TypeSymbol destination, BindingDiagnosticBag diagnostics) 1530var conversion = conversions.ConvertExtensionMethodThisArg(constructed.Parameters[0].Type, receiverType, ref useSiteInfo, isMethodGroupConversion: false);
Binder\Binder_Deconstruct.cs (5)
132new BoundConversion(boundRHS.Syntax, boundRHS, Conversion.Deconstruction, @checked: false, explicitCastInCode: false, conversionGroupOpt: null, 139Conversion conversion; 248out Conversion conversion) 252conversion = Conversion.Deconstruction; 300Conversion nestedConversion;
Binder\Binder_Expressions.cs (18)
1222Conversion conversion = this.Conversions.ClassifyConversionFromExpression(argument, typedReferenceType, isChecked: CheckOverflowAtRuntime, ref useSiteInfo); 1271Conversion conversion = this.Conversions.ClassifyConversionFromExpression(argument, typedReferenceType, isChecked: CheckOverflowAtRuntime, ref useSiteInfo); 2584Conversion conversion = this.Conversions.ClassifyImplicitConversionFromExpression(boundOperand, intType, ref useSiteInfo); 2690Conversion conversion = this.Conversions.ClassifyImplicitConversionFromExpression(boundOperand, indexType, ref useSiteInfo); 2705Conversion conversion = this.Conversions.ClassifyConversionFromExpression(operand, targetType, isChecked: CheckOverflowAtRuntime, ref useSiteInfo, forCast: true); 2722Conversion conversion, 2863var elementConversion = Conversions.ClassifyConversionFromExpression(argument, targetElementType, isChecked: CheckOverflowAtRuntime, ref discardedUseSiteInfo); 2889var underlyingConversion = Conversions.ClassifyBuiltInConversion(operand.Type, underlyingTargetTypeWithAnnotations.Type, isChecked: CheckOverflowAtRuntime, ref discardedUseSiteInfo); 3513var kind = result.ConversionForArg(arg); 3694var interpolatedStringConversion = memberAnalysisResult.ConversionForArg(interpolatedStringArgNum); 5249var conversion = @this.Conversions.ClassifyConversionFromExpression(expression, collectionType, isChecked: @this.CheckOverflowAtRuntime, ref useSiteInfo); 5341var conversion = this.Conversions.ClassifyConversionFromExpression(unboundLambda, type, isChecked: CheckOverflowAtRuntime, ref useSiteInfo); 5381Conversion conversion; 5414Conversion conv = Conversions.MethodGroupConversion(argument.Syntax, methodGroup, type, ref useSiteInfo); 6952Conversion conversion = this.Conversions.ClassifyConversionFromExpression(classCreation, interfaceType, isChecked: CheckOverflowAtRuntime, ref useSiteInfo, forCast: true); 8652Conversion.ImplicitNumeric, 9445Conversion failedConversion = this.Conversions.ClassifyConversionFromExpression(index, int32, isChecked: CheckOverflowAtRuntime, ref useSiteInfo); 9500Conversion conversion = this.Conversions.ClassifyImplicitConversionFromExpression(expr, targetType, ref useSiteInfo);
Binder\Binder_Invocation.cs (2)
1680Conversion conversion = Conversions.ClassifyConversionFromExpression(defaultValue, parameterType, isChecked: CheckOverflowAtRuntime, ref useSiteInfo); 1743Conversion conversion = Conversions.ClassifyImplicitConversionFromExpression(unconvertedCollection, collectionType, ref useSiteInfo);
Binder\Binder_Operators.cs (15)
64var finalDynamicConversion = this.Compilation.Conversions.ClassifyConversionFromExpression(placeholder, left.Type, isChecked: CheckOverflowAtRuntime, ref useSiteInfo); 223Conversion rightToLeftConversion = this.Conversions.ClassifyConversionFromExpression(right, leftType, isChecked: CheckOverflowAtRuntime, ref useSiteInfo); 270Conversion argumentConversion = this.Conversions.ClassifyConversionFromExpression(right, delegateType, isChecked: CheckOverflowAtRuntime, ref useSiteInfo); 820var conversion = this.Conversions.ClassifyConversionFromExpression(right, left.Type, isChecked: CheckOverflowAtRuntime, ref discardedUseSiteInfo); 1068var implicitConversion = Conversions.ClassifyImplicitConversionFromExpression(left, booleanType, ref useSiteInfo); 1279var conversion = this.Conversions.ClassifyConversionFromType(argumentType, op.GetParameterType(0), isChecked: CheckOverflowAtRuntime, ref useSiteInfo); 3311Conversion conv = Conversions.ClassifyConversionFromExpression(operand, targetType, isChecked: CheckOverflowAtRuntime, ref useSiteInfo); 3333Conversion conversion = Conversions.ClassifyBuiltInConversion(operandType, targetType, isChecked: CheckOverflowAtRuntime, ref useSiteInfo); 3790Conversion.NullLiteral, 3829Conversion conversion = Conversions.ClassifyBuiltInConversion(operandType, targetType, isChecked: CheckOverflowAtRuntime, ref useSiteInfo); 4072var rightConversion = Conversions.ClassifyImplicitConversionFromExpression(rightOperand, optLeftType0, ref useSiteInfo); 4090var rightConversion = Conversions.ClassifyImplicitConversionFromExpression(rightOperand, optLeftType, ref useSiteInfo); 4127Conversion leftConversionClassification; 4207var underlyingRightConversion = Conversions.ClassifyImplicitConversionFromExpression(rightOperand, underlyingLeftType, ref useSiteInfo); 4221var rightConversion = Conversions.ClassifyImplicitConversionFromExpression(rightOperand, leftType, ref useSiteInfo);
Binder\Binder_Patterns.cs (15)
424var convertedExpression = BindExpressionOrTypeForPattern(inputType, innerExpression, ref hasErrors, diagnostics, out var constantValueOpt, out bool wasExpression, out Conversion patternConversion); 453private bool ShouldBlockINumberBaseConversion(Conversion patternConversion, TypeSymbol inputType) 504out Conversion patternExpressionConversion) 517patternExpressionConversion = Conversion.NoConversion; 532out Conversion patternExpressionConversion) 538patternExpressionConversion = Conversion.NoConversion; 549out Conversion patternExpressionConversion) 594out Conversion patternExpressionConversion) 640patternExpressionConversion = Conversion.NoConversion; 647patternExpressionConversion = Conversion.NoConversion; 676patternExpressionConversion = Conversion.NoConversion; 766Conversions, inputType, patternType, ref useSiteInfo, out Conversion conversion, operandConstantValue: null, operandCouldBeNull: true); 807out Conversion conversion, 817conversion = Conversion.Identity; 1631BoundExpression value = BindExpressionForPattern(inputType, node.Expression, ref hasErrors, diagnostics, out var constantValueOpt, out _, out Conversion patternConversion);
Binder\Binder_Statements.cs (11)
1367Conversion elementConversionClassification = this.Conversions.ClassifyConversionFromType(pointerType, declType, isChecked: CheckOverflowAtRuntime, ref useSiteInfo); 1923internal BoundExpression GenerateConversionForAssignment(TypeSymbol targetType, BoundExpression expression, BindingDiagnosticBag diagnostics, out Conversion conversion, ConversionForAssignmentFlags flags = ConversionForAssignmentFlags.None) 2232Conversion conversion, TypeSymbol sourceType, TypeSymbol targetType, ConstantValue sourceConstantValueOpt = null) 2302Conversion conversion, 2424var conversion = this.Conversions.ClassifyImplicitConversionFromExpression(expr, targetType, ref useSiteInfo); 2524var elementConversion = Conversions.ClassifyImplicitConversionFromExpression(argument, targetElementType, ref discardedUseSiteInfo); 2647return BoundConversion.Synthesized(node, BindToTypeForErrorRecovery(expr), Conversion.NoConversion, false, explicitCastInCode: false, conversionGroupOpt: null, ConstantValue.NotAvailable, boolean, hasErrors: true); 2672var conversion = this.Conversions.ClassifyConversionFromExpression(expr, boolean, isChecked: CheckOverflowAtRuntime, ref useSiteInfo); 2713return BoundConversion.Synthesized(node, expr, Conversion.NoConversion, false, explicitCastInCode: false, conversionGroupOpt: null, ConstantValue.NotAvailable, boolean, hasErrors: true); 3135Conversion conversion; 3144conversion = Conversion.NoConversion;
Binder\Binder_TupleOperators.cs (1)
132Conversion conversion = this.Conversions.ClassifyImplicitConversionFromType(type, boolean, ref useSiteInfo);
Binder\DecisionDagBuilder.cs (2)
460Conversion conversion = _conversions.ClassifyBuiltInConversion(inputType, type, isChecked: false, ref useSiteInfo); 1544ConstantValue result = Binder.ExpressionOfTypeMatchesPatternType(_conversions, expressionType, patternType, ref useSiteInfo, out Conversion conversion);
Binder\ForEachLoopBinder.cs (5)
469Conversion elementConversionClassification = this.Conversions.ClassifyConversionFromType(inferredType.Type, iterationVariableType.Type, isChecked: CheckOverflowAtRuntime, ref useSiteInfo, forCast: true); 523Conversion collectionConversionClassification = this.Conversions.ClassifyConversionFromExpression(collectionExpr, builder.CollectionType, isChecked: CheckOverflowAtRuntime, ref useSiteInfo); 524Conversion currentConversionClassification = this.Conversions.ClassifyConversionFromType(builder.CurrentPropertyGetter.ReturnType, builder.ElementType, isChecked: CheckOverflowAtRuntime, ref useSiteInfo); 622Conversion collectionConversionClassification, 1529var collectionConversion = this.Conversions.ClassifyConversionFromExpression(collectionExpr, result.Parameters[0].Type, isChecked: CheckOverflowAtRuntime, ref useSiteInfo);
Binder\RefSafetyAnalysis.cs (2)
946private void VisitDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, SyntaxNode syntax, Conversion conversion, BoundExpression right) 1010var underlyingConversion = BoundNode.GetConversion(placeholderConversion, placeholder);
Binder\Semantics\Conversions\Conversion.cs (117)
19public readonly struct Conversion : IEquatable<Conversion>, IConvertibleConversion 83public NestedUncommonData(ImmutableArray<Conversion> nestedConversions) 88internal readonly ImmutableArray<Conversion> _nestedConversionsOpt; 112ImmutableArray<Conversion> elementConversions) : 129internal static Conversion CreateCollectionExpressionConversion( 132ImmutableArray<Conversion> elementConversions) 173internal Conversion(ConversionKind kind, ImmutableArray<Conversion> nestedConversions) 188internal Conversion SetConversionMethod(MethodSymbol conversionMethod) 200internal Conversion SetArrayIndexConversionForDynamic() 260internal static Conversion GetTrivialConversion(ConversionKind kind) 266internal static Conversion UnsetConversion => new Conversion(ConversionKind.UnsetConversionKind); 267internal static Conversion NoConversion => new Conversion(ConversionKind.NoConversion); 268internal static Conversion Identity => new Conversion(ConversionKind.Identity); 269internal static Conversion ImplicitConstant => new Conversion(ConversionKind.ImplicitConstant); 270internal static Conversion ImplicitNumeric => new Conversion(ConversionKind.ImplicitNumeric); 271internal static Conversion ImplicitReference => new Conversion(ConversionKind.ImplicitReference); 272internal static Conversion ImplicitEnumeration => new Conversion(ConversionKind.ImplicitEnumeration); 273internal static Conversion ImplicitThrow => new Conversion(ConversionKind.ImplicitThrow); 274internal static Conversion ObjectCreation => new Conversion(ConversionKind.ObjectCreation); 275internal static Conversion CollectionExpression => new Conversion(ConversionKind.CollectionExpression); 276internal static Conversion AnonymousFunction => new Conversion(ConversionKind.AnonymousFunction); 277internal static Conversion Boxing => new Conversion(ConversionKind.Boxing); 278internal static Conversion NullLiteral => new Conversion(ConversionKind.NullLiteral); 279internal static Conversion DefaultLiteral => new Conversion(ConversionKind.DefaultLiteral); 280internal static Conversion NullToPointer => new Conversion(ConversionKind.ImplicitNullToPointer); 281internal static Conversion PointerToVoid => new Conversion(ConversionKind.ImplicitPointerToVoid); 282internal static Conversion PointerToPointer => new Conversion(ConversionKind.ExplicitPointerToPointer); 283internal static Conversion PointerToInteger => new Conversion(ConversionKind.ExplicitPointerToInteger); 284internal static Conversion IntegerToPointer => new Conversion(ConversionKind.ExplicitIntegerToPointer); 285internal static Conversion Unboxing => new Conversion(ConversionKind.Unboxing); 286internal static Conversion ExplicitReference => new Conversion(ConversionKind.ExplicitReference); 287internal static Conversion IntPtr => new Conversion(ConversionKind.IntPtr); 288internal static Conversion ExplicitEnumeration => new Conversion(ConversionKind.ExplicitEnumeration); 289internal static Conversion ExplicitNumeric => new Conversion(ConversionKind.ExplicitNumeric); 290internal static Conversion ImplicitDynamic => new Conversion(ConversionKind.ImplicitDynamic); 291internal static Conversion ExplicitDynamic => new Conversion(ConversionKind.ExplicitDynamic); 292internal static Conversion InterpolatedString => new Conversion(ConversionKind.InterpolatedString); 293internal static Conversion InterpolatedStringHandler => new Conversion(ConversionKind.InterpolatedStringHandler); 294internal static Conversion Deconstruction => new Conversion(ConversionKind.Deconstruction); 295internal static Conversion PinnedObjectToPointer => new Conversion(ConversionKind.PinnedObjectToPointer); 296internal static Conversion ImplicitPointer => new Conversion(ConversionKind.ImplicitPointer); 297internal static Conversion FunctionType => new Conversion(ConversionKind.FunctionType); 298internal static Conversion InlineArray => new Conversion(ConversionKind.InlineArray); 299internal static Conversion ImplicitSpan => new Conversion(ConversionKind.ImplicitSpan); 300internal static Conversion ExplicitSpan => new Conversion(ConversionKind.ExplicitSpan); 304internal static ImmutableArray<Conversion> IdentityUnderlying => ConversionSingletons.IdentityUnderlying; 305internal static ImmutableArray<Conversion> ImplicitConstantUnderlying => ConversionSingletons.ImplicitConstantUnderlying; 306internal static ImmutableArray<Conversion> ImplicitNumericUnderlying => ConversionSingletons.ImplicitNumericUnderlying; 307internal static ImmutableArray<Conversion> ExplicitNumericUnderlying => ConversionSingletons.ExplicitNumericUnderlying; 308internal static ImmutableArray<Conversion> ExplicitEnumerationUnderlying => ConversionSingletons.ExplicitEnumerationUnderlying; 309internal static ImmutableArray<Conversion> PointerToIntegerUnderlying => ConversionSingletons.PointerToIntegerUnderlying; 312internal static readonly Conversion ExplicitNullableWithExplicitEnumerationUnderlying = new Conversion(ConversionKind.ExplicitNullable, ExplicitEnumerationUnderlying); 313internal static readonly Conversion ExplicitNullableWithPointerToIntegerUnderlying = new Conversion(ConversionKind.ExplicitNullable, PointerToIntegerUnderlying); 314internal static readonly Conversion ExplicitNullableWithIdentityUnderlying = new Conversion(ConversionKind.ExplicitNullable, IdentityUnderlying); 315internal static readonly Conversion ExplicitNullableWithImplicitNumericUnderlying = new Conversion(ConversionKind.ExplicitNullable, ImplicitNumericUnderlying); 316internal static readonly Conversion ExplicitNullableWithExplicitNumericUnderlying = new Conversion(ConversionKind.ExplicitNullable, ExplicitNumericUnderlying); 317internal static readonly Conversion ExplicitNullableWithImplicitConstantUnderlying = new Conversion(ConversionKind.ExplicitNullable, ImplicitConstantUnderlying); 319internal static readonly Conversion ImplicitNullableWithExplicitEnumerationUnderlying = new Conversion(ConversionKind.ImplicitNullable, ExplicitEnumerationUnderlying); 320internal static readonly Conversion ImplicitNullableWithPointerToIntegerUnderlying = new Conversion(ConversionKind.ImplicitNullable, PointerToIntegerUnderlying); 321internal static readonly Conversion ImplicitNullableWithIdentityUnderlying = new Conversion(ConversionKind.ImplicitNullable, IdentityUnderlying); 322internal static readonly Conversion ImplicitNullableWithImplicitNumericUnderlying = new Conversion(ConversionKind.ImplicitNullable, ImplicitNumericUnderlying); 323internal static readonly Conversion ImplicitNullableWithExplicitNumericUnderlying = new Conversion(ConversionKind.ImplicitNullable, ExplicitNumericUnderlying); 324internal static readonly Conversion ImplicitNullableWithImplicitConstantUnderlying = new Conversion(ConversionKind.ImplicitNullable, ImplicitConstantUnderlying); 330internal static ImmutableArray<Conversion> IdentityUnderlying = ImmutableArray.Create(Identity); 331internal static ImmutableArray<Conversion> ImplicitConstantUnderlying = ImmutableArray.Create(ImplicitConstant); 332internal static ImmutableArray<Conversion> ImplicitNumericUnderlying = ImmutableArray.Create(ImplicitNumeric); 333internal static ImmutableArray<Conversion> ExplicitNumericUnderlying = ImmutableArray.Create(ExplicitNumeric); 334internal static ImmutableArray<Conversion> ExplicitEnumerationUnderlying = ImmutableArray.Create(ExplicitEnumeration); 335internal static ImmutableArray<Conversion> PointerToIntegerUnderlying = ImmutableArray.Create(PointerToInteger); 338internal static Conversion MakeStackAllocToPointerType(Conversion underlyingConversion) 343internal static Conversion MakeStackAllocToSpanType(Conversion underlyingConversion) 348internal static Conversion MakeNullableConversion(ConversionKind kind, Conversion nestedConversion) 364internal static Conversion MakeSwitchExpression(ImmutableArray<Conversion> innerConversions) 369internal static Conversion MakeConditionalExpression(ImmutableArray<Conversion> innerConversions) 398internal ImmutableArray<Conversion> UnderlyingConversions 404default(ImmutableArray<Conversion>); 425foreach (var underlying in underlyingConversions) 464foreach (var underlying in underlyingConversions) 575foreach (var conv in nestedConversions) 1079internal Conversion UserDefinedFromConversion 1084return best == null ? Conversion.NoConversion : best.SourceConversion; 1091internal Conversion UserDefinedToConversion 1096return best == null ? Conversion.NoConversion : best.TargetConversion; 1147/// This is a lossy conversion; it is not possible to recover the original <see cref="Conversion"/> 1167/// Determines whether the specified <see cref="Conversion"/> object is equal to the current <see cref="Conversion"/> object. 1169/// <param name="obj">The <see cref="Conversion"/> object to compare with the current <see cref="Conversion"/> object.</param> 1170/// <returns>true if the specified <see cref="Conversion"/> object is equal to the current <see cref="Conversion"/> object; otherwise, false.</returns> 1173return obj is Conversion && this.Equals((Conversion)obj); 1177/// Determines whether the specified <see cref="Conversion"/> object is equal to the current <see cref="Conversion"/> object. 1179/// <param name="other">The <see cref="Conversion"/> object to compare with the current <see cref="Conversion"/> object.</param> 1180/// <returns>true if the specified <see cref="Conversion"/> object is equal to the current <see cref="Conversion"/> object; otherwise, false.</returns> 1181public bool Equals(Conversion other) 1187/// Returns a hash code for the current <see cref="Conversion"/> object. 1189/// <returns>A hash code for the current <see cref="Conversion"/> object.</returns> 1196/// Returns true if the specified <see cref="Conversion"/> objects are equal and false otherwise. 1198/// <param name="left">The first <see cref="Conversion"/> object.</param> 1199/// <param name="right">The second <see cref="Conversion"/> object.</param> 1201public static bool operator ==(Conversion left, Conversion right) 1207/// Returns false if the specified <see cref="Conversion"/> objects are equal and true otherwise. 1209/// <param name="left">The first <see cref="Conversion"/> object.</param> 1210/// <param name="right">The second <see cref="Conversion"/> object.</param> 1212public static bool operator !=(Conversion left, Conversion right) 1222TreeDumperNode Dump(Conversion self)
Binder\Semantics\Conversions\Conversions.cs (39)
44public override Conversion GetMethodGroupDelegateConversion(BoundMethodGroup source, TypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 49return Conversion.NoConversion; 55return Conversion.NoConversion; 105var conversion = (resolution.IsEmpty || resolution.HasAnyErrors) ? 106Conversion.NoConversion : 113public override Conversion GetMethodGroupFunctionPointerConversion(BoundMethodGroup source, FunctionPointerTypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 122var conversion = (resolution.IsEmpty || resolution.HasAnyErrors) ? 123Conversion.NoConversion : 129protected override Conversion GetInterpolatedStringConversion(BoundExpression source, TypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 135return Conversion.NoConversion; 140return Conversion.InterpolatedStringHandler; 145return Conversion.NoConversion; 153? Conversion.InterpolatedString : Conversion.NoConversion; 157protected override Conversion GetCollectionExpressionConversion( 168return Conversion.NoConversion; 177return Conversion.NoConversion; 193return Conversion.NoConversion; 199return Conversion.NoConversion; 203var builder = ArrayBuilder<Conversion>.GetInstance(elements.Length); 206Conversion elementConversion = convertElement(element, elementType, ref useSiteInfo); 210return Conversion.NoConversion; 216return Conversion.CreateCollectionExpressionConversion(collectionTypeKind, elementType, constructor, isExpanded, builder.ToImmutableAndFree()); 218Conversion convertElement(BoundNode element, TypeSymbol elementType, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 228internal Conversion GetCollectionExpressionSpreadElementConversion( 236return Conversion.NoConversion; 376public Conversion MethodGroupConversion(SyntaxNode syntax, MethodGroup methodGroup, NamedTypeSymbol delegateType, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 395var conversion = ToConversion(result, methodGroup, delegateType.DelegateInvokeMethod.ParameterCount); 427private static Conversion ToConversion(OverloadResolutionResult<MethodSymbol> result, MethodGroup methodGroup, int parameterCount) 447return Conversion.NoConversion; 454return Conversion.NoConversion; 460return Conversion.NoConversion; 465return Conversion.NoConversion; 484public override Conversion GetStackAllocConversion(BoundStackAllocArrayCreation sourceExpression, TypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 492var pointerConversion = ClassifyImplicitConversionFromType(sourceAsPointer, destination, ref useSiteInfo); 496return Conversion.MakeStackAllocToPointerType(pointerConversion); 504var spanConversion = ClassifyImplicitConversionFromType(spanType_T, destination, ref useSiteInfo); 508return Conversion.MakeStackAllocToSpanType(spanConversion); 514return Conversion.NoConversion;
Binder\Semantics\Conversions\ConversionsBase.cs (218)
67public abstract Conversion GetMethodGroupDelegateConversion(BoundMethodGroup source, TypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo); 69public abstract Conversion GetMethodGroupFunctionPointerConversion(BoundMethodGroup source, FunctionPointerTypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo); 71public abstract Conversion GetStackAllocConversion(BoundStackAllocArrayCreation sourceExpression, TypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo); 75protected abstract Conversion GetInterpolatedStringConversion(BoundExpression source, TypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo); 78protected abstract Conversion GetCollectionExpressionConversion(BoundUnconvertedCollectionExpression source, TypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo); 98public Conversion ClassifyImplicitConversionFromExpression(BoundExpression sourceExpression, TypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 109return Conversion.Identity; 112Conversion conversion = ClassifyImplicitBuiltInConversionFromExpression(sourceExpression, sourceType, destination, ref useSiteInfo); 121Conversion fastConversion = FastClassifyConversion(sourceType, destination); 142return Conversion.FunctionType; 169public Conversion ClassifyImplicitConversionFromType(TypeSymbol source, TypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 177return Conversion.Identity; 181Conversion fastConversion = FastClassifyConversion(source, destination); 184return fastConversion.IsImplicit ? fastConversion : Conversion.NoConversion; 188Conversion conversion = ClassifyImplicitBuiltInConversionSlow(source, destination, ref useSiteInfo); 204public Conversion ClassifyImplicitConversionFromTypeWhenNeitherOrBothFunctionTypes(TypeSymbol source, TypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 217Conversion.FunctionType : 218Conversion.NoConversion; 222return Conversion.NoConversion; 234public Conversion ClassifyConversionFromExpressionType(TypeSymbol source, TypeSymbol destination, bool isChecked, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 242return Conversion.ImplicitDynamic; 248private static bool TryGetVoidConversion(TypeSymbol source, TypeSymbol destination, out Conversion conversion) 259conversion = Conversion.Identity; 266conversion = Conversion.NoConversion; 283public Conversion ClassifyConversionFromExpression(BoundExpression sourceExpression, TypeSymbol destination, bool isChecked, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, bool forCast = false) 289if (TryGetVoidConversion(sourceExpression.Type, destination, out var conversion)) 299var result = ClassifyImplicitConversionFromExpression(sourceExpression, destination, ref useSiteInfo); 317public Conversion ClassifyConversionFromType(TypeSymbol source, TypeSymbol destination, bool isChecked, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, bool forCast = false) 322if (TryGetVoidConversion(source, destination, out var voidConversion)) 333Conversion fastConversion = FastClassifyConversion(source, destination); 340Conversion conversion1 = ClassifyImplicitBuiltInConversionSlow(source, destination, ref useSiteInfo); 347Conversion conversion = GetImplicitUserDefinedConversion(source, destination, ref useSiteInfo); 375private Conversion ClassifyConversionFromExpressionForCast(BoundExpression source, TypeSymbol destination, bool isChecked, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 381Conversion implicitConversion = ClassifyImplicitConversionFromExpression(source, destination, ref useSiteInfo); 387Conversion explicitConversion = ClassifyExplicitOnlyConversionFromExpression(source, destination, isChecked: isChecked, ref useSiteInfo, forCast: true); 429private Conversion ClassifyConversionFromTypeForCast(TypeSymbol source, TypeSymbol destination, bool isChecked, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 435Conversion fastConversion = FastClassifyConversion(source, destination); 441Conversion implicitBuiltInConversion = ClassifyImplicitBuiltInConversionSlow(source, destination, ref useSiteInfo); 447Conversion explicitBuiltInConversion = ClassifyExplicitBuiltInOnlyConversion(source, destination, isChecked: isChecked, ref useSiteInfo, forCast: true); 474var conversion = GetExplicitUserDefinedConversion(source, destination, isChecked: isChecked, ref useSiteInfo); 488public static Conversion FastClassifyConversion(TypeSymbol source, TypeSymbol target) 493return Conversion.GetTrivialConversion(convKind); 496return Conversion.MakeNullableConversion(convKind, FastClassifyConversion(source.StrippedType(), target.StrippedType())); 499public Conversion ClassifyBuiltInConversion(TypeSymbol source, TypeSymbol destination, bool isChecked, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 505Conversion fastConversion = FastClassifyConversion(source, destination); 512Conversion conversion = ClassifyImplicitBuiltInConversionSlow(source, destination, ref useSiteInfo); 529public Conversion ClassifyStandardConversion(TypeSymbol source, TypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 541public Conversion ClassifyStandardConversion(BoundExpression sourceExpression, TypeSymbol source, TypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 569Conversion conversion = ClassifyStandardImplicitConversion(sourceExpression, source, destination, ref useSiteInfo); 580return Conversion.NoConversion; 605private Conversion ClassifyStandardImplicitConversion(BoundExpression sourceExpression, TypeSymbol source, TypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 642Conversion conversion = ClassifyImplicitBuiltInConversionFromExpression(sourceExpression, source, destination, ref useSiteInfo); 656return Conversion.NoConversion; 658static bool isImplicitCollectionExpressionConversion(Conversion conversion) 695private Conversion ClassifyStandardImplicitConversion(TypeSymbol source, TypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 697var conversion = classifyConversion(source, destination, ref useSiteInfo); 701Conversion classifyConversion(TypeSymbol source, TypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 708return Conversion.Identity; 713return Conversion.ImplicitNumeric; 716var nullableConversion = ClassifyImplicitNullableConversion(source, destination, ref useSiteInfo); 725return Conversion.NoConversion; 730return Conversion.ImplicitReference; 735return Conversion.Boxing; 740return Conversion.PointerToVoid; 745return Conversion.ImplicitPointer; 748var tupleConversion = ClassifyImplicitTupleConversion(source, destination, ref useSiteInfo); 756return Conversion.ImplicitSpan; 759return Conversion.NoConversion; 763private Conversion ClassifyImplicitBuiltInConversionSlow(TypeSymbol source, TypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 770return Conversion.NoConversion; 773Conversion conversion = ClassifyStandardImplicitConversion(source, destination, ref useSiteInfo); 779return Conversion.NoConversion; 782private Conversion GetImplicitUserDefinedConversion(BoundExpression sourceExpression, TypeSymbol source, TypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 788private Conversion GetImplicitUserDefinedConversion(TypeSymbol source, TypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 793private Conversion ClassifyExplicitBuiltInOnlyConversion(TypeSymbol source, TypeSymbol destination, bool isChecked, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, bool forCast) 800return Conversion.NoConversion; 814return Conversion.IntPtr; 819return Conversion.ExplicitEnumeration; 822var nullableConversion = ClassifyExplicitNullableConversion(source, destination, isChecked: isChecked, ref useSiteInfo, forCast); 830return (source.Kind == SymbolKind.DynamicType) ? Conversion.ExplicitDynamic : Conversion.ExplicitReference; 835return Conversion.Unboxing; 838var tupleConversion = ClassifyExplicitTupleConversion(source, destination, isChecked: isChecked, ref useSiteInfo, forCast); 846return Conversion.PointerToPointer; 851return Conversion.PointerToInteger; 856return Conversion.IntegerToPointer; 861return Conversion.ExplicitDynamic; 866return Conversion.ExplicitSpan; 869return Conversion.NoConversion; 872private Conversion GetExplicitUserDefinedConversion(BoundExpression sourceExpression, TypeSymbol source, TypeSymbol destination, bool isChecked, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 878private Conversion GetExplicitUserDefinedConversion(TypeSymbol source, TypeSymbol destination, bool isChecked, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 883private Conversion DeriveStandardExplicitFromOppositeStandardImplicitConversion(TypeSymbol source, TypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 885var oppositeConversion = ClassifyStandardImplicitConversion(destination, source, ref useSiteInfo); 886Conversion impliedExplicitConversion; 891impliedExplicitConversion = Conversion.Identity; 894impliedExplicitConversion = Conversion.ExplicitNumeric; 897impliedExplicitConversion = Conversion.ExplicitReference; 900impliedExplicitConversion = Conversion.Unboxing; 903impliedExplicitConversion = Conversion.NoConversion; 906impliedExplicitConversion = Conversion.PointerToPointer; 912impliedExplicitConversion = Conversion.NoConversion; 918var underlyingConversion = DeriveStandardExplicitFromOppositeStandardImplicitConversion(strippedSource, strippedDestination, ref useSiteInfo); 923Conversion.MakeNullableConversion(ConversionKind.ExplicitNullable, underlyingConversion) : 924Conversion.NoConversion; 929impliedExplicitConversion = Conversion.NoConversion; 1010private static bool ExplicitConversionMayDifferFromImplicit(Conversion implicitConversion) 1029private Conversion ClassifyImplicitBuiltInConversionFromExpression(BoundExpression sourceExpression, TypeSymbol source, TypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 1038return Conversion.ImplicitDynamic; 1045return Conversion.NoConversion; 1050return Conversion.ImplicitEnumeration; 1053var constantConversion = ClassifyImplicitConstantExpressionConversion(sourceExpression, destination); 1062var nullLiteralConversion = ClassifyNullLiteralConversion(sourceExpression, destination); 1070return Conversion.DefaultLiteral; 1075var innerConversion = ClassifyImplicitBuiltInConversionFromExpression(innerExpression, innerExpression.Type, destination, ref useSiteInfo); 1083var tupleConversion = ClassifyImplicitTupleLiteralConversion((BoundTupleLiteral)sourceExpression, destination, ref useSiteInfo); 1093return Conversion.AnonymousFunction; 1098Conversion methodGroupConversion = GetMethodGroupDelegateConversion((BoundMethodGroup)sourceExpression, destination, ref useSiteInfo); 1107Conversion interpolatedStringConversion = GetInterpolatedStringConversion(sourceExpression, destination, ref useSiteInfo); 1114var stackAllocConversion = GetStackAllocConversion((BoundStackAllocArrayCreation)sourceExpression, destination, ref useSiteInfo); 1122var addressOfConversion = GetMethodGroupFunctionPointerConversion(((BoundUnconvertedAddressOfOperator)sourceExpression).Operand, funcPtrType, ref useSiteInfo); 1130return Conversion.ImplicitThrow; 1133return Conversion.ObjectCreation; 1136var collectionExpressionConversion = GetImplicitCollectionExpressionConversion((BoundUnconvertedCollectionExpression)sourceExpression, destination, ref useSiteInfo); 1152return Conversion.InlineArray; 1155return Conversion.NoConversion; 1159private Conversion GetImplicitCollectionExpressionConversion(BoundUnconvertedCollectionExpression collectionExpression, TypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 1161var collectionExpressionConversion = GetCollectionExpressionConversion(collectionExpression, destination, ref useSiteInfo); 1173var underlyingConversion = GetCollectionExpressionConversion(collectionExpression, underlyingDestination, ref useSiteInfo); 1180return Conversion.NoConversion; 1184private Conversion GetSwitchExpressionConversion(BoundExpression source, TypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 1192return Conversion.NoConversion; 1194var innerConversions = ArrayBuilder<Conversion>.GetInstance(switchExpression.SwitchArms.Length); 1197var nestedConversion = this.ClassifyImplicitConversionFromExpression(arm.Value, destination, ref useSiteInfo); 1201return Conversion.NoConversion; 1207return Conversion.MakeSwitchExpression(innerConversions.ToImmutableAndFree()); 1209return Conversion.NoConversion; 1213private Conversion GetConditionalExpressionConversion(BoundExpression source, TypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 1218return Conversion.NoConversion; 1220var trueConversion = this.ClassifyImplicitConversionFromExpression(conditionalOperator.Consequence, destination, ref useSiteInfo); 1222return Conversion.NoConversion; 1224var falseConversion = this.ClassifyImplicitConversionFromExpression(conditionalOperator.Alternative, destination, ref useSiteInfo); 1226return Conversion.NoConversion; 1228return Conversion.MakeConditionalExpression(ImmutableArray.Create(trueConversion, falseConversion)); 1231private static Conversion ClassifyNullLiteralConversion(BoundExpression source, TypeSymbol destination) 1238return Conversion.NoConversion; 1246return Conversion.NullLiteral; 1256return Conversion.ImplicitReference; 1264return Conversion.NullToPointer; 1267return Conversion.NoConversion; 1270private static Conversion ClassifyImplicitConstantExpressionConversion(BoundExpression source, TypeSymbol destination) 1274return Conversion.ImplicitConstant; 1286return Conversion.ImplicitNullableWithImplicitConstantUnderlying; 1290return Conversion.NoConversion; 1293private Conversion ClassifyImplicitTupleLiteralConversion(BoundTupleLiteral source, TypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 1297var tupleConversion = GetImplicitTupleLiteralConversion(source, destination, ref useSiteInfo); 1309var underlyingTupleConversion = GetImplicitTupleLiteralConversion(source, underlyingDestination, ref useSiteInfo); 1316return Conversion.NoConversion; 1319private Conversion ClassifyExplicitTupleLiteralConversion(BoundTupleLiteral source, TypeSymbol destination, bool isChecked, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, bool forCast) 1323var tupleConversion = GetExplicitTupleLiteralConversion(source, destination, isChecked: isChecked, ref useSiteInfo, forCast); 1337var underlyingTupleConversion = GetExplicitTupleLiteralConversion(source, underlyingDestination, isChecked: isChecked, ref useSiteInfo, forCast); 1346return Conversion.NoConversion; 1401private Conversion ClassifyExplicitOnlyConversionFromExpression(BoundExpression sourceExpression, TypeSymbol destination, bool isChecked, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, bool forCast) 1412Conversion tupleConversion = ClassifyExplicitTupleLiteralConversion((BoundTupleLiteral)sourceExpression, destination, isChecked: isChecked, ref useSiteInfo, forCast); 1423Conversion fastConversion = FastClassifyConversion(sourceType, destination); 1430var conversion = ClassifyExplicitBuiltInOnlyConversion(sourceType, destination, isChecked: isChecked, ref useSiteInfo, forCast); 1721internal Conversion ClassifyImplicitUserDefinedConversionForV6SwitchGoverningType(TypeSymbol sourceType, out TypeSymbol switchGoverningType, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 1753internal Conversion GetCallerLineNumberConversion(TypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 1766return Conversion.ImplicitEnumeration; 1769var constantConversion = ClassifyImplicitConstantExpressionConversion(intMaxValueLiteral, destination); 1786Conversion conversion = ClassifyStandardImplicitConversion(expectedAttributeType, destination, ref useSiteInfo); 1912public Conversion ConvertExtensionMethodThisArg(TypeSymbol parameterType, TypeSymbol thisType, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, bool isMethodGroupConversion) 1915var conversion = this.ClassifyImplicitExtensionMethodThisArgConversion(sourceExpressionOpt: null, thisType, parameterType, ref useSiteInfo, isMethodGroupConversion); 1916return IsValidExtensionMethodThisArgConversion(conversion) ? conversion : Conversion.NoConversion; 1922public Conversion ClassifyImplicitExtensionMethodThisArgConversion(BoundExpression sourceExpressionOpt, TypeSymbol sourceType, TypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, bool isMethodGroupConversion) 1932return Conversion.Identity; 1937return Conversion.Boxing; 1942return Conversion.ImplicitReference; 1947return Conversion.ImplicitSpan; 1956var tupleConversion = GetTupleLiteralConversion( 1973var tupleConversion = ClassifyTupleConversion( 1982return Conversion.NoConversion; 1994return Conversion.NoConversion; 2003public static bool IsValidExtensionMethodThisArgConversion(Conversion conversion) 2016foreach (var elementConversion in conversion.UnderlyingConversions) 2238private Conversion ClassifyImplicitNullableConversion(TypeSymbol source, TypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 2251return Conversion.NoConversion; 2259return Conversion.NoConversion; 2264return Conversion.ImplicitNullableWithIdentityUnderlying; 2269return Conversion.ImplicitNullableWithImplicitNumericUnderlying; 2272var tupleConversion = ClassifyImplicitTupleConversion(unwrappedSource, unwrappedDestination, ref useSiteInfo); 2278return Conversion.NoConversion; 2281private delegate Conversion ClassifyConversionFromExpressionDelegate(ConversionsBase conversions, BoundExpression sourceExpression, TypeWithAnnotations destination, bool isChecked, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, bool forCast); 2282private delegate Conversion ClassifyConversionFromTypeDelegate(ConversionsBase conversions, TypeWithAnnotations source, TypeWithAnnotations destination, bool isChecked, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, bool forCast); 2284private Conversion GetImplicitTupleLiteralConversion(BoundTupleLiteral source, TypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 2302private Conversion GetExplicitTupleLiteralConversion(BoundTupleLiteral source, TypeSymbol destination, bool isChecked, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, bool forCast) 2320private Conversion GetTupleLiteralConversion( 2336return Conversion.NoConversion; 2343var argumentConversions = ArrayBuilder<Conversion>.GetInstance(arguments.Length); 2347var result = classifyConversion(this, argument, targetElementTypes[i], isChecked: isChecked, ref useSiteInfo, forCast: forCast); 2351return Conversion.NoConversion; 2360private Conversion ClassifyImplicitTupleConversion(TypeSymbol source, TypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 2371return Conversion.NoConversion; 2379private Conversion ClassifyExplicitTupleConversion(TypeSymbol source, TypeSymbol destination, bool isChecked, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, bool forCast) 2390return Conversion.NoConversion; 2398private Conversion ClassifyTupleConversion( 2414return Conversion.NoConversion; 2417var nestedConversions = ArrayBuilder<Conversion>.GetInstance(sourceTypes.Length); 2420var conversion = classifyConversion(this, sourceTypes[i], destTypes[i], isChecked: isChecked, ref useSiteInfo, forCast); 2424return Conversion.NoConversion; 2433private Conversion ClassifyExplicitNullableConversion(TypeSymbol source, TypeSymbol destination, bool isChecked, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, bool forCast) 2448return Conversion.NoConversion; 2456return Conversion.ExplicitNullableWithIdentityUnderlying; 2461return Conversion.ExplicitNullableWithImplicitNumericUnderlying; 2466return Conversion.ExplicitNullableWithExplicitNumericUnderlying; 2469var tupleConversion = ClassifyExplicitTupleConversion(unwrappedSource, unwrappedDestination, isChecked: isChecked, ref useSiteInfo, forCast); 2477return Conversion.ExplicitNullableWithExplicitEnumerationUnderlying; 2482return Conversion.ExplicitNullableWithPointerToIntegerUnderlying; 2485return Conversion.NoConversion;
Binder\Semantics\Conversions\TypeConversions.cs (5)
36public override Conversion GetMethodGroupDelegateConversion(BoundMethodGroup source, TypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 42public override Conversion GetMethodGroupFunctionPointerConversion(BoundMethodGroup source, FunctionPointerTypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 48public override Conversion GetStackAllocConversion(BoundStackAllocArrayCreation sourceExpression, TypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 54protected override Conversion GetInterpolatedStringConversion(BoundExpression source, TypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 60protected override Conversion GetCollectionExpressionConversion(BoundUnconvertedCollectionExpression source, TypeSymbol destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
Binder\Semantics\Conversions\UserDefinedConversionAnalysis.cs (8)
26public readonly Conversion SourceConversion; 27public readonly Conversion TargetConversion; 33Conversion sourceConversion, 34Conversion targetConversion, 51Conversion sourceConversion, 52Conversion targetConversion, 70Conversion sourceConversion, 71Conversion targetConversion,
Binder\Semantics\Conversions\UserDefinedExplicitConversions.cs (8)
274Conversion fromConversion = EncompassingExplicitConversion(sourceExpression, source, convertsFrom, ref useSiteInfo); 275Conversion toConversion = EncompassingExplicitConversion(convertsTo, target, ref useSiteInfo); 326Conversion liftedFromConversion = EncompassingExplicitConversion(sourceExpression, source, nullableFrom, ref useSiteInfo); 327Conversion liftedToConversion = EncompassingExplicitConversion(nullableTo, target, ref useSiteInfo); 481private Conversion EncompassingExplicitConversion(BoundExpression expr, TypeSymbol a, TypeSymbol b, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 500var result = ClassifyStandardConversion(expr, a, b, ref useSiteInfo); 501return result.IsEnumeration ? Conversion.NoConversion : result; 504private Conversion EncompassingExplicitConversion(TypeSymbol a, TypeSymbol b, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
Binder\Semantics\Conversions\UserDefinedImplicitConversions.cs (11)
302Conversion fromConversion = EncompassingImplicitConversion(sourceExpression, source, convertsFrom, ref useSiteInfo); 303Conversion toConversion = allowAnyTarget ? Conversion.Identity : 324toConversion = allowAnyTarget ? Conversion.Identity : 350Conversion liftedFromConversion = EncompassingImplicitConversion(sourceExpression, source, nullableFrom, ref useSiteInfo); 351Conversion liftedToConversion = !allowAnyTarget ? 353Conversion.Identity; 594private Conversion EncompassingImplicitConversion(BoundExpression aExpr, TypeSymbol a, TypeSymbol b, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 605var result = ClassifyStandardImplicitConversion(aExpr, a, b, ref useSiteInfo); 606return IsEncompassingImplicitConversionKind(result.Kind) ? result : Conversion.NoConversion; 609private Conversion EncompassingImplicitConversion(TypeSymbol a, TypeSymbol b, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
Binder\Semantics\Operators\BinaryOperatorAnalysisResult.cs (8)
16public readonly Conversion LeftConversion; 17public readonly Conversion RightConversion; 21private BinaryOperatorAnalysisResult(OperatorAnalysisResultKind kind, BinaryOperatorSignature signature, Conversion leftConversion, Conversion rightConversion) 54public static BinaryOperatorAnalysisResult Applicable(BinaryOperatorSignature signature, Conversion leftConversion, Conversion rightConversion) 59public static BinaryOperatorAnalysisResult Inapplicable(BinaryOperatorSignature signature, Conversion leftConversion, Conversion rightConversion)
Binder\Semantics\Operators\BinaryOperatorEasyOut.cs (2)
314Conversion leftConversion = Conversions.FastClassifyConversion(leftType, signature.LeftType); 315Conversion rightConversion = Conversions.FastClassifyConversion(rightType, signature.RightType);
Binder\Semantics\Operators\BinaryOperatorOverloadResolution.cs (6)
728var convLeft = getOperandConversionForAllowByRefLikeNullCheck(isChecked, left, op.LeftType, ref useSiteInfo); 729var convRight = getOperandConversionForAllowByRefLikeNullCheck(isChecked, right, op.RightType, ref useSiteInfo); 777Conversion getOperandConversionForAllowByRefLikeNullCheck(bool isChecked, BoundExpression operand, TypeSymbol objectType, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 779return (operand.Type is TypeParameterSymbol { AllowsRefLikeType: true }) ? Conversion.Boxing : Conversions.ClassifyConversionFromExpression(operand, objectType, isChecked: isChecked, ref useSiteInfo); 800var convLeft = Conversions.ClassifyConversionFromExpression(left, op.LeftType, isChecked: isChecked, ref useSiteInfo); 801var convRight = Conversions.ClassifyConversionFromExpression(right, op.RightType, isChecked: isChecked, ref useSiteInfo);
Binder\Semantics\Operators\UnaryOperatorAnalysisResult.cs (4)
14public readonly Conversion Conversion; 17private UnaryOperatorAnalysisResult(OperatorAnalysisResultKind kind, UnaryOperatorSignature signature, Conversion conversion) 37public static UnaryOperatorAnalysisResult Applicable(UnaryOperatorSignature signature, Conversion conversion) 42public static UnaryOperatorAnalysisResult Inapplicable(UnaryOperatorSignature signature, Conversion conversion)
Binder\Semantics\Operators\UnaryOperatorEasyOut.cs (1)
114Conversion? conversion = Conversions.FastClassifyConversion(operandType, signature.OperandType);
Binder\Semantics\Operators\UnaryOperatorOverloadResolution.cs (1)
277var conversion = Conversions.ClassifyConversionFromExpression(operand, op.OperandType, isChecked: isChecked, ref useSiteInfo);
Binder\Semantics\OverloadResolution\MemberAnalysisResult.cs (8)
24private readonly ImmutableArray<Conversion> _conversionsOpt; 25public ImmutableArray<Conversion> ConversionsOpt 121ImmutableArray<Conversion> conversionsOpt = default, 152public Conversion ConversionForArg(int arg) 156return Conversion.Identity; 321public static MemberAnalysisResult BadArgumentConversions(ImmutableArray<int> argsToParamsOpt, BitVector badArguments, ImmutableArray<Conversion> conversions, TypeWithAnnotations definitionParamsElementTypeOpt, TypeWithAnnotations paramsElementTypeOpt) 376public static MemberAnalysisResult NormalForm(ImmutableArray<int> argsToParamsOpt, ImmutableArray<Conversion> conversions, bool hasAnyRefOmittedArgument) 381public static MemberAnalysisResult ExpandedForm(ImmutableArray<int> argsToParamsOpt, ImmutableArray<Conversion> conversions, bool hasAnyRefOmittedArgument, TypeWithAnnotations definitionParamsElementType, TypeWithAnnotations paramsElementType)
Binder\Semantics\OverloadResolution\OverloadResolution.cs (37)
2622var c1 = m1.Result.ConversionForArg(i); 2623var c2 = m2.Result.ConversionForArg(i); 2835Conversion conv1, 2838Conversion conv2, 2888private BetterResult BetterConversionFromExpression(BoundExpression node, TypeSymbol t1, Conversion conv1, TypeSymbol t2, Conversion conv2, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, out bool okToDowngradeToNeither) 3010TypeSymbol t1, Conversion conv1, 3011TypeSymbol t2, Conversion conv2, 3044TypeSymbol t1, CollectionExpressionTypeKind kind1, TypeSymbol elementType1, ImmutableArray<Conversion> underlyingElementConversions1, 3045TypeSymbol t2, CollectionExpressionTypeKind kind2, TypeSymbol elementType2, ImmutableArray<Conversion> underlyingElementConversions2, 3096var conversionToE1 = underlyingElementConversions1[i]; 3097var conversionToE2 = underlyingElementConversions2[i]; 3424return BetterConversionTargetCore(null, type1, default(Conversion), type2, default(Conversion), ref useSiteInfo, out okToDowngradeToNeither, betterConversionTargetRecursionLimit - 1); 3430Conversion conv1, 3432Conversion conv2, 3442Conversion conv1, 3444Conversion conv2, 3597private bool IsMethodGroupConversionIncompatibleWithDelegate(BoundMethodGroup node, NamedTypeSymbol delegateType, Conversion conv) 3690currentResult == BetterConversionTargetCore(null, type1, default(Conversion), type2, default(Conversion), ref useSiteInfo, out _, BetterConversionTargetRecursionLimit)); 4417ArrayBuilder<Conversion> conversions = null; 4422Conversion conversion; 4429conversion = Conversion.Identity; 4439conversion = Conversion.NoConversion; 4524conversions = ArrayBuilder<Conversion>.GetInstance(paramCount); 4525conversions.AddMany(Conversion.Identity, argumentPosition); 4536var conversionsArray = conversions != null ? conversions.ToImmutableAndFree() : default(ImmutableArray<Conversion>); 4558private Conversion CheckArgumentForApplicability( 4580return Conversion.NoConversion; 4592return Conversion.ImplicitDynamic; 4603return Conversion.Identity; 4608var conversion = forExtensionMethodThisArg ? 4612Conversion.ImplicitDynamic); 4619return Conversion.NoConversion; 4627return Conversion.Identity; 4631return Conversion.NoConversion;
Binder\SwitchBinder.cs (2)
257Conversion conversion = Conversions.ClassifyConversionFromExpression(caseExpression, SwitchGoverningType, isChecked: CheckOverflowAtRuntime, ref useSiteInfo); 412Conversion conversion = binder.Conversions.ClassifyImplicitUserDefinedConversionForV6SwitchGoverningType(switchGoverningType, out resultantGoverningType, ref useSiteInfo);
BoundTree\BoundExpressionExtensions.cs (2)
240public static Conversion GetConversion(this BoundExpression boundNode) 249return Conversion.Identity;
BoundTree\BoundNode.cs (3)
443public static Conversion GetConversion(BoundExpression? conversion, BoundValuePlaceholder? placeholder) 448return Conversion.NoConversion; 477return Conversion.Identity;
BoundTree\Constructors.cs (5)
328public static BoundConversion SynthesizedNonUserDefined(SyntaxNode syntax, BoundExpression operand, Conversion conversion, TypeSymbol type, ConstantValue? constantValueOpt = null) 352Conversion conversion, 378Conversion conversion, 402Conversion conversion, 415Conversion conversion,
BoundTree\ConversionGroup.cs (2)
18internal ConversionGroup(Conversion conversion, TypeWithAnnotations explicitType = default) 33internal readonly Conversion Conversion;
Compilation\BuiltInOperators.cs (2)
933var leftConversion = Conversions.ClassifyConversionFromType(leftType, rightType, isChecked: false, ref useSiteInfo); 939var rightConversion = Conversions.ClassifyConversionFromType(rightType, leftType, isChecked: false, ref useSiteInfo);
Compilation\CSharpCompilation.cs (6)
2289/// <returns>A <see cref="Conversion"/> that classifies the conversion from the 2291public Conversion ClassifyConversion(ITypeSymbol source, ITypeSymbol destination) 2337return Conversion.NoConversion; 2348return Conversion.NullLiteral; 2351return Conversion.NoConversion; 2354Conversion result = ClassifyConversion(sourceType, destination);
Compilation\CSharpSemanticModel.cs (23)
966return new CSharpTypeInfo(declarationTypeSymbol, declarationTypeSymbol, nullabilityInfo, nullabilityInfo, Conversion.Identity); 970return new CSharpTypeInfo(declarationInfo.Type, declarationInfo.Type, declarationInfo.Nullability, declarationInfo.Nullability, Conversion.Identity); 1008public Conversion GetConversion(SyntaxNode expression, CancellationToken cancellationToken = default(CancellationToken)) 1069public Conversion GetSpeculativeConversion(int position, ExpressionSyntax expression, SpeculativeBindingOption bindingOption) 2031return new CSharpTypeInfo(member.Type, member.Type, nullability: default, convertedNullability: default, Conversion.Identity); 2088Conversion conversion; 2137conversion = convertedSwitchConversion.IsValid ? convertedSwitchConversion : Conversion.NoConversion; 2144conversion = Conversion.Identity; 2155conversion = Conversion.MakeConditionalExpression(ImmutableArray<Conversion>.Empty); 2162conversion = Conversion.Identity; 2185conversion = Conversion.Identity; 2193conversion = Conversion.Identity; 2238conversion = Conversion.Identity; 2257conversion = Conversion.Identity; 2355return new CSharpTypeInfo(type, type, default, default, Conversion.Identity); 2808public abstract Conversion ClassifyConversion(ExpressionSyntax expression, ITypeSymbol destination, bool isExplicitInSource = false); 2826public Conversion ClassifyConversion(int position, ExpressionSyntax expression, ITypeSymbol destination, bool isExplicitInSource = false) 2838return Conversion.NoConversion; 2864return Conversion.NoConversion; 2879internal abstract Conversion ClassifyConversionForCast(ExpressionSyntax expression, TypeSymbol destination); 2895internal Conversion ClassifyConversionForCast(int position, ExpressionSyntax expression, TypeSymbol destination) 2916return Conversion.NoConversion;
Compilation\DeconstructionInfo.cs (4)
29private readonly Conversion _conversion; 47public Conversion? Conversion 53: (Conversion?)_conversion; 77internal DeconstructionInfo(Conversion conversion)
Compilation\ForEachStatementInfo.cs (4)
55public Conversion ElementConversion { get; } 60public Conversion CurrentConversion { get; } 71Conversion elementConversion, 72Conversion currentConversion)
Compilation\MemberSemanticModel.cs (5)
429public override Conversion ClassifyConversion( 444return Conversion.NoConversion; 478return Conversion.NoConversion; 486internal override Conversion ClassifyConversionForCast( 502return Conversion.NoConversion;
Compilation\SpeculativeSemanticModelWithMemberModel.cs (2)
220public override Conversion ClassifyConversion( 228internal override Conversion ClassifyConversionForCast(
Compilation\SyntaxTreeSemanticModel.cs (5)
520public override Conversion ClassifyConversion(ExpressionSyntax expression, ITypeSymbol destination, bool isExplicitInSource = false) 527return Conversion.NoConversion; 552return Conversion.NoConversion; 558internal override Conversion ClassifyConversionForCast(ExpressionSyntax expression, TypeSymbol destination) 573return Conversion.NoConversion;
Compilation\TypeInfo.cs (3)
15internal static readonly CSharpTypeInfo None = new CSharpTypeInfo(type: null, convertedType: null, nullability: default, convertedNullability: default, Conversion.Identity); 39public readonly Conversion ImplicitConversion; 41internal CSharpTypeInfo(TypeSymbol type, TypeSymbol convertedType, NullabilityInfo nullability, NullabilityInfo convertedNullability, Conversion implicitConversion)
Compiler\AnonymousTypeMethodBodySynthesizer.cs (1)
273Conversion.ImplicitReference);
Compiler\MethodBodySynthesizer.cs (4)
128Conversion.ExplicitReference, 157Conversion.ExplicitReference, 403conversion: Conversion.ExplicitReference, 468conversion: Conversion.ExplicitReference,
Compiler\MethodBodySynthesizer.Lowered.cs (2)
102Conversion.ImplicitNumeric), 191Conversion.ImplicitNumeric),
CSharpExtensions.cs (23)
438public static Conversion ClassifyConversion(this Compilation? compilation, ITypeSymbol source, ITypeSymbol destination) 447return Conversion.NoConversion; 764public static Conversion GetConversion(this SemanticModel? semanticModel, SyntaxNode expression, CancellationToken cancellationToken = default(CancellationToken)) 773return Conversion.NoConversion; 778/// Gets the underlying <see cref="Conversion"/> information from this <see cref="IConversionOperation"/>. This 782/// <returns>The underlying <see cref="Conversion"/>.</returns> 784public static Conversion GetConversion(this IConversionOperation conversionExpression) 793return (Conversion)((ConversionOperation)conversionExpression).ConversionConvertible; 804/// Gets the underlying <see cref="Conversion"/> information from this <see cref="ICompoundAssignmentOperation"/>. This 810public static Conversion GetInConversion(this ICompoundAssignmentOperation compoundAssignment) 819return (Conversion)((CompoundAssignmentOperation)compoundAssignment).InConversionConvertible; 830/// Gets the underlying <see cref="Conversion"/> information from this <see cref="ICompoundAssignmentOperation"/>. This 836public static Conversion GetOutConversion(this ICompoundAssignmentOperation compoundAssignment) 845return (Conversion)((CompoundAssignmentOperation)compoundAssignment).OutConversionConvertible; 856/// Gets the underlying element <see cref="Conversion"/> information from this <see cref="ISpreadOperation"/>. 861public static Conversion GetElementConversion(this ISpreadOperation spread) 870return (Conversion)((SpreadOperation)spread).ElementConversionConvertible; 878public static Conversion GetSpeculativeConversion(this SemanticModel? semanticModel, int position, ExpressionSyntax expression, SpeculativeBindingOption bindingOption) 887return Conversion.NoConversion; 1306public static Conversion ClassifyConversion(this SemanticModel? semanticModel, ExpressionSyntax expression, ITypeSymbol destination, bool isExplicitInSource = false) 1317return Conversion.NoConversion; 1326public static Conversion ClassifyConversion(this SemanticModel? semanticModel, int position, ExpressionSyntax expression, ITypeSymbol destination, bool isExplicitInSource = false) 1335return Conversion.NoConversion;
FlowAnalysis\AbstractFlowPass.cs (2)
2981BoundConversion { Conversion: Conversion conversion, Operand: BoundConditionalAccess ca } when CanPropagateStateWhenNotNull(conversion) => ca, 3003protected static bool CanPropagateStateWhenNotNull(Conversion conversion)
FlowAnalysis\NullableWalker.cs (62)
247/// The delegate is invoked by <see cref="VisitConversion(BoundConversion, BoundExpression, Conversion, TypeWithAnnotations, TypeWithState, bool, bool, bool, AssignmentKind, ParameterSymbol, bool, bool, bool, bool, Optional&lt;LocalState&gt;,bool, Location, ArrayBuilder&lt;VisitResult&gt;)"/>. 2782var conversion = conversionsWithoutNullability.ClassifyImplicitConversionFromType(actualType, targetType, ref discardedUseSiteInfo); 4654var conversions = ArrayBuilder<Conversion>.GetInstance(n); 4660(BoundExpression expressionNoConversion, Conversion conversion) = RemoveConversion(expression, includeExplicitConversions: false); 4703_ = VisitConversion(conversionOpt: null, conversionOperand: expressionsNoConversions[i], Conversion.Identity, targetTypeWithNullability: inferredType, operandType: expressionTypes[i], 4804Conversion conversion = conversionsWithoutNullability.ClassifyConversionFromExpression(placeholder, bestType, isChecked: returns[i].isChecked, ref discardedUseSiteInfo); 4999leftConversion = Conversion.Identity; 5019leftConversion = Conversion.Identity; 5121Conversion leftConversion, 5124Conversion rightConversion, 5139Conversion leftConversion, 5143Conversion rightConversion, 5171Conversion conversion, 5212Conversion conversion, 5258var conversion = _conversions.ClassifyBuiltInConversion(derivedType, baseType, isChecked: false, ref discardedUseSiteInfo); 5269Conversion leftConversion, 5713var conversion = GenerateConversionForConditionalOperator(node.LeftOperand, leftType, rightType, reportMismatch: true, isChecked: node.Checked); 5986(var consequence, var consequenceConversion, consequenceRValue) = visitConditionalOperand(consequenceState, originalConsequence); 5991(var alternative, var alternativeConversion, alternativeRValue) = visitConditionalOperand(alternativeState, originalAlternative); 6066TypeWithState consequenceRValue, TypeWithState alternativeRValue, BoundExpression consequence, Conversion consequenceConversion, bool consequenceEndReachable, 6067BoundExpression alternative, Conversion alternativeConversion, bool alternativeEndReachable, TypeWithAnnotations resultTypeWithAnnotations, bool wasTargetTyped) 6117Conversion consequenceConversion, 6120Conversion alternativeConversion, 6133(BoundExpression, Conversion, TypeWithState) visitConditionalOperand(LocalState state, BoundExpression operand) 6135Conversion conversion; 6166Conversion conversion, 6851(ImmutableArray<BoundExpression> argumentsNoConversions, ImmutableArray<Conversion> conversions) = RemoveArgumentConversions(arguments, refKindsOpt); 6866ImmutableArray<Conversion> conversions, 6953conversions.IsDefault || i >= conversions.Length ? Conversion.Identity : conversions[i], 7037ImmutableArray<Conversion> conversions, 7406Conversion conversion, 7795private (ImmutableArray<BoundExpression> arguments, ImmutableArray<Conversion> conversions) RemoveArgumentConversions( 7800var conversions = default(ImmutableArray<Conversion>); 7804var conversionsBuilder = ArrayBuilder<Conversion>.GetInstance(n); 7810var conversion = Conversion.Identity; 8102private static (BoundExpression expression, Conversion conversion) RemoveConversion(BoundExpression expr, bool includeExplicitConversions) 8121return (expr, Conversion.Identity); 8136return (expr, group?.Conversion ?? Conversion.Identity); 8140private Conversion GenerateConversionForConditionalOperator(BoundExpression sourceExpression, TypeSymbol? sourceType, TypeSymbol destinationType, bool reportMismatch, bool isChecked) 8142var conversion = GenerateConversion(_conversions, sourceExpression, sourceType, destinationType, fromExplicitCast: false, extensionMethodThisArgument: false, isChecked: isChecked); 8151private Conversion GenerateConversion(Conversions conversions, BoundExpression? sourceExpression, TypeSymbol? sourceType, TypeSymbol destinationType, bool fromExplicitCast, bool extensionMethodThisArgument, bool isChecked) 8333(BoundExpression operand, Conversion conversion) = RemoveConversion(node, includeExplicitConversions: true); 8388(BoundExpression operand, Conversion conversion) = RemoveConversion(expr, includeExplicitConversions: false); 8399Conversion conversion, TypeWithState operandType, 8431Func<TypeWithAnnotations, TypeWithState> visitConversionAsContinuation(BoundExpression expr, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind, BoundExpression operand, Conversion conversion, TypeWithState operandType) 8584Conversion conversion, 8612void trackConvertedValue(FieldSymbol targetField, Conversion conversion, FieldSymbol valueField) 8838Conversion conversion, 8870conversion = Conversion.MakeNullableConversion(ConversionKind.ImplicitNullable, Conversion.Identity); 9390Conversion conversion, 9622var conversion = _conversions.ClassifyStandardConversion(operandType.Type, targetType.Type, ref discardedUseSiteInfo); 9896CheckExtensionMethodThisNullability(receiverOpt, Conversion.Identity, method.Parameters[0], receiverType); 10192private void VisitDeconstructionArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right, TypeWithState? rightResultOpt = null) 10206private void VisitDeconstructMethodArguments(ArrayBuilder<DeconstructionVariable> variables, Conversion conversion, BoundExpression right, TypeWithState? rightResultOpt) 10264var argConversion = RemoveConversion(invocation.Arguments[0], includeExplicitConversions: false).conversion; 10273var underlyingConversion = BoundNode.GetConversion(placeholderConversion, placeholder); 10314var underlyingConversion = BoundNode.GetConversion(placeholderConversion, placeholder); 10920Conversion conversion, 11183Conversion conversion = BoundNode.GetConversion(node.ElementConversion, node.ElementPlaceholder); 11895private void CheckExtensionMethodThisNullability(BoundExpression expr, Conversion conversion, ParameterSymbol parameter, TypeWithState result)
FlowAnalysis\NullableWalker_Patterns.cs (4)
913var conversions = ArrayBuilder<Conversion>.GetInstance(numSwitchArms); 931(BoundExpression expression, Conversion conversion) = RemoveConversion(arm.Value, includeExplicitConversions: false); 988ArrayBuilder<Conversion> conversions, 1033ArrayBuilder<Conversion> conversions,
Generated\BoundNodes.xml.Generated.cs (3)
2952public BoundConversion(SyntaxNode syntax, BoundExpression operand, Conversion conversion, bool isBaseConversion, bool @checked, bool explicitCastInCode, ConstantValue? constantValueOpt, ConversionGroup? conversionGroupOpt, ImmutableArray<MethodSymbol> originalUserDefinedConversionsOpt, TypeSymbol type, bool hasErrors = false) 2971public Conversion Conversion { get; } 2982public BoundConversion Update(BoundExpression operand, Conversion conversion, bool isBaseConversion, bool @checked, bool explicitCastInCode, ConstantValue? constantValueOpt, ConversionGroup? conversionGroupOpt, ImmutableArray<MethodSymbol> originalUserDefinedConversionsOpt, TypeSymbol type)
Lowering\AsyncRewriter\AsyncMethodToStateMachineRewriter.cs (1)
581F.Convert(notifyCompletionTemp.Type, F.Local(awaiterTemp), Conversion.ExplicitReference)),
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (1)
889private BoundExpression MakeConversionLambda(Conversion conversion, TypeSymbol fromType, TypeSymbol toType)
Lowering\LocalRewriter\LocalRewriter.DecisionDagRewriter.cs (2)
211void visitConversion(Conversion conversion) 225foreach (var underlying in conversion.UnderlyingConversions)
Lowering\LocalRewriter\LocalRewriter.PatternLocalRewriter.cs (2)
211Conversion conversion = _factory.Compilation.Conversions.ClassifyBuiltInConversion(inputType, output.Type, isChecked: false, ref useSiteInfo); 484_factory.Compilation.Conversions.ClassifyBuiltInConversion(test.Input.Type, typeEvaluation2.Type, isChecked: false, ref useSiteInfo) is Conversion conv &&
Lowering\LocalRewriter\LocalRewriter_AsOperator.cs (1)
49var conversion = BoundNode.GetConversion(operandConversion, operandPlaceholder);
Lowering\LocalRewriter\LocalRewriter_BinaryOperator.cs (11)
738var conversion = _compilation.Conversions.ClassifyConversionFromExpression(loweredLeft, boolean, isChecked: false, ref useSiteInfo); 2033MakeConversionNode(syntax, call, Conversion.ExplicitReference, type, @checked: false) : 2104rewrittenExpr = MakeConversionNode(syntax, rewrittenExpr, Conversion.Boxing, objectType, @checked: false); 2370: _factory.Convert(_factory.SpecialType(destinationType), numericOperand, Conversion.IntegerToPointer); 2387numericOperand = _factory.Convert(nativeIntType, numericOperand, Conversion.IntegerToPointer, isChecked); 2399numericOperand = _factory.Convert(longType, numericOperand, Conversion.ExplicitNumeric, isChecked); 2400sizeOfExpression = _factory.Convert(longType, sizeOfExpression, Conversion.ExplicitNumeric, isChecked); 2412sizeOfExpression = _factory.Convert(longType, sizeOfExpression, Conversion.ExplicitNumeric, isChecked); 2424sizeOfExpression = _factory.Convert(ulongType, sizeOfExpression, Conversion.ExplicitNumeric, isChecked); 2443: _factory.Convert(convertedMultiplicationResultType, multiplication, Conversion.IntegerToPointer); // NOTE: for some reason, dev10 doesn't check this conversion. 2473Conversion.PointerToInteger);
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (2)
31private BoundExpression RewriteCollectionExpressionConversion(Conversion conversion, BoundCollectionExpression node) 197Conversion conversion;
Lowering\LocalRewriter\LocalRewriter_CompoundAssignmentOperator.cs (1)
770Conversion.Boxing,
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (41)
266Conversion conversion, 285Conversion.Identity, 301Conversion conversion, 422conversion = Conversion.ExplicitNumeric; 473var outerConversion = Conversion.ImplicitNullableWithIdentityUnderlying; 789Conversion conversion = MakeConversion(rewrittenOperand, rewrittenType, @checked: @checked, _compilation, _diagnostics, acceptFailingConversion); 805private static Conversion MakeConversion( 815Conversion conversion = compilation.Conversions.ClassifyConversionFromType(rewrittenOperand.Type, rewrittenType, isChecked: @checked, ref useSiteInfo); 839Conversion conversion, 949Conversion conversion, 1036Conversion conversion, 1092Conversion conversion, 1119rewrittenOperand = BoundConversion.SynthesizedNonUserDefined(syntax, rewrittenOperand, Conversion.ImplicitEnumeration, rewrittenOperandType); 1144Conversion conversion, 1206Conversion conversion, 1238Conversion conversion, 1278Conversion conversion, 1340Conversion conversion, 1394Conversion conversion, 1401Conversion conv = TryMakeConversion(syntax, conversion, rewrittenOperand.Type, rewrittenType, @checked: @checked); 1482Conversion conversion, 1738var conversion = new Conversion(conversionKind, method, isExtensionMethod: false); 1752private Conversion TryMakeConversion(SyntaxNode syntax, Conversion conversion, TypeSymbol fromType, TypeSymbol toType, bool @checked) 1762Conversion fromConversion = TryMakeConversion(syntax, conversion.UserDefinedFromConversion, fromType, meth.Parameters[0].Type, @checked: @checked); 1765return Conversion.NoConversion; 1768Conversion toConversion = TryMakeConversion(syntax, conversion.UserDefinedToConversion, meth.ReturnType, toType, @checked: @checked); 1771return Conversion.NoConversion; 1783var resultConversion = new Conversion(result, conversion.IsImplicit); 1795return Conversion.NoConversion; 1809return Conversion.NoConversion; 1826return Conversion.NoConversion; 1839return Conversion.NoConversion; 1853private Conversion TryMakeConversion(SyntaxNode syntax, TypeSymbol fromType, TypeSymbol toType, bool @checked) 1856var result = TryMakeConversion(syntax, _compilation.Conversions.ClassifyConversionFromType(fromType, toType, isChecked: @checked, ref useSiteInfo), fromType, toType, @checked: @checked); 1864private Conversion TryMakeUserDefinedConversion(SyntaxNode syntax, MethodSymbol meth, TypeSymbol fromType, TypeSymbol toType, bool @checked, bool isImplicit) 1868Conversion fromConversion = TryMakeConversion(syntax, fromType, meth.Parameters[0].Type, @checked: @checked); 1871return Conversion.NoConversion; 1874Conversion toConversion = TryMakeConversion(syntax, meth.ReturnType, toType, @checked: @checked); 1877return Conversion.NoConversion;
Lowering\LocalRewriter\LocalRewriter_DeconstructionAssignmentOperator.cs (4)
37private BoundExpression? RewriteDeconstruction(BoundTupleExpression left, Conversion conversion, BoundExpression right, bool isUsed) 57Conversion conversion, 213Conversion conversion, 277private ImmutableArray<BoundExpression> GetRightParts(BoundExpression right, Conversion conversion,
Lowering\LocalRewriter\LocalRewriter_FixedStatement.cs (1)
466Conversion.PinnedObjectToPointer);
Lowering\LocalRewriter\LocalRewriter_ForEachStatement.cs (5)
353Conversion receiverConversion = enumeratorType.IsStructType() ? 354Conversion.Boxing : 355Conversion.ImplicitReference; 495private BoundExpression ConvertReceiverForInvocation(CSharpSyntaxNode syntax, BoundExpression receiver, MethodSymbol method, Conversion receiverConversion, TypeSymbol convertedReceiverType) 1225private static BoundExpression GetUnconvertedCollectionExpression(BoundForEachStatement node, out Conversion collectionConversion)
Lowering\LocalRewriter\LocalRewriter_LockStatement.cs (1)
93Conversion.Boxing,
Lowering\LocalRewriter\LocalRewriter_StackAlloc.cs (3)
134return _factory.Convert(uintPtrType, _factory.Literal((uint)folded), Conversion.IntegerToPointer); 139BoundExpression convertedCount = _factory.Convert(uintType, countExpression, Conversion.ExplicitNumeric); 140convertedCount = _factory.Convert(uintPtrType, convertedCount, Conversion.IntegerToPointer);
Lowering\LocalRewriter\LocalRewriter_SwitchExpression.cs (1)
151Conversion c = _localRewriter._compilation.Conversions.ClassifyConversionFromExpression(expression, type, isChecked: false, ref discardedUseSiteInfo);
Lowering\LocalRewriter\LocalRewriter_TupleBinaryOperator.cs (5)
68var elementConversion = underlyingConversions[i]; 211var conversion = Conversion.MakeNullableConversion(ConversionKind.ImplicitNullable, Conversion.Identity); 472BoundExpression MakeBoundConversion(BoundExpression expr, Conversion conversion, TypeWithAnnotations type, BoundConversion enclosing)
Lowering\LocalRewriter\LocalRewriter_UnaryOperator.cs (1)
161return MakeConversionNode(newNode.Syntax, newNode, Conversion.ExplicitEnumeration, type, @checked: false);
Lowering\LocalRewriter\LocalRewriter_UsingStatement.cs (2)
171Conversion.ImplicitDynamic, 247Conversion.ImplicitDynamic,
Lowering\MethodToClassRewriter.cs (1)
293var conversion = node.Conversion;
Lowering\SyntheticBoundNodeFactory.cs (7)
556var conversion = Compilation.Conversions.ClassifyConversionFromType(expression.Type, CurrentFunction.ReturnType, isChecked: false, ref useSiteInfo); 644Conversion c = Compilation.Conversions.ClassifyBuiltInConversion(operand.Type, type, isChecked: false, ref discardedUseSiteInfo); 1234? BoundConversion.SynthesizedNonUserDefined(syntax, nullLiteral, Conversion.NullToPointer, type) 1477Conversion c = Compilation.Conversions.ClassifyConversionFromExpression(arg, type, isChecked: false, ref useSiteInfo); 1482c = Conversion.Boxing; 1492public BoundExpression Convert(TypeSymbol type, BoundExpression arg, Conversion conversion, bool isChecked = false) 1776rewrittenExpr = Convert(objectType, rewrittenExpr, Conversion.Boxing);
Operations\CSharpOperationFactory.cs (8)
1078Conversion conversion = boundConversion.Conversion; 1143Conversion conversion = BoundNode.GetConversion(boundAsOperator.OperandConversion, boundAsOperator.OperandPlaceholder); 1274var elementConversion = BoundNode.GetConversion(iteratorItem, element.ElementPlaceholder); 1360Conversion inConversion = BoundNode.GetConversion(boundCompoundAssignmentOperator.LeftConversion, boundCompoundAssignmentOperator.LeftPlaceholder); 1361Conversion outConversion = BoundNode.GetConversion(boundCompoundAssignmentOperator.FinalConversion, boundCompoundAssignmentOperator.FinalPlaceholder); 1593Conversion valueConversion = BoundNode.GetConversion(boundNullCoalescingOperator.LeftConversion, boundNullCoalescingOperator.LeftPlaceholder); 1598valueConversion = Conversion.Identity; 1906inlineArrayConversion: enumeratorInfoOpt.InlineArraySpanType is WellKnownType.Unknown ? null : Conversion.InlineArray,
Symbols\ReducedExtensionMethodSymbol.cs (1)
52var conversion = conversions.ConvertExtensionMethodThisArg(method.Parameters[0].Type, receiverType, ref useSiteInfo, isMethodGroupConversion: false);
Symbols\Source\ParameterHelpers.cs (1)
737Conversion conversion = binder.Conversions.ClassifyImplicitConversionFromExpression(defaultExpression, parameterType, ref useSiteInfo);
Microsoft.CodeAnalysis.CSharp.CodeStyle (44)
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
363var conversion = conversionOperation.GetConversion();
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (1)
270var conversion = compilation.ClassifyConversion(type1, type2);
src\Analyzers\CSharp\Analyzers\UseCoalesceExpression\UseCoalesceExpressionHelpers.cs (1)
14var conversion = semanticModel.GetConversion(conditional, cancellationToken);
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (2)
166var conversion = speculationAnalyzer.SpeculativeSemanticModel.GetConversion(speculationAnalyzer.ReplacedExpression, cancellationToken); 289var conversion = compilation.ClassifyConversion(type, convertedType);
src\Analyzers\CSharp\Analyzers\UseDeconstruction\CSharpUseDeconstructionDiagnosticAnalyzer.cs (3)
108var initializerConversion = semanticModel.GetConversion(initializerValue, cancellationToken); 127var elementConversion = semanticModel.GetForEachStatementInfo(forEachStatement).ElementConversion; 139Conversion conversion,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ConversionExtensions.cs (2)
9public static bool IsIdentityOrImplicitReference(this Conversion conversion) 15public static bool IsImplicitUserDefinedConversion(this Conversion conversion)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (18)
232var conversion = conversionOperation.GetConversion(); 296var originalConversion = originalConversionOperation.GetConversion(); 406var originalParentConversion = originalParentConversionOperation.GetConversion(); 683var conversion = semanticModel.GetConversion(castedExpressionNode, cancellationToken); 738var innerOriginalConversion = originalConversionOperation.GetConversion(); 749var outerOriginalConversion = outerOriginalConversionOperation.GetConversion(); 776var originalConversion = originalConversionOperation.GetConversion(); 802var rewrittenBitwiseNotConversion = rewrittenBitwiseNotConversionOperation.GetConversion(); 844var originalConversion = conversionOperation.GetConversion(); 984Conversion conversion, 1043var conversion = semanticModel.GetConversion(castedExpressionNode, cancellationToken); 1071var parentConversion = semanticModel.GetConversion(castNode, cancellationToken); 1119var conversion = semanticModel.GetConversion(current, cancellationToken); 1230var oldConversion = oldForEachInfo.ElementConversion; 1231var newConversion = newForEachInfo.ElementConversion; 1488private static (ITypeSymbol? rewrittenConvertedType, Conversion rewrittenConversion) GetRewrittenInfo( 1491Conversion originalConversion, ITypeSymbol originalConvertedType, 1507var rewrittenConversion = rewrittenSemanticModel.GetConversion(rewrittenExpression, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (15)
38Conversion> 409var originalConversion = this.OriginalSemanticModel.ClassifyConversion(originalOtherPartOfConditional, originalExpressionType); 410var newConversion = this.SpeculativeSemanticModel.ClassifyConversion(newOtherPartOfConditional, newExpressionType); 444var originalConversion = this.OriginalSemanticModel.ClassifyConversion(oldSwitchStatement.Expression, originalCaseType); 445var newConversion = this.SpeculativeSemanticModel.ClassifyConversion(newSwitchStatement.Expression, newCaseType); 547var originalConvertedTypeConversion = this.OriginalSemanticModel.ClassifyConversion(previousOriginalNode, originalExpressionTypeInfo.ConvertedType); 548var newExpressionConvertedTypeConversion = this.SpeculativeSemanticModel.ClassifyConversion(previousReplacedNode, newExpressionTypeInfo.ConvertedType); 710var originalConversion = this.OriginalSemanticModel.ClassifyConversion(originalIsOrAsExpression.Left, originalConvertedType, isExplicitInSource: true); 711var newConversion = this.SpeculativeSemanticModel.ClassifyConversion(newIsOrAsExpression.Left, newConvertedType, isExplicitInSource: true); 815var originalConversion = originalModel.GetConversion(originalExpression); 816var newConversion = newModel.GetConversion(newExpression); 853private bool ConversionsAreCompatible(Conversion originalConversion, Conversion newConversion) 934protected override Conversion ClassifyConversion(SemanticModel model, ExpressionSyntax expression, ITypeSymbol targetType) 937protected override Conversion ClassifyConversion(SemanticModel model, ITypeSymbol originalType, ITypeSymbol targetType)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (1)
308var conversion = semanticModel.GetConversion(expression, cancellationToken);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (3)
src\Analyzers\CSharp\CodeFixes\AddExplicitCast\CSharpAddExplicitCastCodeFixProvider.cs (1)
102var conversion = semanticModel.Compilation.ClassifyConversion(rightType, leftType);
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (1)
197var conversion = _semanticModel.Compilation.ClassifyConversion(typeInfo.Type, typeInfo.ConvertedType);
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateParameterizedMemberService.cs (1)
145var conversion = compilation.ClassifyConversion(sourceType, targetType);
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
SymbolKey\SymbolKeyTestBase.cs (1)
399var conv = model.GetConversion(expr);
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (34)
CodeGen\CodeGenDeconstructTests.cs (2)
314Assert.Equal(Conversion.UnsetConversion, deconstructionInfo.Conversion); 1130var tupleConversion = model.GetConversion(tuple);
CodeGen\CodeGenFunctionPointersTests.cs (2)
10809var conversion = model.GetConversion(lambdas[0]); 10814Assert.Equal(Conversion.NoConversion, conversion);
CodeGen\CodeGenTupleEqualityTests.cs (4)
364Assert.Equal(Conversion.Identity, model.GetConversion(tupleX)); 369Assert.Equal(Conversion.Identity, model.GetConversion(lastX)); 387Assert.Equal(Conversion.ImplicitNumeric, model.GetConversion(lastY)); 729Assert.Equal(Conversion.Identity, model.GetConversion(tuple));
CodeGen\CodeGenTupleTest.cs (26)
7500var castConversion = model.GetConversion(value); 7504var tupleConversion = model.GetConversion(tuple); 7533var tupleConversion = model.GetConversion(value); 7575var conversion1 = model.GetConversion(tuple1); 7584var conversion2 = model.GetConversion(tuple2); 7593var conversion3 = model.GetConversion(tuple3); 7641var conversion = model.GetConversion(tuple); 8329Assert.Equal(Conversion.Identity, model.GetConversion(l11)); 8354Assert.Equal(Conversion.Identity, model.GetConversion(node.Parent)); 8496Assert.Equal(Conversion.Identity, model.GetConversion(node)); 8530Assert.Equal(Conversion.Identity, model.GetConversion(node)); 8603Assert.Equal(Conversion.Identity, model.GetConversion(node.Parent)); 8632Assert.Equal(Conversion.Identity, model.GetConversion(node)); 8667Assert.Equal(Conversion.Identity, model.GetConversion(node)); 8696Assert.Equal(Conversion.Identity, model.GetConversion(node)); 8756Assert.Equal(Conversion.Identity, model.GetConversion(l11)); 8781Assert.Equal(Conversion.Identity, model.GetConversion(node.Parent)); 8841Assert.Equal(Conversion.Identity, model.GetConversion(lnull)); 8854Assert.Equal(Conversion.Identity, model.GetConversion(node.Parent)); 8964Assert.Equal(Conversion.Identity, model.GetConversion(node.Parent)); 9077Assert.Equal(Conversion.NoConversion, model.GetConversion(node)); 17217Assert.Equal(Conversion.Identity, model.GetConversion(n1)); 17224Assert.Equal(Conversion.Identity, model.GetConversion(n2)); 17231Assert.Equal(Conversion.Identity, model.GetConversion(n3)); 17238Assert.Equal(Conversion.Identity, model.GetConversion(n4)); 17299Assert.Equal(Conversion.ImplicitReference, model.GetConversion(n4));
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (1)
Emit\NumericIntPtrTests.cs (1)
58internal static void AssertMatches(ConversionKind[] expected, Conversion conversion)
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (78)
FirstClassSpanTests.cs (3)
2831var argConv = model.GetConversion(arg); 2865var conv = op.GetConversion(); 2881var conv = op.GetConversion();
Semantics\CollectionExpressionTests.cs (73)
14235var conversion = model.GetConversion(returnValue); 14241var underlyingConversion = conversion.UnderlyingConversions[0]; 14311var conversion = model.GetConversion(returnValue); 14317var underlyingConversion = conversion.UnderlyingConversions[0]; 14384var conversion = model.GetConversion(collection); 14448var castConversion = model.GetConversion(cast); 14453var conversion = model.GetConversion(value); 14572var castConversion = model.GetConversion(cast); 14577var conversion = model.GetConversion(value); 14656var conversion = model.GetConversion(nestedCollection); 14745var conversion = model.GetConversion(nestedCollection); 14751var underlyingConversion = conversion.UnderlyingConversions[0]; 15099var conversion = model.GetConversion(expr); 26744var expectedConversion = new Conversion(ConversionKind.CollectionExpression, nestedConversions: ImmutableArray.Create(Conversion.Identity, Conversion.Identity)); 26799var expectedConversion = new Conversion(ConversionKind.CollectionExpression, nestedConversions: ImmutableArray.Create(Conversion.Identity, Conversion.Identity)); 27033var expectedConversion = new Conversion(ConversionKind.Boxing, nestedConversions: default); 27056var expectedConversion = new Conversion(ConversionKind.ImplicitReference, nestedConversions: default); 28622var conversion1 = model.GetConversion(collections[0]); 28624Assert.Equal(Conversion.NoConversion, conversion1); 28626var conversion2 = model.GetConversion(collections[1]); 28666var conversion1 = model.GetConversion(collections[0]); 28668Assert.Equal(Conversion.NoConversion, conversion1); 28670var conversion2 = model.GetConversion(collections[1]); 28715var conversion1 = model.GetConversion(collections[0]); 28720var conversion2 = model.GetConversion(collections[1]); 28756var conversion1 = model.GetConversion(collections[0]); 28758Assert.Equal(Conversion.NoConversion, conversion1); 28760var conversion2 = model.GetConversion(collections[1]); 28799var conversion1 = model.GetConversion(collections[0]); 28801Assert.Equal(Conversion.NoConversion, conversion1); 28803var conversion2 = model.GetConversion(collections[1]); 28842var conversion = model.GetConversion(collection); 28882var conversion = model.GetConversion(collection); 28914var conversion = model.GetConversion(collection); 28948var conversion1 = model.GetConversion(collections[0]); 28950Assert.Equal(Conversion.NoConversion, conversion1); 28952var conversion2 = model.GetConversion(collections[1]); 28960var conversion3 = model.GetConversion(collections[2]); 28968var conversion4 = model.GetConversion(collections[3]); 28970Assert.Equal(Conversion.NoConversion, conversion4); 29001var conversion1 = model.GetConversion(collections[0]); 29003Assert.Equal(Conversion.NoConversion, conversion1); 29005var conversion2 = model.GetConversion(collections[1]); 29013var conversion3 = model.GetConversion(collections[2]); 29021var conversion4 = model.GetConversion(collections[3]); 29023Assert.Equal(Conversion.NoConversion, conversion4); 29067var conversion1 = model.GetConversion(collections[0]); 29070var conversion2 = model.GetConversion(collections[1]); 29077var conversion3 = model.GetConversion(collections[2]); 29084var conversion4 = model.GetConversion(collections[3]); 29128var conversion1 = model.GetConversion(collections[0]); 29131var conversion2 = model.GetConversion(collections[1]); 29138var conversion3 = model.GetConversion(collections[2]); 29145var conversion4 = model.GetConversion(collections[3]); 29204var conversion1 = model.GetConversion(collection); 29206Assert.Equal(Conversion.NoConversion, conversion1); 29247var conversion1 = model.GetConversion(collections[0]); 29252var conversion2 = model.GetConversion(collections[1]); 29254Assert.Equal(Conversion.NoConversion, conversion2); 29294var conversion = model.GetConversion(collection); 29296Assert.Equal(Conversion.NoConversion, conversion); 32306var collectionConversion = model.GetConversion(collection); 32312var elementConversion = model.GetConversion(element); 32403var elementConversion1 = model.GetConversion(element1); 32409var elementConversion2 = model.GetConversion(element2); 32445var elementConversion1 = model.GetConversion(element1); 32451var elementConversion2 = model.GetConversion(element2); 32490var elementConversion1 = model.GetConversion(element1); 32496var elementConversion2 = model.GetConversion(element2);
Semantics\OutVarTests.cs (1)
1058var conversion = model.ClassifyConversion(decl, model.Compilation.ObjectType, false);
Semantics\PatternMatchingTests2.cs (1)
2875var conversion = model.GetConversion(expr);
Microsoft.CodeAnalysis.CSharp.Features (14)
ExtractMethod\CSharpSelectionResult.ExpressionResult.cs (2)
97var conv = semanticModel.GetConversion(expression); 131private static bool IsCoClassImplicitConversion(TypeInfo info, Conversion conversion, INamedTypeSymbol? coclassSymbol)
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
363var conversion = conversionOperation.GetConversion();
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (1)
270var conversion = compilation.ClassifyConversion(type1, type2);
src\Analyzers\CSharp\Analyzers\UseCoalesceExpression\UseCoalesceExpressionHelpers.cs (1)
14var conversion = semanticModel.GetConversion(conditional, cancellationToken);
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (2)
166var conversion = speculationAnalyzer.SpeculativeSemanticModel.GetConversion(speculationAnalyzer.ReplacedExpression, cancellationToken); 289var conversion = compilation.ClassifyConversion(type, convertedType);
src\Analyzers\CSharp\Analyzers\UseDeconstruction\CSharpUseDeconstructionDiagnosticAnalyzer.cs (3)
108var initializerConversion = semanticModel.GetConversion(initializerValue, cancellationToken); 127var elementConversion = semanticModel.GetForEachStatementInfo(forEachStatement).ElementConversion; 139Conversion conversion,
src\Analyzers\CSharp\CodeFixes\AddExplicitCast\CSharpAddExplicitCastCodeFixProvider.cs (1)
102var conversion = semanticModel.Compilation.ClassifyConversion(rightType, leftType);
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (1)
197var conversion = _semanticModel.Compilation.ClassifyConversion(typeInfo.Type, typeInfo.ConvertedType);
src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateParameterizedMemberService.cs (1)
145var conversion = compilation.ClassifyConversion(sourceType, targetType);
UseNamedArguments\CSharpUseNamedArgumentsCodeRefactoringProvider.cs (1)
49var conversion = semanticModel.Compilation.ClassifyConversion(argType, parameters[0].Type);
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (6)
IOperation\IOperationTests_ICompoundAssignmentOperation.cs (4)
48Assert.Equal(Conversion.Identity, compoundAssignment.GetInConversion()); 49Assert.Equal(Conversion.Identity, compoundAssignment.GetOutConversion()); 88var inConversion = new Conversion(ConversionKind.ImplicitUserDefined, inSymbol, false); 89var outConversion = new Conversion(ConversionKind.ImplicitUserDefined, outSymbol, false);
IOperation\IOperationTests_IVariableDeclaration.cs (2)
932Assert.Equal(Conversion.Identity, model.GetConversion(literalExpr)); 939Assert.Equal(Conversion.Identity, model.GetConversion(invocExpr));
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (107)
Semantics\ForEachTests.cs (4)
1224private static Conversion GetCollectionConversion(BoundForEachStatement boundNode) 2147var conv = model.GetConversion(loopSyntax.Type); 3362Assert.Equal(Conversion.Identity, info.CurrentConversion); 3363Assert.Equal(Conversion.Identity, info.ElementConversion);
Semantics\FunctionPointerTests.cs (14)
213var conversion = model.GetConversion(initializer1); 218var classifiedConversion = comp.ClassifyConversion(typeInfo.Type, typeInfo.ConvertedType!); 295var conversion = model.GetConversion(literal); 303var classifiedConversion = model.ClassifyConversion(literal, typeInfo.ConvertedType); 355var conversion = model.ClassifyConversion(conversions[0].Expression, typeInfoOuter.Type!); 406var conversion = model.ClassifyConversion(conversions[0].Expression, typeInfoOuter.Type!); 458var conversion = model.ClassifyConversion(conversions[0].Expression, typeInfoOuter.Type!); 508var conversion = model.ClassifyConversion(conv.Expression, typeInfoOuter.Type!); 605var conversion = model.GetConversion(decl); 609var classifiedConversion = comp.ClassifyConversion(typeInfo.Type!, typeInfo.ConvertedType!); 844var conversion = model.GetConversion(decl); 850var classifiedConversion = comp.ClassifyConversion(typeInfo.Type!, typeInfo.ConvertedType!); 902var conversion = model.GetConversion(initializer); 909var classifiedConversion = comp.ClassifyConversion(typeInfo.Type!, typeInfo.ConvertedType!);
Semantics\LambdaTests.cs (1)
845var conv = model.GetConversion(expr);
Semantics\NativeIntegerTests.cs (1)
51internal static void AssertMatches(ConversionKind[] expected, Conversion conversion)
Semantics\ObjectAndCollectionInitializerTests.cs (3)
3818var conversion = model.GetConversion(literal); 3841var conversion = model.GetConversion(literal); 3865var conversion = model.GetConversion(literal);
Semantics\OperatorTests.cs (2)
3254"valuePlaceholder" => Conversion.Identity, 3257Conversion.NoConversion
Semantics\ScriptSemanticsTests.cs (2)
253Assert.Equal(Conversion.Identity, summary.ImplicitConversion); 570Assert.Equal(Conversion.Identity, summary.ImplicitConversion);
Semantics\StackAllocInitializerTests.cs (47)
376Assert.Equal(Conversion.Identity, stackallocInfo.ImplicitConversion); 382Assert.Equal(Conversion.Identity, element0Info.ImplicitConversion); 390Assert.Equal(Conversion.Identity, stackallocInfo.ImplicitConversion); 396Assert.Equal(Conversion.Identity, element0Info.ImplicitConversion); 404Assert.Equal(Conversion.Identity, stackallocInfo.ImplicitConversion); 410Assert.Equal(Conversion.Identity, element0Info.ImplicitConversion); 452Assert.Equal(Conversion.Identity, stackallocInfo.ImplicitConversion); 458Assert.Equal(Conversion.Identity, element0Info.ImplicitConversion); 466Assert.Equal(Conversion.Identity, stackallocInfo.ImplicitConversion); 472Assert.Equal(Conversion.Identity, element0Info.ImplicitConversion); 480Assert.Equal(Conversion.Identity, stackallocInfo.ImplicitConversion); 486Assert.Equal(Conversion.Identity, element0Info.ImplicitConversion); 2368Assert.Equal(Conversion.Identity, stackallocInfo.ImplicitConversion); 2374Assert.Equal(Conversion.ImplicitNumeric, element0Info.ImplicitConversion); 2380Assert.Equal(Conversion.Identity, element1Info.ImplicitConversion); 2386Assert.Equal(Conversion.Identity, sizeInfo.ImplicitConversion); 2396Assert.Equal(Conversion.Identity, stackallocInfo.ImplicitConversion); 2402Assert.Equal(Conversion.ImplicitNumeric, element0Info.ImplicitConversion); 2408Assert.Equal(Conversion.Identity, element1Info.ImplicitConversion); 2414Assert.Equal(Conversion.Identity, sizeInfo.ImplicitConversion); 2424Assert.Equal(Conversion.Identity, stackallocInfo.ImplicitConversion); 2430Assert.Equal(Conversion.ImplicitNumeric, element0Info.ImplicitConversion); 2436Assert.Equal(Conversion.Identity, element1Info.ImplicitConversion); 2442Assert.Equal(Conversion.Identity, sizeInfo.ImplicitConversion); 2474Assert.Equal(Conversion.Identity, stackallocInfo.ImplicitConversion); 2480Assert.Equal(Conversion.ImplicitNumeric, element0Info.ImplicitConversion); 2486Assert.Equal(Conversion.Identity, element1Info.ImplicitConversion); 2496Assert.Equal(Conversion.Identity, stackallocInfo.ImplicitConversion); 2502Assert.Equal(Conversion.ImplicitNumeric, element0Info.ImplicitConversion); 2508Assert.Equal(Conversion.Identity, element1Info.ImplicitConversion); 2518Assert.Equal(Conversion.Identity, stackallocInfo.ImplicitConversion); 2524Assert.Equal(Conversion.ImplicitNumeric, element0Info.ImplicitConversion); 2530Assert.Equal(Conversion.Identity, element1Info.ImplicitConversion); 2574Assert.Equal(Conversion.NoConversion, stackallocInfo.ImplicitConversion); 2580Assert.Equal(Conversion.ImplicitNumeric, element0Info.ImplicitConversion); 2586Assert.Equal(Conversion.ImplicitNumeric, element1Info.ImplicitConversion); 2592Assert.Equal(Conversion.ImplicitNumeric, sizeInfo.ImplicitConversion); 2602Assert.Equal(Conversion.NoConversion, stackallocInfo.ImplicitConversion); 2608Assert.Equal(Conversion.ImplicitNumeric, element0Info.ImplicitConversion); 2614Assert.Equal(Conversion.ImplicitNumeric, element1Info.ImplicitConversion); 2620Assert.Equal(Conversion.Identity, sizeInfo.ImplicitConversion); 2658Assert.Equal(Conversion.Identity, stackallocInfo.ImplicitConversion); 2664Assert.Equal(Conversion.Identity, element0Info.ImplicitConversion); 2670Assert.Equal(Conversion.Identity, element1Info.ImplicitConversion); 2680Assert.Equal(Conversion.Identity, stackallocInfo.ImplicitConversion); 2686Assert.Equal(Conversion.Identity, element0Info.ImplicitConversion); 2692Assert.Equal(Conversion.ImplicitNumeric, element1Info.ImplicitConversion);
Semantics\TargetTypedDefaultTests.cs (3)
336Assert.Equal(Conversion.Identity, model.GetConversion(default2)); 3529Conversion conversion = model.GetConversion(conversionSyntax); 3602Conversion conversion = model.GetConversion(default4);
Semantics\TopLevelStatementsTests.cs (2)
9708var conversionInTopLevel = speculativeModelInTopLevel.GetConversion(nodeToSpeculate.DescendantTokens().Single(n => n.ValueText == "x").Parent); 9713var conversionOutsideTopLevel = speculativeModelOutsideTopLevel.GetConversion(nodeToSpeculate.DescendantTokens().Single(n => n.ValueText == "x").Parent);
Semantics\UnsafeTests.cs (28)
7267var conv = model.GetConversion(syntax); 7270Assert.Equal(Conversion.Identity, conv); 7334var conv = model.GetConversion(syntax); 7337Assert.Equal(Conversion.Identity, conv); 7372var conv = model.GetConversion(syntax); 7375Assert.Equal(Conversion.Identity, conv); 7414var conv = model.GetConversion(syntax); 7417Assert.Equal(Conversion.Identity, conv); 7545var conv = model.GetConversion(syntax); 7548Assert.Equal(Conversion.Identity, conv); 8349var conv = model.GetConversion(node); 8394var conv = model.GetConversion(value); 8884Assert.Equal(Conversion.Identity, summary.ImplicitConversion); 8919Assert.Equal(Conversion.Identity, summary.ImplicitConversion); 9346Assert.Equal(Conversion.Identity, summary.ImplicitConversion); 10237Assert.Equal(Conversion.Identity, summary.ImplicitConversion); 10313Assert.Equal(Conversion.PointerToVoid, summary0.ImplicitConversion); 10320Assert.Equal(Conversion.PointerToVoid, summary1.ImplicitConversion); 10326Assert.Equal(Conversion.PointerToVoid, summary2.ImplicitConversion); 10639Assert.Equal(Conversion.Identity, typeSummary.ImplicitConversion); 10651Assert.Equal(Conversion.Identity, sizeOfSummary.ImplicitConversion); 10701Assert.Equal(Conversion.Identity, typeSummary.ImplicitConversion); 10713Assert.Equal(Conversion.Identity, sizeOfSummary.ImplicitConversion); 10761Assert.Equal(Conversion.Identity, typeSummary.ImplicitConversion); 10773Assert.Equal(Conversion.Identity, sizeOfSummary.ImplicitConversion); 11313Assert.Equal(Conversion.PointerToVoid, stackAllocSummary.ImplicitConversion); 11325Assert.Equal(Conversion.Identity, typeSummary.ImplicitConversion); 11337Assert.Equal(Conversion.ImplicitNumeric, countSummary.ImplicitConversion);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (65)
Compilation\ForEachStatementInfoTests.cs (4)
42var conv1 = Conversion.Identity; 49var conv2 = Conversion.NoConversion;
Compilation\GetSemanticInfoTests.cs (46)
108var conv = model.GetConversion(expr); 142var conv = model.GetConversion(expr); 604var impconv = model.GetConversion(expr1); 605Assert.Equal(Conversion.Identity, impconv); 606Conversion conv = model.ClassifyConversion(expr1, info.ConvertedType); 634var impconv = model.GetConversion(expr1); 638Conversion conv = model.ClassifyConversion(expr1, info.ConvertedType); 648var conversion = info.Type != null && info.ConvertedType != null ? model.Compilation.ClassifyConversion(info.Type, info.ConvertedType) : Conversion.NoConversion; 655ValidateConversion(Conversion.PointerToVoid, ConversionKind.ImplicitPointerToVoid); 656ValidateConversion(Conversion.NullToPointer, ConversionKind.ImplicitNullToPointer); 657ValidateConversion(Conversion.PointerToPointer, ConversionKind.ExplicitPointerToPointer); 658ValidateConversion(Conversion.IntegerToPointer, ConversionKind.ExplicitIntegerToPointer); 659ValidateConversion(Conversion.PointerToInteger, ConversionKind.ExplicitPointerToInteger); 660ValidateConversion(Conversion.IntPtr, ConversionKind.IntPtr); 664private void ValidateConversion(Conversion conv, ConversionKind kind) 847var conv = semanticModel.GetConversion(expr); 850Conversion act1 = semanticModel.ClassifyConversion(expr, info.ConvertedType); 863var act2 = semanticModel.Compilation.ClassifyConversion(info.Type, info.ConvertedType); 876Conversion act1 = semanticModel.ClassifyConversion(expr, expsym); 2456var conv = model.GetConversion(expr); 2485var conv = model.GetConversion(expr); 2734var conv = model.GetConversion(expr); 2735Assert.Equal(Conversion.Identity, conv); 2805var conv = model.GetConversion(expr); 3336var conversion = model.ClassifyConversion(expr, gNullableType); 3402var conversion = model.ClassifyConversion(expr, gNullableType); 3477var argConversion = model.GetConversion(argexpr); 3531var argConversion = model.GetConversion(argexpr); 3610var conv = model.GetConversion(literal); 3635var literalConversion = model.GetConversion(literal); 3643var castConversion = model.GetConversion(cast); 3668var literalConversion = model.GetConversion(literal); 3676var castConversion = model.GetConversion(cast); 3704var literalConversion = model.GetConversion(literal); 3712var cast1Conversion = model.GetConversion(cast1); 3724var cast2Conversion = model.GetConversion(cast2); 4300Assert.Equal(Conversion.Identity, info.ImplicitConversion); 4379var conv = model.GetConversion(syntax); 5538var conversion = model.ClassifyConversion(lambdaSyntax, otherFuncType); 5586var conversion = model.ClassifyConversion(nullSyntax, typeC); 5625var conversion = model.ClassifyConversion(lambdaSyntax, typeFuncB); 5672var conversion = model.ClassifyConversion(lambdaSyntax, typeFuncC); 5733var conversionA = model.ClassifyConversion(methodGroupSyntax, typeFuncA); 5737var conversionB = model.ClassifyConversion(methodGroupSyntax, typeFuncB); 5740var conversionC = model.ClassifyConversion(methodGroupSyntax, typeFuncC); 5991Assert.Equal(Conversion.UnsetConversion, foreachSymbolInfo.CurrentConversion);
Compilation\SemanticModelAPITests.cs (1)
2281var conv = speculativeModel.GetConversion(initializer);
Compilation\SemanticModelGetSemanticInfoTests.cs (3)
14809var conv = model.GetConversion(creation.Type); 14905var conv = model.GetConversion(creation.Type); 15016var conv = model.GetConversion(creation.Type);
Symbols\ConversionTests.cs (11)
182var result = c.ClassifyConversionFromType(types[j], types[i], ref useSiteDiagnostics); 186var result2 = c.ClassifyConversionFromType(types[j], types[i], ref useSiteDiagnostics); // set breakpoint here if this test is failing... 402Conversion conversion = model.ClassifyConversion(sourceExpression1, targetType); 486var conversion = model.GetConversion(memberAccess); 521var conversion = model.GetConversion(memberAccess); 557var conversion = model.GetConversion(memberAccess); 593var conversion = model.GetConversion(memberAccess); 627var conversion = model.GetConversion(memberAccess); 662var conversion = model.GetConversion(memberAccess); 687var conversion = model.GetConversion(memberAccess); 2079var elementConversion = BoundNode.GetConversion(boundForEach.ElementConversion, boundForEach.ElementPlaceholder);
Microsoft.CodeAnalysis.CSharp.Test.Utilities (6)
CompilationTestUtils.cs (2)
214public Conversion ImplicitConversion = default(Conversion);
Extensions.cs (4)
887public static Conversion ClassifyConversionFromType(this ConversionsBase conversions, TypeSymbol source, TypeSymbol destination, ref HashSet<DiagnosticInfo> useSiteDiagnostics, bool forCast = false) 890Conversion result = conversions.ClassifyConversionFromType(source, destination, isChecked: false, ref useSiteInfo, forCast); 910public static Conversion ClassifyConversionFromExpression(this Conversions conversions, BoundExpression sourceExpression, TypeSymbol destination, ref HashSet<DiagnosticInfo> useSiteDiagnostics, bool forCast = false) 913Conversion result = conversions.ClassifyConversionFromExpression(sourceExpression, destination, isChecked: false, ref useSiteInfo, forCast);
Microsoft.CodeAnalysis.CSharp.Workspaces (36)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ConversionExtensions.cs (2)
9public static bool IsIdentityOrImplicitReference(this Conversion conversion) 15public static bool IsImplicitUserDefinedConversion(this Conversion conversion)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (18)
232var conversion = conversionOperation.GetConversion(); 296var originalConversion = originalConversionOperation.GetConversion(); 406var originalParentConversion = originalParentConversionOperation.GetConversion(); 683var conversion = semanticModel.GetConversion(castedExpressionNode, cancellationToken); 738var innerOriginalConversion = originalConversionOperation.GetConversion(); 749var outerOriginalConversion = outerOriginalConversionOperation.GetConversion(); 776var originalConversion = originalConversionOperation.GetConversion(); 802var rewrittenBitwiseNotConversion = rewrittenBitwiseNotConversionOperation.GetConversion(); 844var originalConversion = conversionOperation.GetConversion(); 984Conversion conversion, 1043var conversion = semanticModel.GetConversion(castedExpressionNode, cancellationToken); 1071var parentConversion = semanticModel.GetConversion(castNode, cancellationToken); 1119var conversion = semanticModel.GetConversion(current, cancellationToken); 1230var oldConversion = oldForEachInfo.ElementConversion; 1231var newConversion = newForEachInfo.ElementConversion; 1488private static (ITypeSymbol? rewrittenConvertedType, Conversion rewrittenConversion) GetRewrittenInfo( 1491Conversion originalConversion, ITypeSymbol originalConvertedType, 1507var rewrittenConversion = rewrittenSemanticModel.GetConversion(rewrittenExpression, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (15)
38Conversion> 409var originalConversion = this.OriginalSemanticModel.ClassifyConversion(originalOtherPartOfConditional, originalExpressionType); 410var newConversion = this.SpeculativeSemanticModel.ClassifyConversion(newOtherPartOfConditional, newExpressionType); 444var originalConversion = this.OriginalSemanticModel.ClassifyConversion(oldSwitchStatement.Expression, originalCaseType); 445var newConversion = this.SpeculativeSemanticModel.ClassifyConversion(newSwitchStatement.Expression, newCaseType); 547var originalConvertedTypeConversion = this.OriginalSemanticModel.ClassifyConversion(previousOriginalNode, originalExpressionTypeInfo.ConvertedType); 548var newExpressionConvertedTypeConversion = this.SpeculativeSemanticModel.ClassifyConversion(previousReplacedNode, newExpressionTypeInfo.ConvertedType); 710var originalConversion = this.OriginalSemanticModel.ClassifyConversion(originalIsOrAsExpression.Left, originalConvertedType, isExplicitInSource: true); 711var newConversion = this.SpeculativeSemanticModel.ClassifyConversion(newIsOrAsExpression.Left, newConvertedType, isExplicitInSource: true); 815var originalConversion = originalModel.GetConversion(originalExpression); 816var newConversion = newModel.GetConversion(newExpression); 853private bool ConversionsAreCompatible(Conversion originalConversion, Conversion newConversion) 934protected override Conversion ClassifyConversion(SemanticModel model, ExpressionSyntax expression, ITypeSymbol targetType) 937protected override Conversion ClassifyConversion(SemanticModel model, ITypeSymbol originalType, ITypeSymbol targetType)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (1)
308var conversion = semanticModel.GetConversion(expression, cancellationToken);
Microsoft.CodeAnalysis.Test.Utilities (3)
Compilation\TestOperationVisitor.cs (3)
851CSharp.Conversion csharpConversion = CSharp.CSharpExtensions.GetConversion(operation); 1180var inConversionInternal = CSharp.CSharpExtensions.GetInConversion(operation); 1181var outConversionInternal = CSharp.CSharpExtensions.GetOutConversion(operation);
Microsoft.Extensions.Logging.Generators (1)
LoggerMessageGenerator.Parser.cs (1)
728Conversion conversion = _compilation.ClassifyConversion(source, dest);
Microsoft.Extensions.Options.SourceGeneration (2)
Parser.cs (1)
730var conversion = _compilation.ClassifyConversion(source, dest);
ParserUtilities.cs (1)
54var conversion = comp.ClassifyConversion(source, dest);
Microsoft.Gen.ComplianceReports (1)
Parser.cs (1)
287var conversion = _compilation.ClassifyConversion(source, dest);
Microsoft.Gen.Logging (1)
src\Generators\Shared\ParserUtilities.cs (1)
59var conversion = comp.ClassifyConversion(source, dest);
Microsoft.Gen.Metrics (1)
src\Generators\Shared\ParserUtilities.cs (1)
59var conversion = comp.ClassifyConversion(source, dest);
Microsoft.Gen.MetricsReports (1)
src\Generators\Shared\ParserUtilities.cs (1)
59var conversion = comp.ClassifyConversion(source, dest);