1 write to Type
Microsoft.CodeAnalysis.CSharp (1)
Symbols\TypeWithState.cs (1)
73Type = type;
95 references to Type
Microsoft.CodeAnalysis.CSharp (95)
FlowAnalysis\NullableWalker.cs (83)
130Debug.Assert(TypeSymbol.Equals(RValueType.Type, LValueType.Type, TypeCompareKind.ConsiderEverything)); 350Debug.Assert(TypeAllowsConditionalState(visitResult.RValueType.Type) 411expr.Type?.Equals(result.RValueType.Type, TypeCompareKind.AllIgnoreOptions) == true ? result.RValueType.Type : expr.Type); 547Debug.Assert(AreCloseEnough(placeholder.Type, result.RValueType.Type)); 2406!targetType.Type.Equals(valueType.Type, TypeCompareKind.AllIgnoreOptions)) 2454return valueType.Type?.TypeKind == TypeKind.TypeParameter && 2662target.Type.Equals(assignedValue.Type, TypeCompareKind.AllIgnoreOptions); 3704Debug.Assert((object?)resultType.Type != _invalidType.Type); 3705Debug.Assert(AreCloseEnough(resultType.Type, node.Type)); 4488Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 4546Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 4953var type = ResultType.Type as ArrayTypeSymbol; 4979var expressionType = VisitRvalueWithState(node.Expression).Type; 5260TypeSymbol asMemberOfType = getTypeIfContainingType(methodContainer, leftUnderlyingType.Type, leftOperand) ?? 5261getTypeIfContainingType(methodContainer, rightUnderlyingType.Type, rightOperand) ?? methodContainer; 5730Debug.Assert(TypeSymbol.Equals(targetType.Type, rightResult.Type, TypeCompareKind.AllIgnoreOptions)); 5773var leftResultType = leftResult.Type; 5774var rightResultType = rightResult.Type; 5827Debug.Assert(conversionResult.Type is not null); 5828return (conversionResult.Type!, conversionResult.State); 6077refResultType = consequenceRValue.Type!.MergeEquivalentTypes(alternativeRValue.Type, VarianceKind.None); 6105resultType = alternativeRValue.Type; 6109resultType = consequenceRValue.Type; 6322var rvalueType = _currentConditionalReceiverVisitResult.RValueType.Type; 6462method = (MethodSymbol)AsMemberOfType(receiverType.Type, method); 6591isWellKnownEqualityMethodOrImplementation(compilation, method, receiverType.Type, WellKnownMember.System_Collections_Generic_IEqualityComparer_T__Equals)) 6602isWellKnownEqualityMethodOrImplementation(compilation, method, receiverType.Type, WellKnownMember.System_IEquatable_T__Equals))) 6820var type = receiverType.Type; 6917return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 6922return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 7674var argumentResultType = resultType.Type; 7759hasNoNonNullableCounterpart(valueState.Type) && 7941return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 7947return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 7962return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 7966return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 7981return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 7985return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 8231method = (MethodSymbol)AsMemberOfType(receiverType.Type, method); 8498return TypeWithState.Create(type.Type, state); 9314if (operandType.Type?.IsTupleType == true || conversionOperand.Kind == BoundKind.TupleLiteral) 9325conversion = GenerateConversion(_conversions, conversionOperand, operandType.Type, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false); 9336if (AreNullableAndUnderlyingTypes(targetType, operandType.Type, out TypeWithAnnotations underlyingType)) 9351conversion = GenerateConversion(_conversions, conversionOperand, operandType.Type, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false); 9359if (operandType.Type?.IsNullableType() == true && !targetType.IsNullableType()) 9393TrackNullableStateOfTupleConversion(conversionOpt, conversionOperand, conversion, targetType, operandType.Type, slot, valueSlot, assignmentKind, parameterOpt, reportWarnings: reportRemainingWarnings); 9403conversion = GenerateConversion(_conversions, conversionOperand, operandType.Type, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false); 9421conversion = GenerateConversion(_conversions, conversionOperand, operandType.Type, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false); 9431conversion = GenerateConversion(_conversions, conversionOperand, operandType.Type, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false); 9455ReportNullabilityMismatchInArgument(getDiagnosticLocation(), operandType.Type, parameterOpt, targetType, forOutput: false); 9459ReportNullabilityMismatchInAssignment(getDiagnosticLocation(), GetTypeAsDiagnosticArgument(operandType.Type), targetType); 9500var type = operandType.Type; 9531var type = operandType.Type; 9724Debug.Assert(operandType.Type is object); 9732if (operandType.Type.IsNullableType() && !parameterType.IsNullableType()) 9734var underlyingOperandTypeWithAnnotations = operandType.Type.GetNullableUnderlyingTypeWithAnnotations(); 9872var type = typeWithState.Type; 9904Debug.Assert(operandType.Type is object); 9907var conversion = _conversions.ClassifyStandardConversion(operandType.Type, targetType.Type, ref discardedUseSiteInfo); 9912ReportNullabilityMismatchInArgument(diagnosticLocation, operandType.Type, parameterOpt, targetType.Type, forOutput: false); 9916ReportNullabilityMismatchInAssignment(diagnosticLocation, operandType.Type, targetType.Type); 10161method = (MethodSymbol)AsMemberOfType(receiverType.Type, method); 10534Debug.Assert(rightResult.Type is object); 10545deconstructMethod = (MethodSymbol)AsMemberOfType(rightResult.Type, deconstructMethod); 10689AreNullableAndUnderlyingTypes(lvalueType.Type, operandType.Type, out TypeWithAnnotations underlyingType)) 10916var reinferredMethod = (MethodSymbol)AsMemberOfType(leftTypeWithState.Type, method); 11010if (argumentType.Type is { } argType && IsNullabilityMismatch(paramType.Type, argType)) 11124var receiverType = VisitRvalueWithState(receiverOpt).Type; 11202member = AsMemberOfType(receiverType.Type, member); 11216if (PossiblyNullableType(resultType.Type)) 11222resultType = TypeWithState.Create(resultType.Type, state); 11327var resultType = resultTypeWithState.Type; 11439getEnumeratorType = spanType.Construct(ImmutableArray.Create(convertedResult.Type!.TryGetInlineArrayElementField()!.TypeWithAnnotations)); 11443getEnumeratorType = convertedResult.Type; 11459var currentPropertyGetter = (MethodSymbol)AsMemberOfType(enumeratorReturnType.Type, enumeratorInfoOpt.CurrentPropertyGetter); 11699method = (MethodSymbol)AsMemberOfType(operandType.Type!.StrippedType(), method); 11880var reinferredGetResult = _visitResult.RValueType.Type is NamedTypeSymbol taskAwaiterType 12125@event = (EventSymbol)AsMemberOfType(ResultType.Type, @event); 12234var resultTypeSymbol = resultType.Type; 12540Debug.Assert(ResultType is TypeWithState { Type: FunctionPointerTypeSymbol { }, State: NullableFlowState.NotNull });
FlowAnalysis\NullableWalker_Patterns.cs (2)
410Debug.Assert(isDerivedType(NominalSlotType(originalInputSlot), expressionTypeWithState.Type)); 411tempMap.Add(rootTemp, (originalInputSlot, expressionTypeWithState.Type));
Symbols\TypeWithState.cs (10)
18[MemberNotNullWhen(false, nameof(Type))] 19public bool HasNullType => Type is null; 77public string GetDebuggerDisplay() => $"{{Type:{Type?.GetDebuggerDisplay()}, State:{State}{"}"}"; 81public TypeWithState WithNotNullState() => new TypeWithState(Type, NullableFlowState.NotNull); 83public TypeWithState WithSuppression(bool suppress) => suppress ? new TypeWithState(Type, NullableFlowState.NotNull) : this; 87if (Type?.IsTypeParameterDisallowingAnnotationInCSharp8() == true) 89var type = TypeWithAnnotations.Create(Type, NullableAnnotation.NotAnnotated); 93(Type?.IsValueType == true ? NullableAnnotation.NotAnnotated : NullableAnnotation.Annotated) : 94(State.IsNotNull() || Type?.CanContainNull() == false ? NullableAnnotation.NotAnnotated : NullableAnnotation.Annotated); 95return TypeWithAnnotations.Create(this.Type, annotation);