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));
344
Debug.Assert(TypeAllowsConditionalState(visitResult.RValueType.
Type
)
405
expr.Type?.Equals(result.RValueType.
Type
, TypeCompareKind.AllIgnoreOptions) == true ? result.RValueType.
Type
: expr.Type);
539
Debug.Assert(AreCloseEnough(placeholder.Type, result.RValueType.
Type
));
2369
!targetType.Type.Equals(valueType.
Type
, TypeCompareKind.AllIgnoreOptions))
2417
return valueType.
Type
?.TypeKind == TypeKind.TypeParameter &&
2625
target.Type.Equals(assignedValue.
Type
, TypeCompareKind.AllIgnoreOptions);
3607
Debug.Assert((object?)resultType.
Type
!= _invalidType.
Type
);
3608
Debug.Assert(AreCloseEnough(resultType.
Type
, node.Type));
4388
Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.
Type
, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
4446
Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.
Type
, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
4851
var type = ResultType.
Type
as ArrayTypeSymbol;
4877
var expressionType = VisitRvalueWithState(node.Expression).
Type
;
5158
TypeSymbol asMemberOfType = getTypeIfContainingType(methodContainer, leftUnderlyingType.
Type
, leftOperand) ??
5159
getTypeIfContainingType(methodContainer, rightUnderlyingType.
Type
, rightOperand) ?? methodContainer;
5633
Debug.Assert(TypeSymbol.Equals(targetType.Type, rightResult.
Type
, TypeCompareKind.AllIgnoreOptions));
5676
var leftResultType = leftResult.
Type
;
5677
var rightResultType = rightResult.
Type
;
5730
Debug.Assert(conversionResult.
Type
is not null);
5731
return (conversionResult.
Type
!, conversionResult.State);
5979
refResultType = consequenceRValue.
Type
!.MergeEquivalentTypes(alternativeRValue.
Type
, VarianceKind.None);
6007
resultType = alternativeRValue.
Type
;
6011
resultType = consequenceRValue.
Type
;
6224
var rvalueType = _currentConditionalReceiverVisitResult.RValueType.
Type
;
6343
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
6386
isWellKnownEqualityMethodOrImplementation(compilation, method, receiverType.
Type
, WellKnownMember.System_Collections_Generic_IEqualityComparer_T__Equals))
6397
isWellKnownEqualityMethodOrImplementation(compilation, method, receiverType.
Type
, WellKnownMember.System_IEquatable_T__Equals)))
6610
var type = receiverType.
Type
;
6707
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
6712
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
7428
var argumentResultType = resultType.
Type
;
7513
hasNoNonNullableCounterpart(valueState.
Type
) &&
7695
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
7701
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
7716
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
7720
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
7735
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
7739
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
7980
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
8214
return TypeWithState.Create(type.
Type
, state);
9029
if (operandType.
Type
?.IsTupleType == true || conversionOperand.Kind == BoundKind.TupleLiteral)
9040
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9051
if (AreNullableAndUnderlyingTypes(targetType, operandType.
Type
, out TypeWithAnnotations underlyingType))
9066
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9074
if (operandType.
Type
?.IsNullableType() == true && !targetType.IsNullableType())
9108
TrackNullableStateOfTupleConversion(conversionOpt, conversionOperand, conversion, targetType, operandType.
Type
, slot, valueSlot, assignmentKind, parameterOpt, reportWarnings: reportRemainingWarnings);
9118
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9136
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9146
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9170
ReportNullabilityMismatchInArgument(getDiagnosticLocation(), operandType.
Type
, parameterOpt, targetType, forOutput: false);
9174
ReportNullabilityMismatchInAssignment(getDiagnosticLocation(), GetTypeAsDiagnosticArgument(operandType.
Type
), targetType);
9215
var type = operandType.
Type
;
9246
var type = operandType.
Type
;
9439
Debug.Assert(operandType.
Type
is object);
9447
if (operandType.
Type
.IsNullableType() && !parameterType.IsNullableType())
9449
var underlyingOperandTypeWithAnnotations = operandType.
Type
.GetNullableUnderlyingTypeWithAnnotations();
9587
var type = typeWithState.
Type
;
9619
Debug.Assert(operandType.
Type
is object);
9622
var conversion = _conversions.ClassifyStandardConversion(operandType.
Type
, targetType.Type, ref discardedUseSiteInfo);
9627
ReportNullabilityMismatchInArgument(diagnosticLocation, operandType.
Type
, parameterOpt, targetType.Type, forOutput: false);
9631
ReportNullabilityMismatchInAssignment(diagnosticLocation, operandType.
Type
, targetType.Type);
9874
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
10223
Debug.Assert(rightResult.
Type
is object);
10233
deconstructMethod = (MethodSymbol)AsMemberOfType(rightResult.
Type
, deconstructMethod);
10375
AreNullableAndUnderlyingTypes(lvalueType.Type, operandType.
Type
, out TypeWithAnnotations underlyingType))
10664
if (argumentType.
Type
is { } argType && IsNullabilityMismatch(paramType.Type, argType))
10749
var receiverType = VisitRvalueWithState(receiverOpt).
Type
;
10825
member = AsMemberOfType(receiverType.
Type
, member);
10839
if (PossiblyNullableType(resultType.
Type
))
10845
resultType = TypeWithState.Create(resultType.
Type
, state);
10950
var resultType = resultTypeWithState.
Type
;
11062
getEnumeratorType = spanType.Construct(ImmutableArray.Create(convertedResult.
Type
!.TryGetInlineArrayElementField()!.TypeWithAnnotations));
11066
getEnumeratorType = convertedResult.
Type
;
11082
var currentPropertyGetter = (MethodSymbol)AsMemberOfType(enumeratorReturnType.
Type
, enumeratorInfoOpt.CurrentPropertyGetter);
11322
method = (MethodSymbol)AsMemberOfType(operandType.
Type
!.StrippedType(), method);
11503
var reinferredGetResult = _visitResult.RValueType.
Type
is NamedTypeSymbol taskAwaiterType
11748
@event = (EventSymbol)AsMemberOfType(ResultType.
Type
, @event);
11857
var resultTypeSymbol = resultType.
Type
;
12163
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);