7 overrides of IsReferenceType
Microsoft.CodeAnalysis.CSharp (7)
Symbols\ArrayTypeSymbol.cs (1)
223
public override bool
IsReferenceType
Symbols\DynamicTypeSymbol.cs (1)
39
public override bool
IsReferenceType
Symbols\FunctionPointers\FunctionPointerTypeSymbol.cs (1)
74
public override bool
IsReferenceType
=> false;
Symbols\FunctionTypeSymbol.cs (1)
98
public override bool
IsReferenceType
=> true;
Symbols\NamedTypeSymbol.cs (1)
533
public override bool
IsReferenceType
Symbols\PointerTypeSymbol.cs (1)
94
public override bool
IsReferenceType
Symbols\TypeParameterSymbol.cs (1)
519
public sealed override bool
IsReferenceType
152 references to IsReferenceType
Microsoft.CodeAnalysis.CSharp (120)
Binder\Binder.ValueChecks.cs (1)
2670
Debug.Assert(receiver is not BoundValuePlaceholderBase && method is not null && receiver.Type?.
IsReferenceType
== false);
Binder\Binder_Conversions.cs (1)
713
typeArgument.Type.
IsReferenceType
&&
Binder\Binder_Expressions.cs (3)
1424
else if (typeWithAnnotations.NullableAnnotation.IsAnnotated() && type.
IsReferenceType
)
2869
if (!targetType.
IsReferenceType
&& !targetType.IsNullableType() && operand.IsLiteralNull())
11677
if ((!accessType.
IsReferenceType
&& !accessType.IsValueType) || accessType.IsRestrictedType())
Binder\Binder_Invocation.cs (1)
1401
if (receiver is BoundValuePlaceholderBase || receiver?.Type is null or {
IsReferenceType
: true })
Binder\Binder_Operators.cs (10)
503
Debug.Assert(leftType.
IsReferenceType
);
1344
Debug.Assert(!right.Type.
IsReferenceType
);
1348
Debug.Assert(!left.Type.
IsReferenceType
);
3586
Debug.Assert(operandType.
IsReferenceType
);
3901
(extensionParameter.Type.
IsReferenceType
&& extensionParameter.RefKind == RefKind.None)))
4208
if (receiver.Type.
IsReferenceType
)
4915
if (targetType.
IsReferenceType
&& targetTypeWithAnnotations.NullableAnnotation.IsAnnotated())
5387
if (targetType.
IsReferenceType
&& targetTypeWithAnnotations.NullableAnnotation.IsAnnotated())
5393
else if (!targetType.
IsReferenceType
&& !targetType.IsNullableType())
5678
if ((object)optLeftType != null && !optLeftType.
IsReferenceType
&& !isLeftNullable)
Binder\LockBinder.cs (1)
52
else if (!exprType.
IsReferenceType
&& (exprType.IsValueType || Compilation.FeatureStrictEnabled))
Binder\Semantics\Conversions\Conversions.cs (2)
363
if (thisParameter?.Type.
IsReferenceType
== false)
486
if (!(method.IsExtensionBlockMember() && method.IsStatic) && !Binder.GetReceiverParameter(method).Type.
IsReferenceType
)
Binder\Semantics\Conversions\ConversionsBase.cs (8)
1269
if (destination.
IsReferenceType
)
2653
if (!source.
IsReferenceType
)
3338
if (!source.IsValueType || !destination.
IsReferenceType
)
3486
if (destination.
IsReferenceType
)
3491
else if (source.Kind == SymbolKind.DynamicType && destination.
IsReferenceType
)
3729
bool bothAreReferenceTypes = sourceArg.
IsReferenceType
&& destinationArg.
IsReferenceType
;
3881
if (source.
IsReferenceType
&&
Binder\Semantics\OverloadResolution\MethodTypeInference.cs (12)
2139
if (elementSource.Type.
IsReferenceType
)
2174
if (!sourceElementType.Type.
IsReferenceType
|| target.IsSpan())
2407
if (sourceTypeArgument.Type.
IsReferenceType
&& typeParameter.Variance == VarianceKind.Out)
2411
else if (sourceTypeArgument.Type.
IsReferenceType
&& typeParameter.Variance == VarianceKind.In)
2451
if ((sourceParam.Type.
IsReferenceType
|| sourceParam.Type.IsFunctionPointer()) && sourceParam.RefKind == RefKind.None)
2461
if ((sourceSignature.ReturnType.
IsReferenceType
|| sourceSignature.ReturnType.IsFunctionPointer()) && sourceSignature.RefKind == RefKind.None)
2514
Debug.Assert(source.Type.
IsReferenceType
|| source.Type.IsFunctionPointer());
2578
if (elementSource.Type.
IsReferenceType
)
2757
if (sourceTypeArgument.Type.
IsReferenceType
&& typeParameter.Variance == VarianceKind.Out)
2761
else if (sourceTypeArgument.Type.
IsReferenceType
&& typeParameter.Variance == VarianceKind.In)
2801
if ((sourceParam.Type.
IsReferenceType
|| sourceParam.Type.IsFunctionPointer()) && sourceParam.RefKind == RefKind.None)
2811
if ((sourceSignature.ReturnType.
IsReferenceType
|| sourceSignature.ReturnType.IsFunctionPointer()) && sourceSignature.RefKind == RefKind.None)
CodeGen\CodeGenerator_HasHome.cs (1)
69
if (type.
IsReferenceType
)
CodeGen\EmitAddress.cs (3)
41
Debug.Assert(!expression.Type.
IsReferenceType
);
236
Debug.Assert(!expression.Type.
IsReferenceType
);
372
if (!receiver.Type.
IsReferenceType
)
CodeGen\EmitArrayInitializer.cs (1)
684
if (elementType.
IsReferenceType
&& elementType.SpecialType != SpecialType.System_String)
CodeGen\EmitExpression.cs (9)
379
Debug.Assert(!expression.Type.
IsReferenceType
);
434
var notConstrained = !receiverType.
IsReferenceType
&& !receiverType.IsValueType;
443
(receiverType.
IsReferenceType
&& receiverType.TypeKind == TypeKind.TypeParameter) ||
656
if (!expression.Type.
IsReferenceType
)
1930
callKind = receiverType.
IsReferenceType
&&
2079
if (!receiverType.
IsReferenceType
)
2137
BoundConditionalReceiver { Type: {
IsReferenceType
: false, IsValueType: false } })
2640
if (rightType.
IsReferenceType
|| (right.ConstantValueOpt != null && rightType.SpecialType != SpecialType.System_Decimal))
3884
Debug.Assert(expr.Type.
IsReferenceType
);
CodeGen\EmitOperators.cs (2)
459
if (comparandType.
IsReferenceType
&& !comparandType.IsVerifierReference())
473
if (comparandType.
IsReferenceType
&& !comparandType.IsVerifierReference())
CodeGen\EmitStatement.cs (3)
218
return ts.
IsReferenceType
;
534
var complexCase = !receiverType.
IsReferenceType
||
611
if (conditionType.
IsReferenceType
&& !conditionType.IsVerifierReference())
CodeGen\Optimizer.cs (1)
1242
if (receiverType.
IsReferenceType
)
Compilation\BuiltInOperators.cs (4)
880
if (leftType.IsValueType || (!leftType.
IsReferenceType
&& !rightIsNull))
891
if (rightType.IsValueType || (!rightType.
IsReferenceType
&& !leftIsNull))
900
var leftIsReferenceType = ((object)leftType != null) && leftType.
IsReferenceType
;
906
var rightIsReferenceType = ((object)rightType != null) && rightType.
IsReferenceType
;
FlowAnalysis\DefiniteAssignment.cs (1)
856
if ((object)type != null && type.
IsReferenceType
&&
FlowAnalysis\NullableWalker.cs (4)
2670
if (targetType.Type.
IsReferenceType
||
2759
if (fieldOrPropertyType.Type.
IsReferenceType
||
8280
return (type.Kind == SymbolKind.TypeParameter && !type.
IsReferenceType
) || type.IsNullableTypeOrTypeParameter();
13236
Debug.Assert(node.Type.
IsReferenceType
);
Lowering\ClosureConversion\ClosureConversion.cs (1)
705
Debug.Assert(capturedFrame.Type.
IsReferenceType
); // Make sure we're not accidentally capturing a struct by value
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (2)
774
else if (!receiver.Type.
IsReferenceType
)
1170
!node.ReceiverOpt.Type.
IsReferenceType
)
Lowering\DiagnosticsPass_Warnings.cs (1)
89
if (IsNonAgileFieldAccess(fieldAccess, _compilation) && !fieldSymbol.Type.
IsReferenceType
)
Lowering\LocalRewriter\LocalRewriter.DecisionDagRewriter.cs (1)
173
receiver.Type?.
IsReferenceType
== false &&
Lowering\LocalRewriter\LocalRewriter.PatternLocalRewriter.cs (1)
504
typeDecision.Type.
IsReferenceType
&&
Lowering\LocalRewriter\LocalRewriter_Call.cs (5)
297
|| (!receiverOpt.Type.
IsReferenceType
&& interceptor.Parameters[0].Type.
IsReferenceType
));
711
if (rewrittenReceiver.Type.
IsReferenceType
)
958
if (rewrittenReceiver.Type.
IsReferenceType
||
1010
if (!receiverType.
IsReferenceType
)
Lowering\LocalRewriter\LocalRewriter_CompoundAssignmentOperator.cs (6)
39
Debug.Assert(node.LeftConversion is null || (node.Left.Type!.
IsReferenceType
&& node.Operator.Method.IsExtensionBlockMember()));
57
if (leftType.
IsReferenceType
)
258
return symbol.IsExtensionBlockMember() && !symbol.IsStatic && symbol.ContainingType.ExtensionParameter is { RefKind: RefKind.None, Type.
IsReferenceType
: false };
605
else if (!receiver.Type.
IsReferenceType
)
610
Debug.Assert(receiver.Type.
IsReferenceType
);
1081
type.
IsReferenceType
||
Lowering\LocalRewriter\LocalRewriter_ConditionalAccess.cs (1)
48
if (loweredReceiver.IsDefaultValue() && receiverType.
IsReferenceType
)
Lowering\LocalRewriter\LocalRewriter_ForEachStatement.cs (1)
508
if (!receiver.Type.
IsReferenceType
&& method.ContainingType.IsInterface)
Lowering\LocalRewriter\LocalRewriter_IndexerAccess.cs (2)
544
receiver.Type.
IsReferenceType
? RefKind.None : RefKind.Ref);
847
receiver.Type.
IsReferenceType
? RefKind.None : RefKind.Ref);
Lowering\LocalRewriter\LocalRewriter_LocalDeclaration.cs (1)
36
if (!localSymbol.Type.
IsReferenceType
&& localSymbol.ConstantValue == null)
Lowering\LocalRewriter\LocalRewriter_NullCoalescingOperator.cs (2)
59
var isUnconstrainedTypeParameter = rewrittenLeft.Type is {
IsReferenceType
: false, IsValueType: false };
91
if (rewrittenLeft.Type.
IsReferenceType
&&
Lowering\LocalRewriter\LocalRewriter_StringConcat.cs (1)
706
bool callWithoutCopy = expr.Type.
IsReferenceType
||
Lowering\LocalRewriter\LocalRewriter_UnaryOperator.cs (2)
408
Debug.Assert(node.OperandConversion is null || (node.Operand.Type!.
IsReferenceType
&& node.MethodOpt.IsExtensionBlockMember()));
430
if (operandType.
IsReferenceType
)
Lowering\SpillSequenceSpiller.cs (6)
380
if (refKind != RefKind.None || expression.Type.
IsReferenceType
)
563
&& !receiverRefLocal.Type.
IsReferenceType
1047
Debug.Assert(refKind == RefKind.None || !receiver.Type.
IsReferenceType
);
1057
Debug.Assert(!receiverType.
IsReferenceType
);
1087
if (!receiver.Type.
IsReferenceType
&& LocalRewriter.CanBePassedByReference(receiver))
1299
if (receiver.Type.
IsReferenceType
|| receiver.Type.IsValueType || receiverRefKind == RefKind.None)
Lowering\StateMachineRewriter\MethodToStateMachineRewriter.cs (1)
147
thisParameter.Type.
IsReferenceType
&&
Lowering\StateMachineRewriter\StateMachineRewriter.cs (1)
444
if (method.IsStatic || method.ThisParameter.Type.
IsReferenceType
)
Lowering\SyntheticBoundNodeFactory.cs (2)
943
Debug.Assert(left.Type.
IsReferenceType
);
1631
return typeSymbol.
IsReferenceType
? Null(typeSymbol, syntax) : Default(typeSymbol, syntax);
Symbols\AliasSymbol.cs (1)
412
annotatedNamespaceOrType.TypeWithAnnotations.Type?.
IsReferenceType
is true)
Symbols\ConstantValueUtils.cs (1)
111
typeSymbol.
IsReferenceType
&&
Symbols\ConstraintsHelper.cs (2)
998
if (!typeArgument.Type.
IsReferenceType
)
1189
if (typeArgument.Type.
IsReferenceType
)
Symbols\PublicModel\TypeSymbol.cs (1)
135
return UnderlyingTypeSymbol.
IsReferenceType
;
Symbols\Source\SourceAssemblySymbol.cs (1)
2786
if (type.
IsReferenceType
) return "null";
Symbols\Source\SourceComplexParameterSymbol.cs (1)
1020
if (this.Type.
IsReferenceType
)
Symbols\Source\SourceUserDefinedOperatorSymbolBase.cs (1)
422
case { TypeKind: TypeKind.TypeParameter,
IsReferenceType
: false }:
Symbols\TypeParameterSymbol.cs (1)
406
if (!constraint.
IsReferenceType
)
Symbols\TypeSymbol.cs (1)
2532
bool ITypeSymbolInternal.IsReferenceType => this.
IsReferenceType
;
Symbols\TypeSymbolExtensions.cs (5)
41
return type.
IsReferenceType
|| type.IsPointerOrFunctionPointer() || type.IsNullableType();
54
return typeSymbol.
IsReferenceType
|| typeSymbol.IsEnumType() || typeSymbol.SpecialType.CanBeConst() || typeSymbol.IsNativeIntegerType;
676
if (type.
IsReferenceType
)
1573
return type.
IsReferenceType
;
1716
return type.
IsReferenceType
&& type.TypeKind != TypeKind.TypeParameter;
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (28)
Semantics\NullableReferenceTypesTests.cs (24)
11511
Assert.False(m1.Parameters[0].Type.
IsReferenceType
);
11516
Assert.False(m2.ReturnType.
IsReferenceType
);
11774
Assert.False(m1.Parameters[0].Type.StrippedType().
IsReferenceType
);
12105
Assert.True(m1.Parameters[0].Type.
IsReferenceType
);
13904
Assert.True(m1.Parameters[0].Type.
IsReferenceType
);
13910
Assert.True(m2.ReturnType.
IsReferenceType
);
139560
Assert.True(c2Goo.Parameters[0].Type.
IsReferenceType
);
139588
Assert.True(((ArrayTypeSymbol)c2Goo.Parameters[0].Type).ElementType.
IsReferenceType
);
139618
Assert.True(tuple.TupleElements[0].Type.
IsReferenceType
);
139620
Assert.True(tuple.TupleElements[1].Type.
IsReferenceType
);
139648
Assert.True(c2Goo.ReturnType.
IsReferenceType
);
139676
Assert.True(((ArrayTypeSymbol)c2Goo.ReturnType).ElementType.
IsReferenceType
);
139706
Assert.True(tuple.TupleElements[0].Type.
IsReferenceType
);
139708
Assert.True(tuple.TupleElements[1].Type.
IsReferenceType
);
139731
Assert.True(dGoo.Parameters[0].Type.
IsReferenceType
);
139754
Assert.True(((ArrayTypeSymbol)dGoo.Parameters[0].Type).ElementType.
IsReferenceType
);
139779
Assert.True(tuple.TupleElements[0].Type.
IsReferenceType
);
139781
Assert.True(tuple.TupleElements[1].Type.
IsReferenceType
);
139804
Assert.True(dGoo.ReturnType.
IsReferenceType
);
139827
Assert.True(((ArrayTypeSymbol)dGoo.ReturnType).ElementType.
IsReferenceType
);
139852
Assert.True(tuple.TupleElements[0].Type.
IsReferenceType
);
139854
Assert.True(tuple.TupleElements[1].Type.
IsReferenceType
);
139879
Assert.True(dGoo.ReturnType.
IsReferenceType
);
139885
Assert.True(tuple.TupleElements[0].Type.
IsReferenceType
);
Semantics\OperatorTests.cs (4)
8170
leftType.
IsReferenceType
&& rightType.
IsReferenceType
&&
8348
(!leftType.
IsReferenceType
|| !rightType.
IsReferenceType
||
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (3)
Symbols\Source\MethodTests.cs (3)
369
Assert.True(refP.
IsReferenceType
);
377
Assert.False(outP.
IsReferenceType
);
408
Assert.False(m.ReturnType.
IsReferenceType
);
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
UsesIsNullableVisitor.cs (1)
158
return (type.NullableAnnotation != NullableAnnotation.Oblivious && typeSymbol.
IsReferenceType
&& !typeSymbol.IsErrorType()) ||