92 references to ClassifyConversion
Microsoft.CodeAnalysis.CSharp.CodeStyle (10)
CastSimplifier.cs (1)
101
semanticModel.
ClassifyConversion
(cast.Expression, parentConversionType).Exists)
SpeculationAnalyzer.cs (9)
396
var originalConversion = this.OriginalSemanticModel.
ClassifyConversion
(originalOtherPartOfConditional, originalExpressionType);
397
var newConversion = this.SpeculativeSemanticModel.
ClassifyConversion
(newOtherPartOfConditional, newExpressionType);
431
var originalConversion = this.OriginalSemanticModel.
ClassifyConversion
(oldSwitchStatement.Expression, originalCaseType);
432
var newConversion = this.SpeculativeSemanticModel.
ClassifyConversion
(newSwitchStatement.Expression, newCaseType);
534
var originalConvertedTypeConversion = this.OriginalSemanticModel.
ClassifyConversion
(previousOriginalNode, originalExpressionTypeInfo.ConvertedType);
535
var newExpressionConvertedTypeConversion = this.SpeculativeSemanticModel.
ClassifyConversion
(previousReplacedNode, newExpressionTypeInfo.ConvertedType);
693
var originalConversion = this.OriginalSemanticModel.
ClassifyConversion
(originalIsOrAsExpression.Left, originalConvertedType, isExplicitInSource: true);
694
var newConversion = this.SpeculativeSemanticModel.
ClassifyConversion
(newIsOrAsExpression.Left, newConvertedType, isExplicitInSource: true);
823
=> model.
ClassifyConversion
(expression, targetType);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (1)
CSharpSemanticFactsService.cs (1)
118
=> semanticModel.
ClassifyConversion
((ExpressionSyntax)expression, destination).ToCommonConversion();
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (24)
CodeGen\CodeGenTupleTest.cs (24)
19079
Assert.Equal(ConversionKind.Identity, model.
ClassifyConversion
(expr1, int_string1).Kind);
19080
Assert.Equal(ConversionKind.Identity, model.
ClassifyConversion
(expr1, int_string1, isExplicitInSource: true).Kind);
19081
Assert.Equal(ConversionKind.ImplicitTuple, model.
ClassifyConversion
(expr1, int_object).Kind);
19082
Assert.Equal(ConversionKind.ExplicitTuple, model.
ClassifyConversion
(expr1, int_object, isExplicitInSource: true).Kind);
19084
Assert.Equal(ConversionKind.NoConversion, model.
ClassifyConversion
(expr1, int_object_object).Kind);
19085
Assert.Equal(ConversionKind.NoConversion, model.
ClassifyConversion
(expr1, int_object_object, isExplicitInSource: true).Kind);
19118
Assert.Equal(ConversionKind.ExplicitTuple, model.
ClassifyConversion
(expr1, int_string1).Kind);
19119
Assert.Equal(ConversionKind.Identity, model.
ClassifyConversion
(expr1, int_object).Kind);
19120
Assert.Equal(ConversionKind.ExplicitTuple, model.
ClassifyConversion
(expr1, int_string1, isExplicitInSource: true).Kind);
19121
Assert.Equal(ConversionKind.Identity, model.
ClassifyConversion
(expr1, int_object, isExplicitInSource: true).Kind);
19123
Assert.Equal(ConversionKind.NoConversion, model.
ClassifyConversion
(expr1, int_object_object).Kind);
19124
Assert.Equal(ConversionKind.NoConversion, model.
ClassifyConversion
(expr1, int_object_object, isExplicitInSource: true).Kind);
19157
Assert.Equal(ConversionKind.Identity, model.
ClassifyConversion
(expr1, int_string1).Kind);
19158
Assert.Equal(ConversionKind.Identity, model.
ClassifyConversion
(expr1, int_string1, isExplicitInSource: true).Kind);
19159
Assert.Equal(ConversionKind.ImplicitTuple, model.
ClassifyConversion
(expr1, int_object).Kind);
19160
Assert.Equal(ConversionKind.ExplicitTuple, model.
ClassifyConversion
(expr1, int_object, isExplicitInSource: true).Kind);
19162
Assert.Equal(ConversionKind.NoConversion, model.
ClassifyConversion
(expr1, int_object_object).Kind);
19163
Assert.Equal(ConversionKind.NoConversion, model.
ClassifyConversion
(expr1, int_object_object, isExplicitInSource: true).Kind);
19196
Assert.Equal(ConversionKind.ExplicitTuple, model.
ClassifyConversion
(expr1, int_string1).Kind);
19197
Assert.Equal(ConversionKind.Identity, model.
ClassifyConversion
(expr1, int_object).Kind);
19198
Assert.Equal(ConversionKind.ExplicitTuple, model.
ClassifyConversion
(expr1, int_string1, isExplicitInSource: true).Kind);
19199
Assert.Equal(ConversionKind.Identity, model.
ClassifyConversion
(expr1, int_object, isExplicitInSource: true).Kind);
19201
Assert.Equal(ConversionKind.NoConversion, model.
ClassifyConversion
(expr1, int_object_object).Kind);
19202
Assert.Equal(ConversionKind.NoConversion, model.
ClassifyConversion
(expr1, int_object_object, isExplicitInSource: true).Kind);
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (1)
Emit\NumericIntPtrTests.cs (1)
5981
AssertMatches(expectedConversions, model.
ClassifyConversion
(expr, destTypeSymbol));
Microsoft.CodeAnalysis.CSharp.Features (1)
ConvertIfToSwitch\CSharpConvertIfToSwitchCodeRefactoringProvider.Analyzer.cs (1)
42
semanticModel.
ClassifyConversion
(expressionSyntax, targetType).IsImplicit;
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (12)
Semantics\DelegateTypeTests.cs (2)
11455
Assert.Equal(expectedImplicitKind, model.
ClassifyConversion
(expr, destination, isExplicitInSource: false).Kind);
11456
Assert.Equal(expectedExplicitKind, model.
ClassifyConversion
(expr, destination, isExplicitInSource: true).Kind);
Semantics\FunctionPointerTests.cs (7)
281
var classifiedConversion = model.
ClassifyConversion
(literal, typeInfo.ConvertedType);
333
var conversion = model.
ClassifyConversion
(conversions[0].Expression, typeInfoOuter.Type!);
339
conversion = model.
ClassifyConversion
(conversions[1].Expression, typeInfoOuter.Type!);
384
var conversion = model.
ClassifyConversion
(conversions[0].Expression, typeInfoOuter.Type!);
388
conversion = model.
ClassifyConversion
(conversions[1].Expression, typeInfoOuter.Type!);
436
var conversion = model.
ClassifyConversion
(conversions[0].Expression, typeInfoOuter.Type!);
486
var conversion = model.
ClassifyConversion
(conv.Expression, typeInfoOuter.Type!);
Semantics\NativeIntegerTests.cs (1)
9475
AssertMatches(expectedConversions, model.
ClassifyConversion
(expr, destTypeSymbol));
Semantics\OutVarTests.cs (2)
1058
var conversion = model.
ClassifyConversion
(decl, model.Compilation.ObjectType, false);
1060
Assert.Equal(conversion, model.
ClassifyConversion
(decl, model.Compilation.ObjectType, true));
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (32)
Compilation\GetSemanticInfoTests.cs (17)
606
Conversion conv = model.
ClassifyConversion
(expr1, info.ConvertedType);
611
conv = model.
ClassifyConversion
(expr2, info.ConvertedType);
638
Conversion conv = model.
ClassifyConversion
(expr1, info.ConvertedType);
850
Conversion act1 = semanticModel.
ClassifyConversion
(expr, info.ConvertedType);
876
Conversion act1 = semanticModel.
ClassifyConversion
(expr, expsym);
3336
var conversion = model.
ClassifyConversion
(expr, gNullableType);
3402
var conversion = model.
ClassifyConversion
(expr, gNullableType);
3681
Assert.Equal(ConversionKind.Boxing, model.
ClassifyConversion
(literal, castTypeInfo.Type).Kind);
3718
Assert.Equal(ConversionKind.ImplicitNumeric, model.
ClassifyConversion
(literal, cast1TypeInfo.Type).Kind);
3729
Assert.Equal(ConversionKind.Boxing, model.
ClassifyConversion
(cast1, cast2TypeInfo.Type).Kind);
5538
var conversion = model.
ClassifyConversion
(lambdaSyntax, otherFuncType);
5586
var conversion = model.
ClassifyConversion
(nullSyntax, typeC);
5625
var conversion = model.
ClassifyConversion
(lambdaSyntax, typeFuncB);
5672
var conversion = model.
ClassifyConversion
(lambdaSyntax, typeFuncC);
5733
var conversionA = model.
ClassifyConversion
(methodGroupSyntax, typeFuncA);
5737
var conversionB = model.
ClassifyConversion
(methodGroupSyntax, typeFuncB);
5740
var conversionC = model.
ClassifyConversion
(methodGroupSyntax, typeFuncC);
Symbols\CheckedUserDefinedOperatorsTests.cs (12)
7225
Assert.Equal("System.Int64 C0.op_CheckedExplicit(C0 x)", model.
ClassifyConversion
(xNode, int64, isExplicitInSource: false).Method.ToTestDisplayString());
7226
Assert.Equal("System.Int64 C0.op_CheckedExplicit(C0 x)", model.
ClassifyConversion
(xNode, int64, isExplicitInSource: true).Method.ToTestDisplayString());
7228
Assert.Equal("System.Int64 C0.op_CheckedExplicit(C0 x)", model.
ClassifyConversion
(yNode, int64, isExplicitInSource: false).Method.ToTestDisplayString());
7229
Assert.Equal("System.Int64 C0.op_CheckedExplicit(C0 x)", model.
ClassifyConversion
(yNode, int64, isExplicitInSource: true).Method.ToTestDisplayString());
7296
Assert.Equal("System.Int64 C0.op_Explicit(C0 x)", model.
ClassifyConversion
(xNode, int64, isExplicitInSource: false).Method.ToTestDisplayString());
7297
Assert.Equal("System.Int64 C0.op_Explicit(C0 x)", model.
ClassifyConversion
(xNode, int64, isExplicitInSource: true).Method.ToTestDisplayString());
7298
Assert.Equal("System.Int64 C0.op_Explicit(C0 x)", model.
ClassifyConversion
(yNode, int64, isExplicitInSource: false).Method.ToTestDisplayString());
7299
Assert.Equal("System.Int64 C0.op_Explicit(C0 x)", model.
ClassifyConversion
(yNode, int64, isExplicitInSource: true).Method.ToTestDisplayString());
7368
Assert.Equal("System.Int64 C0.op_Explicit(C0 x)", model.
ClassifyConversion
(xNode, int64, isExplicitInSource: false).Method.ToTestDisplayString());
7369
Assert.Equal("System.Int64 C0.op_Explicit(C0 x)", model.
ClassifyConversion
(xNode, int64, isExplicitInSource: true).Method.ToTestDisplayString());
7371
Assert.Equal("System.Int64 C0.op_Explicit(C0 x)", model.
ClassifyConversion
(yNode, int64, isExplicitInSource: false).Method.ToTestDisplayString());
7372
Assert.Equal("System.Int64 C0.op_Explicit(C0 x)", model.
ClassifyConversion
(yNode, int64, isExplicitInSource: true).Method.ToTestDisplayString());
Symbols\ConversionTests.cs (3)
348
Assert.Equal(ConversionKind.Identity, tuple.Item2.
ClassifyConversion
(tuple.Item1, comp.GetSpecialType(SpecialType.System_Boolean)).Kind);
400
Conversion conversion = model.
ClassifyConversion
(sourceExpression1, targetType);
406
conversion = model.
ClassifyConversion
(sourceExpression2, targetType);
Microsoft.CodeAnalysis.CSharp.Workspaces (11)
CastSimplifier.cs (1)
101
semanticModel.
ClassifyConversion
(cast.Expression, parentConversionType).Exists)
CSharpSemanticFactsService.cs (1)
118
=> semanticModel.
ClassifyConversion
((ExpressionSyntax)expression, destination).ToCommonConversion();
SpeculationAnalyzer.cs (9)
396
var originalConversion = this.OriginalSemanticModel.
ClassifyConversion
(originalOtherPartOfConditional, originalExpressionType);
397
var newConversion = this.SpeculativeSemanticModel.
ClassifyConversion
(newOtherPartOfConditional, newExpressionType);
431
var originalConversion = this.OriginalSemanticModel.
ClassifyConversion
(oldSwitchStatement.Expression, originalCaseType);
432
var newConversion = this.SpeculativeSemanticModel.
ClassifyConversion
(newSwitchStatement.Expression, newCaseType);
534
var originalConvertedTypeConversion = this.OriginalSemanticModel.
ClassifyConversion
(previousOriginalNode, originalExpressionTypeInfo.ConvertedType);
535
var newExpressionConvertedTypeConversion = this.SpeculativeSemanticModel.
ClassifyConversion
(previousReplacedNode, newExpressionTypeInfo.ConvertedType);
693
var originalConversion = this.OriginalSemanticModel.
ClassifyConversion
(originalIsOrAsExpression.Left, originalConvertedType, isExplicitInSource: true);
694
var newConversion = this.SpeculativeSemanticModel.
ClassifyConversion
(newIsOrAsExpression.Left, newConvertedType, isExplicitInSource: true);
823
=> model.
ClassifyConversion
(expression, targetType);