1 write to Type
Microsoft.CodeAnalysis.CSharp (1)
Symbols\TypeWithState.cs (1)
73Type = type;
94 references to Type
Microsoft.CodeAnalysis.CSharp (94)
FlowAnalysis\NullableWalker.cs (82)
130Debug.Assert(TypeSymbol.Equals(RValueType.Type, LValueType.Type, TypeCompareKind.ConsiderEverything)); 344Debug.Assert(TypeAllowsConditionalState(visitResult.RValueType.Type) 405expr.Type?.Equals(result.RValueType.Type, TypeCompareKind.AllIgnoreOptions) == true ? result.RValueType.Type : expr.Type); 539Debug.Assert(AreCloseEnough(placeholder.Type, result.RValueType.Type)); 2371!targetType.Type.Equals(valueType.Type, TypeCompareKind.AllIgnoreOptions)) 2419return valueType.Type?.TypeKind == TypeKind.TypeParameter && 2627target.Type.Equals(assignedValue.Type, TypeCompareKind.AllIgnoreOptions); 3609Debug.Assert((object?)resultType.Type != _invalidType.Type); 3610Debug.Assert(AreCloseEnough(resultType.Type, node.Type)); 4393Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 4451Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 4856var type = ResultType.Type as ArrayTypeSymbol; 4882var expressionType = VisitRvalueWithState(node.Expression).Type; 5163TypeSymbol asMemberOfType = getTypeIfContainingType(methodContainer, leftUnderlyingType.Type, leftOperand) ?? 5164getTypeIfContainingType(methodContainer, rightUnderlyingType.Type, rightOperand) ?? methodContainer; 5638Debug.Assert(TypeSymbol.Equals(targetType.Type, rightResult.Type, TypeCompareKind.AllIgnoreOptions)); 5681var leftResultType = leftResult.Type; 5682var rightResultType = rightResult.Type; 5735Debug.Assert(conversionResult.Type is not null); 5736return (conversionResult.Type!, conversionResult.State); 5984refResultType = consequenceRValue.Type!.MergeEquivalentTypes(alternativeRValue.Type, VarianceKind.None); 6012resultType = alternativeRValue.Type; 6016resultType = consequenceRValue.Type; 6229var rvalueType = _currentConditionalReceiverVisitResult.RValueType.Type; 6348method = (MethodSymbol)AsMemberOfType(receiverType.Type, method); 6391isWellKnownEqualityMethodOrImplementation(compilation, method, receiverType.Type, WellKnownMember.System_Collections_Generic_IEqualityComparer_T__Equals)) 6402isWellKnownEqualityMethodOrImplementation(compilation, method, receiverType.Type, WellKnownMember.System_IEquatable_T__Equals))) 6615var type = receiverType.Type; 6712return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 6717return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 7439var argumentResultType = resultType.Type; 7524hasNoNonNullableCounterpart(valueState.Type) && 7706return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 7712return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 7727return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 7731return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 7746return TypeWithState.Create(typeWithState.Type, NullableFlowState.MaybeDefault); 7750return TypeWithState.Create(typeWithState.Type, NullableFlowState.NotNull); 7991method = (MethodSymbol)AsMemberOfType(receiverType.Type, method); 8225return TypeWithState.Create(type.Type, state); 9040if (operandType.Type?.IsTupleType == true || conversionOperand.Kind == BoundKind.TupleLiteral) 9051conversion = GenerateConversion(_conversions, conversionOperand, operandType.Type, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false); 9062if (AreNullableAndUnderlyingTypes(targetType, operandType.Type, out TypeWithAnnotations underlyingType)) 9077conversion = GenerateConversion(_conversions, conversionOperand, operandType.Type, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false); 9085if (operandType.Type?.IsNullableType() == true && !targetType.IsNullableType()) 9119TrackNullableStateOfTupleConversion(conversionOpt, conversionOperand, conversion, targetType, operandType.Type, slot, valueSlot, assignmentKind, parameterOpt, reportWarnings: reportRemainingWarnings); 9129conversion = GenerateConversion(_conversions, conversionOperand, operandType.Type, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false); 9147conversion = GenerateConversion(_conversions, conversionOperand, operandType.Type, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false); 9157conversion = GenerateConversion(_conversions, conversionOperand, operandType.Type, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false); 9181ReportNullabilityMismatchInArgument(getDiagnosticLocation(), operandType.Type, parameterOpt, targetType, forOutput: false); 9185ReportNullabilityMismatchInAssignment(getDiagnosticLocation(), GetTypeAsDiagnosticArgument(operandType.Type), targetType); 9226var type = operandType.Type; 9257var type = operandType.Type; 9450Debug.Assert(operandType.Type is object); 9458if (operandType.Type.IsNullableType() && !parameterType.IsNullableType()) 9460var underlyingOperandTypeWithAnnotations = operandType.Type.GetNullableUnderlyingTypeWithAnnotations(); 9598var type = typeWithState.Type; 9630Debug.Assert(operandType.Type is object); 9633var conversion = _conversions.ClassifyStandardConversion(operandType.Type, targetType.Type, ref discardedUseSiteInfo); 9638ReportNullabilityMismatchInArgument(diagnosticLocation, operandType.Type, parameterOpt, targetType.Type, forOutput: false); 9642ReportNullabilityMismatchInAssignment(diagnosticLocation, operandType.Type, targetType.Type); 9885method = (MethodSymbol)AsMemberOfType(receiverType.Type, method); 10234Debug.Assert(rightResult.Type is object); 10244deconstructMethod = (MethodSymbol)AsMemberOfType(rightResult.Type, deconstructMethod); 10386AreNullableAndUnderlyingTypes(lvalueType.Type, operandType.Type, out TypeWithAnnotations underlyingType)) 10675if (argumentType.Type is { } argType && IsNullabilityMismatch(paramType.Type, argType)) 10760var receiverType = VisitRvalueWithState(receiverOpt).Type; 10836member = AsMemberOfType(receiverType.Type, member); 10850if (PossiblyNullableType(resultType.Type)) 10856resultType = TypeWithState.Create(resultType.Type, state); 10961var resultType = resultTypeWithState.Type; 11073getEnumeratorType = spanType.Construct(ImmutableArray.Create(convertedResult.Type!.TryGetInlineArrayElementField()!.TypeWithAnnotations)); 11077getEnumeratorType = convertedResult.Type; 11093var currentPropertyGetter = (MethodSymbol)AsMemberOfType(enumeratorReturnType.Type, enumeratorInfoOpt.CurrentPropertyGetter); 11333method = (MethodSymbol)AsMemberOfType(operandType.Type!.StrippedType(), method); 11514var reinferredGetResult = _visitResult.RValueType.Type is NamedTypeSymbol taskAwaiterType 11759@event = (EventSymbol)AsMemberOfType(ResultType.Type, @event); 11868var resultTypeSymbol = resultType.Type; 12174Debug.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);