1 write to Type
Microsoft.CodeAnalysis.CSharp (1)
Symbols\TypeWithState.cs (1)
73
Type
= type;
107 references to Type
Microsoft.CodeAnalysis.CSharp (107)
FlowAnalysis\NullableWalker.cs (95)
149
Debug.Assert(TypeSymbol.Equals(RValueType.
Type
, LValueType.Type, TypeCompareKind.ConsiderEverything));
369
Debug.Assert(TypeAllowsConditionalState(visitResult.RValueType.
Type
)
436
expr.Type?.Equals(result.RValueType.
Type
, TypeCompareKind.AllIgnoreOptions) == true ? result.RValueType.
Type
: expr.Type);
574
Debug.Assert(AreCloseEnough(placeholder.Type, result.RValueType.
Type
));
2431
!targetType.Type.Equals(valueType.
Type
, TypeCompareKind.AllIgnoreOptions))
2479
return valueType.
Type
?.TypeKind == TypeKind.TypeParameter &&
2687
target.Type.Equals(assignedValue.
Type
, TypeCompareKind.AllIgnoreOptions);
3754
Debug.Assert((object?)resultType.
Type
!= _invalidType.
Type
);
3755
Debug.Assert(AreCloseEnough(resultType.
Type
, node.Type));
4830
Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.
Type
, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
4888
Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.
Type
, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
5295
var type = ResultType.
Type
as ArrayTypeSymbol;
5321
var expressionType = VisitRvalueWithState(node.Expression).
Type
;
5672
TypeSymbol asMemberOfType = getTypeIfContainingType(methodContainer, leftUnderlyingType.
Type
, leftOperand) ??
5673
getTypeIfContainingType(methodContainer, rightUnderlyingType.
Type
, rightOperand) ?? methodContainer;
5691
[new BoundExpressionWithNullability(leftOperand.Syntax, leftOperand, leftUnderlyingType.ToTypeWithAnnotations(compilation).NullableAnnotation, leftUnderlyingType.
Type
),
5692
new BoundExpressionWithNullability(rightOperand.Syntax, rightOperand, rightUnderlyingType.ToTypeWithAnnotations(compilation).NullableAnnotation, rightUnderlyingType.
Type
)],
6134
Debug.Assert(TypeSymbol.Equals(targetType.Type, rightResult.
Type
, TypeCompareKind.AllIgnoreOptions));
6177
var leftResultType = leftResult.
Type
;
6178
var rightResultType = rightResult.
Type
;
6233
Debug.Assert(conversionResult.
Type
is not null);
6234
return (conversionResult.
Type
!, conversionResult.State);
6483
refResultType = consequenceRValue.
Type
!.MergeEquivalentTypes(alternativeRValue.
Type
, VarianceKind.None);
6511
resultType = alternativeRValue.
Type
;
6515
resultType = consequenceRValue.
Type
;
6728
var rvalueType = _currentConditionalReceiverVisitResult.RValueType.
Type
;
6957
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
7078
isWellKnownEqualityMethodOrImplementation(compilation, method, receiverType.
Type
, WellKnownMember.System_Collections_Generic_IEqualityComparer_T__Equals))
7089
isWellKnownEqualityMethodOrImplementation(compilation, method, receiverType.
Type
, WellKnownMember.System_IEquatable_T__Equals)))
7307
var type = receiverType.
Type
;
7404
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
7409
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8174
var argumentResultType = resultType.
Type
;
8259
hasNoNonNullableCounterpart(valueState.
Type
) &&
8466
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8472
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
8487
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8491
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
8506
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8510
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
8802
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
9080
return TypeWithState.Create(type.
Type
, state);
9558
if (PossiblyNullableType(valueFieldType.
Type
))
9563
valueFieldType = TypeWithState.Create(valueFieldType.
Type
, GetState(ref this.State, valueFieldSlot));
9567
var conversionOperand = new BoundValueForNullableAnalysis(convertedNode.Syntax, originalExpression: null, valueFieldType.
Type
);
9994
if (operandType.
Type
?.IsTupleType == true || conversionOperand.Kind == BoundKind.TupleLiteral)
10006
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
10017
if (AreNullableAndUnderlyingTypes(targetType, operandType.
Type
, out TypeWithAnnotations underlyingType))
10032
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
10040
if (operandType.
Type
?.IsNullableType() == true && !targetType.IsNullableType())
10076
TrackNullableStateOfTupleConversion(conversionOpt, conversionOperand, conversion, targetType, operandType.
Type
, fromExplicitCast: fromExplicitCast, slot, valueSlot, assignmentKind, parameterOpt, reportWarnings: reportRemainingWarnings);
10087
canConvertNestedNullability = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false).Exists;
10125
Conversion generated = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
10134
Conversion generated = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
10158
ReportNullabilityMismatchInArgument(getDiagnosticLocation(), operandType.
Type
, parameterOpt, targetType, forOutput: false);
10162
ReportNullabilityMismatchInAssignment(getDiagnosticLocation(), GetTypeAsDiagnosticArgument(operandType.
Type
), targetType);
10203
var type = operandType.
Type
;
10234
var type = operandType.
Type
;
10434
Debug.Assert(operandType.
Type
is object);
10442
if (operandType.
Type
.IsNullableType() && !parameterType.IsNullableType())
10444
var underlyingOperandTypeWithAnnotations = operandType.
Type
.GetNullableUnderlyingTypeWithAnnotations();
10621
Debug.Assert(operandType.
Type
is object);
10737
var type = typeWithState.
Type
;
10769
Debug.Assert(operandType.
Type
is object);
10772
var conversion = _conversions.ClassifyStandardConversion(operandType.
Type
, targetType.Type, ref discardedUseSiteInfo);
10777
ReportNullabilityMismatchInArgument(diagnosticLocation, operandType.
Type
, parameterOpt, targetType.Type, forOutput: false);
10781
ReportNullabilityMismatchInAssignment(diagnosticLocation, operandType.
Type
, targetType.Type);
11026
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
11397
Debug.Assert(rightResult.
Type
is object);
11408
deconstructMethod = (MethodSymbol)AsMemberOfType(rightResult.
Type
, deconstructMethod);
11552
AreNullableAndUnderlyingTypes(lvalueType.Type, operandType.
Type
, out TypeWithAnnotations underlyingType))
11690
SetResultType(node, TypeWithState.Create(receiverType.
Type
, NullableFlowState.NotNull));
11694
SetResultType(node, TypeWithState.Create(results[0].RValueType.
Type
, GetState(ref State, extensionReceiverSlot)));
11714
SetResultType(node, TypeWithState.Create(opType.
Type
, NullableFlowState.NotNull));
11879
SetResultType(node, TypeWithState.Create(receiverType.
Type
, NullableFlowState.NotNull));
11883
SetResultType(node, TypeWithState.Create(results[0].RValueType.
Type
, GetState(ref State, extensionReceiverSlot)));
11907
SetResultType(node, TypeWithState.Create(opType.
Type
, NullableFlowState.NotNull));
12114
var receiverType = VisitRvalueWithState(receiverOpt).
Type
;
12199
member = AsMemberOfType(receiverType.
Type
, member);
12203
receiverType.
Type
is NamedTypeSymbol { IsUnionType: true } unionType &&
12221
if (PossiblyNullableType(resultType.
Type
))
12227
resultType = TypeWithState.Create(resultType.
Type
, state);
12340
var resultType = resultTypeWithState.
Type
;
12458
getEnumeratorType = spanType.Construct(ImmutableArray.Create(convertedResult.
Type
!.TryGetInlineArrayElementField()!.TypeWithAnnotations));
12462
getEnumeratorType = convertedResult.
Type
;
12478
var currentPropertyGetter = (MethodSymbol)AsMemberOfType(enumeratorReturnType.
Type
, enumeratorInfoOpt.CurrentPropertyGetter);
12755
method = (MethodSymbol)AsMemberOfType(operandType.
Type
!.StrippedType(), method);
12769
[new BoundExpressionWithNullability(operand.Syntax, operand, operandType.ToTypeWithAnnotations(compilation).NullableAnnotation, operandType.
Type
)],
13001
var reinferredGetResult = (MethodSymbol)AsMemberOfType(_visitResult.RValueType.
Type
, awaitableInfo.GetResult);
13243
@event = (EventSymbol)AsMemberOfType(ResultType.
Type
, @event);
13352
var resultTypeSymbol = resultType.
Type
;
13711
Debug.Assert(ResultType is TypeWithState {
Type
: FunctionPointerTypeSymbol { }, State: NullableFlowState.NotNull });
FlowAnalysis\NullableWalker_Patterns.cs (2)
411
Debug.Assert(isDerivedType(NominalSlotType(originalInputSlot), expressionTypeWithState.
Type
));
412
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);