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
));
2371
!targetType.Type.Equals(valueType.
Type
, TypeCompareKind.AllIgnoreOptions))
2419
return valueType.
Type
?.TypeKind == TypeKind.TypeParameter &&
2627
target.Type.Equals(assignedValue.
Type
, TypeCompareKind.AllIgnoreOptions);
3609
Debug.Assert((object?)resultType.
Type
!= _invalidType.
Type
);
3610
Debug.Assert(AreCloseEnough(resultType.
Type
, node.Type));
4393
Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.
Type
, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
4451
Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.
Type
, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
4856
var type = ResultType.
Type
as ArrayTypeSymbol;
4882
var expressionType = VisitRvalueWithState(node.Expression).
Type
;
5163
TypeSymbol asMemberOfType = getTypeIfContainingType(methodContainer, leftUnderlyingType.
Type
, leftOperand) ??
5164
getTypeIfContainingType(methodContainer, rightUnderlyingType.
Type
, rightOperand) ?? methodContainer;
5638
Debug.Assert(TypeSymbol.Equals(targetType.Type, rightResult.
Type
, TypeCompareKind.AllIgnoreOptions));
5681
var leftResultType = leftResult.
Type
;
5682
var rightResultType = rightResult.
Type
;
5735
Debug.Assert(conversionResult.
Type
is not null);
5736
return (conversionResult.
Type
!, conversionResult.State);
5984
refResultType = consequenceRValue.
Type
!.MergeEquivalentTypes(alternativeRValue.
Type
, VarianceKind.None);
6012
resultType = alternativeRValue.
Type
;
6016
resultType = consequenceRValue.
Type
;
6229
var rvalueType = _currentConditionalReceiverVisitResult.RValueType.
Type
;
6348
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
6391
isWellKnownEqualityMethodOrImplementation(compilation, method, receiverType.
Type
, WellKnownMember.System_Collections_Generic_IEqualityComparer_T__Equals))
6402
isWellKnownEqualityMethodOrImplementation(compilation, method, receiverType.
Type
, WellKnownMember.System_IEquatable_T__Equals)))
6615
var type = receiverType.
Type
;
6712
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
6717
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
7439
var argumentResultType = resultType.
Type
;
7524
hasNoNonNullableCounterpart(valueState.
Type
) &&
7706
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
7712
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
7727
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
7731
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
7746
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
7750
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
7991
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
8225
return TypeWithState.Create(type.
Type
, state);
9040
if (operandType.
Type
?.IsTupleType == true || conversionOperand.Kind == BoundKind.TupleLiteral)
9051
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9062
if (AreNullableAndUnderlyingTypes(targetType, operandType.
Type
, out TypeWithAnnotations underlyingType))
9077
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9085
if (operandType.
Type
?.IsNullableType() == true && !targetType.IsNullableType())
9119
TrackNullableStateOfTupleConversion(conversionOpt, conversionOperand, conversion, targetType, operandType.
Type
, slot, valueSlot, assignmentKind, parameterOpt, reportWarnings: reportRemainingWarnings);
9129
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9147
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9157
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9181
ReportNullabilityMismatchInArgument(getDiagnosticLocation(), operandType.
Type
, parameterOpt, targetType, forOutput: false);
9185
ReportNullabilityMismatchInAssignment(getDiagnosticLocation(), GetTypeAsDiagnosticArgument(operandType.
Type
), targetType);
9226
var type = operandType.
Type
;
9257
var type = operandType.
Type
;
9450
Debug.Assert(operandType.
Type
is object);
9458
if (operandType.
Type
.IsNullableType() && !parameterType.IsNullableType())
9460
var underlyingOperandTypeWithAnnotations = operandType.
Type
.GetNullableUnderlyingTypeWithAnnotations();
9598
var type = typeWithState.
Type
;
9630
Debug.Assert(operandType.
Type
is object);
9633
var conversion = _conversions.ClassifyStandardConversion(operandType.
Type
, targetType.Type, ref discardedUseSiteInfo);
9638
ReportNullabilityMismatchInArgument(diagnosticLocation, operandType.
Type
, parameterOpt, targetType.Type, forOutput: false);
9642
ReportNullabilityMismatchInAssignment(diagnosticLocation, operandType.
Type
, targetType.Type);
9885
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
10234
Debug.Assert(rightResult.
Type
is object);
10244
deconstructMethod = (MethodSymbol)AsMemberOfType(rightResult.
Type
, deconstructMethod);
10386
AreNullableAndUnderlyingTypes(lvalueType.Type, operandType.
Type
, out TypeWithAnnotations underlyingType))
10675
if (argumentType.
Type
is { } argType && IsNullabilityMismatch(paramType.Type, argType))
10760
var receiverType = VisitRvalueWithState(receiverOpt).
Type
;
10836
member = AsMemberOfType(receiverType.
Type
, member);
10850
if (PossiblyNullableType(resultType.
Type
))
10856
resultType = TypeWithState.Create(resultType.
Type
, state);
10961
var resultType = resultTypeWithState.
Type
;
11073
getEnumeratorType = spanType.Construct(ImmutableArray.Create(convertedResult.
Type
!.TryGetInlineArrayElementField()!.TypeWithAnnotations));
11077
getEnumeratorType = convertedResult.
Type
;
11093
var currentPropertyGetter = (MethodSymbol)AsMemberOfType(enumeratorReturnType.
Type
, enumeratorInfoOpt.CurrentPropertyGetter);
11333
method = (MethodSymbol)AsMemberOfType(operandType.
Type
!.StrippedType(), method);
11514
var reinferredGetResult = _visitResult.RValueType.
Type
is NamedTypeSymbol taskAwaiterType
11759
@event = (EventSymbol)AsMemberOfType(ResultType.
Type
, @event);
11868
var resultTypeSymbol = resultType.
Type
;
12174
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);