1 write to Type
Microsoft.CodeAnalysis.CSharp (1)
Symbols\TypeWithState.cs (1)
73
Type
= type;
95 references to Type
Microsoft.CodeAnalysis.CSharp (95)
FlowAnalysis\NullableWalker.cs (83)
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));
4488
Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.
Type
, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
4546
Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.
Type
, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
4953
var type = ResultType.
Type
as ArrayTypeSymbol;
4979
var expressionType = VisitRvalueWithState(node.Expression).
Type
;
5260
TypeSymbol asMemberOfType = getTypeIfContainingType(methodContainer, leftUnderlyingType.
Type
, leftOperand) ??
5261
getTypeIfContainingType(methodContainer, rightUnderlyingType.
Type
, rightOperand) ?? methodContainer;
5730
Debug.Assert(TypeSymbol.Equals(targetType.Type, rightResult.
Type
, TypeCompareKind.AllIgnoreOptions));
5773
var leftResultType = leftResult.
Type
;
5774
var rightResultType = rightResult.
Type
;
5827
Debug.Assert(conversionResult.
Type
is not null);
5828
return (conversionResult.
Type
!, conversionResult.State);
6077
refResultType = consequenceRValue.
Type
!.MergeEquivalentTypes(alternativeRValue.
Type
, VarianceKind.None);
6105
resultType = alternativeRValue.
Type
;
6109
resultType = consequenceRValue.
Type
;
6322
var rvalueType = _currentConditionalReceiverVisitResult.RValueType.
Type
;
6462
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
6591
isWellKnownEqualityMethodOrImplementation(compilation, method, receiverType.
Type
, WellKnownMember.System_Collections_Generic_IEqualityComparer_T__Equals))
6602
isWellKnownEqualityMethodOrImplementation(compilation, method, receiverType.
Type
, WellKnownMember.System_IEquatable_T__Equals)))
6820
var type = receiverType.
Type
;
6917
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
6922
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
7674
var argumentResultType = resultType.
Type
;
7759
hasNoNonNullableCounterpart(valueState.
Type
) &&
7941
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
7947
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
7962
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
7966
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
7981
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
7985
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
8231
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
8498
return TypeWithState.Create(type.
Type
, state);
9314
if (operandType.
Type
?.IsTupleType == true || conversionOperand.Kind == BoundKind.TupleLiteral)
9325
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9336
if (AreNullableAndUnderlyingTypes(targetType, operandType.
Type
, out TypeWithAnnotations underlyingType))
9351
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9359
if (operandType.
Type
?.IsNullableType() == true && !targetType.IsNullableType())
9393
TrackNullableStateOfTupleConversion(conversionOpt, conversionOperand, conversion, targetType, operandType.
Type
, slot, valueSlot, assignmentKind, parameterOpt, reportWarnings: reportRemainingWarnings);
9403
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9421
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9431
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
9455
ReportNullabilityMismatchInArgument(getDiagnosticLocation(), operandType.
Type
, parameterOpt, targetType, forOutput: false);
9459
ReportNullabilityMismatchInAssignment(getDiagnosticLocation(), GetTypeAsDiagnosticArgument(operandType.
Type
), targetType);
9500
var type = operandType.
Type
;
9531
var type = operandType.
Type
;
9724
Debug.Assert(operandType.
Type
is object);
9732
if (operandType.
Type
.IsNullableType() && !parameterType.IsNullableType())
9734
var underlyingOperandTypeWithAnnotations = operandType.
Type
.GetNullableUnderlyingTypeWithAnnotations();
9872
var type = typeWithState.
Type
;
9904
Debug.Assert(operandType.
Type
is object);
9907
var conversion = _conversions.ClassifyStandardConversion(operandType.
Type
, targetType.Type, ref discardedUseSiteInfo);
9912
ReportNullabilityMismatchInArgument(diagnosticLocation, operandType.
Type
, parameterOpt, targetType.Type, forOutput: false);
9916
ReportNullabilityMismatchInAssignment(diagnosticLocation, operandType.
Type
, targetType.Type);
10161
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
10534
Debug.Assert(rightResult.
Type
is object);
10545
deconstructMethod = (MethodSymbol)AsMemberOfType(rightResult.
Type
, deconstructMethod);
10689
AreNullableAndUnderlyingTypes(lvalueType.Type, operandType.
Type
, out TypeWithAnnotations underlyingType))
10916
var reinferredMethod = (MethodSymbol)AsMemberOfType(leftTypeWithState.
Type
, method);
11010
if (argumentType.
Type
is { } argType && IsNullabilityMismatch(paramType.Type, argType))
11124
var receiverType = VisitRvalueWithState(receiverOpt).
Type
;
11202
member = AsMemberOfType(receiverType.
Type
, member);
11216
if (PossiblyNullableType(resultType.
Type
))
11222
resultType = TypeWithState.Create(resultType.
Type
, state);
11327
var resultType = resultTypeWithState.
Type
;
11439
getEnumeratorType = spanType.Construct(ImmutableArray.Create(convertedResult.
Type
!.TryGetInlineArrayElementField()!.TypeWithAnnotations));
11443
getEnumeratorType = convertedResult.
Type
;
11459
var currentPropertyGetter = (MethodSymbol)AsMemberOfType(enumeratorReturnType.
Type
, enumeratorInfoOpt.CurrentPropertyGetter);
11699
method = (MethodSymbol)AsMemberOfType(operandType.
Type
!.StrippedType(), method);
11880
var reinferredGetResult = _visitResult.RValueType.
Type
is NamedTypeSymbol taskAwaiterType
12125
@event = (EventSymbol)AsMemberOfType(ResultType.
Type
, @event);
12234
var resultTypeSymbol = resultType.
Type
;
12540
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);