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
)
411
expr.Type?.Equals(result.RValueType.
Type
, TypeCompareKind.AllIgnoreOptions) == true ? result.RValueType.
Type
: expr.Type);
547
Debug.Assert(AreCloseEnough(placeholder.Type, result.RValueType.
Type
));
2406
!targetType.Type.Equals(valueType.
Type
, TypeCompareKind.AllIgnoreOptions))
2454
return valueType.
Type
?.TypeKind == TypeKind.TypeParameter &&
2662
target.Type.Equals(assignedValue.
Type
, TypeCompareKind.AllIgnoreOptions);
3704
Debug.Assert((object?)resultType.
Type
!= _invalidType.
Type
);
3705
Debug.Assert(AreCloseEnough(resultType.
Type
, node.Type));
4542
Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.
Type
, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
4600
Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.
Type
, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
5007
var type = ResultType.
Type
as ArrayTypeSymbol;
5033
var expressionType = VisitRvalueWithState(node.Expression).
Type
;
5384
TypeSymbol asMemberOfType = getTypeIfContainingType(methodContainer, leftUnderlyingType.
Type
, leftOperand) ??
5385
getTypeIfContainingType(methodContainer, rightUnderlyingType.
Type
, rightOperand) ?? methodContainer;
5403
[new BoundExpressionWithNullability(leftOperand.Syntax, leftOperand, leftUnderlyingType.ToTypeWithAnnotations(compilation).NullableAnnotation, leftUnderlyingType.
Type
),
5404
new BoundExpressionWithNullability(rightOperand.Syntax, rightOperand, rightUnderlyingType.ToTypeWithAnnotations(compilation).NullableAnnotation, rightUnderlyingType.
Type
)],
5846
Debug.Assert(TypeSymbol.Equals(targetType.Type, rightResult.
Type
, TypeCompareKind.AllIgnoreOptions));
5889
var leftResultType = leftResult.
Type
;
5890
var rightResultType = rightResult.
Type
;
5943
Debug.Assert(conversionResult.
Type
is not null);
5944
return (conversionResult.
Type
!, conversionResult.State);
6193
refResultType = consequenceRValue.
Type
!.MergeEquivalentTypes(alternativeRValue.
Type
, VarianceKind.None);
6221
resultType = alternativeRValue.
Type
;
6225
resultType = consequenceRValue.
Type
;
6438
var rvalueType = _currentConditionalReceiverVisitResult.RValueType.
Type
;
6621
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
6740
isWellKnownEqualityMethodOrImplementation(compilation, method, receiverType.
Type
, WellKnownMember.System_Collections_Generic_IEqualityComparer_T__Equals))
6751
isWellKnownEqualityMethodOrImplementation(compilation, method, receiverType.
Type
, WellKnownMember.System_IEquatable_T__Equals)))
6969
var type = receiverType.
Type
;
7066
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
7071
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
7823
var argumentResultType = resultType.
Type
;
7908
hasNoNonNullableCounterpart(valueState.
Type
) &&
8090
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8096
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
8111
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8115
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
8130
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8134
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
8380
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
8647
return TypeWithState.Create(type.
Type
, state);
9463
if (operandType.
Type
?.IsTupleType == true || conversionOperand.Kind == BoundKind.TupleLiteral)
9474
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9485
if (AreNullableAndUnderlyingTypes(targetType, operandType.
Type
, out TypeWithAnnotations underlyingType))
9500
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9508
if (operandType.
Type
?.IsNullableType() == true && !targetType.IsNullableType())
9542
TrackNullableStateOfTupleConversion(conversionOpt, conversionOperand, conversion, targetType, operandType.
Type
, slot, valueSlot, assignmentKind, parameterOpt, reportWarnings: reportRemainingWarnings);
9552
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9570
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9580
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9604
ReportNullabilityMismatchInArgument(getDiagnosticLocation(), operandType.
Type
, parameterOpt, targetType, forOutput: false);
9608
ReportNullabilityMismatchInAssignment(getDiagnosticLocation(), GetTypeAsDiagnosticArgument(operandType.
Type
), targetType);
9649
var type = operandType.
Type
;
9680
var type = operandType.
Type
;
9873
Debug.Assert(operandType.
Type
is object);
9881
if (operandType.
Type
.IsNullableType() && !parameterType.IsNullableType())
9883
var underlyingOperandTypeWithAnnotations = operandType.
Type
.GetNullableUnderlyingTypeWithAnnotations();
10021
var type = typeWithState.
Type
;
10053
Debug.Assert(operandType.
Type
is object);
10056
var conversion = _conversions.ClassifyStandardConversion(operandType.
Type
, targetType.Type, ref discardedUseSiteInfo);
10061
ReportNullabilityMismatchInArgument(diagnosticLocation, operandType.
Type
, parameterOpt, targetType.Type, forOutput: false);
10065
ReportNullabilityMismatchInAssignment(diagnosticLocation, operandType.
Type
, targetType.Type);
10310
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
10683
Debug.Assert(rightResult.
Type
is object);
10694
deconstructMethod = (MethodSymbol)AsMemberOfType(rightResult.
Type
, deconstructMethod);
10838
AreNullableAndUnderlyingTypes(lvalueType.Type, operandType.
Type
, out TypeWithAnnotations underlyingType))
10973
SetResultType(node, TypeWithState.Create(receiverType.
Type
, NullableFlowState.NotNull));
10977
SetResultType(node, TypeWithState.Create(results[0].RValueType.
Type
, GetState(ref State, extensionReceiverSlot)));
10997
SetResultType(node, TypeWithState.Create(opType.
Type
, NullableFlowState.NotNull));
11151
SetResultType(node, TypeWithState.Create(receiverType.
Type
, NullableFlowState.NotNull));
11155
SetResultType(node, TypeWithState.Create(results[0].RValueType.
Type
, GetState(ref State, extensionReceiverSlot)));
11179
SetResultType(node, TypeWithState.Create(opType.
Type
, NullableFlowState.NotNull));
11378
var receiverType = VisitRvalueWithState(receiverOpt).
Type
;
11456
member = AsMemberOfType(receiverType.
Type
, member);
11470
if (PossiblyNullableType(resultType.
Type
))
11476
resultType = TypeWithState.Create(resultType.
Type
, state);
11581
var resultType = resultTypeWithState.
Type
;
11693
getEnumeratorType = spanType.Construct(ImmutableArray.Create(convertedResult.
Type
!.TryGetInlineArrayElementField()!.TypeWithAnnotations));
11697
getEnumeratorType = convertedResult.
Type
;
11713
var currentPropertyGetter = (MethodSymbol)AsMemberOfType(enumeratorReturnType.
Type
, enumeratorInfoOpt.CurrentPropertyGetter);
11993
method = (MethodSymbol)AsMemberOfType(operandType.
Type
!.StrippedType(), method);
12007
[new BoundExpressionWithNullability(operand.Syntax, operand, operandType.ToTypeWithAnnotations(compilation).NullableAnnotation, operandType.
Type
)],
12238
var reinferredGetResult = _visitResult.RValueType.
Type
is NamedTypeSymbol taskAwaiterType
12483
@event = (EventSymbol)AsMemberOfType(ResultType.
Type
, @event);
12592
var resultTypeSymbol = resultType.
Type
;
12898
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);