1 write to Type
Microsoft.CodeAnalysis.CSharp (1)
Symbols\TypeWithState.cs (1)
73
Type
= type;
94 references to Type
Microsoft.CodeAnalysis.CSharp (94)
FlowAnalysis\NullableWalker.cs (82)
130
Debug.Assert(TypeSymbol.Equals(RValueType.
Type
, LValueType.Type, TypeCompareKind.ConsiderEverything));
350
Debug.Assert(TypeAllowsConditionalState(visitResult.RValueType.
Type
)
411
expr.Type?.Equals(result.RValueType.
Type
, TypeCompareKind.AllIgnoreOptions) == true ? result.RValueType.
Type
: expr.Type);
547
Debug.Assert(AreCloseEnough(placeholder.Type, result.RValueType.
Type
));
2391
!targetType.Type.Equals(valueType.
Type
, TypeCompareKind.AllIgnoreOptions))
2439
return valueType.
Type
?.TypeKind == TypeKind.TypeParameter &&
2647
target.Type.Equals(assignedValue.
Type
, TypeCompareKind.AllIgnoreOptions);
3688
Debug.Assert((object?)resultType.
Type
!= _invalidType.
Type
);
3689
Debug.Assert(AreCloseEnough(resultType.
Type
, node.Type));
4472
Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.
Type
, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
4530
Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.
Type
, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
4937
var type = ResultType.
Type
as ArrayTypeSymbol;
4963
var expressionType = VisitRvalueWithState(node.Expression).
Type
;
5244
TypeSymbol asMemberOfType = getTypeIfContainingType(methodContainer, leftUnderlyingType.
Type
, leftOperand) ??
5245
getTypeIfContainingType(methodContainer, rightUnderlyingType.
Type
, rightOperand) ?? methodContainer;
5719
Debug.Assert(TypeSymbol.Equals(targetType.Type, rightResult.
Type
, TypeCompareKind.AllIgnoreOptions));
5762
var leftResultType = leftResult.
Type
;
5763
var rightResultType = rightResult.
Type
;
5816
Debug.Assert(conversionResult.
Type
is not null);
5817
return (conversionResult.
Type
!, conversionResult.State);
6065
refResultType = consequenceRValue.
Type
!.MergeEquivalentTypes(alternativeRValue.
Type
, VarianceKind.None);
6093
resultType = alternativeRValue.
Type
;
6097
resultType = consequenceRValue.
Type
;
6310
var rvalueType = _currentConditionalReceiverVisitResult.RValueType.
Type
;
6431
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
6474
isWellKnownEqualityMethodOrImplementation(compilation, method, receiverType.
Type
, WellKnownMember.System_Collections_Generic_IEqualityComparer_T__Equals))
6485
isWellKnownEqualityMethodOrImplementation(compilation, method, receiverType.
Type
, WellKnownMember.System_IEquatable_T__Equals)))
6698
var type = receiverType.
Type
;
6801
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
6806
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
7528
var argumentResultType = resultType.
Type
;
7613
hasNoNonNullableCounterpart(valueState.
Type
) &&
7795
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
7801
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
7816
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
7820
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
7835
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
7839
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
8080
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
8314
return TypeWithState.Create(type.
Type
, state);
9133
if (operandType.
Type
?.IsTupleType == true || conversionOperand.Kind == BoundKind.TupleLiteral)
9144
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9155
if (AreNullableAndUnderlyingTypes(targetType, operandType.
Type
, out TypeWithAnnotations underlyingType))
9170
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9178
if (operandType.
Type
?.IsNullableType() == true && !targetType.IsNullableType())
9212
TrackNullableStateOfTupleConversion(conversionOpt, conversionOperand, conversion, targetType, operandType.
Type
, slot, valueSlot, assignmentKind, parameterOpt, reportWarnings: reportRemainingWarnings);
9222
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9240
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9250
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9274
ReportNullabilityMismatchInArgument(getDiagnosticLocation(), operandType.
Type
, parameterOpt, targetType, forOutput: false);
9278
ReportNullabilityMismatchInAssignment(getDiagnosticLocation(), GetTypeAsDiagnosticArgument(operandType.
Type
), targetType);
9319
var type = operandType.
Type
;
9350
var type = operandType.
Type
;
9543
Debug.Assert(operandType.
Type
is object);
9551
if (operandType.
Type
.IsNullableType() && !parameterType.IsNullableType())
9553
var underlyingOperandTypeWithAnnotations = operandType.
Type
.GetNullableUnderlyingTypeWithAnnotations();
9691
var type = typeWithState.
Type
;
9723
Debug.Assert(operandType.
Type
is object);
9726
var conversion = _conversions.ClassifyStandardConversion(operandType.
Type
, targetType.Type, ref discardedUseSiteInfo);
9731
ReportNullabilityMismatchInArgument(diagnosticLocation, operandType.
Type
, parameterOpt, targetType.Type, forOutput: false);
9735
ReportNullabilityMismatchInAssignment(diagnosticLocation, operandType.
Type
, targetType.Type);
9979
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
10342
Debug.Assert(rightResult.
Type
is object);
10353
deconstructMethod = (MethodSymbol)AsMemberOfType(rightResult.
Type
, deconstructMethod);
10495
AreNullableAndUnderlyingTypes(lvalueType.Type, operandType.
Type
, out TypeWithAnnotations underlyingType))
10784
if (argumentType.
Type
is { } argType && IsNullabilityMismatch(paramType.Type, argType))
10869
var receiverType = VisitRvalueWithState(receiverOpt).
Type
;
10945
member = AsMemberOfType(receiverType.
Type
, member);
10959
if (PossiblyNullableType(resultType.
Type
))
10965
resultType = TypeWithState.Create(resultType.
Type
, state);
11070
var resultType = resultTypeWithState.
Type
;
11182
getEnumeratorType = spanType.Construct(ImmutableArray.Create(convertedResult.
Type
!.TryGetInlineArrayElementField()!.TypeWithAnnotations));
11186
getEnumeratorType = convertedResult.
Type
;
11202
var currentPropertyGetter = (MethodSymbol)AsMemberOfType(enumeratorReturnType.
Type
, enumeratorInfoOpt.CurrentPropertyGetter);
11442
method = (MethodSymbol)AsMemberOfType(operandType.
Type
!.StrippedType(), method);
11623
var reinferredGetResult = _visitResult.RValueType.
Type
is NamedTypeSymbol taskAwaiterType
11868
@event = (EventSymbol)AsMemberOfType(ResultType.
Type
, @event);
11977
var resultTypeSymbol = resultType.
Type
;
12283
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);