1 write to Type
Microsoft.CodeAnalysis.CSharp (1)
Symbols\TypeWithState.cs (1)
73
Type
= type;
104 references to Type
Microsoft.CodeAnalysis.CSharp (104)
FlowAnalysis\NullableWalker_Patterns.cs (2)
415
Debug.Assert(isDerivedType(NominalSlotType(originalInputSlot), expressionTypeWithState.
Type
));
416
tempMap.Add(rootTemp, (originalInputSlot, expressionTypeWithState.
Type
));
FlowAnalysis\NullableWalker.cs (92)
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);
2504
!targetType.Type.Equals(valueType.
Type
, TypeCompareKind.AllIgnoreOptions))
2552
return valueType.
Type
?.TypeKind == TypeKind.TypeParameter &&
2760
target.Type.Equals(assignedValue.
Type
, TypeCompareKind.AllIgnoreOptions);
4978
Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.
Type
, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
5385
var type = ResultType.
Type
as ArrayTypeSymbol;
5411
var expressionType = VisitRvalueWithState(node.Expression).
Type
;
5778
TypeSymbol asMemberOfType = getTypeIfContainingType(methodContainer, leftUnderlyingType.
Type
, leftOperand) ??
5779
getTypeIfContainingType(methodContainer, rightUnderlyingType.
Type
, rightOperand) ?? methodContainer;
5797
[new BoundExpressionWithNullability(leftOperand.Syntax, leftOperand, leftUnderlyingType.ToTypeWithAnnotations(compilation).NullableAnnotation, leftUnderlyingType.
Type
),
5798
new BoundExpressionWithNullability(rightOperand.Syntax, rightOperand, rightUnderlyingType.ToTypeWithAnnotations(compilation).NullableAnnotation, rightUnderlyingType.
Type
)],
6240
Debug.Assert(TypeSymbol.Equals(targetType.Type, rightResult.
Type
, TypeCompareKind.AllIgnoreOptions));
6283
var leftResultType = leftResult.
Type
;
6284
var rightResultType = rightResult.
Type
;
6339
Debug.Assert(conversionResult.
Type
is not null);
6340
return (conversionResult.
Type
!, conversionResult.State);
6589
refResultType = consequenceRValue.
Type
!.MergeEquivalentTypes(alternativeRValue.
Type
, VarianceKind.None);
6617
resultType = alternativeRValue.
Type
;
6621
resultType = consequenceRValue.
Type
;
6834
var rvalueType = _currentConditionalReceiverVisitResult.RValueType.
Type
;
7063
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
7072
ReinferenceResult<MethodSymbol> reinferenceResult = VisitArgumentsCore(node, receiverType.
Type
, arguments, refKindsOpt, parameters, argsToParamsOpt, defaultArguments,
7205
isWellKnownEqualityMethodOrImplementation(compilation, method, receiverType.
Type
, WellKnownMember.System_Collections_Generic_IEqualityComparer_T__Equals))
7216
isWellKnownEqualityMethodOrImplementation(compilation, method, receiverType.
Type
, WellKnownMember.System_IEquatable_T__Equals)))
7434
var type = receiverType.
Type
;
7539
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
7544
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8318
var argumentResultType = resultType.
Type
;
8403
hasNoNonNullableCounterpart(valueState.
Type
) &&
8605
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8611
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
8626
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8630
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
8645
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8649
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
8941
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
9219
return TypeWithState.Create(type.
Type
, state);
9697
if (PossiblyNullableType(valueFieldType.
Type
))
9702
valueFieldType = TypeWithState.Create(valueFieldType.
Type
, GetState(ref this.State, valueFieldSlot));
9706
var conversionOperand = new BoundValueForNullableAnalysis(convertedNode.Syntax, originalExpression: null, valueFieldType.
Type
);
10131
if (operandType.
Type
?.IsTupleType == true || conversionOperand.Kind == BoundKind.TupleLiteral)
10143
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
10154
if (AreNullableAndUnderlyingTypes(targetType, operandType.
Type
, out TypeWithAnnotations underlyingType))
10169
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
10177
if (operandType.
Type
?.IsNullableType() == true && !targetType.IsNullableType())
10213
TrackNullableStateOfTupleConversion(conversionOpt, conversionOperand, conversion, targetType, operandType.
Type
, fromExplicitCast: fromExplicitCast, slot, valueSlot, assignmentKind, parameterOpt, reportWarnings: reportRemainingWarnings);
10224
canConvertNestedNullability = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false).Exists;
10262
Conversion generated = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
10271
Conversion generated = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
10295
ReportNullabilityMismatchInArgument(getDiagnosticLocation(), operandType.
Type
, parameterOpt, targetType, forOutput: false);
10299
ReportNullabilityMismatchInAssignment(getDiagnosticLocation(), GetTypeAsDiagnosticArgument(operandType.
Type
), targetType);
10340
var type = operandType.
Type
;
10371
var type = operandType.
Type
;
10571
Debug.Assert(operandType.
Type
is object);
10579
if (operandType.
Type
.IsNullableType() && !parameterType.IsNullableType())
10581
var underlyingOperandTypeWithAnnotations = operandType.
Type
.GetNullableUnderlyingTypeWithAnnotations();
10768
Debug.Assert(operandType.
Type
is object);
10895
var type = typeWithState.
Type
;
10927
Debug.Assert(operandType.
Type
is object);
10930
var conversion = _conversions.ClassifyStandardConversion(operandType.
Type
, targetType.Type, ref discardedUseSiteInfo);
10935
ReportNullabilityMismatchInArgument(diagnosticLocation, operandType.
Type
, parameterOpt, targetType.Type, forOutput: false);
10939
ReportNullabilityMismatchInAssignment(diagnosticLocation, operandType.
Type
, targetType.Type);
11184
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
11560
Debug.Assert(rightResult.
Type
is object);
11571
deconstructMethod = (MethodSymbol)AsMemberOfType(rightResult.
Type
, deconstructMethod);
11717
AreNullableAndUnderlyingTypes(lvalueType.Type, operandType.
Type
, out TypeWithAnnotations underlyingType))
11855
SetResultType(node, TypeWithState.Create(receiverType.
Type
, NullableFlowState.NotNull));
11859
SetResultType(node, TypeWithState.Create(results[0].RValueType.
Type
, GetState(ref State, extensionReceiverSlot)));
11879
SetResultType(node, TypeWithState.Create(opType.
Type
, NullableFlowState.NotNull));
12048
SetResultType(node, TypeWithState.Create(receiverType.
Type
, NullableFlowState.NotNull));
12052
SetResultType(node, TypeWithState.Create(results[0].RValueType.
Type
, GetState(ref State, extensionReceiverSlot)));
12076
SetResultType(node, TypeWithState.Create(opType.
Type
, NullableFlowState.NotNull));
12330
var receiverType = VisitRvalueWithState(receiverOpt).
Type
;
12408
member = AsMemberOfType(receiverType.
Type
, member);
12412
receiverType.
Type
is NamedTypeSymbol { IsUnionType: true } unionType &&
12425
var memberAnnotations = GetRValueAnnotations(containingSlotOpt: -1, receiverTypeForMemberAccessOpt: receiverType.
Type
, symbol: member);
12430
if (PossiblyNullableType(resultType.
Type
))
12436
resultType = TypeWithState.Create(resultType.
Type
, state);
12558
var resultType = resultTypeWithState.
Type
;
12676
getEnumeratorType = spanType.Construct(ImmutableArray.Create(convertedResult.
Type
!.TryGetInlineArrayElementField()!.TypeWithAnnotations));
12680
getEnumeratorType = convertedResult.
Type
;
12696
var currentPropertyGetter = (MethodSymbol)AsMemberOfType(enumeratorReturnType.
Type
, enumeratorInfoOpt.CurrentPropertyGetter);
12973
method = (MethodSymbol)AsMemberOfType(operandType.
Type
!.StrippedType(), method);
12987
[new BoundExpressionWithNullability(operand.Syntax, operand, operandType.ToTypeWithAnnotations(compilation).NullableAnnotation, operandType.
Type
)],
13219
var reinferredGetResult = (MethodSymbol)AsMemberOfType(_visitResult.RValueType.
Type
, awaitableInfo.GetResult);
13461
@event = (EventSymbol)AsMemberOfType(ResultType.
Type
, @event);
13570
var resultTypeSymbol = resultType.
Type
;
13937
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);