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.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
));
2467
!targetType.Type.Equals(valueType.
Type
, TypeCompareKind.AllIgnoreOptions))
2515
return valueType.
Type
?.TypeKind == TypeKind.TypeParameter &&
2723
target.Type.Equals(assignedValue.
Type
, TypeCompareKind.AllIgnoreOptions);
3790
Debug.Assert((object?)resultType.
Type
!= _invalidType.
Type
);
3791
Debug.Assert(AreCloseEnough(resultType.
Type
, node.Type));
4870
Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.
Type
, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
4928
Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.
Type
, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
5335
var type = ResultType.
Type
as ArrayTypeSymbol;
5361
var expressionType = VisitRvalueWithState(node.Expression).
Type
;
5712
TypeSymbol asMemberOfType = getTypeIfContainingType(methodContainer, leftUnderlyingType.
Type
, leftOperand) ??
5713
getTypeIfContainingType(methodContainer, rightUnderlyingType.
Type
, rightOperand) ?? methodContainer;
5731
[new BoundExpressionWithNullability(leftOperand.Syntax, leftOperand, leftUnderlyingType.ToTypeWithAnnotations(compilation).NullableAnnotation, leftUnderlyingType.
Type
),
5732
new BoundExpressionWithNullability(rightOperand.Syntax, rightOperand, rightUnderlyingType.ToTypeWithAnnotations(compilation).NullableAnnotation, rightUnderlyingType.
Type
)],
6174
Debug.Assert(TypeSymbol.Equals(targetType.Type, rightResult.
Type
, TypeCompareKind.AllIgnoreOptions));
6217
var leftResultType = leftResult.
Type
;
6218
var rightResultType = rightResult.
Type
;
6273
Debug.Assert(conversionResult.
Type
is not null);
6274
return (conversionResult.
Type
!, conversionResult.State);
6523
refResultType = consequenceRValue.
Type
!.MergeEquivalentTypes(alternativeRValue.
Type
, VarianceKind.None);
6551
resultType = alternativeRValue.
Type
;
6555
resultType = consequenceRValue.
Type
;
6768
var rvalueType = _currentConditionalReceiverVisitResult.RValueType.
Type
;
6997
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
7005
ReinferenceResult<MethodSymbol> reinferenceResult = VisitArgumentsCore(node, receiverType.
Type
, arguments, refKindsOpt, parameters, argsToParamsOpt, defaultArguments,
7118
isWellKnownEqualityMethodOrImplementation(compilation, method, receiverType.
Type
, WellKnownMember.System_Collections_Generic_IEqualityComparer_T__Equals))
7129
isWellKnownEqualityMethodOrImplementation(compilation, method, receiverType.
Type
, WellKnownMember.System_IEquatable_T__Equals)))
7347
var type = receiverType.
Type
;
7444
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
7449
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8216
var argumentResultType = resultType.
Type
;
8301
hasNoNonNullableCounterpart(valueState.
Type
) &&
8503
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8509
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
8524
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8528
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
8543
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8547
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
8839
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
9117
return TypeWithState.Create(type.
Type
, state);
9595
if (PossiblyNullableType(valueFieldType.
Type
))
9600
valueFieldType = TypeWithState.Create(valueFieldType.
Type
, GetState(ref this.State, valueFieldSlot));
9604
var conversionOperand = new BoundValueForNullableAnalysis(convertedNode.Syntax, originalExpression: null, valueFieldType.
Type
);
10029
if (operandType.
Type
?.IsTupleType == true || conversionOperand.Kind == BoundKind.TupleLiteral)
10041
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
10052
if (AreNullableAndUnderlyingTypes(targetType, operandType.
Type
, out TypeWithAnnotations underlyingType))
10067
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
10075
if (operandType.
Type
?.IsNullableType() == true && !targetType.IsNullableType())
10111
TrackNullableStateOfTupleConversion(conversionOpt, conversionOperand, conversion, targetType, operandType.
Type
, fromExplicitCast: fromExplicitCast, slot, valueSlot, assignmentKind, parameterOpt, reportWarnings: reportRemainingWarnings);
10122
canConvertNestedNullability = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false).Exists;
10160
Conversion generated = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
10169
Conversion generated = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
10193
ReportNullabilityMismatchInArgument(getDiagnosticLocation(), operandType.
Type
, parameterOpt, targetType, forOutput: false);
10197
ReportNullabilityMismatchInAssignment(getDiagnosticLocation(), GetTypeAsDiagnosticArgument(operandType.
Type
), targetType);
10238
var type = operandType.
Type
;
10269
var type = operandType.
Type
;
10469
Debug.Assert(operandType.
Type
is object);
10477
if (operandType.
Type
.IsNullableType() && !parameterType.IsNullableType())
10479
var underlyingOperandTypeWithAnnotations = operandType.
Type
.GetNullableUnderlyingTypeWithAnnotations();
10660
Debug.Assert(operandType.
Type
is object);
10787
var type = typeWithState.
Type
;
10819
Debug.Assert(operandType.
Type
is object);
10822
var conversion = _conversions.ClassifyStandardConversion(operandType.
Type
, targetType.Type, ref discardedUseSiteInfo);
10827
ReportNullabilityMismatchInArgument(diagnosticLocation, operandType.
Type
, parameterOpt, targetType.Type, forOutput: false);
10831
ReportNullabilityMismatchInAssignment(diagnosticLocation, operandType.
Type
, targetType.Type);
11076
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
11447
Debug.Assert(rightResult.
Type
is object);
11458
deconstructMethod = (MethodSymbol)AsMemberOfType(rightResult.
Type
, deconstructMethod);
11603
AreNullableAndUnderlyingTypes(lvalueType.Type, operandType.
Type
, out TypeWithAnnotations underlyingType))
11741
SetResultType(node, TypeWithState.Create(receiverType.
Type
, NullableFlowState.NotNull));
11745
SetResultType(node, TypeWithState.Create(results[0].RValueType.
Type
, GetState(ref State, extensionReceiverSlot)));
11765
SetResultType(node, TypeWithState.Create(opType.
Type
, NullableFlowState.NotNull));
11934
SetResultType(node, TypeWithState.Create(receiverType.
Type
, NullableFlowState.NotNull));
11938
SetResultType(node, TypeWithState.Create(results[0].RValueType.
Type
, GetState(ref State, extensionReceiverSlot)));
11962
SetResultType(node, TypeWithState.Create(opType.
Type
, NullableFlowState.NotNull));
12169
var receiverType = VisitRvalueWithState(receiverOpt).
Type
;
12254
member = AsMemberOfType(receiverType.
Type
, member);
12258
receiverType.
Type
is NamedTypeSymbol { IsUnionType: true } unionType &&
12276
if (PossiblyNullableType(resultType.
Type
))
12282
resultType = TypeWithState.Create(resultType.
Type
, state);
12395
var resultType = resultTypeWithState.
Type
;
12513
getEnumeratorType = spanType.Construct(ImmutableArray.Create(convertedResult.
Type
!.TryGetInlineArrayElementField()!.TypeWithAnnotations));
12517
getEnumeratorType = convertedResult.
Type
;
12533
var currentPropertyGetter = (MethodSymbol)AsMemberOfType(enumeratorReturnType.
Type
, enumeratorInfoOpt.CurrentPropertyGetter);
12810
method = (MethodSymbol)AsMemberOfType(operandType.
Type
!.StrippedType(), method);
12824
[new BoundExpressionWithNullability(operand.Syntax, operand, operandType.ToTypeWithAnnotations(compilation).NullableAnnotation, operandType.
Type
)],
13056
var reinferredGetResult = (MethodSymbol)AsMemberOfType(_visitResult.RValueType.
Type
, awaitableInfo.GetResult);
13298
@event = (EventSymbol)AsMemberOfType(ResultType.
Type
, @event);
13407
var resultTypeSymbol = resultType.
Type
;
13766
Debug.Assert(ResultType is TypeWithState {
Type
: FunctionPointerTypeSymbol { }, State: NullableFlowState.NotNull });
FlowAnalysis\NullableWalker_Patterns.cs (2)
413
Debug.Assert(isDerivedType(NominalSlotType(originalInputSlot), expressionTypeWithState.
Type
));
414
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);