1 write to Type
Microsoft.CodeAnalysis.CSharp (1)
Symbols\TypeWithState.cs (1)
73
Type
= type;
108 references to Type
Microsoft.CodeAnalysis.CSharp (108)
FlowAnalysis\NullableWalker.cs (96)
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);
591
Debug.Assert(AreCloseEnough(placeholder.Type, result.RValueType.
Type
));
2469
!targetType.Type.Equals(valueType.
Type
, TypeCompareKind.AllIgnoreOptions))
2517
return valueType.
Type
?.TypeKind == TypeKind.TypeParameter &&
2725
target.Type.Equals(assignedValue.
Type
, TypeCompareKind.AllIgnoreOptions);
3799
Debug.Assert((object?)resultType.
Type
!= _invalidType.
Type
);
3800
Debug.Assert(AreCloseEnough(resultType.
Type
, node.Type));
4868
Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.
Type
, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
4926
Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.
Type
, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
5333
var type = ResultType.
Type
as ArrayTypeSymbol;
5359
var expressionType = VisitRvalueWithState(node.Expression).
Type
;
5710
TypeSymbol asMemberOfType = getTypeIfContainingType(methodContainer, leftUnderlyingType.
Type
, leftOperand) ??
5711
getTypeIfContainingType(methodContainer, rightUnderlyingType.
Type
, rightOperand) ?? methodContainer;
5729
[new BoundExpressionWithNullability(leftOperand.Syntax, leftOperand, leftUnderlyingType.ToTypeWithAnnotations(compilation).NullableAnnotation, leftUnderlyingType.
Type
),
5730
new BoundExpressionWithNullability(rightOperand.Syntax, rightOperand, rightUnderlyingType.ToTypeWithAnnotations(compilation).NullableAnnotation, rightUnderlyingType.
Type
)],
6172
Debug.Assert(TypeSymbol.Equals(targetType.Type, rightResult.
Type
, TypeCompareKind.AllIgnoreOptions));
6215
var leftResultType = leftResult.
Type
;
6216
var rightResultType = rightResult.
Type
;
6271
Debug.Assert(conversionResult.
Type
is not null);
6272
return (conversionResult.
Type
!, conversionResult.State);
6521
refResultType = consequenceRValue.
Type
!.MergeEquivalentTypes(alternativeRValue.
Type
, VarianceKind.None);
6549
resultType = alternativeRValue.
Type
;
6553
resultType = consequenceRValue.
Type
;
6766
var rvalueType = _currentConditionalReceiverVisitResult.RValueType.
Type
;
6995
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
7004
ReinferenceResult<MethodSymbol> reinferenceResult = VisitArgumentsCore(node, receiverType.
Type
, arguments, refKindsOpt, parameters, argsToParamsOpt, defaultArguments,
7137
isWellKnownEqualityMethodOrImplementation(compilation, method, receiverType.
Type
, WellKnownMember.System_Collections_Generic_IEqualityComparer_T__Equals))
7148
isWellKnownEqualityMethodOrImplementation(compilation, method, receiverType.
Type
, WellKnownMember.System_IEquatable_T__Equals)))
7366
var type = receiverType.
Type
;
7463
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
7468
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8243
var argumentResultType = resultType.
Type
;
8328
hasNoNonNullableCounterpart(valueState.
Type
) &&
8530
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8536
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
8551
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8555
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
8570
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.MaybeDefault);
8574
return TypeWithState.Create(typeWithState.
Type
, NullableFlowState.NotNull);
8866
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
9144
return TypeWithState.Create(type.
Type
, state);
9622
if (PossiblyNullableType(valueFieldType.
Type
))
9627
valueFieldType = TypeWithState.Create(valueFieldType.
Type
, GetState(ref this.State, valueFieldSlot));
9631
var conversionOperand = new BoundValueForNullableAnalysis(convertedNode.Syntax, originalExpression: null, valueFieldType.
Type
);
10056
if (operandType.
Type
?.IsTupleType == true || conversionOperand.Kind == BoundKind.TupleLiteral)
10068
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
10079
if (AreNullableAndUnderlyingTypes(targetType, operandType.
Type
, out TypeWithAnnotations underlyingType))
10094
conversion = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
10102
if (operandType.
Type
?.IsNullableType() == true && !targetType.IsNullableType())
10138
TrackNullableStateOfTupleConversion(conversionOpt, conversionOperand, conversion, targetType, operandType.
Type
, fromExplicitCast: fromExplicitCast, slot, valueSlot, assignmentKind, parameterOpt, reportWarnings: reportRemainingWarnings);
10149
canConvertNestedNullability = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false).Exists;
10187
Conversion generated = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
10196
Conversion generated = GenerateConversion(_conversions, conversionOperand, operandType.
Type
, targetType, fromExplicitCast, extensionMethodThisArgument, isChecked: conversionOpt?.Checked ?? false);
10220
ReportNullabilityMismatchInArgument(getDiagnosticLocation(), operandType.
Type
, parameterOpt, targetType, forOutput: false);
10224
ReportNullabilityMismatchInAssignment(getDiagnosticLocation(), GetTypeAsDiagnosticArgument(operandType.
Type
), targetType);
10265
var type = operandType.
Type
;
10296
var type = operandType.
Type
;
10496
Debug.Assert(operandType.
Type
is object);
10504
if (operandType.
Type
.IsNullableType() && !parameterType.IsNullableType())
10506
var underlyingOperandTypeWithAnnotations = operandType.
Type
.GetNullableUnderlyingTypeWithAnnotations();
10689
Debug.Assert(operandType.
Type
is object);
10816
var type = typeWithState.
Type
;
10848
Debug.Assert(operandType.
Type
is object);
10851
var conversion = _conversions.ClassifyStandardConversion(operandType.
Type
, targetType.Type, ref discardedUseSiteInfo);
10856
ReportNullabilityMismatchInArgument(diagnosticLocation, operandType.
Type
, parameterOpt, targetType.Type, forOutput: false);
10860
ReportNullabilityMismatchInAssignment(diagnosticLocation, operandType.
Type
, targetType.Type);
11105
method = (MethodSymbol)AsMemberOfType(receiverType.
Type
, method);
11474
Debug.Assert(rightResult.
Type
is object);
11485
deconstructMethod = (MethodSymbol)AsMemberOfType(rightResult.
Type
, deconstructMethod);
11631
AreNullableAndUnderlyingTypes(lvalueType.Type, operandType.
Type
, out TypeWithAnnotations underlyingType))
11769
SetResultType(node, TypeWithState.Create(receiverType.
Type
, NullableFlowState.NotNull));
11773
SetResultType(node, TypeWithState.Create(results[0].RValueType.
Type
, GetState(ref State, extensionReceiverSlot)));
11793
SetResultType(node, TypeWithState.Create(opType.
Type
, NullableFlowState.NotNull));
11962
SetResultType(node, TypeWithState.Create(receiverType.
Type
, NullableFlowState.NotNull));
11966
SetResultType(node, TypeWithState.Create(results[0].RValueType.
Type
, GetState(ref State, extensionReceiverSlot)));
11990
SetResultType(node, TypeWithState.Create(opType.
Type
, NullableFlowState.NotNull));
12244
var receiverType = VisitRvalueWithState(receiverOpt).
Type
;
12322
member = AsMemberOfType(receiverType.
Type
, member);
12326
receiverType.
Type
is NamedTypeSymbol { IsUnionType: true } unionType &&
12344
if (PossiblyNullableType(resultType.
Type
))
12350
resultType = TypeWithState.Create(resultType.
Type
, state);
12463
var resultType = resultTypeWithState.
Type
;
12581
getEnumeratorType = spanType.Construct(ImmutableArray.Create(convertedResult.
Type
!.TryGetInlineArrayElementField()!.TypeWithAnnotations));
12585
getEnumeratorType = convertedResult.
Type
;
12601
var currentPropertyGetter = (MethodSymbol)AsMemberOfType(enumeratorReturnType.
Type
, enumeratorInfoOpt.CurrentPropertyGetter);
12878
method = (MethodSymbol)AsMemberOfType(operandType.
Type
!.StrippedType(), method);
12892
[new BoundExpressionWithNullability(operand.Syntax, operand, operandType.ToTypeWithAnnotations(compilation).NullableAnnotation, operandType.
Type
)],
13124
var reinferredGetResult = (MethodSymbol)AsMemberOfType(_visitResult.RValueType.
Type
, awaitableInfo.GetResult);
13366
@event = (EventSymbol)AsMemberOfType(ResultType.
Type
, @event);
13475
var resultTypeSymbol = resultType.
Type
;
13834
Debug.Assert(ResultType is TypeWithState {
Type
: FunctionPointerTypeSymbol { }, State: NullableFlowState.NotNull });
FlowAnalysis\NullableWalker_Patterns.cs (2)
415
Debug.Assert(isDerivedType(NominalSlotType(originalInputSlot), expressionTypeWithState.
Type
));
416
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);