1 write to Type
Microsoft.CodeAnalysis.CSharp (1)
Symbols\TypeWithState.cs (1)
73
Type
= type;
102 references to Type
Microsoft.CodeAnalysis.CSharp (102)
FlowAnalysis\NullableWalker.cs (90)
149
Debug.Assert(TypeSymbol.Equals(RValueType.
Type
, LValueType.Type, TypeCompareKind.ConsiderEverything));
369
Debug.Assert(TypeAllowsConditionalState(visitResult.RValueType.
Type
)
436
expr.Type?.Equals(result.RValueType.
Type
, TypeCompareKind.AllIgnoreOptions) == true ? result.RValueType.
Type
: expr.Type);
572
Debug.Assert(AreCloseEnough(placeholder.Type, result.RValueType.
Type
));
2430
!targetType.Type.Equals(valueType.
Type
, TypeCompareKind.AllIgnoreOptions))
2478
return valueType.
Type
?.TypeKind == TypeKind.TypeParameter &&
2686
target.Type.Equals(assignedValue.
Type
, TypeCompareKind.AllIgnoreOptions);
3725
Debug.Assert((object?)resultType.
Type
!= _invalidType.
Type
);
3726
Debug.Assert(AreCloseEnough(resultType.
Type
, node.Type));
4600
Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.
Type
, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
4658
Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.
Type
, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
5065
var type = ResultType.
Type
as ArrayTypeSymbol;
5091
var expressionType = VisitRvalueWithState(node.Expression).
Type
;
5442
TypeSymbol asMemberOfType = getTypeIfContainingType(methodContainer, leftUnderlyingType.
Type
, leftOperand) ??
5443
getTypeIfContainingType(methodContainer, rightUnderlyingType.
Type
, rightOperand) ?? methodContainer;
5461
[new BoundExpressionWithNullability(leftOperand.Syntax, leftOperand, leftUnderlyingType.ToTypeWithAnnotations(compilation).NullableAnnotation, leftUnderlyingType.
Type
),
5462
new BoundExpressionWithNullability(rightOperand.Syntax, rightOperand, rightUnderlyingType.ToTypeWithAnnotations(compilation).NullableAnnotation, rightUnderlyingType.
Type
)],
5904
Debug.Assert(TypeSymbol.Equals(targetType.Type, rightResult.
Type
, TypeCompareKind.AllIgnoreOptions));
5947
var leftResultType = leftResult.
Type
;
5948
var rightResultType = rightResult.
Type
;
6001
Debug.Assert(conversionResult.
Type
is not null);
6002
return (conversionResult.
Type
!, conversionResult.State);
6251
refResultType = consequenceRValue.
Type
!.MergeEquivalentTypes(alternativeRValue.
Type
, VarianceKind.None);
6279
resultType = alternativeRValue.
Type
;
6283
resultType = consequenceRValue.
Type
;
6496
var rvalueType = _currentConditionalReceiverVisitResult.RValueType.
Type
;
6720
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
6840
isWellKnownEqualityMethodOrImplementation(compilation, method, receiverType.
Type
, WellKnownMember.System_Collections_Generic_IEqualityComparer_T__Equals))
6851
isWellKnownEqualityMethodOrImplementation(compilation, method, receiverType.
Type
, WellKnownMember.System_IEquatable_T__Equals)))
7069
var type = receiverType.
Type
;
7166
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
7171
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
7918
var argumentResultType = resultType.
Type
;
8003
hasNoNonNullableCounterpart(valueState.
Type
) &&
8185
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8191
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
8206
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8210
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
8225
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8229
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
8521
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
8788
return TypeWithState.Create(type.
Type
, state);
9605
if (operandType.
Type
?.IsTupleType == true || conversionOperand.Kind == BoundKind.TupleLiteral)
9616
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9627
if (AreNullableAndUnderlyingTypes(targetType, operandType.
Type
, out TypeWithAnnotations underlyingType))
9642
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9650
if (operandType.
Type
?.IsNullableType() == true && !targetType.IsNullableType())
9684
TrackNullableStateOfTupleConversion(conversionOpt, conversionOperand, conversion, targetType, operandType.
Type
, slot, valueSlot, assignmentKind, parameterOpt, reportWarnings: reportRemainingWarnings);
9694
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9712
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9722
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9746
ReportNullabilityMismatchInArgument(getDiagnosticLocation(), operandType.
Type
, parameterOpt, targetType, forOutput: false);
9750
ReportNullabilityMismatchInAssignment(getDiagnosticLocation(), GetTypeAsDiagnosticArgument(operandType.
Type
), targetType);
9791
var type = operandType.
Type
;
9822
var type = operandType.
Type
;
10023
Debug.Assert(operandType.
Type
is object);
10031
if (operandType.
Type
.IsNullableType() && !parameterType.IsNullableType())
10033
var underlyingOperandTypeWithAnnotations = operandType.
Type
.GetNullableUnderlyingTypeWithAnnotations();
10171
var type = typeWithState.
Type
;
10203
Debug.Assert(operandType.
Type
is object);
10206
var conversion = _conversions.ClassifyStandardConversion(operandType.
Type
, targetType.Type, ref discardedUseSiteInfo);
10211
ReportNullabilityMismatchInArgument(diagnosticLocation, operandType.
Type
, parameterOpt, targetType.Type, forOutput: false);
10215
ReportNullabilityMismatchInAssignment(diagnosticLocation, operandType.
Type
, targetType.Type);
10460
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
10831
Debug.Assert(rightResult.
Type
is object);
10842
deconstructMethod = (MethodSymbol)AsMemberOfType(rightResult.
Type
, deconstructMethod);
10986
AreNullableAndUnderlyingTypes(lvalueType.Type, operandType.
Type
, out TypeWithAnnotations underlyingType))
11120
SetResultType(node, TypeWithState.Create(receiverType.
Type
, NullableFlowState.NotNull));
11124
SetResultType(node, TypeWithState.Create(results[0].RValueType.
Type
, GetState(ref State, extensionReceiverSlot)));
11144
SetResultType(node, TypeWithState.Create(opType.
Type
, NullableFlowState.NotNull));
11297
SetResultType(node, TypeWithState.Create(receiverType.
Type
, NullableFlowState.NotNull));
11301
SetResultType(node, TypeWithState.Create(results[0].RValueType.
Type
, GetState(ref State, extensionReceiverSlot)));
11325
SetResultType(node, TypeWithState.Create(opType.
Type
, NullableFlowState.NotNull));
11530
var receiverType = VisitRvalueWithState(receiverOpt).
Type
;
11608
member = AsMemberOfType(receiverType.
Type
, member);
11622
if (PossiblyNullableType(resultType.
Type
))
11628
resultType = TypeWithState.Create(resultType.
Type
, state);
11731
var resultType = resultTypeWithState.
Type
;
11848
getEnumeratorType = spanType.Construct(ImmutableArray.Create(convertedResult.
Type
!.TryGetInlineArrayElementField()!.TypeWithAnnotations));
11852
getEnumeratorType = convertedResult.
Type
;
11868
var currentPropertyGetter = (MethodSymbol)AsMemberOfType(enumeratorReturnType.
Type
, enumeratorInfoOpt.CurrentPropertyGetter);
12155
method = (MethodSymbol)AsMemberOfType(operandType.
Type
!.StrippedType(), method);
12169
[new BoundExpressionWithNullability(operand.Syntax, operand, operandType.ToTypeWithAnnotations(compilation).NullableAnnotation, operandType.
Type
)],
12400
var reinferredGetResult = _visitResult.RValueType.
Type
is NamedTypeSymbol taskAwaiterType
12645
@event = (EventSymbol)AsMemberOfType(ResultType.
Type
, @event);
12754
var resultTypeSymbol = resultType.
Type
;
13060
Debug.Assert(ResultType is TypeWithState {
Type
: FunctionPointerTypeSymbol { }, State: NullableFlowState.NotNull });
FlowAnalysis\NullableWalker_Patterns.cs (2)
410
Debug.Assert(isDerivedType(NominalSlotType(originalInputSlot), expressionTypeWithState.
Type
));
411
tempMap.Add(rootTemp, (originalInputSlot, expressionTypeWithState.
Type
));
Symbols\TypeWithState.cs (10)
18
[MemberNotNullWhen(false, nameof(
Type
))]
19
public bool HasNullType =>
Type
is null;
77
public string GetDebuggerDisplay() => $"{{Type:{
Type
?.GetDebuggerDisplay()}, State:{State}{"}"}";
81
public TypeWithState WithNotNullState() => new TypeWithState(
Type
, NullableFlowState.NotNull);
83
public TypeWithState WithSuppression(bool suppress) => suppress ? new TypeWithState(
Type
, NullableFlowState.NotNull) : this;
87
if (
Type
?.IsTypeParameterDisallowingAnnotationInCSharp8() == true)
89
var type = TypeWithAnnotations.Create(
Type
, NullableAnnotation.NotAnnotated);
93
(
Type
?.IsValueType == true ? NullableAnnotation.NotAnnotated : NullableAnnotation.Annotated) :
94
(State.IsNotNull() ||
Type
?.CanContainNull() == false ? NullableAnnotation.NotAnnotated : NullableAnnotation.Annotated);
95
return TypeWithAnnotations.Create(this.
Type
, annotation);