1 write to Type
Microsoft.CodeAnalysis.CSharp (1)
Symbols\TypeWithState.cs (1)
73
Type
= type;
108 references to Type
Microsoft.CodeAnalysis.CSharp (108)
FlowAnalysis\NullableWalker_Patterns.cs (2)
415
Debug.Assert(isDerivedType(NominalSlotType(originalInputSlot), expressionTypeWithState.
Type
));
416
tempMap.Add(rootTemp, (originalInputSlot, expressionTypeWithState.
Type
));
FlowAnalysis\NullableWalker.cs (96)
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);
591
Debug.Assert(AreCloseEnough(placeholder.Type, result.RValueType.
Type
));
2455
!targetType.Type.Equals(valueType.
Type
, TypeCompareKind.AllIgnoreOptions))
2503
return valueType.
Type
?.TypeKind == TypeKind.TypeParameter &&
2711
target.Type.Equals(assignedValue.
Type
, TypeCompareKind.AllIgnoreOptions);
3785
Debug.Assert((object?)resultType.
Type
!= _invalidType.
Type
);
3786
Debug.Assert(AreCloseEnough(resultType.
Type
, node.Type));
4854
Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.
Type
, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
4912
Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.
Type
, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
5319
var type = ResultType.
Type
as ArrayTypeSymbol;
5345
var expressionType = VisitRvalueWithState(node.Expression).
Type
;
5696
TypeSymbol asMemberOfType = getTypeIfContainingType(methodContainer, leftUnderlyingType.
Type
, leftOperand) ??
5697
getTypeIfContainingType(methodContainer, rightUnderlyingType.
Type
, rightOperand) ?? methodContainer;
5715
[new BoundExpressionWithNullability(leftOperand.Syntax, leftOperand, leftUnderlyingType.ToTypeWithAnnotations(compilation).NullableAnnotation, leftUnderlyingType.
Type
),
5716
new BoundExpressionWithNullability(rightOperand.Syntax, rightOperand, rightUnderlyingType.ToTypeWithAnnotations(compilation).NullableAnnotation, rightUnderlyingType.
Type
)],
6158
Debug.Assert(TypeSymbol.Equals(targetType.Type, rightResult.
Type
, TypeCompareKind.AllIgnoreOptions));
6201
var leftResultType = leftResult.
Type
;
6202
var rightResultType = rightResult.
Type
;
6257
Debug.Assert(conversionResult.
Type
is not null);
6258
return (conversionResult.
Type
!, conversionResult.State);
6507
refResultType = consequenceRValue.
Type
!.MergeEquivalentTypes(alternativeRValue.
Type
, VarianceKind.None);
6535
resultType = alternativeRValue.
Type
;
6539
resultType = consequenceRValue.
Type
;
6752
var rvalueType = _currentConditionalReceiverVisitResult.RValueType.
Type
;
6981
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
6990
ReinferenceResult<MethodSymbol> reinferenceResult = VisitArgumentsCore(node, receiverType.
Type
, arguments, refKindsOpt, parameters, argsToParamsOpt, defaultArguments,
7123
isWellKnownEqualityMethodOrImplementation(compilation, method, receiverType.
Type
, WellKnownMember.System_Collections_Generic_IEqualityComparer_T__Equals))
7134
isWellKnownEqualityMethodOrImplementation(compilation, method, receiverType.
Type
, WellKnownMember.System_IEquatable_T__Equals)))
7352
var type = receiverType.
Type
;
7449
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
7454
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8229
var argumentResultType = resultType.
Type
;
8314
hasNoNonNullableCounterpart(valueState.
Type
) &&
8516
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8522
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
8537
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8541
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
8556
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8560
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
8852
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
9130
return TypeWithState.Create(type.
Type
, state);
9608
if (PossiblyNullableType(valueFieldType.
Type
))
9613
valueFieldType = TypeWithState.Create(valueFieldType.
Type
, GetState(ref this.State, valueFieldSlot));
9617
var conversionOperand = new BoundValueForNullableAnalysis(convertedNode.Syntax, originalExpression: null, valueFieldType.
Type
);
10042
if (operandType.
Type
?.IsTupleType == true || conversionOperand.Kind == BoundKind.TupleLiteral)
10054
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
10065
if (AreNullableAndUnderlyingTypes(targetType, operandType.
Type
, out TypeWithAnnotations underlyingType))
10080
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
10088
if (operandType.
Type
?.IsNullableType() == true && !targetType.IsNullableType())
10124
TrackNullableStateOfTupleConversion(conversionOpt, conversionOperand, conversion, targetType, operandType.
Type
, fromExplicitCast: fromExplicitCast, slot, valueSlot, assignmentKind, parameterOpt, reportWarnings: reportRemainingWarnings);
10135
canConvertNestedNullability = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false).Exists;
10173
Conversion generated = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
10182
Conversion generated = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
10206
ReportNullabilityMismatchInArgument(getDiagnosticLocation(), operandType.
Type
, parameterOpt, targetType, forOutput: false);
10210
ReportNullabilityMismatchInAssignment(getDiagnosticLocation(), GetTypeAsDiagnosticArgument(operandType.
Type
), targetType);
10251
var type = operandType.
Type
;
10282
var type = operandType.
Type
;
10482
Debug.Assert(operandType.
Type
is object);
10490
if (operandType.
Type
.IsNullableType() && !parameterType.IsNullableType())
10492
var underlyingOperandTypeWithAnnotations = operandType.
Type
.GetNullableUnderlyingTypeWithAnnotations();
10679
Debug.Assert(operandType.
Type
is object);
10806
var type = typeWithState.
Type
;
10838
Debug.Assert(operandType.
Type
is object);
10841
var conversion = _conversions.ClassifyStandardConversion(operandType.
Type
, targetType.Type, ref discardedUseSiteInfo);
10846
ReportNullabilityMismatchInArgument(diagnosticLocation, operandType.
Type
, parameterOpt, targetType.Type, forOutput: false);
10850
ReportNullabilityMismatchInAssignment(diagnosticLocation, operandType.
Type
, targetType.Type);
11095
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
11464
Debug.Assert(rightResult.
Type
is object);
11475
deconstructMethod = (MethodSymbol)AsMemberOfType(rightResult.
Type
, deconstructMethod);
11621
AreNullableAndUnderlyingTypes(lvalueType.Type, operandType.
Type
, out TypeWithAnnotations underlyingType))
11759
SetResultType(node, TypeWithState.Create(receiverType.
Type
, NullableFlowState.NotNull));
11763
SetResultType(node, TypeWithState.Create(results[0].RValueType.
Type
, GetState(ref State, extensionReceiverSlot)));
11783
SetResultType(node, TypeWithState.Create(opType.
Type
, NullableFlowState.NotNull));
11952
SetResultType(node, TypeWithState.Create(receiverType.
Type
, NullableFlowState.NotNull));
11956
SetResultType(node, TypeWithState.Create(results[0].RValueType.
Type
, GetState(ref State, extensionReceiverSlot)));
11980
SetResultType(node, TypeWithState.Create(opType.
Type
, NullableFlowState.NotNull));
12234
var receiverType = VisitRvalueWithState(receiverOpt).
Type
;
12312
member = AsMemberOfType(receiverType.
Type
, member);
12316
receiverType.
Type
is NamedTypeSymbol { IsUnionType: true } unionType &&
12334
if (PossiblyNullableType(resultType.
Type
))
12340
resultType = TypeWithState.Create(resultType.
Type
, state);
12462
var resultType = resultTypeWithState.
Type
;
12580
getEnumeratorType = spanType.Construct(ImmutableArray.Create(convertedResult.
Type
!.TryGetInlineArrayElementField()!.TypeWithAnnotations));
12584
getEnumeratorType = convertedResult.
Type
;
12600
var currentPropertyGetter = (MethodSymbol)AsMemberOfType(enumeratorReturnType.
Type
, enumeratorInfoOpt.CurrentPropertyGetter);
12877
method = (MethodSymbol)AsMemberOfType(operandType.
Type
!.StrippedType(), method);
12891
[new BoundExpressionWithNullability(operand.Syntax, operand, operandType.ToTypeWithAnnotations(compilation).NullableAnnotation, operandType.
Type
)],
13123
var reinferredGetResult = (MethodSymbol)AsMemberOfType(_visitResult.RValueType.
Type
, awaitableInfo.GetResult);
13365
@event = (EventSymbol)AsMemberOfType(ResultType.
Type
, @event);
13474
var resultTypeSymbol = resultType.
Type
;
13833
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);