1 write to Type
Microsoft.CodeAnalysis.CSharp (1)
Symbols\TypeWithState.cs (1)
73
Type
= type;
103 references to Type
Microsoft.CodeAnalysis.CSharp (103)
FlowAnalysis\NullableWalker_Patterns.cs (2)
415
Debug.Assert(isDerivedType(NominalSlotType(originalInputSlot), expressionTypeWithState.
Type
));
416
tempMap.Add(rootTemp, (originalInputSlot, expressionTypeWithState.
Type
));
FlowAnalysis\NullableWalker.cs (91)
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);
2511
!targetType.Type.Equals(valueType.
Type
, TypeCompareKind.AllIgnoreOptions))
2559
return valueType.
Type
?.TypeKind == TypeKind.TypeParameter &&
2767
target.Type.Equals(assignedValue.
Type
, TypeCompareKind.AllIgnoreOptions);
4968
Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.
Type
, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
5375
var type = ResultType.
Type
as ArrayTypeSymbol;
5401
var expressionType = VisitRvalueWithState(node.Expression).
Type
;
5768
TypeSymbol asMemberOfType = getTypeIfContainingType(methodContainer, leftUnderlyingType.
Type
, leftOperand) ??
5769
getTypeIfContainingType(methodContainer, rightUnderlyingType.
Type
, rightOperand) ?? methodContainer;
5787
[new BoundExpressionWithNullability(leftOperand.Syntax, leftOperand, leftUnderlyingType.ToTypeWithAnnotations(compilation).NullableAnnotation, leftUnderlyingType.
Type
),
5788
new BoundExpressionWithNullability(rightOperand.Syntax, rightOperand, rightUnderlyingType.ToTypeWithAnnotations(compilation).NullableAnnotation, rightUnderlyingType.
Type
)],
6230
Debug.Assert(TypeSymbol.Equals(targetType.Type, rightResult.
Type
, TypeCompareKind.AllIgnoreOptions));
6273
var leftResultType = leftResult.
Type
;
6274
var rightResultType = rightResult.
Type
;
6329
Debug.Assert(conversionResult.
Type
is not null);
6330
return (conversionResult.
Type
!, conversionResult.State);
6579
refResultType = consequenceRValue.
Type
!.MergeEquivalentTypes(alternativeRValue.
Type
, VarianceKind.None);
6607
resultType = alternativeRValue.
Type
;
6611
resultType = consequenceRValue.
Type
;
6824
var rvalueType = _currentConditionalReceiverVisitResult.RValueType.
Type
;
7053
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
7062
ReinferenceResult<MethodSymbol> reinferenceResult = VisitArgumentsCore(node, receiverType.
Type
, arguments, refKindsOpt, parameters, argsToParamsOpt, defaultArguments,
7195
isWellKnownEqualityMethodOrImplementation(compilation, method, receiverType.
Type
, WellKnownMember.System_Collections_Generic_IEqualityComparer_T__Equals))
7206
isWellKnownEqualityMethodOrImplementation(compilation, method, receiverType.
Type
, WellKnownMember.System_IEquatable_T__Equals)))
7424
var type = receiverType.
Type
;
7521
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
7526
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8301
var argumentResultType = resultType.
Type
;
8386
hasNoNonNullableCounterpart(valueState.
Type
) &&
8588
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8594
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
8609
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8613
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
8628
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8632
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
8924
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
9202
return TypeWithState.Create(type.
Type
, state);
9680
if (PossiblyNullableType(valueFieldType.
Type
))
9685
valueFieldType = TypeWithState.Create(valueFieldType.
Type
, GetState(ref this.State, valueFieldSlot));
9689
var conversionOperand = new BoundValueForNullableAnalysis(convertedNode.Syntax, originalExpression: null, valueFieldType.
Type
);
10114
if (operandType.
Type
?.IsTupleType == true || conversionOperand.Kind == BoundKind.TupleLiteral)
10126
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
10137
if (AreNullableAndUnderlyingTypes(targetType, operandType.
Type
, out TypeWithAnnotations underlyingType))
10152
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
10160
if (operandType.
Type
?.IsNullableType() == true && !targetType.IsNullableType())
10196
TrackNullableStateOfTupleConversion(conversionOpt, conversionOperand, conversion, targetType, operandType.
Type
, fromExplicitCast: fromExplicitCast, slot, valueSlot, assignmentKind, parameterOpt, reportWarnings: reportRemainingWarnings);
10207
canConvertNestedNullability = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false).Exists;
10245
Conversion generated = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
10254
Conversion generated = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
10278
ReportNullabilityMismatchInArgument(getDiagnosticLocation(), operandType.
Type
, parameterOpt, targetType, forOutput: false);
10282
ReportNullabilityMismatchInAssignment(getDiagnosticLocation(), GetTypeAsDiagnosticArgument(operandType.
Type
), targetType);
10323
var type = operandType.
Type
;
10354
var type = operandType.
Type
;
10554
Debug.Assert(operandType.
Type
is object);
10562
if (operandType.
Type
.IsNullableType() && !parameterType.IsNullableType())
10564
var underlyingOperandTypeWithAnnotations = operandType.
Type
.GetNullableUnderlyingTypeWithAnnotations();
10751
Debug.Assert(operandType.
Type
is object);
10878
var type = typeWithState.
Type
;
10910
Debug.Assert(operandType.
Type
is object);
10913
var conversion = _conversions.ClassifyStandardConversion(operandType.
Type
, targetType.Type, ref discardedUseSiteInfo);
10918
ReportNullabilityMismatchInArgument(diagnosticLocation, operandType.
Type
, parameterOpt, targetType.Type, forOutput: false);
10922
ReportNullabilityMismatchInAssignment(diagnosticLocation, operandType.
Type
, targetType.Type);
11167
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
11543
Debug.Assert(rightResult.
Type
is object);
11554
deconstructMethod = (MethodSymbol)AsMemberOfType(rightResult.
Type
, deconstructMethod);
11700
AreNullableAndUnderlyingTypes(lvalueType.Type, operandType.
Type
, out TypeWithAnnotations underlyingType))
11838
SetResultType(node, TypeWithState.Create(receiverType.
Type
, NullableFlowState.NotNull));
11842
SetResultType(node, TypeWithState.Create(results[0].RValueType.
Type
, GetState(ref State, extensionReceiverSlot)));
11862
SetResultType(node, TypeWithState.Create(opType.
Type
, NullableFlowState.NotNull));
12031
SetResultType(node, TypeWithState.Create(receiverType.
Type
, NullableFlowState.NotNull));
12035
SetResultType(node, TypeWithState.Create(results[0].RValueType.
Type
, GetState(ref State, extensionReceiverSlot)));
12059
SetResultType(node, TypeWithState.Create(opType.
Type
, NullableFlowState.NotNull));
12313
var receiverType = VisitRvalueWithState(receiverOpt).
Type
;
12391
member = AsMemberOfType(receiverType.
Type
, member);
12395
receiverType.
Type
is NamedTypeSymbol { IsUnionType: true } unionType &&
12413
if (PossiblyNullableType(resultType.
Type
))
12419
resultType = TypeWithState.Create(resultType.
Type
, state);
12541
var resultType = resultTypeWithState.
Type
;
12659
getEnumeratorType = spanType.Construct(ImmutableArray.Create(convertedResult.
Type
!.TryGetInlineArrayElementField()!.TypeWithAnnotations));
12663
getEnumeratorType = convertedResult.
Type
;
12679
var currentPropertyGetter = (MethodSymbol)AsMemberOfType(enumeratorReturnType.
Type
, enumeratorInfoOpt.CurrentPropertyGetter);
12956
method = (MethodSymbol)AsMemberOfType(operandType.
Type
!.StrippedType(), method);
12970
[new BoundExpressionWithNullability(operand.Syntax, operand, operandType.ToTypeWithAnnotations(compilation).NullableAnnotation, operandType.
Type
)],
13202
var reinferredGetResult = (MethodSymbol)AsMemberOfType(_visitResult.RValueType.
Type
, awaitableInfo.GetResult);
13444
@event = (EventSymbol)AsMemberOfType(ResultType.
Type
, @event);
13553
var resultTypeSymbol = resultType.
Type
;
13912
Debug.Assert(ResultType is TypeWithState {
Type
: FunctionPointerTypeSymbol { }, State: NullableFlowState.NotNull });
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);