201 references to IsIdentity
Microsoft.AspNetCore.Components.Analyzers (1)
ComponentParameterUsageAnalyzer.cs (1)
90
if (conversion.Exists && conversion.
IsIdentity
)
Microsoft.AspNetCore.Components.SdkAnalyzers (1)
ComponentParameterUsageAnalyzer.cs (1)
90
if (conversion.Exists && conversion.
IsIdentity
)
Microsoft.CodeAnalysis.CSharp (29)
Binder\Binder_Conversions.cs (2)
67
Debug.Assert(result is BoundConversion || (conversion.
IsIdentity
&& ((object)result == source) || source.NeedsToBeConverted()) || hasErrors);
110
if (conversion.
IsIdentity
)
Binder\Binder_Expressions.cs (4)
3397
Debug.Assert(result.ConversionForArg(arg).
IsIdentity
);
3520
else if (!kind.
IsIdentity
)
3541
Debug.Assert(kind.
IsIdentity
);
5086
case BoundConversion { Conversion.
IsIdentity
: true, Operand: BoundParameter param }:
Binder\Binder_Patterns.cs (1)
460
if (patternConversion.
IsIdentity
|| patternConversion.IsConstantExpression || patternConversion.IsNumeric)
Binder\ForEachLoopBinder.cs (2)
567
collectionConversionClassification.
IsIdentity
||
641
Debug.Assert(collectionConversionClassification.
IsIdentity
);
Binder\RefSafetyAnalysis.cs (1)
1054
inlineArray: node.Expression is not BoundConversion { Conversion.
IsIdentity
: true, ExplicitCastInCode: false, Operand: BoundExpression operand } ? node.Expression : operand,
Binder\Semantics\Conversions\Conversion.cs (1)
1154
return new CommonConversion(Exists,
IsIdentity
, IsNumeric, IsReference, IsImplicit, IsNullable, methodSymbol, constrainedToType);
Binder\Semantics\OverloadResolution\OverloadResolution.cs (1)
4501
else if (!conversion.
IsIdentity
)
Binder\SwitchBinder.cs (1)
419
Debug.Assert(conversion.UserDefinedToConversion.
IsIdentity
);
Compilation\BuiltInOperators.cs (2)
934
if (leftConversion.
IsIdentity
|| leftConversion.IsReference)
940
if (rightConversion.
IsIdentity
|| rightConversion.IsReference)
FlowAnalysis\NullableWalker.cs (2)
10272
if (underlyingConversion.
IsIdentity
)
10920
else if (conversion.
IsIdentity
||
Lowering\DiagnosticsPass_Warnings.cs (1)
288
if (!node.Operator.Kind.IsDynamic() && node.LeftConversion is BoundConversion { Conversion: {
IsIdentity
: false, Exists: true } conversion })
Lowering\LocalRewriter\LocalRewriter.PatternLocalRewriter.cs (1)
485
(conv.
IsIdentity
|| conv.Kind == ConversionKind.ImplicitReference || conv.IsBoxing) &&
Lowering\LocalRewriter\LocalRewriter_DeconstructionAssignmentOperator.cs (1)
373
if (BoundNode.GetConversion(conversion, placeholder).
IsIdentity
)
Lowering\LocalRewriter\LocalRewriter_NullCoalescingOperator.cs (2)
44
if (leftConversion is BoundConversion { Conversion: {
IsIdentity
: false } })
99
if (BoundNode.GetConversion(leftConversion, leftPlaceholder) is {
IsIdentity
: true } or { Kind: ConversionKind.ExplicitNullable })
Lowering\LocalRewriter\LocalRewriter_TupleBinaryOperator.cs (2)
401
case BoundConversion { Conversion: {
IsIdentity
: true }, Operand: var o }:
435
case BoundConversion { Conversion: {
IsIdentity
: true }, Operand: var o }:
Lowering\LocalRewriter\LocalRewriter_UnaryOperator.cs (1)
610
if (!conversion.Conversion.
IsIdentity
)
Operations\CSharpOperationFactory.cs (3)
1096
if (boundConversion.ExplicitCastInCode && conversion.
IsIdentity
&& boundOperand.Kind == BoundKind.Conversion)
1595
if (valueConversion.Exists && !valueConversion.
IsIdentity
&&
1978
boundForEachStatement.Expression is not BoundConversion { Conversion.
IsIdentity
: true, ExplicitCastInCode: false, Operand: BoundExpression operand } ?
Symbols\Source\ParameterHelpers.cs (1)
779
conversion.
IsIdentity
&& parameterType.SpecialType == SpecialType.System_Object && defaultExpression.Type.IsDynamic())
Microsoft.CodeAnalysis.CSharp.CodeStyle (10)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (1)
147
if (conversion.
IsIdentity
)
src\Analyzers\CSharp\Analyzers\UseDeconstruction\CSharpUseDeconstructionDiagnosticAnalyzer.cs (1)
155
!conversion.
IsIdentity
&&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ConversionExtensions.cs (1)
11
return conversion.
IsIdentity
||
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (4)
646
if (!conversion.
IsIdentity
)
958
if (conversion.
IsIdentity
)
1006
if (!conversion.
IsIdentity
)
1464
var convertedType = originalConversion.
IsIdentity
? originalConvertedType : originalSemanticModel.Compilation.ObjectType;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (1)
830
if (originalConversion.
IsIdentity
)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (2)
156
if (foreachStatementInfo.ElementConversion.
IsIdentity
)
329
if (conversion.
IsIdentity
)
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (43)
FirstClassSpanTests.cs (1)
2743
Assert.False(argConv.
IsIdentity
);
Semantics\CollectionExpressionTests.cs (15)
14515
Assert.True(castConversion.
IsIdentity
);
14520
Assert.True(conversion.
IsIdentity
);
14639
Assert.True(castConversion.
IsIdentity
);
14645
Assert.True(conversion.
IsIdentity
);
14724
Assert.False(conversion.
IsIdentity
);
14813
Assert.False(conversion.
IsIdentity
);
28790
Assert.True(conversion1.
IsIdentity
);
28795
Assert.True(conversion2.
IsIdentity
);
32397
Assert.True(elementConversion.
IsIdentity
);
32488
Assert.True(elementConversion1.
IsIdentity
);
32494
Assert.True(elementConversion2.
IsIdentity
);
32530
Assert.True(elementConversion1.
IsIdentity
);
32536
Assert.True(elementConversion2.
IsIdentity
);
32575
Assert.True(elementConversion1.
IsIdentity
);
32581
Assert.True(elementConversion2.
IsIdentity
);
Semantics\InlineArrayTests.cs (9)
18591
Assert.True(model.GetConversion(f).
IsIdentity
);
18601
Assert.True(forEachInfo.ElementConversion.
IsIdentity
);
18602
Assert.True(forEachInfo.CurrentConversion.
IsIdentity
);
18917
Assert.True(model.GetConversion(f).
IsIdentity
);
18927
Assert.True(forEachInfo.ElementConversion.
IsIdentity
);
18928
Assert.True(forEachInfo.CurrentConversion.
IsIdentity
);
19254
Assert.True(model.GetConversion(collection).
IsIdentity
);
19264
Assert.True(forEachInfo.ElementConversion.
IsIdentity
);
19265
Assert.True(forEachInfo.CurrentConversion.
IsIdentity
);
Semantics\OutVarTests.cs (9)
1034
Assert.True(model.GetConversion(decl).
IsIdentity
);
1056
Assert.True(model.GetConversion(typeSyntax).
IsIdentity
);
33028
Assert.True(model.GetConversion(declaration1.Type).
IsIdentity
);
33044
Assert.True(model.GetConversion(declaration2.Type).
IsIdentity
);
33100
Assert.True(model.GetConversion(declaration1.Type).
IsIdentity
);
33142
Assert.True(model.GetConversion(declaration1.Type).
IsIdentity
);
33158
Assert.True(model.GetConversion(declaration2.Type).
IsIdentity
);
33206
Assert.True(model.GetConversion(declaration1.Type).
IsIdentity
);
33224
Assert.True(model.GetConversion(declaration2.Type).
IsIdentity
);
Semantics\ParamsCollectionTests.cs (7)
234
Assert.True(model.GetConversion(expression).
IsIdentity
);
350
Assert.True(model.GetConversion(expression).
IsIdentity
);
533
Assert.True(model.GetConversion(expression).
IsIdentity
);
678
Assert.True(model.GetConversion(expression).
IsIdentity
);
1422
Assert.True(model.GetConversion(expression).
IsIdentity
);
2546
Assert.True(model.GetConversion(expression).
IsIdentity
);
2682
Assert.True(model.GetConversion(expression).
IsIdentity
);
Semantics\PatternMatchingTestBase.cs (2)
137
Assert.True(model.GetConversion(typeSyntax).
IsIdentity
);
396
Assert.True(model.GetConversion(decl.Type).
IsIdentity
);
Microsoft.CodeAnalysis.CSharp.Features (3)
ConvertForEachToFor\CSharpConvertForEachToForCodeRefactoringProvider.cs (1)
82
var donotCastElement = foreachStatementInfo.ElementConversion.
IsIdentity
;
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (1)
147
if (conversion.
IsIdentity
)
src\Analyzers\CSharp\Analyzers\UseDeconstruction\CSharpUseDeconstructionDiagnosticAnalyzer.cs (1)
155
!conversion.
IsIdentity
&&
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (93)
Semantics\DeconstructionTests.cs (78)
4263
Assert.True(model.GetConversion(declarations[0]).
IsIdentity
);
4275
Assert.True(model.GetConversion(declarations[0].Type).
IsIdentity
);
4287
Assert.True(model.GetConversion(declarations[1]).
IsIdentity
);
4293
Assert.True(model.GetConversion(declarations[1].Type).
IsIdentity
);
4304
Assert.True(model.GetConversion(declarations[2]).
IsIdentity
);
4309
Assert.True(model.GetConversion(declarations[2].Type).
IsIdentity
);
4318
Assert.True(model.GetConversion(tuple).
IsIdentity
);
4398
Assert.True(model.GetConversion(declarations[0]).
IsIdentity
);
4406
Assert.True(model.GetConversion(declarations[0].Type).
IsIdentity
);
4418
Assert.True(model.GetConversion(declarations[1]).
IsIdentity
);
4424
Assert.True(model.GetConversion(declarations[1].Type).
IsIdentity
);
4435
Assert.True(model.GetConversion(declarations[2]).
IsIdentity
);
4440
Assert.True(model.GetConversion(declarations[2].Type).
IsIdentity
);
4449
Assert.True(model.GetConversion(tuple).
IsIdentity
);
4522
Assert.True(model.GetConversion(declarations[0]).
IsIdentity
);
4534
Assert.True(model.GetConversion(declarations[0].Type).
IsIdentity
);
4546
Assert.True(model.GetConversion(declarations[1]).
IsIdentity
);
4555
Assert.True(model.GetConversion(declarations[1].Type).
IsIdentity
);
4566
Assert.True(model.GetConversion(declarations[2]).
IsIdentity
);
4574
Assert.True(model.GetConversion(declarations[2].Type).
IsIdentity
);
4583
Assert.True(model.GetConversion(tuple).
IsIdentity
);
4672
Assert.True(model.GetConversion(declarations[0]).
IsIdentity
);
4680
Assert.True(model.GetConversion(declarations[0].Type).
IsIdentity
);
4691
Assert.True(model.GetConversion(declarations[1]).
IsIdentity
);
4696
Assert.True(model.GetConversion(declarations[1].Type).
IsIdentity
);
4766
Assert.True(model.GetConversion(declarations[0]).
IsIdentity
);
4774
Assert.True(model.GetConversion(declarations[0].Type).
IsIdentity
);
4785
Assert.True(model.GetConversion(declarations[1]).
IsIdentity
);
4790
Assert.True(model.GetConversion(declarations[1].Type).
IsIdentity
);
4844
Assert.True(model.GetConversion(declarations[0]).
IsIdentity
);
4852
Assert.True(model.GetConversion(declarations[0].Type).
IsIdentity
);
4863
Assert.True(model.GetConversion(declarations[1]).
IsIdentity
);
4871
Assert.True(model.GetConversion(declarations[1].Type).
IsIdentity
);
4948
Assert.True(model.GetConversion(declaration).
IsIdentity
);
4953
Assert.True(model.GetConversion(declaration.Type).
IsIdentity
);
4994
Assert.True(model.GetConversion(declaration).
IsIdentity
);
4999
Assert.True(model.GetConversion(declaration.Type).
IsIdentity
);
5052
Assert.True(model.GetConversion(declaration).
IsIdentity
);
5060
Assert.True(model.GetConversion(declaration.Type).
IsIdentity
);
5212
Assert.True(model.GetConversion(declarations[0]).
IsIdentity
);
5220
Assert.True(model.GetConversion(declarations[0].Type).
IsIdentity
);
5232
Assert.True(model.GetConversion(declarations[1]).
IsIdentity
);
5238
Assert.True(model.GetConversion(declarations[1].Type).
IsIdentity
);
5249
Assert.True(model.GetConversion(declarations[2]).
IsIdentity
);
5254
Assert.True(model.GetConversion(declarations[2].Type).
IsIdentity
);
5266
Assert.True(model.GetConversion(tuples[0]).
IsIdentity
);
5276
Assert.True(model.GetConversion(tuples[1]).
IsIdentity
);
5356
Assert.True(model.GetConversion(declarations[0]).
IsIdentity
);
5364
Assert.True(model.GetConversion(declarations[0].Type).
IsIdentity
);
5376
Assert.True(model.GetConversion(declarations[1]).
IsIdentity
);
5382
Assert.True(model.GetConversion(declarations[1].Type).
IsIdentity
);
5393
Assert.True(model.GetConversion(declarations[2]).
IsIdentity
);
5398
Assert.True(model.GetConversion(declarations[2].Type).
IsIdentity
);
5410
Assert.True(model.GetConversion(tuples[0]).
IsIdentity
);
5420
Assert.True(model.GetConversion(tuples[1]).
IsIdentity
);
5493
Assert.True(model.GetConversion(declarations[0]).
IsIdentity
);
5501
Assert.True(model.GetConversion(declarations[0].Type).
IsIdentity
);
5513
Assert.True(model.GetConversion(declarations[1]).
IsIdentity
);
5522
Assert.True(model.GetConversion(declarations[1].Type).
IsIdentity
);
5533
Assert.True(model.GetConversion(declarations[2]).
IsIdentity
);
5541
Assert.True(model.GetConversion(declarations[2].Type).
IsIdentity
);
5553
Assert.True(model.GetConversion(tuples[0]).
IsIdentity
);
5563
Assert.True(model.GetConversion(tuples[1]).
IsIdentity
);
5680
Assert.True(model.GetConversion(declarations[0]).
IsIdentity
);
5688
Assert.True(model.GetConversion(declarations[0].Type).
IsIdentity
);
5699
Assert.True(model.GetConversion(declarations[1]).
IsIdentity
);
5704
Assert.True(model.GetConversion(declarations[1].Type).
IsIdentity
);
5713
Assert.True(model.GetConversion(tuple).
IsIdentity
);
5790
Assert.True(model.GetConversion(declarations[0]).
IsIdentity
);
5798
Assert.True(model.GetConversion(declarations[0].Type).
IsIdentity
);
5809
Assert.True(model.GetConversion(declarations[1]).
IsIdentity
);
5814
Assert.True(model.GetConversion(declarations[1].Type).
IsIdentity
);
5823
Assert.True(model.GetConversion(tuple).
IsIdentity
);
5893
Assert.True(model.GetConversion(declarations[0]).
IsIdentity
);
5901
Assert.True(model.GetConversion(declarations[0].Type).
IsIdentity
);
5912
Assert.True(model.GetConversion(declarations[1]).
IsIdentity
);
5920
Assert.True(model.GetConversion(declarations[1].Type).
IsIdentity
);
5929
Assert.True(model.GetConversion(tuple).
IsIdentity
);
Semantics\DynamicTests.cs (5)
10042
Assert.True(model.GetDeconstructionInfo(assignment) is { Method: null, Conversion: null, Nested: [{ Method: null, Conversion: {
IsIdentity
: true }, Nested: [] }, _] });
10170
Assert.True(model.GetDeconstructionInfo(assignment) is { Method: null, Conversion: null, Nested: [{ Method: null, Conversion: {
IsIdentity
: true }, Nested: [] }, _] });
10298
Assert.True(model.GetDeconstructionInfo(assignment) is { Method: null, Conversion: null, Nested: [{ Method: null, Conversion: {
IsIdentity
: true }, Nested: [] }, _] });
10452
Assert.True(model.GetDeconstructionInfo(assignment) is { Method: null, Conversion: null, Nested: [{ Method: null, Conversion: {
IsIdentity
: true }, Nested: [] }, _] });
11127
Assert.True(model.GetDeconstructionInfo(assignment) is { Method: null, Conversion: null, Nested: [{ Method: null, Conversion: null, Nested: [{ Method: null, Conversion: {
IsIdentity
: true }, Nested: [] }, _] }, _] });
Semantics\IteratorTests.cs (2)
620
Assert.True(model.GetConversion(node).
IsIdentity
);
658
Assert.True(model.GetConversion(node).
IsIdentity
);
Semantics\TargetTypedDefaultTests.cs (1)
3522
Assert.True(model.GetConversion(def).
IsIdentity
);
Semantics\Utf8StringsLiteralsTests.cs (7)
3007
Assert.True(model.GetConversion(node).
IsIdentity
);
3063
Assert.True(model.GetConversion(node).
IsIdentity
);
3119
Assert.True(model.GetConversion(node).
IsIdentity
);
3175
Assert.True(model.GetConversion(node).
IsIdentity
);
3231
Assert.True(model.GetConversion(node).
IsIdentity
);
3259
Assert.True(model.GetConversion(node).
IsIdentity
);
3315
Assert.True(model.GetConversion(node).
IsIdentity
);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (8)
Compilation\GetSemanticInfoTests.cs (1)
679
Assert.True(conv.
IsIdentity
);
Compilation\SemanticModelGetSemanticInfoTests.cs (7)
7487
Assert.False(semanticInfo.ImplicitConversion.
IsIdentity
);
14810
Assert.True(conv.
IsIdentity
);
14826
Assert.True(conv.
IsIdentity
);
14906
Assert.True(conv.
IsIdentity
);
14922
Assert.True(conv.
IsIdentity
);
15017
Assert.True(conv.
IsIdentity
);
15032
Assert.True(conv.
IsIdentity
);
Microsoft.CodeAnalysis.CSharp.Workspaces (8)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ConversionExtensions.cs (1)
11
return conversion.
IsIdentity
||
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (4)
646
if (!conversion.
IsIdentity
)
958
if (conversion.
IsIdentity
)
1006
if (!conversion.
IsIdentity
)
1464
var convertedType = originalConversion.
IsIdentity
? originalConvertedType : originalSemanticModel.Compilation.ObjectType;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (1)
830
if (originalConversion.
IsIdentity
)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (2)
156
if (foreachStatementInfo.ElementConversion.
IsIdentity
)
329
if (conversion.
IsIdentity
)
Microsoft.Extensions.Logging.Generators (1)
LoggerMessageGenerator.Parser.cs (1)
729
return conversion.
IsIdentity
|| (conversion.IsReference && conversion.IsImplicit);
Microsoft.Extensions.Options.SourceGeneration (1)
ParserUtilities.cs (1)
55
return conversion.
IsIdentity
|| (conversion.IsReference && conversion.IsImplicit);
Microsoft.Gen.Logging (1)
src\Generators\Shared\ParserUtilities.cs (1)
60
return conversion.
IsIdentity
|| (conversion.IsReference && conversion.IsImplicit);
Microsoft.Gen.Metrics (1)
src\Generators\Shared\ParserUtilities.cs (1)
60
return conversion.
IsIdentity
|| (conversion.IsReference && conversion.IsImplicit);
Microsoft.Gen.MetricsReports (1)
src\Generators\Shared\ParserUtilities.cs (1)
60
return conversion.
IsIdentity
|| (conversion.IsReference && conversion.IsImplicit);