1 write to Type
Microsoft.CodeAnalysis.CSharp (1)
Symbols\TypeWithState.cs (1)
73
Type
= type;
86 references to Type
Microsoft.CodeAnalysis.CSharp (86)
FlowAnalysis\NullableWalker.cs (74)
115
Debug.Assert(TypeSymbol.Equals(RValueType.
Type
, LValueType.Type, TypeCompareKind.ConsiderEverything));
372
expr.Type?.Equals(result.RValueType.
Type
, TypeCompareKind.AllIgnoreOptions) == true ? result.RValueType.
Type
: expr.Type);
505
Debug.Assert(AreCloseEnough(placeholder.Type, result.RValueType.
Type
));
2236
!targetType.Type.Equals(valueType.
Type
, TypeCompareKind.AllIgnoreOptions))
2289
return valueType.
Type
?.TypeKind == TypeKind.TypeParameter &&
2497
target.Type.Equals(assignedValue.
Type
, TypeCompareKind.AllIgnoreOptions);
3336
Debug.Assert((object?)resultType.
Type
!= _invalidType.
Type
);
3337
Debug.Assert(AreCloseEnough(resultType.
Type
, node.Type));
3927
Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.VisitResult.RValueType.
Type
, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
3985
Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.VisitResult.RValueType.
Type
, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
4386
var type = ResultType.
Type
as ArrayTypeSymbol;
4654
TypeSymbol asMemberOfType = getTypeIfContainingType(methodContainer, leftUnderlyingType.
Type
, leftOperand) ??
4655
getTypeIfContainingType(methodContainer, rightUnderlyingType.
Type
, rightOperand) ?? methodContainer;
5154
var leftResultType = leftResult.
Type
;
5155
var rightResultType = rightResult.
Type
;
5208
Debug.Assert(conversionResult.
Type
is not null);
5209
return (conversionResult.
Type
!, conversionResult.State);
5441
refResultType = consequenceRValue.
Type
!.MergeEquivalentTypes(alternativeRValue.
Type
, VarianceKind.None);
5669
var rvalueType = _currentConditionalReceiverVisitResult.RValueType.
Type
;
5693
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
5735
isWellKnownEqualityMethodOrImplementation(compilation, method, receiverType.
Type
, WellKnownMember.System_Collections_Generic_IEqualityComparer_T__Equals))
5746
isWellKnownEqualityMethodOrImplementation(compilation, method, receiverType.
Type
, WellKnownMember.System_IEquatable_T__Equals)))
5966
var type = receiverType.
Type
;
6041
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
6046
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
6573
var argumentResultType = resultType.
Type
;
6658
hasNoNonNullableCounterpart(valueState.
Type
) &&
6840
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
6846
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
6861
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
6865
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
6880
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
6884
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
7117
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
7313
return TypeWithState.Create(type.
Type
, state);
8101
if (operandType.
Type
?.IsTupleType == true || conversionOperand.Kind == BoundKind.TupleLiteral)
8112
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
8123
if (AreNullableAndUnderlyingTypes(targetType, operandType.
Type
, out TypeWithAnnotations underlyingType))
8138
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
8146
if (operandType.
Type
?.IsNullableType() == true && !targetType.IsNullableType())
8180
TrackNullableStateOfTupleConversion(conversionOpt, conversionOperand, conversion, targetType, operandType.
Type
, slot, valueSlot, assignmentKind, parameterOpt, reportWarnings: reportRemainingWarnings);
8190
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
8223
ReportNullabilityMismatchInArgument(diagnosticLocationOpt, operandType.
Type
, parameterOpt, targetType, forOutput: false);
8227
ReportNullabilityMismatchInAssignment(diagnosticLocationOpt, GetTypeAsDiagnosticArgument(operandType.
Type
), targetType);
8261
var type = operandType.
Type
;
8292
var type = operandType.
Type
;
8484
Debug.Assert(operandType.
Type
is object);
8492
if (operandType.
Type
.IsNullableType() && !parameterType.IsNullableType())
8494
var underlyingOperandTypeWithAnnotations = operandType.
Type
.GetNullableUnderlyingTypeWithAnnotations();
8629
var type = typeWithState.
Type
;
8661
Debug.Assert(operandType.
Type
is object);
8664
var conversion = _conversions.ClassifyStandardConversion(operandType.
Type
, targetType.Type, ref discardedUseSiteInfo);
8669
ReportNullabilityMismatchInArgument(diagnosticLocation, operandType.
Type
, parameterOpt, targetType.Type, forOutput: false);
8673
ReportNullabilityMismatchInAssignment(diagnosticLocation, operandType.
Type
, targetType.Type);
8916
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
9278
Debug.Assert(rightResult.
Type
is object);
9288
deconstructMethod = (MethodSymbol)AsMemberOfType(rightResult.
Type
, deconstructMethod);
9430
AreNullableAndUnderlyingTypes(lvalueType.Type, operandType.
Type
, out TypeWithAnnotations underlyingType))
9734
if (argumentType.
Type
is { } argType && IsNullabilityMismatch(paramType.Type, argType))
9819
var receiverType = VisitRvalueWithState(receiverOpt).
Type
;
9883
member = AsMemberOfType(receiverType.
Type
, member);
9897
if (PossiblyNullableType(resultType.
Type
))
9903
resultType = TypeWithState.Create(resultType.
Type
, state);
9990
var resultType = resultTypeWithState.
Type
;
10094
reinferredGetEnumeratorMethod ??= (MethodSymbol)AsMemberOfType(convertedResult.
Type
, node.EnumeratorInfoOpt.GetEnumeratorInfo.Method);
10105
var currentPropertyGetter = (MethodSymbol)AsMemberOfType(enumeratorReturnType.
Type
, node.EnumeratorInfoOpt.CurrentPropertyGetter);
10343
method = (MethodSymbol)AsMemberOfType(operandType.
Type
!.StrippedType(), method);
10524
var reinferredGetResult = _visitResult.RValueType.
Type
is NamedTypeSymbol taskAwaiterType
10771
@event = (EventSymbol)AsMemberOfType(ResultType.
Type
, @event);
10880
var resultTypeSymbol = resultType.
Type
;
11186
Debug.Assert(ResultType is TypeWithState {
Type
: FunctionPointerTypeSymbol { }, State: NullableFlowState.NotNull });
FlowAnalysis\NullableWalker_Patterns.cs (2)
372
Debug.Assert(isDerivedType(NominalSlotType(originalInputSlot), expressionTypeWithState.
Type
));
373
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);