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);
3726
Debug.Assert((object?)resultType.
Type
!= _invalidType.
Type
);
3727
Debug.Assert(AreCloseEnough(resultType.
Type
, node.Type));
4601
Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.
Type
, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
4659
Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.
Type
, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
5066
var type = ResultType.
Type
as ArrayTypeSymbol;
5092
var expressionType = VisitRvalueWithState(node.Expression).
Type
;
5443
TypeSymbol asMemberOfType = getTypeIfContainingType(methodContainer, leftUnderlyingType.
Type
, leftOperand) ??
5444
getTypeIfContainingType(methodContainer, rightUnderlyingType.
Type
, rightOperand) ?? methodContainer;
5462
[new BoundExpressionWithNullability(leftOperand.Syntax, leftOperand, leftUnderlyingType.ToTypeWithAnnotations(compilation).NullableAnnotation, leftUnderlyingType.
Type
),
5463
new BoundExpressionWithNullability(rightOperand.Syntax, rightOperand, rightUnderlyingType.ToTypeWithAnnotations(compilation).NullableAnnotation, rightUnderlyingType.
Type
)],
5905
Debug.Assert(TypeSymbol.Equals(targetType.Type, rightResult.
Type
, TypeCompareKind.AllIgnoreOptions));
5948
var leftResultType = leftResult.
Type
;
5949
var rightResultType = rightResult.
Type
;
6002
Debug.Assert(conversionResult.
Type
is not null);
6003
return (conversionResult.
Type
!, conversionResult.State);
6252
refResultType = consequenceRValue.
Type
!.MergeEquivalentTypes(alternativeRValue.
Type
, VarianceKind.None);
6280
resultType = alternativeRValue.
Type
;
6284
resultType = consequenceRValue.
Type
;
6497
var rvalueType = _currentConditionalReceiverVisitResult.RValueType.
Type
;
6721
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
6841
isWellKnownEqualityMethodOrImplementation(compilation, method, receiverType.
Type
, WellKnownMember.System_Collections_Generic_IEqualityComparer_T__Equals))
6852
isWellKnownEqualityMethodOrImplementation(compilation, method, receiverType.
Type
, WellKnownMember.System_IEquatable_T__Equals)))
7070
var type = receiverType.
Type
;
7167
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
7172
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
7919
var argumentResultType = resultType.
Type
;
8004
hasNoNonNullableCounterpart(valueState.
Type
) &&
8186
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8192
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
8207
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8211
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
8226
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8230
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
8522
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
8789
return TypeWithState.Create(type.
Type
, state);
9606
if (operandType.
Type
?.IsTupleType == true || conversionOperand.Kind == BoundKind.TupleLiteral)
9617
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9628
if (AreNullableAndUnderlyingTypes(targetType, operandType.
Type
, out TypeWithAnnotations underlyingType))
9643
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9651
if (operandType.
Type
?.IsNullableType() == true && !targetType.IsNullableType())
9685
TrackNullableStateOfTupleConversion(conversionOpt, conversionOperand, conversion, targetType, operandType.
Type
, slot, valueSlot, assignmentKind, parameterOpt, reportWarnings: reportRemainingWarnings);
9695
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9713
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9723
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9747
ReportNullabilityMismatchInArgument(getDiagnosticLocation(), operandType.
Type
, parameterOpt, targetType, forOutput: false);
9751
ReportNullabilityMismatchInAssignment(getDiagnosticLocation(), GetTypeAsDiagnosticArgument(operandType.
Type
), targetType);
9792
var type = operandType.
Type
;
9823
var type = operandType.
Type
;
10024
Debug.Assert(operandType.
Type
is object);
10032
if (operandType.
Type
.IsNullableType() && !parameterType.IsNullableType())
10034
var underlyingOperandTypeWithAnnotations = operandType.
Type
.GetNullableUnderlyingTypeWithAnnotations();
10172
var type = typeWithState.
Type
;
10204
Debug.Assert(operandType.
Type
is object);
10207
var conversion = _conversions.ClassifyStandardConversion(operandType.
Type
, targetType.Type, ref discardedUseSiteInfo);
10212
ReportNullabilityMismatchInArgument(diagnosticLocation, operandType.
Type
, parameterOpt, targetType.Type, forOutput: false);
10216
ReportNullabilityMismatchInAssignment(diagnosticLocation, operandType.
Type
, targetType.Type);
10461
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
10832
Debug.Assert(rightResult.
Type
is object);
10843
deconstructMethod = (MethodSymbol)AsMemberOfType(rightResult.
Type
, deconstructMethod);
10987
AreNullableAndUnderlyingTypes(lvalueType.Type, operandType.
Type
, out TypeWithAnnotations underlyingType))
11121
SetResultType(node, TypeWithState.Create(receiverType.
Type
, NullableFlowState.NotNull));
11125
SetResultType(node, TypeWithState.Create(results[0].RValueType.
Type
, GetState(ref State, extensionReceiverSlot)));
11145
SetResultType(node, TypeWithState.Create(opType.
Type
, NullableFlowState.NotNull));
11298
SetResultType(node, TypeWithState.Create(receiverType.
Type
, NullableFlowState.NotNull));
11302
SetResultType(node, TypeWithState.Create(results[0].RValueType.
Type
, GetState(ref State, extensionReceiverSlot)));
11326
SetResultType(node, TypeWithState.Create(opType.
Type
, NullableFlowState.NotNull));
11531
var receiverType = VisitRvalueWithState(receiverOpt).
Type
;
11609
member = AsMemberOfType(receiverType.
Type
, member);
11623
if (PossiblyNullableType(resultType.
Type
))
11629
resultType = TypeWithState.Create(resultType.
Type
, state);
11732
var resultType = resultTypeWithState.
Type
;
11849
getEnumeratorType = spanType.Construct(ImmutableArray.Create(convertedResult.
Type
!.TryGetInlineArrayElementField()!.TypeWithAnnotations));
11853
getEnumeratorType = convertedResult.
Type
;
11869
var currentPropertyGetter = (MethodSymbol)AsMemberOfType(enumeratorReturnType.
Type
, enumeratorInfoOpt.CurrentPropertyGetter);
12156
method = (MethodSymbol)AsMemberOfType(operandType.
Type
!.StrippedType(), method);
12170
[new BoundExpressionWithNullability(operand.Syntax, operand, operandType.ToTypeWithAnnotations(compilation).NullableAnnotation, operandType.
Type
)],
12401
var reinferredGetResult = _visitResult.RValueType.
Type
is NamedTypeSymbol taskAwaiterType
12646
@event = (EventSymbol)AsMemberOfType(ResultType.
Type
, @event);
12755
var resultTypeSymbol = resultType.
Type
;
13061
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);