192 references to IsNullableType
Microsoft.CodeAnalysis.CSharp (192)
Binder\Binder_Conversions.cs (6)
324if (destination.IsNullableType()) 326switch (source.Type?.IsNullableType()) 356else if (source.Type?.IsNullableType() == true) 1845if (conversionToType.IsNullableType() && TypeSymbol.Equals(conversionToType.GetNullableUnderlyingType(), conversionReturnType, TypeCompareKind.ConsiderEverything2)) 2169Debug.Assert(conversion.IsNullable == destination.IsNullableType()); 2911if (destination.IsNullableType())
Binder\Binder_Expressions.cs (12)
2502if (targetType.IsNullableType() && 2505!operand.Type.IsNullableType() && 2527if ((object)boundOperand.Type != null && boundOperand.Type.IsNullableType()) 2606if (left?.Type.IsNullableType() == true || right?.Type.IsNullableType() == true) 2634if (boundOperand.Type?.IsNullableType() == true) 2707if (!targetType.IsReferenceType && !targetType.IsNullableType() && operand.IsLiteralNull()) 2842Debug.Assert((object)operand.Type != null && !operand.Type.IsNullableType()); 5105if (typeWithAnnotations.NullableAnnotation.IsAnnotated() && !type.IsNullableType()) 10832if (accessType.IsValueType && !accessType.IsNullableType() && !accessType.IsVoidType()) 10903if (receiverType?.IsNullableType() == true) 10949if (receiverType.IsValueType && !receiverType.IsNullableType())
Binder\Binder_Operators.cs (9)
731(leftNull && (object)rightType != null && rightType.IsNullableType() || 732rightNull && (object)leftType != null && leftType.IsNullableType()); 3603if (targetType.IsNullableType()) 3608Debug.Assert(operandType.IsNullableType()); 3665Debug.Assert(targetType.IsNullableType()); 3738else if (!targetType.IsReferenceType && !targetType.IsNullableType()) 4009bool isLeftNullable = (object)optLeftType != null && optLeftType.IsNullableType(); 4187if (leftType.IsValueType && !leftType.IsNullableType()) 4197if (leftType.IsNullableType())
Binder\Binder_Patterns.cs (2)
690if (inputType.IsNullableType() && (convertedExpression.ConstantValueOpt == null || !convertedExpression.ConstantValueOpt.IsNull)) 740else if (patternType.IsNullableType())
Binder\Binder_TupleOperators.cs (2)
247bool leftNullable = left.Type?.IsNullableType() == true; 248bool rightNullable = right.Type?.IsNullableType() == true;
Binder\ForEachLoopBinder.cs (3)
544(builder.ElementType.IsNullableType() && builder.ElementType.GetMemberTypeArgumentsNoUseSiteDiagnostics().Single().IsErrorType() && collectionExpr.Type.IsArray())); 704if ((object)collectionExprType != null && collectionExprType.IsNullableType()) 908(originalCollectionExpr.Type?.IsNullableType() == true && originalCollectionExpr.Type.StrippedType().Equals(collectionExpr.Type, TypeCompareKind.AllIgnoreOptions)));
Binder\PatternExplainer.cs (1)
357input.Type.IsNullableType() && input.Type.GetNullableUnderlyingType().Equals(evaluationType, TypeCompareKind.AllIgnoreOptions))
Binder\Semantics\Conversions\Conversions.cs (2)
342else if (method.ContainingType.IsNullableType() && !method.IsOverride) 463if (method.ContainingType.IsNullableType() && !method.IsOverride)
Binder\Semantics\Conversions\ConversionsBase.cs (9)
1226if (destination.IsNullableType()) 1437destination.IsNullableType() && destination.GetNullableUnderlyingType().IsEnumType(); 2226if (!destination.IsNullableType()) 2423if (!source.IsNullableType() && !destination.IsNullableType()) 3302if (source.IsNullableType()) 3813if (destination.IsValueType && !destination.IsNullableType()) 3823!destination.IsNullableType() && 3839destination.IsNullableType() &&
Binder\Semantics\Conversions\UserDefinedExplicitConversions.cs (5)
270source.IsNullableType() && 279target.IsNullableType() && 312if ((object)source != null && source.IsNullableType() && convertsFrom.IsValidNullableTypeArgument() && target.CanBeAssignedNull()) 340if (target.IsNullableType() && convertsTo.IsValidNullableTypeArgument()) 346if ((object)source != null && source.IsNullableType() && convertsFrom.IsValidNullableTypeArgument())
Binder\Semantics\Conversions\UserDefinedImplicitConversions.cs (2)
313if ((object)target != null && target.IsNullableType() && convertsTo.IsValidNullableTypeArgument()) 322else if ((object)source != null && source.IsNullableType() && convertsFrom.IsValidNullableTypeArgument() &&
Binder\Semantics\OverloadResolution\OverloadResolution.cs (2)
3451if ((object)type != null && type.IsNullableType()) 3472if ((object)type != null && type.IsNullableType())
BoundTree\BoundNullCoalescingAssignmentOperator.cs (1)
16if (leftType?.IsNullableType() != true)
CodeGen\EmitAddress.cs (1)
44Debug.Assert(!expression.Type.IsValueType || expression.Type.IsNullableType());
CodeGen\EmitConversion.cs (1)
288Debug.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()); 2191if (methodContainingType.IsNullableType())
CodeGen\EmitStatement.cs (1)
1236Debug.Assert(!dispatch.Expression.Type.IsNullableType());
Compilation\CSharpSemanticModel.cs (2)
3859((binaryOperator.Left.IsLiteralNull() && binaryOperator.Right.Type.IsNullableType()) || 3860(binaryOperator.Right.IsLiteralNull() && binaryOperator.Left.Type.IsNullableType())) &&
FlowAnalysis\AbstractFlowPass.cs (1)
1428return t.IsNullableType();
FlowAnalysis\NullableWalker.cs (16)
3875else if (type.IsNullableType()) 5233if (receiverType.IsNullableType()) 5724oldType.IsNullableType() && !accessType.IsNullableType() ? MakeNullableOf(accessTypeWithAnnotations) : 5741if (slot > 0 && receiver.Type?.IsNullableType() == true) 6048if (rvalueType?.IsNullableType() == true) 6435type?.IsNullableType() == true && 8228if (nullableTypeOpt?.IsNullableType() == true && 8229underlyingTypeOpt?.IsNullableType() == false) 8858if (operandType.Type?.IsNullableType() == true && !targetType.IsNullableType()) 8970else if (fromExplicitCast && targetTypeWithNullability.NullableAnnotation.IsAnnotated() && !targetType.IsNullableType()) 9220if (operandType.Type.IsNullableType() && !parameterType.IsNullableType()) 9361if (type?.IsNullableType() == true) 10476parameterOpt?.Type.IsNonNullableValueType() == true && parameterType.IsNullableType() ? parameterOpt.Type : parameterType, // Compensate for operator lifting 10659Debug.Assert(containingType.IsNullableType());
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (3)
540var promotedType = e.IsNullableType() ? _nullableType.Construct(PromotedType(e.GetNullableUnderlyingType())) : PromotedType(e); 638var resultType = (isLifted && method.ReturnType.IsNonNullableValueType() && node.Type.IsNullableType()) ? 656if (node.Operand.Type.IsNullableType())
Lowering\DiagnosticsPass_Warnings.cs (3)
620if (from.IsNullableType()) 625if (to.IsNullableType()) 858if ((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)
260if (type?.IsNullableType() != true)
Lowering\LocalRewriter\LocalRewriter.PatternLocalRewriter.cs (4)
344return MakeNullCheck(d.Syntax, input, input.Type.IsNullableType() ? BinaryOperatorKind.NullableNullNotEqual : BinaryOperatorKind.NotEqual); 351return MakeNullCheck(d.Syntax, input, input.Type.IsNullableType() ? BinaryOperatorKind.NullableNullEqual : BinaryOperatorKind.Equal); 354Debug.Assert(!input.Type.IsNullableType()); 358Debug.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)
894if (expression.Type.IsNullableType()) 917if (expression.Type.IsNullableType()) 2106else if (exprType.IsNullableType())
Lowering\LocalRewriter\LocalRewriter_CompoundAssignmentOperator.cs (2)
906if (expression.Type.IsNullableType()) 920if (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()) 461if (rewrittenType.IsNullableType()) 490if (!rewrittenType.IsNullableType() && 801if (rewrittenOperand.Type.IsNullableType() && 803!userDefinedConversionRewrittenType.IsNullableType() && 899if (!expression.Type.IsNullableType()) 916when underlying.Length == 1 && underlying[0].Kind == ConversionKind.ImplicitTuple && !convertedArgument.Type!.IsNullableType(): 953Debug.Assert(rewrittenType.IsNullableType() || rewrittenOperandType.IsNullableType()); 955if (rewrittenOperandType.IsNullableType() && rewrittenType.IsNullableType()) 959else if (rewrittenType.IsNullableType()) 1003Debug.Assert(rewrittenType.IsNullableType() || rewrittenOperandType.IsNullableType()); 1021rewrittenOperandType = rewrittenOperandType.IsNullableType() ? ((NamedTypeSymbol)rewrittenOperandType.OriginalDefinition).Construct(typeFromUnderlying) : typeFromUnderlying; 1249if (rewrittenOperand.Type.IsNullableType()) 1253!parameterType.IsNullableType() && 1286Debug.Assert(resultType.IsNullableType() && TypeSymbol.Equals(resultType.GetNullableUnderlyingType(), call.Method.ReturnType, TypeCompareKind.ConsiderEverything2)); 1316Debug.Assert(rewrittenOperand.Type.IsNullableType()); 1412if (source.IsNullableType() && target.IsNullableType()) 1414Debug.Assert(target.IsNullableType()); 1417else if (source.IsNullableType())
Lowering\LocalRewriter\LocalRewriter_FixedStatement.cs (3)
332bool needNullCheck = !initializerType.IsValueType || initializerType.IsNullableType(); 338if (initializerType.IsNullableType()) 385if (initializerType.IsNullableType())
Lowering\LocalRewriter\LocalRewriter_Index.cs (2)
29if (!node.Type.IsNullableType()) 71Debug.Assert(targetNullableType.IsNullableType());
Lowering\LocalRewriter\LocalRewriter_NullCoalescingAssignmentOperator.cs (1)
63Debug.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)
90expr.Type is { } exprType && exprType.IsNullableType() && exprType.StrippedType().Equals(o.Type, TypeCompareKind.AllIgnoreOptions): 205case BoundObjectCreationExpression { Arguments: { Length: 0 }, Type: { } eType } _ when eType.IsNullableType(): 207case BoundObjectCreationExpression { Arguments: { Length: 1 }, Type: { } eType } creation when eType.IsNullableType(): 356isNullable = !(expr is BoundTupleExpression) && expr.Type is { } && expr.Type.IsNullableType(); 404when expr.Type.IsNullableType() && o.Type is { } && o.Type.IsNullableType() && !underlying[0].IsUserDefined: 438expr.Type is { } exprType && exprType.IsNullableType() && o.Type is { } && o.Type.IsNullableType() && nested[0] is { IsTupleConversion: true } tupleConversion:
Lowering\LocalRewriter\LocalRewriter_UnaryOperator.cs (3)
791else if (unaryOperandType.IsNullableType() && unaryOperandType.GetNullableUnderlyingType().SpecialType == SpecialType.System_Decimal) 833Debug.Assert(operand.Type is { } && operand.Type.IsNullableType() && operand.Type.GetNullableUnderlyingType().SpecialType == SpecialType.System_Decimal); 1020if (underlyingType.IsNullableType())
Lowering\LocalRewriter\LocalRewriter_UsingStatement.cs (1)
359bool isNullableValueType = local.Type.IsNullableType();
Lowering\SyntheticBoundNodeFactory.cs (2)
1564arg.Type.IsNullableType() && 1834else if (exprType.IsNullableType())
Operations\CSharpOperationFactory.cs (2)
2754isLifted: boundIndex.Type.IsNullableType(), 2771isLifted: boundRange.Type.IsNullableType(),
Symbols\ConstraintsHelper.cs (2)
477else if (deducedBase.IsNullableType() && (typeParameter.HasValueTypeConstraint || typeParameter.HasReferenceTypeConstraint)) 1343if (conversions.HasBoxingConversion(typeArgument.Type.IsNullableType() ? ((NamedTypeSymbol)typeArgument.Type).ConstructedFrom : typeArgument.Type,
Symbols\PublicModel\TypeSymbol.cs (1)
70!(UnderlyingTypeSymbol.IsValueType && !UnderlyingTypeSymbol.IsNullableType()))
Symbols\Source\ParameterHelpers.cs (2)
804else if (((conversion.IsNullable && !defaultExpression.Type.IsNullableType()) || 805(conversion.IsObjectCreation && convertedExpression.Type.IsNullableType())) &&
Symbols\Source\SourceComplexParameterSymbol.cs (1)
402if (Type.IsNullableType())
Symbols\TypeSymbolExtensions.cs (7)
31return type.IsReferenceType || type.IsPointerOrFunctionPointer() || type.IsNullableType(); 121return type.IsNullableType(); 138&& !type.IsNullableType() 164RoslynDebug.Assert(IsNullableType(type)); 172return type.IsNullableType() ? type.GetNullableUnderlyingType() : type; 1308if (type.IsNullableType()) 2182if ((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())