192 references to IsNullableType
Microsoft.CodeAnalysis.CSharp (192)
Binder\Binder_Conversions.cs (6)
320if (destination.IsNullableType()) 322switch (source.Type?.IsNullableType()) 352else if (source.Type?.IsNullableType() == true) 2105if (conversionToType.IsNullableType() && TypeSymbol.Equals(conversionToType.GetNullableUnderlyingType(), conversionReturnType, TypeCompareKind.ConsiderEverything2)) 2429Debug.Assert(conversion.IsNullable == destination.IsNullableType()); 3171if (destination.IsNullableType())
Binder\Binder_Expressions.cs (12)
2540if (targetType.IsNullableType() && 2543!operand.Type.IsNullableType() && 2565if ((object)boundOperand.Type != null && boundOperand.Type.IsNullableType()) 2644if (left?.Type.IsNullableType() == true || right?.Type.IsNullableType() == true) 2672if (boundOperand.Type?.IsNullableType() == true) 2745if (!targetType.IsReferenceType && !targetType.IsNullableType() && operand.IsLiteralNull()) 2880Debug.Assert((object)operand.Type != null && !operand.Type.IsNullableType()); 5143if (typeWithAnnotations.NullableAnnotation.IsAnnotated() && !type.IsNullableType()) 11023if (accessType.IsValueType && !accessType.IsNullableType() && !accessType.IsVoidType()) 11094if (receiverType?.IsNullableType() == true) 11140if (receiverType.IsValueType && !receiverType.IsNullableType())
Binder\Binder_Operators.cs (9)
731(leftNull && (object)rightType != null && rightType.IsNullableType() || 732rightNull && (object)leftType != null && leftType.IsNullableType()); 3605if (targetType.IsNullableType()) 3610Debug.Assert(operandType.IsNullableType()); 3667Debug.Assert(targetType.IsNullableType()); 3740else if (!targetType.IsReferenceType && !targetType.IsNullableType()) 4011bool isLeftNullable = (object)optLeftType != null && optLeftType.IsNullableType(); 4189if (leftType.IsValueType && !leftType.IsNullableType()) 4199if (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)
1242if (destination.IsNullableType()) 1453destination.IsNullableType() && destination.GetNullableUnderlyingType().IsEnumType(); 2249if (!destination.IsNullableType()) 2446if (!source.IsNullableType() && !destination.IsNullableType()) 3325if (source.IsNullableType()) 3836if (destination.IsValueType && !destination.IsNullableType()) 3846!destination.IsNullableType() && 3862destination.IsNullableType() &&
Binder\Semantics\Conversions\UserDefinedExplicitConversions.cs (5)
275source.IsNullableType() && 284target.IsNullableType() && 317if ((object)source != null && source.IsNullableType() && convertsFrom.IsValidNullableTypeArgument() && target.CanBeAssignedNull()) 345if (target.IsNullableType() && convertsTo.IsValidNullableTypeArgument()) 351if ((object)source != null && source.IsNullableType() && convertsFrom.IsValidNullableTypeArgument())
Binder\Semantics\Conversions\UserDefinedImplicitConversions.cs (2)
318if ((object)target != null && target.IsNullableType() && convertsTo.IsValidNullableTypeArgument()) 327else if ((object)source != null && source.IsNullableType() && convertsFrom.IsValidNullableTypeArgument() &&
Binder\Semantics\OverloadResolution\OverloadResolution.cs (2)
3713if ((object)type != null && type.IsNullableType()) 3734if ((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)
1476return t.IsNullableType();
FlowAnalysis\NullableWalker.cs (16)
3991else if (type.IsNullableType()) 5349if (receiverType.IsNullableType()) 5840oldType.IsNullableType() && !accessType.IsNullableType() ? MakeNullableOf(accessTypeWithAnnotations) : 5857if (slot > 0 && receiver.Type?.IsNullableType() == true) 6164if (rvalueType?.IsNullableType() == true) 6551type?.IsNullableType() == true && 8386if (nullableTypeOpt?.IsNullableType() == true && 8387underlyingTypeOpt?.IsNullableType() == false) 9016if (operandType.Type?.IsNullableType() == true && !targetType.IsNullableType()) 9139else if (fromExplicitCast && targetTypeWithNullability.NullableAnnotation.IsAnnotated() && !targetType.IsNullableType()) 9389if (operandType.Type.IsNullableType() && !parameterType.IsNullableType()) 9530if (type?.IsNullableType() == true) 10633parameterOpt?.Type.IsNonNullableValueType() == true && parameterType.IsNullableType() ? parameterOpt.Type : parameterType, // Compensate for operator lifting 10828Debug.Assert(containingType.IsNullableType());
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (3)
608var promotedType = e.IsNullableType() ? _nullableType.Construct(PromotedType(e.GetNullableUnderlyingType())) : PromotedType(e); 706var resultType = (isLifted && method.ReturnType.IsNonNullableValueType() && node.Type.IsNullableType()) ? 725if (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() && 898if (rewrittenOperand.Type.IsNullableType() && 900!userDefinedConversionRewrittenType.IsNullableType() && 996if (!expression.Type.IsNullableType()) 1013when underlying.Length == 1 && underlying[0].Kind == ConversionKind.ImplicitTuple && !convertedArgument.Type!.IsNullableType(): 1050Debug.Assert(rewrittenType.IsNullableType() || rewrittenOperandType.IsNullableType()); 1052if (rewrittenOperandType.IsNullableType() && rewrittenType.IsNullableType()) 1056else if (rewrittenType.IsNullableType()) 1100Debug.Assert(rewrittenType.IsNullableType() || rewrittenOperandType.IsNullableType()); 1118rewrittenOperandType = rewrittenOperandType.IsNullableType() ? ((NamedTypeSymbol)rewrittenOperandType.OriginalDefinition).Construct(typeFromUnderlying) : typeFromUnderlying; 1346if (rewrittenOperand.Type.IsNullableType()) 1350!parameterType.IsNullableType() && 1383Debug.Assert(resultType.IsNullableType() && TypeSymbol.Equals(resultType.GetNullableUnderlyingType(), call.Method.ReturnType, TypeCompareKind.ConsiderEverything2)); 1413Debug.Assert(rewrittenOperand.Type.IsNullableType()); 1509if (source.IsNullableType() && target.IsNullableType()) 1511Debug.Assert(target.IsNullableType()); 1514else 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)
1508arg.Type.IsNullableType() && 1778else if (exprType.IsNullableType())
Operations\CSharpOperationFactory.cs (2)
2817isLifted: boundIndex.Type.IsNullableType(), 2834isLifted: 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)
40return type.IsReferenceType || type.IsPointerOrFunctionPointer() || type.IsNullableType(); 130return type.IsNullableType(); 147&& !type.IsNullableType() 173RoslynDebug.Assert(IsNullableType(type)); 181return type.IsNullableType() ? type.GetNullableUnderlyingType() : type; 1332if (type.IsNullableType()) 2232if ((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())