206 references to IsNullableType
Microsoft.CodeAnalysis.CSharp (206)
Binder\Binder_Conversions.cs (6)
381if (destination.IsNullableType()) 383switch (source.Type?.IsNullableType()) 415else if (source.Type?.IsNullableType() == true) 2640if (conversionToType.IsNullableType() && TypeSymbol.Equals(conversionToType.GetNullableUnderlyingType(), conversionReturnType, TypeCompareKind.ConsiderEverything2)) 3140Debug.Assert(conversion.IsNullable == destination.IsNullableType()); 3893if (destination.IsNullableType())
Binder\Binder_Expressions.cs (12)
2664if (targetType.IsNullableType() && 2667!operand.Type.IsNullableType() && 2689if ((object)boundOperand.Type != null && boundOperand.Type.IsNullableType()) 2768if (left?.Type.IsNullableType() == true || right?.Type.IsNullableType() == true) 2796if (boundOperand.Type?.IsNullableType() == true) 2869if (!targetType.IsReferenceType && !targetType.IsNullableType() && operand.IsLiteralNull()) 3004Debug.Assert((object)operand.Type != null && !operand.Type.IsNullableType()); 5289if (typeWithAnnotations.NullableAnnotation.IsAnnotated() && !type.IsNullableType()) 11695if (accessType.IsValueType && !accessType.IsNullableType() && !accessType.IsVoidType() && !accessType.IsPointerOrFunctionPointer()) 11802if (receiverType?.IsNullableType() == true) 11848if (receiverType.IsValueType && !receiverType.IsNullableType())
Binder\Binder_Operators.cs (10)
1196(leftNull && (object)rightType != null && rightType.IsNullableType() || 1197rightNull && (object)leftType != null && leftType.IsNullableType()); 1622if (type is not NamedTypeSymbol { IsInterface: false } namedType || namedType.IsNullableType()) 5284if (targetType.IsNullableType()) 5289Debug.Assert(operandType.IsNullableType()); 5346Debug.Assert(targetType.IsNullableType()); 5420else if (!targetType.IsReferenceType && !targetType.IsNullableType()) 5691bool isLeftNullable = (object)optLeftType != null && optLeftType.IsNullableType(); 5867if (leftType.IsValueType && !leftType.IsNullableType()) 5877if (leftType.IsNullableType())
Binder\Binder_Patterns.cs (6)
314if (caseType.IsNullableType()) 425if (caseType.IsNullableType() && 943return unionMatchingInputType is not null && constantValueOpt == ConstantValue.Null && (unionMatchingInputType.IsNullableType() || !unionMatchingInputType.IsValueType); 1189if (inputType.IsNullableType() && (convertedExpression.ConstantValueOpt == null || !convertedExpression.ConstantValueOpt.IsNull)) 1286else if (patternType.IsNullableType()) 2430if (unionMatchingInputType is not null && (unionMatchingInputType.TypeKind != TypeKind.Struct || unionMatchingInputType.IsNullableType()))
Binder\Binder_TupleOperators.cs (2)
254bool leftNullable = left.Type?.IsNullableType() == true; 255bool rightNullable = right.Type?.IsNullableType() == true;
Binder\ForEachLoopBinder.cs (3)
559(builder.ElementType.IsNullableType() && builder.ElementType.GetMemberTypeArgumentsNoUseSiteDiagnostics().Single().IsErrorType() && collectionExpr.Type.IsArray())); 727if ((object)collectionExprType != null && collectionExprType.IsNullableType()) 931(originalCollectionExpr.Type?.IsNullableType() == true && originalCollectionExpr.Type.StrippedType().Equals(collectionExpr.Type, TypeCompareKind.AllIgnoreOptions)));
Binder\PatternExplainer.cs (1)
415input.Type.IsNullableType() && input.Type.GetNullableUnderlyingType().Equals(evaluationType, TypeCompareKind.AllIgnoreOptions))
Binder\Semantics\Conversions\Conversions.cs (2)
374else if (method.ContainingType.IsNullableType() && !method.IsOverride) 498if (method.ContainingType.IsNullableType() && !method.IsOverride)
Binder\Semantics\Conversions\ConversionsBase.cs (9)
1257if (destination.IsNullableType()) 1468destination.IsNullableType() && destination.GetNullableUnderlyingType().IsEnumType(); 2263if (!destination.IsNullableType()) 2466if (!source.IsNullableType() && !destination.IsNullableType()) 3345if (source.IsNullableType()) 3856if (destination.IsValueType && !destination.IsNullableType()) 3866!destination.IsNullableType() && 3882destination.IsNullableType() &&
Binder\Semantics\Conversions\UserDefinedExplicitConversions.cs (5)
279source.IsNullableType() && 288target.IsNullableType() && 321if ((object)source != null && source.IsNullableType() && convertsFrom.IsValidNullableTypeArgument() && target.CanBeAssignedNull()) 349if (target.IsNullableType() && convertsTo.IsValidNullableTypeArgument()) 355if ((object)source != null && source.IsNullableType() && convertsFrom.IsValidNullableTypeArgument())
Binder\Semantics\Conversions\UserDefinedImplicitConversions.cs (2)
321if ((object)target != null && target.IsNullableType() && convertsTo.IsValidNullableTypeArgument()) 330else if ((object)source != null && source.IsNullableType() && convertsFrom.IsValidNullableTypeArgument() &&
Binder\Semantics\Operators\BinaryOperatorOverloadResolution.cs (3)
1448if (left.Type?.IsNullableType() == true || right.Type?.IsNullableType() == true) // Wouldn't be applicable to the receiver type otherwise 1617if (candidate.Kind.IsLifted() && operand.Type.IsNullableType())
Binder\Semantics\Operators\UnaryOperatorOverloadResolution.cs (2)
89if (operand.Type.IsNullableType()) // Wouldn't be applicable to the receiver type otherwise 225Debug.Assert(operand.Type.IsNullableType());
Binder\Semantics\OverloadResolution\OverloadResolution.cs (2)
3812if ((object)type != null && type.IsNullableType()) 3833if ((object)type != null && type.IsNullableType())
Binder\UnionMatchingRewriter.cs (1)
465if (unionMatchingInputType.IsNullableType())
BoundTree\BoundConstantPattern.cs (1)
18(ConstantValue == ConstantValue.Null && (InputType.IsNullableType() || !InputType.IsValueType) && NarrowedType.Equals(InputType, TypeCompareKind.AllIgnoreOptions)));
BoundTree\BoundNullCoalescingAssignmentOperator.cs (1)
16if (leftType?.IsNullableType() != true)
CodeGen\EmitAddress.cs (1)
42Debug.Assert(!expression.Type.IsValueType || expression.Type.IsNullableType());
CodeGen\EmitConversion.cs (1)
319Debug.Assert(!conversion.Type.IsNullableType());
CodeGen\EmitExpression.cs (4)
54!expression.Type.IsNullableType())) 412(receiverType.IsNullableType() && expression.HasValueMethodOpt != null), "conditional receiver cannot be a struct"); 522Debug.Assert(receiver.Type.IsNullableType()); 2223if (methodContainingType.IsNullableType())
CodeGen\EmitStatement.cs (1)
1263Debug.Assert(!dispatch.Expression.Type.IsNullableType());
Compilation\CSharpSemanticModel.cs (2)
3884((binaryOperator.Left.IsLiteralNull() && binaryOperator.Right.Type.IsNullableType()) || 3885(binaryOperator.Right.IsLiteralNull() && binaryOperator.Left.Type.IsNullableType())) &&
FlowAnalysis\AbstractFlowPass.cs (2)
967Debug.Assert(!inputType.IsNullableType()); 1525return t.IsNullableType();
FlowAnalysis\NullableWalker.cs (16)
4426else if (type.IsNullableType()) 5951if (receiverType.IsNullableType()) 6445oldType.IsNullableType() && !accessType.IsNullableType() ? MakeNullableOf(accessTypeWithAnnotations) : 6462if (slot > 0 && receiver.Type?.IsNullableType() == true) 6769if (rvalueType?.IsNullableType() == true) 7349type?.IsNullableType() == true && 9349if (nullableTypeOpt?.IsNullableType() == true && 9350underlyingTypeOpt?.IsNullableType() == false) 10075if (operandType.Type?.IsNullableType() == true && !targetType.IsNullableType()) 10220else if (fromExplicitCast && targetTypeWithNullability.NullableAnnotation.IsAnnotated() && !targetType.IsNullableType()) 10477if (operandType.Type.IsNullableType() && !parameterType.IsNullableType()) 10788if (type?.IsNullableType() == true) 12074parameterOpt?.Type.IsNonNullableValueType() == true && parameterType.IsNullableType() ? parameterOpt.Type : parameterType, // Compensate for operator lifting 12333Debug.Assert(containingType.IsNullableType());
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (3)
615var promotedType = e.IsNullableType() ? _nullableType.Construct(PromotedType(e.GetNullableUnderlyingType())) : PromotedType(e); 716var resultType = (isLifted && method.ReturnType.IsNonNullableValueType() && node.Type.IsNullableType()) ? 735if (node.Operand.Type.IsNullableType())
Lowering\DiagnosticsPass_Warnings.cs (3)
619if (from.IsNullableType()) 624if (to.IsNullableType()) 857if ((object)node.Type == null || !node.Type.IsNullableType())
Lowering\Extensions.cs (3)
45if (!expr.Type.IsNullableType()) 85if ((object)expr.Type == null || !expr.Type.IsNullableType()) 132if (expr.Type.IsNullableType() && expr.Type.GetNullableUnderlyingType().SpecialType != SpecialType.System_Boolean)
Lowering\LocalRewriter\LocalRewriter.cs (1)
264if (type?.IsNullableType() != true)
Lowering\LocalRewriter\LocalRewriter.PatternLocalRewriter.cs (4)
373return MakeNullCheck(d.Syntax, input, input.Type.IsNullableType() ? BinaryOperatorKind.NullableNullNotEqual : BinaryOperatorKind.NotEqual); 380return MakeNullCheck(d.Syntax, input, input.Type.IsNullableType() ? BinaryOperatorKind.NullableNullEqual : BinaryOperatorKind.Equal); 383Debug.Assert(!input.Type.IsNullableType()); 387Debug.Assert(!input.Type.IsNullableType());
Lowering\LocalRewriter\LocalRewriter_AsOperator.cs (2)
45Debug.Assert(!rewrittenType.IsValueType || rewrittenType.IsNullableType()); 61BoundExpression result = rewrittenType.IsNullableType() ? new BoundDefaultExpression(syntax, rewrittenType) : MakeLiteral(syntax, constantValue, rewrittenType);
Lowering\LocalRewriter\LocalRewriter_BinaryOperator.cs (3)
913if (expression.Type.IsNullableType()) 936if (expression.Type.IsNullableType()) 2125else if (exprType.IsNullableType())
Lowering\LocalRewriter\LocalRewriter_CompoundAssignmentOperator.cs (2)
1037if (expression.Type.IsNullableType()) 1051if (method.ContainingType?.IsNullableType() == true)
Lowering\LocalRewriter\LocalRewriter_ConditionalAccess.cs (3)
133if (!TypeSymbol.Equals(accessExpressionType, nodeType, TypeCompareKind.ConsiderEverything2) && nodeType.IsNullableType()) 153receiverType.IsNullableType() ? 207if (newtarget.Type.IsNullableType())
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (23)
50if (node.Type.IsNullableType()) 466if (rewrittenType.IsNullableType()) 495if (!rewrittenType.IsNullableType() && 917if (rewrittenOperand.Type.IsNullableType() && 919!userDefinedConversionRewrittenType.IsNullableType() && 1065if (!expression.Type.IsNullableType()) 1082when underlying.Length == 1 && underlying[0].Kind == ConversionKind.ImplicitTuple && !convertedArgument.Type!.IsNullableType(): 1120Debug.Assert(rewrittenType.IsNullableType() || rewrittenOperandType.IsNullableType()); 1122if (rewrittenOperandType.IsNullableType() && rewrittenType.IsNullableType()) 1126else if (rewrittenType.IsNullableType()) 1170Debug.Assert(rewrittenType.IsNullableType() || rewrittenOperandType.IsNullableType()); 1186rewrittenOperandType = rewrittenOperandType.IsNullableType() ? ((NamedTypeSymbol)rewrittenOperandType.OriginalDefinition).Construct(typeFromUnderlying) : typeFromUnderlying; 1417if (rewrittenOperand.Type.IsNullableType()) 1421!parameterType.IsNullableType() && 1456Debug.Assert(resultType.IsNullableType() && TypeSymbol.Equals(resultType.GetNullableUnderlyingType(), call.Method.ReturnType, TypeCompareKind.ConsiderEverything2)); 1488Debug.Assert(rewrittenOperand.Type.IsNullableType()); 1623if (source.IsNullableType() && target.IsNullableType()) 1625Debug.Assert(target.IsNullableType()); 1628else if (source.IsNullableType())
Lowering\LocalRewriter\LocalRewriter_FixedStatement.cs (3)
332bool needNullCheck = !initializerType.IsValueType || initializerType.IsNullableType(); 338if (initializerType.IsNullableType()) 386if (initializerType.IsNullableType())
Lowering\LocalRewriter\LocalRewriter_Index.cs (2)
29if (!node.Type.IsNullableType()) 71Debug.Assert(targetNullableType.IsNullableType());
Lowering\LocalRewriter\LocalRewriter_NullCoalescingAssignmentOperator.cs (1)
81Debug.Assert(node.LeftOperand.Type.IsNullableType());
Lowering\LocalRewriter\LocalRewriter_NullCoalescingOperator.cs (5)
110if (whenNullOpt.Type.IsNullableType()) 133if (rewrittenLeft.Type.IsNullableType() && 243Debug.Assert(rewrittenLeftType.IsNullableType() || !rewrittenLeftType.IsValueType); 250var conversionTakesNullableType = leftPlaceholder?.Type?.IsNullableType() == true; 253&& rewrittenLeftType.IsNullableType()
Lowering\LocalRewriter\LocalRewriter_Range.cs (6)
44if (node.Type.IsNullableType()) 67if (operand.Type.IsNullableType()) 79Debug.Assert(node.Type.IsNullableType()); 80Debug.Assert(left?.Type?.IsNullableType() == true || right?.Type?.IsNullableType() == true); 133if (tempOperand.Type.IsNullableType())
Lowering\LocalRewriter\LocalRewriter_TupleBinaryOperator.cs (8)
91expr.Type is { } exprType && exprType.IsNullableType() && exprType.StrippedType().Equals(o.Type, TypeCompareKind.AllIgnoreOptions): 208case BoundObjectCreationExpression { Arguments: { Length: 0 }, Type: { } eType } _ when eType.IsNullableType(): 210case BoundObjectCreationExpression { Arguments: { Length: 1 }, Type: { } eType } creation when eType.IsNullableType(): 362isNullable = !(expr is BoundTupleExpression) && expr.Type is { } && expr.Type.IsNullableType(); 410when expr.Type.IsNullableType() && o.Type is { } && o.Type.IsNullableType() && 445expr.Type is { } exprType && exprType.IsNullableType() && o.Type is { } && o.Type.IsNullableType() && nested[0] is { IsTupleConversion: true } tupleConversion:
Lowering\LocalRewriter\LocalRewriter_UnaryOperator.cs (3)
950else if (unaryOperandType.IsNullableType() && unaryOperandType.GetNullableUnderlyingType().SpecialType == SpecialType.System_Decimal) 992Debug.Assert(operand.Type is { } && operand.Type.IsNullableType() && operand.Type.GetNullableUnderlyingType().SpecialType == SpecialType.System_Decimal); 1179if (underlyingType.IsNullableType())
Lowering\LocalRewriter\LocalRewriter_UsingStatement.cs (1)
359bool isNullableValueType = local.Type.IsNullableType();
Lowering\SyntheticBoundNodeFactory.cs (1)
1797else if (exprType.IsNullableType())
Operations\CSharpOperationFactory.cs (2)
2883isLifted: boundIndex.Type.IsNullableType(), 2900isLifted: boundRange.Type.IsNullableType(),
Symbols\ConstraintsHelper.cs (2)
477else if (deducedBase.IsNullableType() && (typeParameter.HasValueTypeConstraint || typeParameter.HasReferenceTypeConstraint)) 1370if (conversions.HasBoxingConversion(typeArgument.Type.IsNullableType() ? ((NamedTypeSymbol)typeArgument.Type).ConstructedFrom : typeArgument.Type,
Symbols\PublicModel\TypeSymbol.cs (1)
77!(UnderlyingTypeSymbol.IsValueType && !UnderlyingTypeSymbol.IsNullableType()))
Symbols\Source\ParameterHelpers.cs (2)
1016else if (((conversion.IsNullable && !defaultExpression.Type.IsNullableType()) || 1017(conversion.IsObjectCreation && convertedExpression.Type.IsNullableType())) &&
Symbols\Source\SourceComplexParameterSymbol.cs (1)
410if (Type.IsNullableType())
Symbols\TypeSymbolExtensions.cs (7)
41return type.IsReferenceType || type.IsPointerOrFunctionPointer() || type.IsNullableType(); 131return type.IsNullableType(); 148&& !type.IsNullableType() 174RoslynDebug.Assert(IsNullableType(type)); 182return type.IsNullableType() ? type.GetNullableUnderlyingType() : type; 1417if (type.IsNullableType()) 2327if ((object)type != null && type.IsNullableType())
Symbols\TypeWithAnnotations.cs (17)
55Debug.Assert(defaultType?.IsNullableType() != true || defaultAnnotation == NullableAnnotation.Annotated); 97if (typeSymbol?.IsNullableType() == true) 110if (NullableAnnotation.IsAnnotated() || (Type.IsValueType && Type.IsNullableType())) 120if (NullableAnnotation.IsNotAnnotated() || (Type.IsValueType && !Type.IsNullableType())) 264public bool IsNullableType() => Type.IsNullableType(); 378bool isValueType = type.IsValueType && !type.IsNullableType(); 450Debug.Assert(newTypeWithModifiers.NullableAnnotation.IsOblivious() || (typeSymbol.IsNullableType() && newTypeWithModifiers.NullableAnnotation.IsAnnotated())); 459else if ((NullableAnnotation.IsOblivious() || (typeSymbol.IsNullableType() && NullableAnnotation.IsAnnotated())) && 615return type.IsNullableType(); 710!(result.NullableAnnotation.IsAnnotated() && oldTypeSymbol.IsNullableType())) // Preserve nullable annotation on Nullable<T>. 727if (NullableAnnotation.IsNotAnnotated() || (typeSymbol.IsValueType && !typeSymbol.IsNullableType())) 743if (!typeSymbol.IsValueType && !typeSymbol.IsNullableType()) 927return CreateNonLazyType(defaultType, defaultType.IsNullableType() ? type.NullableAnnotation : NullableAnnotation.NotAnnotated, _customModifiers); 1030return CreateNonLazyType(defaultType, defaultType.IsNullableType() ? type.NullableAnnotation : NullableAnnotation.NotAnnotated, _customModifiers); 1103Debug.Assert(resolvedType.IsNullableType() && CustomModifiers.IsEmpty); 1120if (resolvedType.IsNullableType()) 1130if (typeSymbol.IsNullableType())
Utilities\TypeUnionValueSet.cs (2)
67Debug.Assert(!typesInUnion.Any(t => t.CaseType.IsNullableType())); 93Debug.Assert(!typesInUnion.Any(t => t.CaseType.IsNullableType()));