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)
130
Debug.Assert(TypeSymbol.Equals(RValueType.
Type
, LValueType.Type, TypeCompareKind.ConsiderEverything));
350
Debug.Assert(TypeAllowsConditionalState(visitResult.RValueType.
Type
)
417
expr.Type?.Equals(result.RValueType.
Type
, TypeCompareKind.AllIgnoreOptions) == true ? result.RValueType.
Type
: expr.Type);
553
Debug.Assert(AreCloseEnough(placeholder.Type, result.RValueType.
Type
));
2412
!targetType.Type.Equals(valueType.
Type
, TypeCompareKind.AllIgnoreOptions))
2460
return valueType.
Type
?.TypeKind == TypeKind.TypeParameter &&
2668
target.Type.Equals(assignedValue.
Type
, TypeCompareKind.AllIgnoreOptions);
3710
Debug.Assert((object?)resultType.
Type
!= _invalidType.
Type
);
3711
Debug.Assert(AreCloseEnough(resultType.
Type
, node.Type));
4549
Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.
Type
, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
4607
Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.
Type
, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
5014
var type = ResultType.
Type
as ArrayTypeSymbol;
5040
var expressionType = VisitRvalueWithState(node.Expression).
Type
;
5391
TypeSymbol asMemberOfType = getTypeIfContainingType(methodContainer, leftUnderlyingType.
Type
, leftOperand) ??
5392
getTypeIfContainingType(methodContainer, rightUnderlyingType.
Type
, rightOperand) ?? methodContainer;
5410
[new BoundExpressionWithNullability(leftOperand.Syntax, leftOperand, leftUnderlyingType.ToTypeWithAnnotations(compilation).NullableAnnotation, leftUnderlyingType.
Type
),
5411
new BoundExpressionWithNullability(rightOperand.Syntax, rightOperand, rightUnderlyingType.ToTypeWithAnnotations(compilation).NullableAnnotation, rightUnderlyingType.
Type
)],
5853
Debug.Assert(TypeSymbol.Equals(targetType.Type, rightResult.
Type
, TypeCompareKind.AllIgnoreOptions));
5896
var leftResultType = leftResult.
Type
;
5897
var rightResultType = rightResult.
Type
;
5950
Debug.Assert(conversionResult.
Type
is not null);
5951
return (conversionResult.
Type
!, conversionResult.State);
6200
refResultType = consequenceRValue.
Type
!.MergeEquivalentTypes(alternativeRValue.
Type
, VarianceKind.None);
6228
resultType = alternativeRValue.
Type
;
6232
resultType = consequenceRValue.
Type
;
6445
var rvalueType = _currentConditionalReceiverVisitResult.RValueType.
Type
;
6628
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
6748
isWellKnownEqualityMethodOrImplementation(compilation, method, receiverType.
Type
, WellKnownMember.System_Collections_Generic_IEqualityComparer_T__Equals))
6759
isWellKnownEqualityMethodOrImplementation(compilation, method, receiverType.
Type
, WellKnownMember.System_IEquatable_T__Equals)))
6977
var type = receiverType.
Type
;
7074
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
7079
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
7826
var argumentResultType = resultType.
Type
;
7911
hasNoNonNullableCounterpart(valueState.
Type
) &&
8093
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8099
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
8114
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8118
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
8133
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8137
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
8383
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
8650
return TypeWithState.Create(type.
Type
, state);
9467
if (operandType.
Type
?.IsTupleType == true || conversionOperand.Kind == BoundKind.TupleLiteral)
9478
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9489
if (AreNullableAndUnderlyingTypes(targetType, operandType.
Type
, out TypeWithAnnotations underlyingType))
9504
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9512
if (operandType.
Type
?.IsNullableType() == true && !targetType.IsNullableType())
9546
TrackNullableStateOfTupleConversion(conversionOpt, conversionOperand, conversion, targetType, operandType.
Type
, slot, valueSlot, assignmentKind, parameterOpt, reportWarnings: reportRemainingWarnings);
9556
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9574
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9584
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9608
ReportNullabilityMismatchInArgument(getDiagnosticLocation(), operandType.
Type
, parameterOpt, targetType, forOutput: false);
9612
ReportNullabilityMismatchInAssignment(getDiagnosticLocation(), GetTypeAsDiagnosticArgument(operandType.
Type
), targetType);
9653
var type = operandType.
Type
;
9684
var type = operandType.
Type
;
9885
Debug.Assert(operandType.
Type
is object);
9893
if (operandType.
Type
.IsNullableType() && !parameterType.IsNullableType())
9895
var underlyingOperandTypeWithAnnotations = operandType.
Type
.GetNullableUnderlyingTypeWithAnnotations();
10033
var type = typeWithState.
Type
;
10065
Debug.Assert(operandType.
Type
is object);
10068
var conversion = _conversions.ClassifyStandardConversion(operandType.
Type
, targetType.Type, ref discardedUseSiteInfo);
10073
ReportNullabilityMismatchInArgument(diagnosticLocation, operandType.
Type
, parameterOpt, targetType.Type, forOutput: false);
10077
ReportNullabilityMismatchInAssignment(diagnosticLocation, operandType.
Type
, targetType.Type);
10322
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
10695
Debug.Assert(rightResult.
Type
is object);
10706
deconstructMethod = (MethodSymbol)AsMemberOfType(rightResult.
Type
, deconstructMethod);
10850
AreNullableAndUnderlyingTypes(lvalueType.Type, operandType.
Type
, out TypeWithAnnotations underlyingType))
10985
SetResultType(node, TypeWithState.Create(receiverType.
Type
, NullableFlowState.NotNull));
10989
SetResultType(node, TypeWithState.Create(results[0].RValueType.
Type
, GetState(ref State, extensionReceiverSlot)));
11009
SetResultType(node, TypeWithState.Create(opType.
Type
, NullableFlowState.NotNull));
11163
SetResultType(node, TypeWithState.Create(receiverType.
Type
, NullableFlowState.NotNull));
11167
SetResultType(node, TypeWithState.Create(results[0].RValueType.
Type
, GetState(ref State, extensionReceiverSlot)));
11191
SetResultType(node, TypeWithState.Create(opType.
Type
, NullableFlowState.NotNull));
11396
var receiverType = VisitRvalueWithState(receiverOpt).
Type
;
11474
member = AsMemberOfType(receiverType.
Type
, member);
11488
if (PossiblyNullableType(resultType.
Type
))
11494
resultType = TypeWithState.Create(resultType.
Type
, state);
11599
var resultType = resultTypeWithState.
Type
;
11717
getEnumeratorType = spanType.Construct(ImmutableArray.Create(convertedResult.
Type
!.TryGetInlineArrayElementField()!.TypeWithAnnotations));
11721
getEnumeratorType = convertedResult.
Type
;
11737
var currentPropertyGetter = (MethodSymbol)AsMemberOfType(enumeratorReturnType.
Type
, enumeratorInfoOpt.CurrentPropertyGetter);
12017
method = (MethodSymbol)AsMemberOfType(operandType.
Type
!.StrippedType(), method);
12031
[new BoundExpressionWithNullability(operand.Syntax, operand, operandType.ToTypeWithAnnotations(compilation).NullableAnnotation, operandType.
Type
)],
12262
var reinferredGetResult = _visitResult.RValueType.
Type
is NamedTypeSymbol taskAwaiterType
12507
@event = (EventSymbol)AsMemberOfType(ResultType.
Type
, @event);
12616
var resultTypeSymbol = resultType.
Type
;
12922
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);