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