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