2 writes to Type
Microsoft.CodeAnalysis.CSharp (2)
Generated\BoundNodes.xml.Generated.cs (2)
430this.Type = type; 436this.Type = type;
1646 references to Type
Microsoft.CodeAnalysis.CSharp (1646)
Binder\Binder.cs (2)
866RoslynDebug.Assert(expression.Type is object); 867return expression.Type;
Binder\Binder.ValueChecks.cs (32)
676Debug.Assert(!checkingReceiver || expr.Type.IsValueType || expr.Type.IsTypeParameter()); 703if ((expr.ConstantValueOpt != null) || (expr.Type.GetSpecialTypeSafe() == SpecialType.System_Void)) 893getItemOrSliceHelper = getItemOrSliceHelper.AsMember(getItemOrSliceHelper.ContainingType.Construct(ImmutableArray.Create(elementAccess.Expression.Type.TryGetInlineArrayElementField().TypeWithAnnotations))); 964indices[0].Type, 997Error(diagnostics, ErrorCode.ERR_BadSKunknown, expr.Syntax, expr.Type, MessageID.IDS_SK_TYPE.Localize()); 1628&& receiver?.Type?.IsValueType == true; 1860if (receiver is BoundObjectOrCollectionValuePlaceholder && receiver.Type.IsAnonymousType) 2038if (methodInfo.Method?.RequiresInstanceReceiver == true && receiver?.Type?.IsRefLikeOrAllowsRefLikeType() == true) 2195if (receiver?.Type?.IsRefLikeOrAllowsRefLikeType() == true) 2291Debug.Assert(receiver.Type is { }); 2296Debug.Assert(receiver is not BoundValuePlaceholderBase && method is not null && receiver.Type?.IsReferenceType == false); 2301receiver = new BoundCapturedReceiverPlaceholder(receiver.Syntax, receiver, _localScopeDepth, receiver.Type).MakeCompilerGenerated(); 2416if (receiver.Type is TypeParameterSymbol typeParameter) 3298Debug.Assert(expr.Type is not null); 3330if (expr.Type?.GetSpecialTypeSafe() == SpecialType.System_Void) 3631Debug.Assert(!checkingReceiver || expr.Type.IsValueType || expr.Type.IsTypeParameter()); 3646if (expr.Type?.GetSpecialTypeSafe() == SpecialType.System_Void) 4039if (expr.Type?.IsRefLikeOrAllowsRefLikeType() != true) 4508RoslynDebug.Assert(false, $"{expr.Kind} expression of {expr.Type} type"); 4709Debug.Assert(!checkingReceiver || expr.Type.IsValueType || expr.Type.IsTypeParameter()); 4730if (expr.Type?.IsRefLikeOrAllowsRefLikeType() != true) 4795Error(diagnostics, inUnsafeRegion ? ErrorCode.WRN_EscapeStackAlloc : ErrorCode.ERR_EscapeStackAlloc, node, expr.Type); 5104Error(diagnostics, ErrorCode.ERR_CollectionExpressionEscape, node, expr.Type); 5303RoslynDebug.Assert(false, $"{expr.Kind} expression of {expr.Type} type"); 5476TypeWithAnnotations.Create(elementAccess.Expression.Type), 5516TypeWithAnnotations.Create(inlineArray.Type), 5704if (addressKind == AddressKind.ReadOnly && !expression.Type.IsValueType && peVerifyCompatEnabled) 5718var type = expression.Type; 5879if (receiver?.Type.IsValueType == true)
Binder\Binder.WithQueryLambdaParametersBinder.cs (4)
66return new BoundRangeVariable(node, qv, translation, translation.Type); 74var receiverType = receiver.Type as NamedTypeSymbol; 80if (receiver.Type?.IsErrorType() != true) 96LookupMembersWithFallback(lookupResult, receiver.Type, name, 0, ref useSiteInfo, basesBeingResolved: null, options: options);
Binder\Binder_AnonymousTypes.cs (1)
214TypeSymbol? expressionType = expression.Type;
Binder\Binder_Attributes.cs (5)
839RoslynDebug.Assert(node.Type is object); 840var typedConstantKind = node.Type.GetAttributeParameterTypedConstantKind(_binder.Compilation); 893return new TypedConstant(spread.Expression.Type, TypedConstantKind.Error, value: null); 912var operandType = operand.Type; 1015var type = node.Type;
Binder\Binder_Await.cs (13)
31var placeholder = new BoundAwaitableValuePlaceholder(expression.Syntax, expression.Type); 84var type = expression.Type; 262Debug.Assert(TypeSymbol.Equals(expression.Type, getAwaiterArgument.Type, TypeCompareKind.ConsiderEverything)); 286TypeSymbol awaiterType = getAwaiter.Type!; 287return GetIsCompletedProperty(awaiterType, node, expression.Type!, diagnostics, out isCompleted) 289&& GetGetResultMethod(getAwaiter, node, expression.Type!, diagnostics, out getResult, out getAwaiterGetResultCall); 303if (expression.Type is null) 325RoslynDebug.Assert(expression.Type is object); 326if (expression.Type.IsVoidType()) 342Error(diagnostics, ErrorCode.ERR_BadAwaitArg, node, expression.Type); 353Error(diagnostics, ErrorCode.ERR_BadAwaitArg, node, expression.Type); 437var awaiterType = awaiterExpression.Type;
Binder\Binder_Conversions.cs (26)
75else if (source.Type is not null && filterConversion(conversion)) 77var placeholder2 = new BoundValuePlaceholder(source.Syntax, source.Type); 120RoslynDebug.Assert(source.Type is object); 124if (!isCast && source.Type.Equals(destination, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)) 211TypeSymbol? type = source.Type; 255Debug.Assert(source.Type is null); 281source.Type is { } sourceType && 322switch (source.Type?.IsNullableType()) 327new BoundValuePlaceholder(source.Syntax, source.Type.GetNullableUnderlyingType()), 352else if (source.Type?.IsNullableType() == true) 356new BoundValuePlaceholder(source.Syntax, source.Type.GetNullableUnderlyingType()), 373if (source.Type?.TryGetElementTypesWithAnnotationsIfTupleType(out sourceTypes) == true && 446Debug.Assert(source.Type is { }); 448FieldSymbol? elementField = source.Type.TryGetInlineArrayElementField(); 481CheckInlineArrayTypeIsSupported(syntax, source.Type, elementField.Type, diagnostics); 485Debug.Assert(source.Type is not null); 494if (source.Type is ArrayTypeSymbol) 505if (source.Type.IsSpan()) 509TryFindImplicitOperatorFromSpan(source.Type.OriginalDefinition, destination.OriginalDefinition), 510source.Type.OriginalDefinition, 517if (source.Type.IsSpan() || source.Type.IsReadOnlySpan()) 520if (NeedsSpanCastUp(source.Type, destination)) 525TypeSymbol sourceForCastUp = source.Type.IsSpan() 527: source.Type.OriginalDefinition; 538.Construct([((NamedTypeSymbol)source.Type).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0]])
Binder\Binder_Deconstruct.cs (12)
122if ((object?)boundRHS.Type == null || boundRHS.Type.IsErrorType()) 128var type = boundRHS.Type ?? voidType; 143boundRHS.Type, 158Debug.Assert(hasErrors || lhsTuple.Type is object); 159TypeSymbol returnType = hasErrors ? CreateErrorType() : lhsTuple.Type!; 226else if ((object?)boundRHS.Type == null) 481TypeSymbol? mergedType = element.Type; 569typesWithAnnotationsBuilder.Add(TypeWithAnnotations.Create(value.Type)); 622if (receiver.Type?.IsDynamic() ?? false) 717if (receiver.Type?.IsErrorType() == false) 719Error(diagnostics, ErrorCode.ERR_MissingDeconstruct, rightSyntax, receiver.Type!, numParameters);
Binder\Binder_Expressions.cs (87)
199TypeSymbol resultType = expr.Type; 292var commonType = expr.Type; 364case BoundStackAllocArrayCreation { Type: null } boundStackAlloc: 563TypeSymbol exprType = expr.Type; 1037if (boundArgument.Type?.SpecialType == SpecialType.System_Void) 1047var elementTypeWithAnnotations = TypeWithAnnotations.Create(boundArgument.Type); 1246if ((object)argument.Type != null && argument.Type.IsRestrictedType()) 1249Error(diagnostics, ErrorCode.ERR_MethodArgCantBeRefAny, node, argument.Type); 1642type: expression.Type, 2542(object)operand.Type != null && 2543!operand.Type.IsNullableType() && 2544!TypeSymbol.Equals(targetType.GetNullableUnderlyingType(), operand.Type, TypeCompareKind.ConsiderEverything2)) 2565if ((object)boundOperand.Type != null && boundOperand.Type.IsNullableType()) 2644if (left?.Type.IsNullableType() == true || right?.Type.IsNullableType() == true) 2672if (boundOperand.Type?.IsNullableType() == true) 2764SymbolDistinguisher distinguisher1 = new SymbolDistinguisher(this.Compilation, operand.Type, targetType); 2813case BoundKind.UnconvertedConditionalOperator when operand.Type is null: 2814case BoundKind.UnconvertedSwitchExpression when operand.Type is null: 2838Debug.Assert((object)operand.Type != null); 2839SymbolDistinguisher distinguisher = new SymbolDistinguisher(this.Compilation, operand.Type, targetType); 2880Debug.Assert((object)operand.Type != null && !operand.Type.IsNullableType()); 2886var underlyingConversion = Conversions.ClassifyBuiltInConversion(operand.Type, underlyingTargetTypeWithAnnotations.Type, isChecked: CheckOverflowAtRuntime, ref discardedUseSiteInfo); 3803Debug.Assert(receiver!.Type is not null); 3805placeholderType = receiver.Type; 4171if ((object)boundExpression.Type == null || !boundExpression.Type.IsErrorType()) 4255Debug.Assert(init.Type.IsErrorType()); 4665if (constantValue == null || constantValue.IsBad || expression.Type.SpecialType != SpecialType.System_Int32) 4688var type = expression.Type.SpecialType; 5240Debug.Assert(expression.Type is { }); 5242var expressionPlaceholder = new BoundCollectionExpressionSpreadExpressionPlaceholder(syntax.Expression, expression.Type); 5255_ = expression.Type.HasInlineArrayAttribute(out int length); 5385else if ((object)argument.Type == null) 5397else if (argument.Type.TypeKind == TypeKind.Delegate) 5399var sourceDelegate = (NamedTypeSymbol)argument.Type; 5403if (ReportDelegateInvokeUseSiteDiagnostic(diagnostics, argument.Type, node: node)) 5684Debug.Assert((object)boundLeft.Type != null); 5693type: boundLeft.Type, 5981type: boundMember.Type, 6395({ Type: null } or BoundLiteral or BoundUnconvertedInterpolatedString or BoundBinaryOperator { IsUnconvertedInterpolatedStringAddition: true }) && 7468var leftType = boundValue.Type; 7476if (TypeSymbol.Equals(boundType.Type, leftType, TypeCompareKind.AllIgnoreOptions)) 7508TypeSymbol.Equals(BindNamespaceOrType(id, BindingDiagnosticBag.Discarded).Type, type, TypeCompareKind.AllIgnoreOptions); 7612TypeSymbol leftType = boundLeft.Type; 7650leftType = boundLeft.Type; 7877Error(diagnostics, ErrorCode.WRN_DotOnDefault, node, boundLeft.Type); 7934var leftType = boundLeft.Type; 8054if ((object)boundLeft.Type == null) 8063Error(diagnostics, ErrorCode.ERR_NoSuchMember, name, boundLeft.Type, plainName); 8065else if (WouldUsingSystemFindExtension(boundLeft.Type, plainName)) 8067Error(diagnostics, ErrorCode.ERR_NoSuchMemberOrExtensionNeedUsing, name, boundLeft.Type, plainName, "System"); 8071Error(diagnostics, ErrorCode.ERR_NoSuchMemberOrExtension, name, boundLeft.Type, plainName); 8375if ((object)methodGroup.Methods[i].ReduceExtensionMethod(left.Type, this.Compilation) == null) 8546TypeSymbol receiverType = receiver.Type; 8717if (receiverOpt is { Type: TypeParameterSymbol { AllowsRefLikeType: true } } && 8759bool isUsableAsField = eventSymbol.HasAssociatedField && this.IsAccessible(eventSymbol.AssociatedField, ref useSiteInfo, (receiver != null) ? receiver.Type : null); 8999if ((object)expr.Type == null) 9020expr.Type.HasInlineArrayAttribute(out int length) && expr.Type.TryGetPossiblyUnsupportedByLanguageInlineArrayElementField() is FieldSymbol elementField) 9032Debug.Assert(expr.Type.TryGetInlineArrayElementField() is not null); 9052{ Code: (int)ErrorCode.ERR_BadIndexLHS, Arguments: [TypeSymbol type] } && type.Equals(expr.Type, TypeCompareKind.ConsiderEverything)) 9179CheckInlineArrayTypeIsSupported(node, expr.Type, elementField.Type, diagnostics); 9230if (TypeSymbol.Equals(convertedIndex.Type, compilation.GetWellKnownType(WellKnownType.System_Index), TypeCompareKind.AllIgnoreOptions)) 9278Debug.Assert((object)expr.Type != null); 9281var exprType = expr.Type; 9324var arrayType = (ArrayTypeSymbol)expr.Type; 9371var receiverPlaceholder = new BoundImplicitIndexerReceiverPlaceholder(expr.Syntax, isEquivalentToThisReference: expr.IsEquivalentToThisReference, expr.Type) { WasCompilerGenerated = true }; 9535Debug.Assert(expr.Type.IsPointerType()); 9536PointerTypeSymbol pointerType = (PointerTypeSymbol)expr.Type; 9582Debug.Assert((object)expr.Type != null); 9588this.LookupMembersWithFallback(lookupResult, expr.Type, WellKnownMemberNames.Indexer, arity: 0, useSiteInfo: ref useSiteInfo, options: lookupOptions); 9909Debug.Assert(receiver.Type is not null); 9916var receiverPlaceholder = new BoundImplicitIndexerReceiverPlaceholder(receiver.Syntax, isEquivalentToThisReference: receiver.IsEquivalentToThisReference, receiver.Type) { WasCompilerGenerated = true }; 9925Debug.Assert(indexerOrSliceAccess.Type is not null); 9935indexerOrSliceAccess.Type); 10146Debug.Assert(receiverPlaceholder.Type is not null); 10147if (TryLookupLengthOrCount(syntax, receiverPlaceholder.Type, lookupResult, out var lengthOrCountProperty, diagnostics)) 10528if (m.ReduceExtensionMethod(receiver.Type, Compilation) is { } reduced) 10697var reduced = substituted.ReduceExtensionMethod(receiver.Type, Compilation, out bool wasFullyInferred); 10953var receiverType = receiver.Type; 10962var accessType = access.Type; 11093var receiverType = receiver.Type; 11124var receiverType = receiver.Type;
Binder\Binder_Initializers.cs (2)
259((object?)expression.Type == null || !expression.Type.IsVoidType()))
Binder\Binder_InterpolatedString.cs (17)
219Debug.Assert(unconvertedInterpolatedString.Type?.SpecialType == SpecialType.System_String); 245Debug.Assert(unconvertedInterpolatedString.Parts.All(static part => part.Type is null or { SpecialType: SpecialType.System_String })); 259if (unconvertedInterpolatedString.Type.IsErrorType() || haveErrors || canLowerToStringConcatenation(parts)) 264return BindUnconvertedInterpolatedExpressionToFactory(unconvertedInterpolatedString, parts, (NamedTypeSymbol)unconvertedInterpolatedString.Type, factoryMethod: "Format", unconvertedInterpolatedString.Type, diagnostics); 272unconvertedInterpolatedString.Type, 304fillin.Value.Type?.SpecialType != SpecialType.System_String || 367unconvertedSource.Type, 397if (value.Type?.TypeKind == TypeKind.Dynamic) 433&& unconvertedInterpolatedString.Parts.All(p => p is not BoundStringInsert { Value.Type.TypeKind: TypeKind.Dynamic }); 436=> parts.All(p => p is BoundLiteral or BoundStringInsert { Value.Type.SpecialType: SpecialType.System_String, Alignment: null, Format: null }); 536expression.Type, 597unconvertedInterpolatedString.Type, 684if (value.Type is not null) 860if (insert.Value.Type is null) 887Debug.Assert(part is BoundLiteral { Type: { SpecialType: SpecialType.System_String }, ConstantValueOpt.IsString: true }); 955argumentsBuilder.Add(boundLiteral.Update(ConstantValue.Create(literalText), boundLiteral.Type));
Binder\Binder_Invocation.cs (28)
278else if ((object)argument.Type == null && !argument.HasAnyErrors) 289else if (argument.Type.IsVoidType()) 342if ((object)boundExpression.Type != null && boundExpression.Type.IsDynamic()) 369else if (boundExpression.Type?.Kind == SymbolKind.FunctionPointerType) 556Debug.Assert(receiver.Type is not null); 557Error(diagnostics, ErrorCode.ERR_CannotDynamicInvokeOnExpression, receiver.Syntax, receiver.Type); 608Debug.Assert((object?)arg.Type != null); 611Error(diagnostics, ErrorCode.ERR_BadDynamicMethodArg, arg.Syntax, arg.Type); 817Debug.Assert(methodGroup.InstanceOpt != null && (object)methodGroup.InstanceOpt.Type != null); 819Error(diagnostics, ErrorCode.ERR_BadArgTypeDynamicExtension, syntax, methodGroup.InstanceOpt.Type, methodGroup.Name); 1045if (!call.HasAnyErrors && call.ReceiverOpt != null && (object)call.ReceiverOpt.Type != null) 1050if (call.ReceiverOpt.Type.IsRestrictedType() && !call.Method.ContainingType.IsInterface && !TypeSymbol.Equals(call.Method.ContainingType, call.ReceiverOpt.Type, TypeCompareKind.ConsiderEverything2)) 1052SymbolDistinguisher distinguisher = new SymbolDistinguisher(compilation, call.ReceiverOpt.Type, call.Method.ContainingType); 1068(object)dynInvoke.Expression.Type != null && 1069dynInvoke.Expression.Type.IsRestrictedType()) 1073Error(diagnostics, ErrorCode.ERR_BadDynamicMethodArg, dynInvoke.Expression.Syntax, dynInvoke.Expression.Type); 1158case BoundUnconvertedSwitchExpression { Type: { } naturalType } switchExpr: 1336if (receiver is BoundValuePlaceholderBase || receiver?.Type is null or { IsReferenceType: true }) 1785receiver.Type.IsValueType && 1848!(d.Arguments is [ParameterSymbol shadowedParameter] && shadowedParameter.Type.Equals(typeOrValue.Data.ValueExpression.Type, TypeCompareKind.AllIgnoreOptions))) // If the type and the name match, we would resolve to the same type rather than a value at the end. 1903var type = expr.Type as NamedTypeSymbol; 1943var methodContainer = (object)receiver != null && (object)receiver.Type != null 1944? receiver.Type 2173var methodContainer = expr.Type ?? this.ContainingType; 2345RoslynDebug.Assert(boundExpression.Type is FunctionPointerTypeSymbol); 2347var funcPtr = (FunctionPointerTypeSymbol)boundExpression.Type;
Binder\Binder_Operators.cs (77)
63var placeholder = new BoundValuePlaceholder(right.Syntax, left.HasDynamicType() ? left.Type : right.Type).MakeCompilerGenerated(); 64var finalDynamicConversion = this.Compilation.Conversions.ClassifyConversionFromExpression(placeholder, left.Type, isChecked: CheckOverflowAtRuntime, ref useSiteInfo); 66var conversion = (BoundConversion)CreateConversion(node, placeholder, finalDynamicConversion, isCast: true, conversionGroupOpt: null, left.Type, diagnostics); 75left.Type, 76right.Type, 84left.Type, 197var leftType = left.Type; 347TypeSymbol type = operand.Type; 375Debug.Assert((object)left.Type != null && left.Type.IsDynamic() || (object)right.Type != null && right.Type.IsDynamic()); 399Error(diagnostics, ErrorCode.ERR_InvalidDynamicCondition, node.Left, left.Type, kind == BinaryOperatorKind.LogicalAnd ? "false" : "true"); 405Debug.Assert(left.Type is not TypeParameterSymbol); 521TypeSymbol leftType = left.Type; 522TypeSymbol rightType = right.Type; 557Debug.Assert(right.Type.SpecialType == SpecialType.System_String); 558var stringConstant = FoldBinaryOperator(node, BinaryOperatorKind.StringConcatenation, left, right, right.Type, diagnostics); 559return new BoundBinaryOperator(node, BinaryOperatorKind.StringConcatenation, BoundBinaryOperator.UncommonData.UnconvertedInterpolatedStringAddition(stringConstant), LookupResultKind.Empty, left, right, right.Type); 726TypeSymbol leftType = left.Type; 727TypeSymbol rightType = right.Type; 816(object)left.Type != null && left.Type.TypeKind == TypeKind.Delegate) 820var conversion = this.Conversions.ClassifyConversionFromExpression(right, left.Type, isChecked: CheckOverflowAtRuntime, ref discardedUseSiteInfo); 822GenerateImplicitConversionError(diagnostics, right.Syntax, conversion, right, left.Type); 844case (BoundKind.DefaultLiteral, _) when right.Type is TypeParameterSymbol: 845Debug.Assert(!right.Type.IsReferenceType); 846Error(diagnostics, ErrorCode.ERR_AmbigBinaryOpsOnUnconstrainedDefault, node, operatorToken.Text, right.Type); 848case (_, BoundKind.DefaultLiteral) when left.Type is TypeParameterSymbol: 849Debug.Assert(!left.Type.IsReferenceType); 850Error(diagnostics, ErrorCode.ERR_AmbigBinaryOpsOnUnconstrainedDefault, node, operatorToken.Text, left.Type); 869case LookupResultKind.OverloadResolutionFailure when operatorToken.Kind() is SyntaxKind.PlusToken && isReadOnlySpanOfByte(left.Type) && isReadOnlySpanOfByte(right.Type): 936if ((object)left.Type != null && left.Type.SpecialType == SpecialType.System_Boolean && 937(object)right.Type != null && right.Type.SpecialType == SpecialType.System_Boolean) 939var constantValue = FoldBinaryOperator(node, kind | BinaryOperatorKind.Bool, left, right, left.Type, diagnostics); 943resultKind: LookupResultKind.Viable, left, right, type: left.Type, hasErrors: constantValue != null && constantValue.IsBad); 1055var type = left.Type; 1072if (left.Type is not null) 1074var operandPlaceholder = new BoundValuePlaceholder(left.Syntax, left.Type).MakeCompilerGenerated(); 1450(object)operand.Type != null && 1451(operand.Type.SpecialType == SpecialType.System_UInt64 || isNuint(operand.Type))) 1676return left.Type; 1679return right.Type; 1743BinaryOperatorKind newKind = kind.Operator().WithType(newLeftOperand.Type!.SpecialType); 2287var operandType = operand.Type; 2357var operandPlaceholder = new BoundValuePlaceholder(operand.Syntax, operand.Type).MakeCompilerGenerated(); 2476var operandType = operand.Type as PointerTypeSymbol; 2531TypeSymbol operandType = operand.Type; 2610if (receiver.Type.IsReferenceType) 2736if (isOperandNullOrNew || operand.Type?.IsErrorType() == true) 2764type: operand.Type!); 2813var underlyingType = operand.Type.GetEnumUnderlyingType()!; 3172if ((object)operand.Type == null && !operand.IsLiteralNull()) 3231if ((object)operand.Type == null) 3242var convertedExpression = BindExpressionForPattern(operand.Type, node.Right, ref hasErrors, isPatternDiagnostics, out var constantValueOpt, out var wasExpression, out _); 3249node.Right, convertedExpression, constantValueOpt ?? ConstantValue.Bad, operand.Type, convertedExpression.Type ?? operand.Type, hasErrors) 3269if (operandHasErrors || IsOperatorErrors(node, operand.Type, typeExpression, diagnostics)) 3290operand.Type.IsVoidType()) 3320var operandType = operand.Type; 3720if ((object)operand.Type == null) 3782Debug.Assert(operand.Type is null); 3783operandPlaceholder = new BoundValuePlaceholder(operand.Syntax, operand.Type).MakeCompilerGenerated(); 3797var operandType = operand.Type; 3830operandPlaceholder = new BoundValuePlaceholder(operand.Syntax, operand.Type).MakeCompilerGenerated(); 4009TypeSymbol optLeftType = leftOperand.Type; // "A" 4010TypeSymbol optRightType = rightOperand.Type; // "B" 4185TypeSymbol leftType = leftOperand.Type; 4203if (underlyingRightConversion.Exists && rightOperand.Type?.IsDynamic() != true) 4344TypeSymbol trueType = trueExpr.Type; 4345TypeSymbol falseType = falseExpr.Type;
Binder\Binder_Patterns.cs (20)
24TypeSymbol? expressionType = expression.Type; 37Debug.Assert(expression.Type is { }); 38BoundPattern pattern = BindPattern(node.Pattern, expression.Type, permitDesignations: true, hasErrors, diagnostics, underIsPattern: true); 65Debug.Assert(expression.Type is object); 66diagnostics.Add(ErrorCode.ERR_IsPatternImpossible, node.Location, expression.Type); 82Debug.Assert(expression.Type is object); 83diagnostics.Add(ErrorCode.WRN_IsPatternAlways, node.Location, expression.Type); 248Debug.Assert(indexerAccess.Type is not null); 249sliceType = indexerAccess.Type; 322Debug.Assert(indexerAccess!.Type is not null); 323elementType = indexerAccess.Type; 427var convertedType = convertedExpression.Type ?? inputType; 515Debug.Assert(expression is { Kind: BoundKind.TypeExpression, Type: { } }); 516hasErrors |= CheckValidPatternType(patternExpression, inputType, expression.Type, diagnostics: diagnostics); 578if (convertedExpression.Type is null && constantValueOpt != ConstantValue.Null) 619RoslynDebug.Assert(expression.Type is { }); 620ConstantValue match = ExpressionOfTypeMatchesPatternType(Conversions, inputType, expression.Type, ref useSiteInfo, out _, operandConstantValue: null); 652if (expression.Type?.SpecialType == SpecialType.System_String && inputType.IsSpanOrReadOnlySpanChar()) 707(conversion.ConversionKind == ConversionKind.NoConversion && convertedExpression.Type?.IsErrorType() == true)) 1633var type = value.Type ?? inputType;
Binder\Binder_Query.cs (14)
300Debug.Assert(state.fromExpression.Type is { }); 303ImmutableArray.Create(state.fromExpression), state.fromExpression.Type); 738else if (!yExpression.HasAnyErrors && yExpression.Type!.IsVoidType()) 740Error(d, ErrorCode.ERR_QueryRangeVariableAssignedBadValue, errorLocation, yExpression.Type!); 741Debug.Assert(yExpression.Type is { }); 742yExpression = new BoundBadExpression(yExpression.Syntax, LookupResultKind.Empty, ImmutableArray<Symbol?>.Empty, ImmutableArray.Create(yExpression), yExpression.Type); 803field2Value = new BoundBadExpression(field2Value.Syntax, LookupResultKind.Empty, ImmutableArray<Symbol?>.Empty, ImmutableArray.Create(field2Value), field2Value.Type, true); 823return e.Type ?? CreateErrorType(); 928Debug.Assert(receiver.Type is object || ultimateReceiver.Type is null); 929if ((object?)ultimateReceiver.Type == null) 979if (ultimateReceiver.Type.TypeKind == TypeKind.TypeParameter) 982Error(diagnostics, ErrorCode.ERR_BadSKunknown, ultimateReceiver.Syntax, ultimateReceiver.Type, MessageID.IDS_SK_TYVAR.Localize()); 990else if (receiver.Type!.IsVoidType())
Binder\Binder_QueryErrors.cs (7)
45if (instanceArgument.Type.IsDynamic()) 52else if (ImplementsStandardQueryInterface(instanceArgument.Type, name, ref useSiteInfo)) 57new object[] { instanceArgument.Type, name }, 60else if (fromClause != null && fromClause.Type == null && HasCastToQueryProvider(instanceArgument.Type, ref useSiteInfo)) 65new object[] { instanceArgument.Type, name, fromClause.Identifier.ValueText }, 73new object[] { instanceArgument.Type, name }, 238TypeSymbol receiverType = receiver?.Type;
Binder\Binder_Statements.cs (26)
407var type = boundExpr.Type; 757Debug.Assert(expr.Type is object); 758Debug.Assert(expr.Type.IsRefLikeType || hasAwait); // pattern dispose lookup is only valid on ref structs or asynchronous usings 1020TypeSymbol initializerType = initializerOpt?.Type; 1232TypeSymbol initializerType = initializerOpt.Type; 1248elementType = ((BoundAddressOfOperator)initializerOpt).Operand.Type; 1322if (initializer.Type.IsVoidType()) 1342additionalDiagnostics.Add(ErrorCode.WRN_PatternBadSignature, initializer.Syntax.Location, initializer.Type, "fixed", patternMethodSymbol); 1459var inferredType = op2.Type; 1485if (op1.Type is { } lhsType && !lhsType.IsErrorType()) 1521type = op1.Type; 1542Debug.Assert(op1.Type is { }); 1575Debug.Assert(leftEscape.Equals(rightEscape) || op1.Type.IsRefLikeOrAllowsRefLikeType()); 1595if (!hasErrors && op1.Type.IsRefLikeOrAllowsRefLikeType()) 1818Debug.Assert((object)receiver.Type != null); 1819return receiver.Type; 1945this.Conversions.ClassifyConversionFromType(expression.Type, targetType, isChecked: CheckOverflowAtRuntime, ref useSiteInfo); 1977expression.Type, 2433var sourceType = operand.Type; 3041hasErrors |= arg.HasErrors || ((object)arg.Type != null && arg.Type.IsErrorType()); 3116if ((object)arg?.Type != null && arg.Type.IsVoidType()) 3180&& TypeSymbol.Equals(argument.Type, this.GetCurrentReturnType(out unusedRefKind), TypeCompareKind.ConsiderEverything2)) 3183Error(diagnostics, ErrorCode.ERR_BadAsyncReturnExpression, argument.Syntax, returnType, argument.Type); 3515else if (expression.Type?.SpecialType == SpecialType.System_Void)
Binder\Binder_Symbols.cs (1)
1451receiver = new BoundBadExpression(receiver.Syntax, LookupResultKind.Ambiguous, ImmutableArray<Symbol>.Empty, ImmutableArray.Create(receiver), receiver.Type, hasErrors: true).MakeCompilerGenerated();
Binder\Binder_TupleOperators.cs (16)
85TypeSymbol leftType = left.Type; 86TypeSymbol rightType = right.Type; 111return new TupleBinaryOperatorInfo.Single(binary.Left.Type, binary.Right.Type, binary.OperatorKind, binary.Method, binary.ConstrainedToType, 183Debug.Assert((object)left.Type != null && left.Type.IsDynamic() || (object)right.Type != null && right.Type.IsDynamic()); 205left = GiveTupleTypeToDefaultLiteralIfNeeded(left, right.Type); 206right = GiveTupleTypeToDefaultLiteralIfNeeded(right, left.Type); 217Debug.Assert((object)left.Type != null || left.Kind == BoundKind.TupleLiteral); 218Debug.Assert((object)right.Type != null || right.Kind == BoundKind.TupleLiteral); 247bool leftNullable = left.Type?.IsNullableType() == true; 248bool rightNullable = right.Type?.IsNullableType() == true; 356TypeSymbol type = expr.Type; 383TypeSymbol tupleType = expr.Type.StrippedType();
Binder\Binder_WithExpression.cs (1)
20var receiverType = receiver.Type;
Binder\DecisionDagBuilder.cs (5)
407Debug.Assert(variableAccess.Type!.Equals(input.Type, TypeCompareKind.AllIgnoreOptions) || variableAccess.Type.IsErrorType()); 500Debug.Assert(constant.Value.Type is not null || constant.HasErrors); 501output = input = constant.Value.Type is { } type ? MakeConvertToType(input, constant.Syntax, type, isExplicitTest: false, tests) : input; 708var type = rel.Value.Type ?? input.Type;
Binder\ForEachLoopBinder.cs (21)
543(builder.ElementType.IsPointerOrFunctionPointer() && collectionExpr.Type.IsArray()) || 544(builder.ElementType.IsNullableType() && builder.ElementType.GetMemberTypeArgumentsNoUseSiteDiagnostics().Single().IsErrorType() && collectionExpr.Type.IsArray())); 574(collectionConversionClassification.Kind == ConversionKind.ExplicitReference && collectionExpr.Type.SpecialType == SpecialType.System_String)); 643Debug.Assert(collectionType.Equals(collectionExpr.Type, TypeCompareKind.AllIgnoreOptions)); // Should not create an Identity conversion that changes type. 682else if (collectionExpr.Type.SpecialType == SpecialType.System_String && builder.CollectionType.SpecialType == SpecialType.System_Collections_IEnumerable) 700TypeSymbol collectionExprType = collectionExpr.Type; 777TypeSymbol collectionExprType = collectionExpr.Type; 816if (!isAsync && collectionExpr.Type?.HasInlineArrayAttribute(out _) == true && collectionExpr.Type.TryGetPossiblyUnsupportedByLanguageInlineArrayElementField() is FieldSymbol elementField) 847diagnostics.Add(ErrorCode.ERR_InlineArrayForEachNotSupported, collectionExpr.Syntax.GetLocation(), collectionExpr.Type); 870builder.CollectionType = collectionExpr.Type; 887CheckInlineArrayTypeIsSupported(collectionExpr.Syntax, collectionExpr.Type, elementField.Type, diagnostics); 895diagnostics.Add(ErrorCode.ERR_InlineArrayForEachNotSupported, collectionExpr.Syntax.GetLocation(), collectionExpr.Type); 908(originalCollectionExpr.Type?.IsNullableType() == true && originalCollectionExpr.Type.StrippedType().Equals(collectionExpr.Type, TypeCompareKind.AllIgnoreOptions))); 919TypeSymbol collectionExprType = collectionExpr.Type; 959var unwrappedCollectionExprType = unwrappedCollectionExpr.Type; 1025: collectionExpr.Type; 1334getEnumeratorInfo = FindForEachPatternMethod(syntax, collectionSyntax, collectionExpr.Type, methodName, lookupResult, warningsOnly: true, diagnostics, isAsync); 1556diagnostics.Add(ErrorCode.WRN_PatternIsAmbiguous, collectionSyntax.Location, collectionExpr.Type, MessageID.IDS_Collection.Localize(),
Binder\LockBinder.cs (1)
40TypeSymbol? exprType = expr.Type;
Binder\RefSafetyAnalysis.cs (3)
240return placeholder.Type?.SpecialType == SpecialType.System_Int32; 521if (node.ExpressionOpt is { Type: { } } expr) 531if (node.Expression is { Type: { } } expr)
Binder\Semantics\BestTypeInferrer.cs (2)
138if (expr1.Type is { } type1) 153if (expr2.Type is { } type2)
Binder\Semantics\Conversions\Conversions.cs (2)
458if (method.RequiresInstanceReceiver && methodGroup.Receiver?.Type?.IsRestrictedType() == true) 488Debug.Assert((object)sourceExpression.Type == null);
Binder\Semantics\Conversions\ConversionsBase.cs (13)
104var sourceType = sourceExpression.Type; 289if (TryGetVoidConversion(sourceExpression.Type, destination, out var conversion)) 609Debug.Assert(sourceExpression == null || (object)sourceExpression.Type == (object)source); 1033Debug.Assert(sourceExpression == null || (object)sourceExpression.Type == (object)source); 1075var innerConversion = ClassifyImplicitBuiltInConversionFromExpression(innerExpression, innerExpression.Type, destination, ref useSiteInfo); 1353if (constantValue == null || (object)source.Type == null) 1363var specialSource = source.Type.GetSpecialTypeSafe(); 1419var sourceType = sourceExpression.Type; 1462source.Type is object && 1463IsNumericType(source.Type) && 1925Debug.Assert(sourceExpressionOpt == null || (object)sourceExpressionOpt.Type == sourceType); 1962conversions.ClassifyImplicitExtensionMethodThisArgConversion(s, s.Type, d.Type, ref u, isMethodGroupConversion: false), 3045if (expressionToCheck.Type is TypeSymbol typeToCheck && IsRefLikeOrAllowsRefLikeTypeImplementingVarianceCompatibleInterface(typeToCheck, targetInterfaceType, ref useSiteInfo))
Binder\Semantics\Operators\BinaryOperatorEasyOut.cs (9)
288var leftType = left.Type; 294var rightType = right.Type; 326Debug.Assert((object?)left.Type != null); 328Debug.Assert((object?)right.Type != null); 348if (left.Type.SpecialType != right.Type.SpecialType) 354if (left.Type.SpecialType == SpecialType.System_Int32 || 355left.Type.SpecialType == SpecialType.System_Boolean || 356left.Type.SpecialType == SpecialType.System_String)
Binder\Semantics\Operators\BinaryOperatorOverloadResolution.cs (27)
67TypeSymbol leftOperatorSourceOpt = left.Type?.StrippedType(); 68TypeSymbol rightOperatorSourceOpt = right.Type?.StrippedType(); 360var leftType = left.Type; 362var rightType = right.Type; 504bool isExactSubtraction = TypeSymbol.Equals(right.Type?.StrippedType(), underlying, TypeCompareKind.ConsiderEverything2); 608var leftType = left.Type; 614var rightType = right.Type; 683var leftType = left.Type as PointerTypeSymbol; 684var rightType = right.Type as PointerTypeSymbol; 699if ((object)leftType != null || (object)rightType != null || left.Type is FunctionPointerTypeSymbol || right.Type is FunctionPointerTypeSymbol) 721if ((left.Type is TypeParameterSymbol { AllowsRefLikeType: true } && right.IsLiteralNull()) || 722(right.Type is TypeParameterSymbol { AllowsRefLikeType: true } && left.IsLiteralNull())) 741this.Compilation.BuiltInOperators.GetSimpleBuiltInOperators(kind, operators, skipNativeIntegerOperators: !left.Type.IsNativeIntegerOrNullableThereof() && !right.Type.IsNativeIntegerOrNullableThereof()); 756this.Compilation.BuiltInOperators.GetUtf8ConcatenationBuiltInOperator(left.Type, operators); 767BuiltInOperators.IsValidObjectEquality(conversions, left.Type, left.IsLiteralNull(), leftIsDefault: false, right.Type, right.IsLiteralNull(), rightIsDefault: false, ref useSiteInfo) && 768((object)left.Type == null || (!left.Type.IsDelegateType() && left.Type.SpecialType != SpecialType.System_String && left.Type.SpecialType != SpecialType.System_Delegate)) && 769((object)right.Type == null || (!right.Type.IsDelegateType() && right.Type.SpecialType != SpecialType.System_String && right.Type.SpecialType != SpecialType.System_Delegate)); 779return (operand.Type is TypeParameterSymbol { AllowsRefLikeType: true }) ? Conversion.Boxing : Conversions.ClassifyConversionFromExpression(operand, objectType, isChecked: isChecked, ref useSiteInfo);
Binder\Semantics\Operators\UnaryOperatorEasyOut.cs (1)
99var operandType = operand.Type;
Binder\Semantics\Operators\UnaryOperatorOverloadResolution.cs (5)
257this.Compilation.BuiltInOperators.GetSimpleBuiltInOperators(kind, operators, skipNativeIntegerOperators: !operand.Type.IsNativeIntegerOrNullableThereof()); 296var enumType = operand.Type; 327var pointerType = operand.Type as PointerTypeSymbol; 351if ((object)operand.Type == null) 379TypeSymbol type0 = operand.Type.StrippedType();
Binder\Semantics\OverloadResolution\MethodTypeInference.cs (3)
363sb.AppendFormat("Argument types ({0})\n", string.Join(", ", from a in _arguments select a.Type)); 851if (argument.Kind == BoundKind.TupleLiteral && (object)argument.Type == null) 3239TypeSymbol source = argument.Type;
Binder\Semantics\OverloadResolution\OverloadResolution.cs (5)
3210if ((object)node.Type != null && Conversions.HasIdentityConversion(node.Type, t)) 4574var argType = argument.Type; 4588Conversions.ClassifyImplicitExtensionMethodThisArgConversion(argument, argument.Type, parameterType, ref useSiteInfo, isMethodGroupConversion: isMethodGroupConversion) : 4589((!dynamicConvertsToAnything || !argument.Type.IsDynamic()) ?
Binder\Semantics\OverloadResolution\OverloadResolutionResult.cs (6)
522diagnostics.Add(ErrorCode.ERR_CollectionExpressionMissingAdd, location, receiver.Type); 662diagnostics.Add(ErrorCode.ERR_QueryNoProvider, location, receiverOpt.Type, symbol.Name); 670diagnostics.Add(ErrorCode.ERR_BadAwaitArg, location, receiverOpt.Type); 1132diagnostics.Add(ErrorCode.ERR_CollectionExpressionMissingAdd, location, receiver.Type); 1369=> argument is BoundLiteral { Type.SpecialType: SpecialType.System_String } && 1408diagnostics.Add(ErrorCode.ERR_QueryMultipleProviders, location, receiver.Type, name);
Binder\SwitchBinder.cs (4)
48protected TypeSymbol SwitchGoverningType => SwitchGoverningExpression.Type; 380var switchGoverningType = switchGoverningExpression.Type; 442Debug.Assert((object)switchGoverningExpression.Type == null || switchGoverningExpression.Type.IsVoidType());
Binder\SwitchExpressionBinder.cs (6)
145var type = @case.Value.Type; 182Debug.Assert(inputExpression.Type is not null); 193Debug.Assert(inputExpression.Type is not null); 194return inputExpression.Type; 200if (switchGoverningExpression.Type == (object?)null || switchGoverningExpression.Type.IsVoidType())
Binder\UsingStatementBinder.cs (4)
120if (expressionOpt.Type is not null) 122CheckRestrictedTypeInAsyncMethod(originalBinder.ContainingMemberOrLambda, expressionOpt.Type, diagnostics, expressionOpt.Syntax); 189TypeSymbol? type = fromExpression ? expressionOpt!.Type : declarationTypeOpt; 290(fromExpression ? expressionOpt!.Type : declarationTypeOpt)!.ContainingModule != originalBinder.Compilation.SourceModule)
BoundTree\BoundDagEvaluation.cs (2)
57return arrayAccess.Expression.Type; 61return arrayAccess.Expression.Type;
BoundTree\BoundDecisionDag.cs (1)
193var f = ValueSetFactory.ForType(input.Type);
BoundTree\BoundExpression.cs (2)
88return this.Type is null; 145=> Type?.GetITypeSymbol(TopLevelNullability.FlowState.ToAnnotation());
BoundTree\BoundExpressionExtensions.cs (4)
126return node.Type is { }; 131var type = node.Type; 146if (expr.Type is { } type) 264TypeSymbol? receiverType = expressionOpt.Type;
BoundTree\BoundFunctionPointerInvocation.cs (2)
16Debug.Assert(InvokedExpression.Type is FunctionPointerTypeSymbol); 17return (FunctionPointerTypeSymbol)InvokedExpression.Type;
BoundTree\BoundInlineArrayAccess.cs (4)
18Debug.Assert(Argument.Type is 33if (Argument.Type.Name == "Range") 62Debug.Assert(((NamedTypeSymbol)Type).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Equals(Expression.Type?.TryGetInlineArrayElementField()?.TypeWithAnnotations ?? default, TypeCompareKind.ConsiderEverything)); 70Debug.Assert(Type.Equals(Expression.Type?.TryGetInlineArrayElementField()?.Type, TypeCompareKind.ConsiderEverything));
BoundTree\BoundNode.cs (1)
111return expression?.Type?.IsErrorType() == true;
BoundTree\BoundNullCoalescingAssignmentOperator.cs (2)
15var leftType = LeftOperand.Type; 22return nullableUnderlying.Equals(RightOperand.Type);
BoundTree\Constructors.cs (1)
708public static BoundDagTemp ForOriginalInput(BoundExpression expr) => new BoundDagTemp(expr.Syntax, expr.Type!, source: null);
BoundTree\Formatting.cs (4)
21RoslynDebug.Assert(this.Type is { }, $"Unexpected null type in {this.GetType().Name}"); 22return this.Type; 155=> (Type is null) ? FormattableStringFactory.Create("stackalloc {0}[{1}]", ElementType, Count.WasCompilerGenerated ? null : Count.Syntax.ToString()) : base.Display; 161=> (Type is null) ? MessageID.IDS_FeatureSwitchExpression.Localize() : base.Display;
BoundTree\UnboundLambda.cs (1)
379expression.Type?.SetUnknownNullabilityForReferenceTypes();
CodeGen\EmitAddress.cs (14)
43Debug.Assert(!expression.Type.IsReferenceType); 44Debug.Assert(!expression.Type.IsValueType || expression.Type.IsNullableType()); 67Debug.Assert(expression.Type.IsValueType || IsAnyReadOnly(addressKind), "'this' is readonly in classes"); 69if (expression.Type.IsValueType) 104Debug.Assert(operand.Type.IsPointerType()); 136var type = expression.Type; 333var value = this.AllocateTemp(expression.Type, expression.Syntax); 374if (!receiver.Type.IsReferenceType) 391TreatLongsAsNative(index.Type.PrimitiveTypeCode); 405if (((ArrayTypeSymbol)arrayAccess.Expression.Type).IsSZArray) 413_builder.EmitArrayElementAddress(_module.Translate((ArrayTypeSymbol)arrayAccess.Expression.Type), 506var receiverType = receiver.Type; 526EmitBox(receiver.Type, receiver.Syntax);
CodeGen\EmitArrayInitializer.cs (1)
225TypeSymbol type = init.Type.EnumUnderlyingTypeOrSelf();
CodeGen\EmitConversion.cs (11)
73Debug.Assert((operand.Type.IsArray()) && 139var fromType = conversion.Operand.Type; 214var fromType = conversion.Operand.Type; 230if (!conversion.Operand.Type.IsVerifierReference()) 232EmitBox(conversion.Operand.Type, conversion.Operand.Syntax); 262if (!conversion.Operand.Type.IsVerifierReference()) 264EmitBox(conversion.Operand.Type, conversion.Operand.Syntax); 290var fromType = conversion.Operand.Type; 337EmitSymbolToken(receiver.Type, receiver.Syntax); 343if (!receiver.Type.IsVerifierReference()) 345EmitBox(receiver.Type, receiver.Syntax);
CodeGen\EmitExpression.cs (50)
52if ((object)expression.Type == null || 53(expression.Type.SpecialType != SpecialType.System_Decimal && 54!expression.Type.IsNullableType())) 56EmitConstantExpression(expression.Type, constantValue, used, expression.Syntax); 374EmitDefaultValue(node.Type, used, node.Syntax); 409var receiverType = receiver.Type; 522Debug.Assert(receiver.Type.IsNullableType()); 680EmitSymbolToken(expression.Operand.Type, expression.Operand.Syntax); 737Debug.Assert(argument.Type.IsDynamic() || argument is BoundFieldAccess { FieldSymbol.RefKind: not RefKind.None }, "passing args byref should not clone them into temps"); 792EmitLoadIndirect(expression.Type, expression.Syntax); 801var meth = expression.MethodOpt ?? receiver.Type.DelegateInvokeMethod(); 1014if (((ArrayTypeSymbol)arrayAccess.Expression.Type).IsSZArray) 1101_builder.EmitArrayElementLoad(_module.Translate((ArrayTypeSymbol)arrayAccess.Expression.Type), arrayAccess.Expression.Syntax, _diagnostics.DiagnosticBag); 1132if (!field.IsVolatile && !field.IsStatic && fieldAccess.ReceiverOpt.Type.IsVerifierValue() && field.RefKind == RefKind.None) 1171if (fieldType.IsValueType && (object)fieldType == (object)receiver.Type) 1227if (receiver == null || !receiver.Type.IsValueType) 1238EmitSymbolToken(receiver.Type, receiver.Syntax); 1267if (!receiver.Type.IsVerifierValue()) 1319var type = expr.Type; 1510if (receiver.Type.IsTypeParameter()) 1515Debug.Assert(receiver.Type.IsVerifierReference(), "this is not a reference"); 1645Debug.Assert(TypeSymbol.Equals(method.ContainingType, receiver.Type, TypeCompareKind.ConsiderEverything2)); 1674EmitSymbolToken(receiver.Type, receiver.Syntax); 1831var receiverType = receiver.Type; 1917var receiverType = receiver.Type; 1977Debug.Assert(receiver.Type.IsVerifierReference()); 1988Debug.Assert(receiver.Type.IsVerifierReference()); 2008EmitSymbolToken(receiver.Type, receiver.Syntax); 2023var receiverType = receiver.Type; 2086var receiverType = receiver.Type; 2598var rightType = right.Type; 2654if (left.Kind == BoundKind.ArrayAccess && left.Type.TypeKind == TypeKind.TypeParameter && !left.Type.IsValueType) 2678EmitSymbolToken(target.Type, target.Syntax); 3050assignmentOperator.Left.Type, 3097var arrayType = (ArrayTypeSymbol)array.Type; 3111EmitIndirectStore(expression.Type, expression.Syntax); 3116EmitIndirectStore(expression.Type, expression.Syntax); 3122EmitIndirectStore(expression.Type, expression.Syntax); 3134EmitIndirectStore(expression.Type, expression.Syntax); 3139EmitIndirectStore(expression.Type, expression.Syntax); 3385Debug.Assert((object)operand.Type != null); 3386if (!operand.Type.IsVerifierReference()) 3389EmitBox(operand.Type, operand.Syntax); 3412var operandType = operand.Type; 3907if (!(expr.Type.IsInterfaceType() || expr.Type.IsDelegateType())) 3909return expr.Type; 3954return expr.Type; 4025temp = AllocateTemp(ptrInvocation.InvokedExpression.Type, ptrInvocation.Syntax);
CodeGen\EmitOperators.cs (21)
305Debug.Assert(binOp.Left.Type.SpecialType == SpecialType.System_Boolean); 306Debug.Assert(binOp.Right.Type.SpecialType == SpecialType.System_Boolean); 314Debug.Assert(binOp.Left.Type.SpecialType == SpecialType.System_Boolean); 315Debug.Assert(binOp.Right.Type.SpecialType == SpecialType.System_Boolean); 331Debug.Assert(binOp.Left.Type.SpecialType == SpecialType.System_Boolean); 332Debug.Assert(binOp.Right.Type.SpecialType == SpecialType.System_Boolean); 337Debug.Assert(binOp.Left.Type.SpecialType == SpecialType.System_Boolean); 338Debug.Assert(binOp.Right.Type.SpecialType == SpecialType.System_Boolean); 343Debug.Assert(binOp.Left.Type.SpecialType == SpecialType.System_Boolean); 344Debug.Assert(binOp.Right.Type.SpecialType == SpecialType.System_Boolean); 375if (comparand is BoundConversion { Type.SpecialType: SpecialType.System_Object, ConversionKind: ConversionKind.Boxing, Operand.Type: TypeParameterSymbol { AllowsRefLikeType: true } } && 458var comparandType = comparand.Type; 472var comparandType = comparand.Type; 496Debug.Assert(condition.Type.SpecialType == SpecialType.System_Boolean); 531Debug.Assert(condition.Type.SpecialType == SpecialType.System_Boolean); 654enumType = expression.Left.Type; 659Debug.Assert(TypeSymbol.Equals(expression.Left.Type, expression.Right.Type, TypeCompareKind.ConsiderEverything2)); 664enumType = expression.Right.Type; 786return IsUnsigned(Binder.GetEnumPromotedType(op.Left.Type.GetEnumUnderlyingType().SpecialType)); 789return IsUnsigned(Binder.GetEnumPromotedType(op.Right.Type.GetEnumUnderlyingType().SpecialType));
CodeGen\EmitStatement.cs (28)
178var exprType = thrown.Type; 252var nonConstType = nonConstOp.Type; 530var receiverType = receiver.Type; 589Debug.Assert((object)operand.Type != null); 590if (!operand.Type.IsVerifierReference()) 593EmitBox(operand.Type, operand.Syntax); 610var conditionType = condition.Type; 915_module.Translate(expressionOpt.Type, boundReturnStatement.Syntax, _diagnostics.DiagnosticBag); 1127if (!exceptionSourceOpt.Type.IsVerifierReference()) 1129Debug.Assert(exceptionSourceOpt.Type.IsTypeParameter()); // only expecting type parameters 1131EmitSymbolToken(exceptionSourceOpt.Type, exceptionSourceOpt.Syntax); 1158Debug.Assert(!left.ReceiverOpt.Type.IsTypeParameter()); 1169var temp = AllocateTemp(exceptionSource.Type, exceptionSource.Syntax); 1232Debug.Assert((object)dispatch.Expression.Type != null); 1233Debug.Assert(dispatch.Expression.Type.IsValidV6SwitchGoverningType() || dispatch.Expression.Type.IsSpanOrReadOnlySpanChar()); 1236Debug.Assert(!dispatch.Expression.Type.IsNullableType()); 1255Debug.Assert((object)expression.Type != null && 1256(expression.Type.IsValidV6SwitchGoverningType() || expression.Type.IsSpanOrReadOnlySpanChar())); 1301temp = AllocateTemp(expression.Type, expression.Syntax); 1308expression.Type.SpecialType == SpecialType.System_String || expression.Type.IsSpanOrReadOnlySpanChar()); 1311if (expression.Type.SpecialType == SpecialType.System_String || expression.Type.IsSpanOrReadOnlySpanChar()) 1315this.EmitStringSwitchJumpTable(switchCaseLabels, fallThroughLabel, key, expression.Syntax, expression.Type); 1319this.EmitLengthBasedStringSwitchJumpTable(lengthBasedSwitchStringJumpTableOpt, fallThroughLabel, key, expression.Syntax, expression.Type); 1324_builder.EmitIntegerSwitchJumpTable(switchCaseLabels, fallThroughLabel, key, expression.Type.EnumUnderlyingTypeOrSelf().PrimitiveTypeCode);
CodeGen\Optimizer.cs (12)
610node.Type); 951right.Type.IsVerifierValue() && 974node.Left.Type.Equals(node.Right.Type, TypeCompareKind.AllIgnoreOptions) || 1020left.Type.Equals(((PointerTypeSymbol)right.Type).PointedAtType, TypeCompareKind.AllIgnoreOptions); 1037Debug.Assert(lhs.Type.IsValueType, "'this' is assignable only in structs"); 1195var receiverType = receiver.Type; 1230var receiverType = receiver.Type; 1348if (receiver.Type.IsTypeParameter()) 1357if (receiver.Type.IsValueType && ( 1658PushEvalStack(new BoundDefaultExpression(node.Syntax, node.Operand.Type), ExprContext.Value);
Compilation\CSharpCompilation.cs (2)
2192(result!.Type!.IsVoidType() || result.Type!.SpecialType == SpecialType.System_Int32);
Compilation\CSharpSemanticModel.cs (18)
2051type = boundExpr.Type; 2170convertedType = highestBoundExpr.Type; 2176convertedType = highestBoundExpr.Type; 2265static (TypeSymbol, NullabilityInfo) getTypeAndNullability(BoundExpression expr) => (expr.Type, expr.TopLevelNullability); 3376else if (expr.Type.IsDelegateType()) 3685var thisParam = GetThisParameter(boundNode.Type, containingType, containingMember, out resultKind); 3809symbols = OneOrMany.Create<Symbol>(new SynthesizedIntrinsicOperatorSymbol(unaryOperator.Operand.Type.StrippedType(), 3832TypeSymbol opType = increment.Operand.Type.StrippedType(); 3859((binaryOperator.Left.IsLiteralNull() && binaryOperator.Right.Type.IsNullableType()) || 3860(binaryOperator.Right.IsLiteralNull() && binaryOperator.Left.Type.IsNullableType())) && 3874binaryOperator.Left.Type, 3875binaryOperator.Right.Type, 4085TypeSymbol type = boundNode.Type; 4637receiver.Type, 4752extensionThisType = call.ReceiverOpt.Type; 4756extensionThisType = call.Arguments[0].Type; 4786MethodSymbol reduced = method.ReduceExtensionMethod(receiver.Type, Compilation); 4801MethodSymbol reduced = method.ReduceExtensionMethod(receiverOpt.Type, Compilation);
Compilation\MemberSemanticModel.cs (1)
1144return (bound as BoundTupleExpression)?.Type as NamedTypeSymbol;
Compiler\MethodBodySynthesizer.Lowered.cs (2)
360TypeSymbol system_Int32 = currentHashValue.Type!; 385NamedTypeSymbol constructedEqualityComparer = equalityComparerType.Construct(valueToHash.Type);
Emitter\Model\PEModuleBuilder.cs (1)
1229Translate(optArgList.Arguments[i].Type, syntaxNodeOpt, diagnostics));
FlowAnalysis\AbstractFlowPass.cs (6)
644else if ((object)node.Type == null || node.Type.SpecialType != SpecialType.System_Boolean) 1669&& node.Type.SpecialType == SpecialType.System_Boolean) 2239(object)receiverOpt.Type != null && 2240!receiverOpt.Type.IsPrimitiveRecursiveStruct()); 2632&& conv.Operand.Type!.IsNonNullableValueType());
FlowAnalysis\AbstractFlowPass_Switch.cs (1)
101if (!node.Expression.Type.IsValidV6SwitchGoverningType())
FlowAnalysis\DefiniteAssignment.cs (7)
1125MayRequireTrackingReceiverType(receiver.Type); 1142MayRequireTrackingReceiverType(receiverOpt.Type) && 1143!receiverOpt.Type.IsPrimitiveRecursiveStruct(); 1381if (_emptyStructTypeCache.IsEmptyStructType(node.Type)) return true; 1594if (elementAccess.Expression.Type.HasInlineArrayAttribute(out int length) && 1598int slot = MakeMemberSlot(elementAccess.Expression, elementAccess.Expression.Type.TryGetInlineArrayElementField()); 2583if (refKind != RefKind.None && ((object)method == null || method.IsExtern) && arg.Type is TypeSymbol type)
FlowAnalysis\NullableWalker.cs (62)
405expr.Type?.Equals(result.RValueType.Type, TypeCompareKind.AllIgnoreOptions) == true ? result.RValueType.Type : expr.Type); 538Debug.Assert(AreCloseEnough(placeholder.Type, result.RValueType.Type)); 1994receiver.Type is object; 2005TypeSymbol? nodeType = node.Type; 2041var operandType = operand.Type; 2059TypeSymbol.Equals(conv.Type, conv.Operand.Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes): 3547Debug.Assert(AreCloseEnough(resultType.Type, node.Type)); 4353SetAnalyzedNullability(node.ImplicitReceiverOpt, new VisitResult(node.ImplicitReceiverOpt.Type, NullableAnnotation.NotAnnotated, NullableFlowState.NotNull)); 4410SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 4415var resultType = TypeWithState.Create(node.Type, NullableFlowState.NotNull); 4462Debug.Assert(node.Type is object); 4463if (IsEmptyStructType(node.Type)) 4468return GetOrCreatePlaceholderSlot(node, TypeWithAnnotations.Create(node.Type, NullableAnnotation.NotAnnotated)); 4785Debug.Assert(!node.Expression.Type!.IsValueType); 4799TypeSymbol.Equals(node.Indices[0].Type, compilation.GetWellKnownType(WellKnownType.System_Range), TypeCompareKind.ConsiderEverything2)) 5154if (expr.Type is null) 5164TypeWithAnnotations.Create(expr.Type), 5178Debug.Assert(binary.Type!.SpecialType == SpecialType.System_Boolean); 5348var receiverType = conditional.Receiver.Type!; 5377if (slot > 0 && PossiblyNullableType(operand.Type)) 5447LearnFromNullTest(slot, expressionWithoutConversion.Type, ref state, markDependentSlotsNotNull: false); 5561node.Type?.ContainsErrorType() == true || 5562TypeSymbol.Equals(targetType.Type.GetNullableUnderlyingType(), node.Type, TypeCompareKind.AllIgnoreOptions)); 5568targetType = TypeWithAnnotations.Create(node.Type, NullableAnnotation.NotAnnotated); 5857if (slot > 0 && receiver.Type?.IsNullableType() == true) 5858slot = GetNullableOfTValueSlot(receiver.Type, slot, out _); 5902TypeSymbol? refResultType = node.Type?.SetUnknownNullabilityForReferenceTypes(); 5968resultType ??= node.Type?.SetUnknownNullabilityForReferenceTypes(); 6959TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState.Create(argument.Type, result.RValueType.State), argument as BoundConversion, argumentNoConversion); 7077completion(TypeWithAnnotations.Create(argument.Type)); 8125if (value.Type is null || value.Type.IsDynamic() || value.ConstantValueOpt != null) 8135value.Type.HasInlineArrayAttribute(out _) == true && 8136value.Type.TryGetInlineArrayElementField() is not null) 8274if (TypeAllowsConditionalState(targetType.Type) && TypeAllowsConditionalState(operand.Type)) 8422var tupleOpt = (NamedTypeSymbol?)node.Type; 9614case BoundExpression arg when arg.Type is { TypeKind: TypeKind.Delegate }: 9728Debug.Assert(arg.Type is not null); 9729TypeSymbol argType = arg.Type; 9747Debug.Assert(arg.Type is not null); 9748TypeSymbol argType = arg.Type; 9916var rvalueResult = TypeWithState.Create(node.Type, NullableFlowState.NotNull); 9917var lvalueResult = TypeWithAnnotations.Create(node.Type, NullableAnnotation.NotAnnotated); 10400if (expr.Type is NamedTypeSymbol { IsTupleType: true } tupleType) 10585SetResultType(node.Expression, TypeWithState.Create(node.Expression.Type, ResultType.State)); 10926if (collectionExpression.Type!.SpecialType == SpecialType.System_Collections_IEnumerable) 10929targetTypeWithAnnotations = TypeWithAnnotations.Create(collectionExpression.Type); 10931else if (ForEachLoopBinder.IsIEnumerableT(collectionExpression.Type.OriginalDefinition, isAsync, compilation)) 11195var type = TypeWithAnnotations.Create(node.Type); 11591SetResultType(node, TypeWithState.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.IsNull == true ? NullableFlowState.MaybeDefault : NullableFlowState.NotNull)); 11768SetResultType(expression, TypeWithState.Create(expression.Type, default)); 11802Debug.Assert(receiverOpt.Type is null || AreCloseEnough(receiverOpt.Type, resultTypeSymbol)); 11890SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 11923Debug.Assert(node.Type is null || node.Type.IsErrorType() || node.Type.IsRefLikeType); 11939SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 11943Debug.Assert(node.Type is not null); 11944var type = VisitArrayInitialization(node.Type, initialization, node.HasErrors);
FlowAnalysis\NullableWalker_Patterns.cs (4)
29LearnFromAnyNullPatterns(slot, expression.Type, pattern); 279var originalInputType = node.Expression.Type; 883var originalInputType = node.Expression.Type; 953?? node.Type?.SetUnknownNullabilityForReferenceTypes();
FlowAnalysis\ReadWriteWalker.cs (1)
216if (receiver.Type.IsStructType() && receiverSyntax.Span.OverlapsWith(RegionSpan))
Generated\BoundNodes.xml.Generated.cs (187)
488if (!TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 518if (receiver != this.Receiver || localScopeDepth != this.LocalScopeDepth || !TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 550public new TypeSymbol Type => base.Type!; 587public new TypeSymbol Type => base.Type!; 616public new TypeSymbol? Type => base.Type; 651public new TypeSymbol Type => base.Type!; 688public new TypeSymbol Type => base.Type!; 724public new TypeSymbol Type => base.Type!; 761public new TypeSymbol Type => base.Type!; 797public new TypeSymbol Type => base.Type!; 832public new TypeSymbol Type => base.Type!; 867public new TypeSymbol Type => base.Type!; 902public new TypeSymbol Type => base.Type!; 940if (refKind != this.RefKind || !TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 968if (expression != this.Expression || !TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 1001if (resultKind != this.ResultKind || symbols != this.Symbols || childBoundNodes != this.ChildBoundNodes || !TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 1084public new TypeSymbol Type => base.Type!; 1122public new TypeSymbol Type => base.Type!; 1162public new TypeSymbol? Type => base.Type; 1199public new TypeSymbol Type => base.Type!; 1244public new TypeSymbol Type => base.Type!; 1284public new TypeSymbol Type => base.Type!; 1315public new TypeSymbol? Type => base.Type; 1358public new TypeSymbol Type => base.Type!; 1388public new TypeSymbol Type => base.Type!; 1423public new TypeSymbol Type => base.Type!; 1460public new TypeSymbol Type => base.Type!; 1494public new TypeSymbol Type => base.Type!; 1525public new TypeSymbol Type => base.Type!; 1556public new TypeSymbol Type => base.Type!; 1588public new TypeSymbol Type => base.Type!; 1620public new TypeSymbol Type => base.Type!; 1654public new TypeSymbol Type => base.Type!; 1710public new TypeSymbol Type => base.Type!; 1797public new TypeSymbol Type => base.Type!; 1837public new TypeSymbol Type => base.Type!; 1872public new TypeSymbol Type => base.Type!; 1910public new TypeSymbol Type => base.Type!; 1954if (leftOperand != this.LeftOperand || rightOperand != this.RightOperand || !TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 1981public new TypeSymbol? Type => base.Type; 2023public new TypeSymbol Type => base.Type!; 2061public new TypeSymbol Type => base.Type!; 2091public new TypeSymbol? Type => base.Type; 2121public new TypeSymbol Type => base.Type!; 2187public new TypeSymbol Type => base.Type!; 2227public new TypeSymbol Type => base.Type!; 2314public new TypeSymbol Type => base.Type!; 2356public new TypeSymbol Type => base.Type!; 2399public new TypeSymbol Type => base.Type!; 2436public new TypeSymbol Type => base.Type!; 2471public new TypeSymbol Type => base.Type!; 2509public new TypeSymbol Type => base.Type!; 2544public new TypeSymbol Type => base.Type!; 2579public new TypeSymbol Type => base.Type!; 2614public new TypeSymbol Type => base.Type!; 2649public new TypeSymbol Type => base.Type!; 2688public new TypeSymbol Type => base.Type!; 2730public new TypeSymbol Type => base.Type!; 2773public new TypeSymbol Type => base.Type!; 2804public new TypeSymbol? Type => base.Type; 2827public new TypeSymbol Type => base.Type!; 2861public new TypeSymbol Type => base.Type!; 2897public new TypeSymbol Type => base.Type!; 2931public new TypeSymbol Type => base.Type!; 2969public new TypeSymbol Type => base.Type!; 3008public new TypeSymbol Type => base.Type!; 3045public new TypeSymbol Type => base.Type!; 3074public new TypeSymbol? Type => base.Type; 3110public new TypeSymbol Type => base.Type!; 4320if (constantValueOpt != this.ConstantValueOpt || !TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 4352public new TypeSymbol Type => base.Type!; 4388public new TypeSymbol Type => base.Type!; 4423public new TypeSymbol Type => base.Type!; 4458public new TypeSymbol Type => base.Type!; 4487public new TypeSymbol? Type => base.Type; 4532public new TypeSymbol Type => base.Type!; 4579public new TypeSymbol Type => base.Type!; 4612public new TypeSymbol Type => base.Type!; 4653public new TypeSymbol Type => base.Type!; 4798if (!Symbols.SymbolEqualityComparer.ConsiderEverything.Equals(label, this.Label) || !TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 4959if (expression != this.Expression || switchArms != this.SwitchArms || reachabilityDecisionDag != this.ReachabilityDecisionDag || !Symbols.SymbolEqualityComparer.ConsiderEverything.Equals(defaultLabel, this.DefaultLabel) || reportedNotExhaustive != this.ReportedNotExhaustive || !TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 4984public new TypeSymbol Type => base.Type!; 5731public new TypeSymbol? Type => base.Type; 5754if (expression != this.Expression || !TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 5780public new TypeSymbol Type => base.Type!; 5816public new TypeSymbol Type => base.Type!; 5853public new TypeSymbol Type => base.Type!; 5908public new TypeSymbol Type => base.Type!; 5942public new TypeSymbol Type => base.Type!; 5979public new TypeSymbol Type => base.Type!; 6022public new TypeSymbol Type => base.Type!; 6054public new TypeSymbol Type => base.Type!; 6167public new TypeSymbol Type => base.Type!; 6214public new TypeSymbol Type => base.Type!; 6256public new TypeSymbol Type => base.Type!; 6297public new TypeSymbol? Type => base.Type; 6337public new TypeSymbol Type => base.Type!; 6415public new TypeSymbol? Type => base.Type; 6452public new TypeSymbol Type => base.Type!; 6495if (!TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 6573public new TypeSymbol? Type => base.Type; 6610if (sourceTuple != this.SourceTuple || wasTargetTyped != this.WasTargetTyped || arguments != this.Arguments || argumentNamesOpt != this.ArgumentNamesOpt || inferredNamesOpt != this.InferredNamesOpt || !TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 6709public new TypeSymbol Type => base.Type!; 6764public new TypeSymbol Type => base.Type!; 6817public new TypeSymbol Type => base.Type!; 6884public new TypeSymbol Type => base.Type!; 6923public new TypeSymbol Type => base.Type!; 6959public new TypeSymbol Type => base.Type!; 6992public new TypeSymbol Type => base.Type!; 7034public new TypeSymbol Type => base.Type!; 7097public new TypeSymbol Type => base.Type!; 7131public new TypeSymbol Type => base.Type!; 7162public new TypeSymbol? Type => base.Type; 7217if (!TypeSymbol.Equals(elementType, this.ElementType, TypeCompareKind.ConsiderEverything) || count != this.Count || initializerOpt != this.InitializerOpt || !TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 7239public new TypeSymbol Type => base.Type!; 7273public new TypeSymbol Type => base.Type!; 7318public new TypeSymbol Type => base.Type!; 7352public new TypeSymbol Type => base.Type!; 7389public new TypeSymbol Type => base.Type!; 7433public new TypeSymbol Type => base.Type!; 7487public new TypeSymbol Type => base.Type!; 7530public new TypeSymbol Type => base.Type!; 7569public new TypeSymbol Type => base.Type!; 7611public new TypeSymbol? Type => base.Type; 7655public new TypeSymbol? Type => base.Type; 7693public new TypeSymbol Type => base.Type!; 7756public new TypeSymbol Type => base.Type!; 7807if (parts != this.Parts || constantValueOpt != this.ConstantValueOpt || !TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 7835if (!interpolationData.Equals(this.InterpolationData) || parts != this.Parts || constantValueOpt != this.ConstantValueOpt || !TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 7863if (!TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 7893public new TypeSymbol Type => base.Type!; 7925public new TypeSymbol? Type => base.Type; 7978if (expression != this.Expression || pattern != this.Pattern || isNegated != this.IsNegated || reachabilityDecisionDag != this.ReachabilityDecisionDag || !Symbols.SymbolEqualityComparer.ConsiderEverything.Equals(whenTrueLabel, this.WhenTrueLabel) || !Symbols.SymbolEqualityComparer.ConsiderEverything.Equals(whenFalseLabel, this.WhenFalseLabel) || !TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 8542public new TypeSymbol? Type => base.Type; 8579if (expression != this.Expression || !TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 8601public new TypeSymbol? Type => base.Type; 8674public new TypeSymbol? Type => base.Type; 8772public new TypeSymbol? Type => base.Type; 8805public new TypeSymbol Type => base.Type!; 10822TypeSymbol? type = this.VisitType(node.Type); 10828TypeSymbol? type = this.VisitType(node.Type); 10888TypeSymbol? type = this.VisitType(node.Type); 10894TypeSymbol? type = this.VisitType(node.Type); 10900TypeSymbol? type = this.VisitType(node.Type); 11077TypeSymbol? type = this.VisitType(node.Type); 11444TypeSymbol? type = this.VisitType(node.Type); 11507TypeSymbol? type = this.VisitType(node.Type); 11532TypeSymbol? type = this.VisitType(node.Type); 11669TypeSymbol? type = this.VisitType(node.Type); 11791TypeSymbol? type = this.VisitType(node.Type); 11814TypeSymbol? type = this.VisitType(node.Type); 11918TypeSymbol? type = this.VisitType(node.Type); 12019TypeSymbol? type = this.VisitType(node.Type); 12025TypeSymbol? type = this.VisitType(node.Type); 12030TypeSymbol? type = this.VisitType(node.Type); 12051TypeSymbol? type = this.VisitType(node.Type); 12168TypeSymbol? type = this.VisitType(node.Type); 12277updatedNode = node.Update(receiver, node.LocalScopeDepth, node.Type); 12443updatedNode = node.Update(expression, node.Type); 12461updatedNode = node.Update(node.ResultKind, node.Symbols, childBoundNodes, node.Type); 12856updatedNode = node.Update(leftOperand, rightOperand, node.Type); 13649updatedNode = node.Update(expression, switchArms, reachabilityDecisionDag, node.DefaultLabel, node.ReportedNotExhaustive, node.Type); 13744updatedNode = node.Update(expression, node.Type); 14106updatedNode = node.Update(sourceTuple, node.WasTargetTyped, arguments, node.ArgumentNamesOpt, node.InferredNamesOpt, node.Type); 14389updatedNode = node.Update(elementType, count, initializerOpt, node.Type); 14627updatedNode = node.Update(parts, node.ConstantValueOpt, node.Type); 14644updatedNode = node.Update(node.InterpolationData, parts, node.ConstantValueOpt, node.Type); 14706updatedNode = node.Update(expression, pattern, node.IsNegated, reachabilityDecisionDag, node.WhenTrueLabel, node.WhenFalseLabel, node.Type); 14855updatedNode = node.Update(expression, node.Type); 14997new TreeDumperNode("type", node.Type, null), 15006new TreeDumperNode("type", node.Type, null), 15095new TreeDumperNode("type", node.Type, null), 15103new TreeDumperNode("type", node.Type, null), 15113new TreeDumperNode("type", node.Type, null), 15383new TreeDumperNode("type", node.Type, null), 15946new TreeDumperNode("type", node.Type, null), 16048new TreeDumperNode("type", node.Type, null), 16084new TreeDumperNode("type", node.Type, null), 16270new TreeDumperNode("type", node.Type, null), 16487new TreeDumperNode("type", node.Type, null), 16521new TreeDumperNode("type", node.Type, null), 16687new TreeDumperNode("type", node.Type, null), 16854new TreeDumperNode("type", node.Type, null), 16864new TreeDumperNode("type", node.Type, null), 16871new TreeDumperNode("type", node.Type, null), 16903new TreeDumperNode("type", node.Type, null), 17057new TreeDumperNode("type", node.Type, null),
Lowering\AsyncRewriter\AsyncExceptionHandlerRewriter.cs (2)
674rewrittenSource.Type, 1008this.returnValue = returnValue = new SynthesizedLocal(containingMethod, TypeWithAnnotations.Create(valueOpt.Type), SynthesizedLocalKind.AsyncMethodReturnValue, _syntaxOpt);
Lowering\AsyncRewriter\AsyncMethodToStateMachineRewriter.cs (1)
370var awaiterTemp = F.SynthesizedLocal(getAwaiter.Type, syntax: node.Syntax, kind: SynthesizedLocalKind.Awaiter);
Lowering\AsyncRewriter\AsyncRewriter.AsyncIteratorRewriter.cs (1)
236F.Call(parameterProxy, WellKnownMember.System_Threading_CancellationToken__Equals, F.Default(parameterProxy.Type)),
Lowering\ClosureConversion\ClosureConversion.cs (4)
580Debug.Assert(TypeSymbol.Equals(result.Type, frameType, TypeCompareKind.ConsiderEverything2)); 695BoundExpression assignment = new BoundAssignmentOperator(syntax, left, right, left.Type); 788var assignToProxy = new BoundAssignmentOperator(syntax, left, value, value.Type); 1251rewrittenExceptionSource.Type);
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (28)
118if (!node.Type.Equals(result.Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)) 298if (!TypeSymbol.Equals(index.Type, _int32Type, TypeCompareKind.ConsiderEverything2)) 300index = ConvertIndex(index, arg.Type, _int32Type); 316if (!TypeSymbol.Equals(index.Type, _int32Type, TypeCompareKind.ConsiderEverything2)) 318index = ConvertIndex(index, arg.Type, _int32Type); 367if (node.Operand.IsLiteralNull() && (object)node.Operand.Type == null) 493if ((object)left.Type == null && left.IsLiteralNull()) 495left = _bound.Default(right.Type); 497if ((object)right.Type == null && right.IsLiteralNull()) 499right = _bound.Default(left.Type); 510var promotedType = PromotedType(enumOperand.Type.StrippedType().GetEnumUnderlyingType()); 563return Convert(loweredOperand, operand.Type, promotedType, isChecked, false); 700var operandType = node.Operand.Type; 709? Convert(Visit(node.Operand), node.Operand.Type, method.Parameters[0].Type, node.Checked, false) 725if (node.Operand.Type.IsNullableType()) 727return Convert(Visit(node.Operand), node.Operand.Type, node.Type, node.Checked, node.ExplicitCastInCode); 734var e1 = Convert(Visit(node.Operand), node.Operand.Type, intermediate, node.Checked, false); 740return Convert(Visit(node.Operand), node.Operand.Type, node.Type, node.Checked, node.ExplicitCastInCode); 760receiver = requiresInstanceReceiver ? nullObject : receiver.Type.IsReferenceType ? receiver : _bound.Convert(_objectType, receiver); 798var d = node.Argument.Type as NamedTypeSymbol; 819if ((object)operand.Type == null && operand.ConstantValueOpt != null && operand.ConstantValueOpt.IsNull) 880TypeSymbol lambdaParamType = node.LeftPlaceholder.Type; 881return _bound.StaticCall(WellKnownMember.System_Linq_Expressions_Expression__Coalesce_Lambda, left, right, MakeConversionLambda(leftConversion, lambdaParamType, node.LeftConversion.Type)); 1117if (node.ReceiverOpt?.Type.IsTypeParameter() == true && 1118!node.ReceiverOpt.Type.IsReferenceType) 1188var promotedType = PromotedType(arg.Type.StrippedType().GetEnumUnderlyingType()); 1190loweredArg = Convert(loweredArg, arg.Type, promotedType, isChecked, false); 1207_bound.Typeof(node.Type, _bound.WellKnownType(WellKnownType.System_Type)));
Lowering\DiagnosticsPass_ExpressionTrees.cs (4)
66if (e != null && (object)e.Type != null && e.Type.IsPointerOrFunctionPointer()) NoteUnsafe(e); 93!node.Indices[0].Type!.SpecialType.CanOptimizeBehavior()) 377expr.Type is TypeSymbol type &&
Lowering\DiagnosticsPass_Warnings.cs (18)
228Debug.Assert(TypeSymbol.Equals(expr1.Type, expr2.Type, TypeCompareKind.ConsiderEverything2)); 330if (node.Left.Type.SpecialType == SpecialType.System_Object && !IsExplicitCast(node.Left) && !(node.Left.ConstantValueOpt != null && node.Left.ConstantValueOpt.IsNull) && ConvertedHasEqual(node.OperatorKind, node.Right, out t)) 335else if (node.Right.Type.SpecialType == SpecialType.System_Object && !IsExplicitCast(node.Right) && !(node.Right.ConstantValueOpt != null && node.Right.ConstantValueOpt.IsNull) && ConvertedHasEqual(node.OperatorKind, node.Left, out t)) 356NamedTypeSymbol nt = conv.Operand.Type as NamedTypeSymbol; 447if (!conversion.Operand.Type.SpecialType.IsIntegralType() || !conversion.Type.SpecialType.IsIntegralType()) 452if (!Binder.CheckConstantBounds(conversion.Operand.Type.SpecialType, constantValue, out _)) 454Error(ErrorCode.WRN_VacuousIntegralComp, tree, conversion.Operand.Type); 612TypeSymbol from = conv.Operand.Type; 770Error(ErrorCode.WRN_NubExprIsConstBool, node, always, node.Left.Type.GetNullableUnderlyingType(), node.Left.Type); 774Error(ErrorCode.WRN_NubExprIsConstBool, node, always, node.Right.Type.GetNullableUnderlyingType(), node.Right.Type); 818Error(node.OperatorKind.IsUserDefined() ? ErrorCode.WRN_NubExprIsConstBool2 : ErrorCode.WRN_NubExprIsConstBool, node, always, node.Left.Type.GetNullableUnderlyingType(), GetTypeForLiftedComparisonWarning(node.Right)); 822Error(node.OperatorKind.IsUserDefined() ? ErrorCode.WRN_NubExprIsConstBool2 : ErrorCode.WRN_NubExprIsConstBool, node, always, node.Right.Type.GetNullableUnderlyingType(), GetTypeForLiftedComparisonWarning(node.Left)); 858if ((object)node.Type == null || !node.Type.IsNullableType()) 874return type ?? node.Type;
Lowering\Extensions.cs (8)
35if ((object)expr.Type == null) 40if (expr.Type.IsDynamic()) 45if (!expr.Type.IsNullableType()) 80if ((object)expr.Type == null && expr.ConstantValueOpt == ConstantValue.Null) 85if ((object)expr.Type == null || !expr.Type.IsNullableType()) 132if (expr.Type.IsNullableType() && expr.Type.GetNullableUnderlyingType().SpecialType != SpecialType.System_Boolean)
Lowering\InitializerRewriter.cs (2)
52(object)expression.Type != null && 53!expression.Type.IsVoidType())
Lowering\Instrumentation\DebugInfoInjector.cs (2)
483rewrittenFilter = AddConditionSequencePoint(new BoundSequencePointExpression(filterClause, rewrittenFilter, rewrittenFilter.Type), filterClause, factory); 495return new BoundSequencePointExpression(original.Syntax, base.InstrumentSwitchExpressionArmExpression(original, rewrittenExpression, factory), rewrittenExpression.Type);
Lowering\Instrumentation\DebugInfoInjector_SequencePoints.cs (4)
173Debug.Assert(condition.Type is not null); 182var local = factory.SynthesizedLocal(condition.Type, synthesizedVariableSyntax, kind: SynthesizedLocalKind.ConditionalBranchDiscriminator); 187new BoundSequencePointExpression(syntax: null!, expression: factory.Local(local), type: condition.Type) : 195condition.Type);
Lowering\Instrumentation\LocalStateTracingInstrumenter.cs (2)
555Debug.Assert(invocation.Type is not null); 565if (invocation.Type.SpecialType != SpecialType.System_Void)
Lowering\Instrumentation\ModuleCancellationInstrumenter.cs (1)
130if (arguments is [.., { Type: { } lastArgumentType } lastArgument] &&
Lowering\IteratorRewriter\IteratorMethodToStateMachineRewriter.cs (1)
295_methodValue = F.SynthesizedLocal(result.Type);
Lowering\LocalRewriter\LocalRewriter.cs (19)
259TypeSymbol? type = node.Type; 280Debug.Assert(visited == null || visited.HasErrors || ReferenceEquals(visited.Type, node.Type) || 281visited.Type is { } && visited.Type.Equals(node.Type, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes) || 302type: visited.Type); 512Debug.Assert(value.Type is { } && (value.Type.Equals(placeholder.Type, TypeCompareKind.AllIgnoreOptions) || value.HasErrors)); 577Debug.Assert(node.Type is { }); 578return BadExpression(node.Syntax, node.Type, ImmutableArray.Create(node)); 831var indexType = VisitType(node.Indices[0].Type); 843Debug.Assert(node.Expression.Type is { TypeKind: TypeKind.Array }); 844var elementType = ((ArrayTypeSymbol)node.Expression.Type).ElementTypeWithAnnotations; 1060Debug.Assert(eventAccess.ReceiverOpt.Type is { }); 1061return !eventAccess.ReceiverOpt.Type.IsValueType || CanBePassedByReference(eventAccess.ReceiverOpt); 1071Debug.Assert(fieldAccess.ReceiverOpt.Type is { }); 1072return !fieldAccess.ReceiverOpt.Type.IsValueType || CanBePassedByReference(fieldAccess.ReceiverOpt);
Lowering\LocalRewriter\LocalRewriter.DecisionDagRewriter.cs (12)
173receiver.Type?.IsReferenceType == false && 746if (input.Type.IsValidV6SwitchGoverningType() || input.Type.IsSpanOrReadOnlySpanChar()) 752bool isStringInput = input.Type.SpecialType == SpecialType.System_String; 753bool isSpanInput = input.Type.IsSpanChar(); 754bool isReadOnlySpanInput = input.Type.IsReadOnlySpanChar(); 783else if (input.Type.IsNativeIntegerType) 788switch (input.Type.SpecialType) 803throw ExceptionUtilities.UnexpectedValue(input.Type); 813var lessThanOrEqualOperator = input.Type.SpecialType switch 818_ => throw ExceptionUtilities.UnexpectedValue(input.Type.SpecialType) 821var cases = node.Cases.Sort(new CasesComparer(input.Type));
Lowering\LocalRewriter\LocalRewriter.PatternLocalRewriter.cs (24)
198TypeSymbol inputType = input.Type; 211Conversion conversion = _factory.Compilation.Conversions.ClassifyBuiltInConversion(inputType, output.Type, isChecked: false, ref useSiteInfo); 219inputType.GetNullableUnderlyingType().Equals(output.Type, TypeCompareKind.AllIgnoreOptions) && 340Debug.Assert(input.Type is { }); 344return MakeNullCheck(d.Syntax, input, input.Type.IsNullableType() ? BinaryOperatorKind.NullableNullNotEqual : BinaryOperatorKind.NotEqual); 351return MakeNullCheck(d.Syntax, input, input.Type.IsNullableType() ? BinaryOperatorKind.NullableNullEqual : BinaryOperatorKind.Equal); 354Debug.Assert(!input.Type.IsNullableType()); 358Debug.Assert(!input.Type.IsNullableType()); 359Debug.Assert(input.Type.IsValueType); 369Debug.Assert(!rewrittenExpr.Type.IsSpanOrReadOnlySpanChar()); 371if (rewrittenExpr.Type.IsPointerOrFunctionPointer()) 389if (value.IsString && input.Type.IsSpanOrReadOnlySpanChar()) 394TypeSymbol comparisonType = input.Type.EnumUnderlyingTypeOrSelf(); 403if (input.Type.SpecialType == SpecialType.System_Double && double.IsNaN(value.DoubleValue) || 404input.Type.SpecialType == SpecialType.System_Single && float.IsNaN(value.SingleValue)) 410BoundExpression literal = _localRewriter.MakeLiteral(syntax, value, input.Type); 411TypeSymbol comparisonType = input.Type.EnumUnderlyingTypeOrSelf(); 433var isReadOnlySpan = input.Type.IsReadOnlySpanChar(); 475Debug.Assert(output.Type is { }); 477testExpression = _factory.ObjectNotEqual(output, _factory.Null(output.Type)); 511Debug.Assert(loweredInput.Type is { }); 552if (loweredInput.Type.IsTupleType && 553!loweredInput.Type.OriginalDefinition.Equals(_factory.Compilation.GetWellKnownType(WellKnownType.System_ValueTuple_TRest)) && 627var temp = new BoundDagTemp(expr.Syntax, expr.Type, fieldFetchEvaluation);
Lowering\LocalRewriter\LocalRewriter_AsOperator.cs (2)
51ConstantValue constantValue = Binder.GetAsOperatorConstantResult(rewrittenOperand.Type, rewrittenType, conversion.Kind, rewrittenOperand.ConstantValueOpt); 88Debug.Assert(result.Type!.Equals(rewrittenType, TypeCompareKind.ConsiderEverything));
Lowering\LocalRewriter\LocalRewriter_AssignmentOperator.cs (1)
322TypeSymbol? exprType = rewrittenRight.Type;
Lowering\LocalRewriter\LocalRewriter_BinaryOperator.cs (54)
333Debug.Assert(loweredLeft.Type is { }); 334Debug.Assert(loweredRight.Type is { }); 336return MakeUnaryOperator(UnaryOperatorKind.BoolLogicalNegation, syntax, method: null, constrainedToTypeOpt: null, loweredRight, loweredRight.Type); 339return MakeUnaryOperator(UnaryOperatorKind.BoolLogicalNegation, syntax, method: null, constrainedToTypeOpt: null, loweredLeft, loweredLeft.Type); 347Debug.Assert(loweredLeft.Type is { }); 348Debug.Assert(loweredRight.Type is { }); 350return MakeUnaryOperator(UnaryOperatorKind.BoolLogicalNegation, syntax, method: null, constrainedToTypeOpt: null, loweredRight, loweredRight.Type); 353return MakeUnaryOperator(UnaryOperatorKind.BoolLogicalNegation, syntax, method: null, constrainedToTypeOpt: null, loweredLeft, loweredLeft.Type); 361Debug.Assert(loweredLeft.Type is { }); 362Debug.Assert(loweredRight.Type is { }); 364return MakeUnaryOperator(UnaryOperatorKind.BoolLogicalNegation, syntax, method: null, constrainedToTypeOpt: null, loweredRight, loweredRight.Type); 367return MakeUnaryOperator(UnaryOperatorKind.BoolLogicalNegation, syntax, method: null, constrainedToTypeOpt: null, loweredLeft, loweredLeft.Type); 569Debug.Assert(loweredLeft.Type is { }); 570whenNullOpt = RewriteLiftedBinaryOperator(syntax, operatorKind, _factory.Default(loweredLeft.Type), loweredRight, type, method, constrainedToTypeOpt); 580type: result.Type! 890Debug.Assert(expression.Type is { }); 894if (expression.Type.IsNullableType()) 900UnsafeGetNullableMethod(syntax, expression.Type, SpecialMember.System_Nullable_T_GetValueOrDefault)); 913Debug.Assert(expression.Type is { }); 917if (expression.Type.IsNullableType()) 927Debug.Assert(expression.Type is { }); 932UnsafeGetNullableMethod(syntax, expression.Type, SpecialMember.System_Nullable_T_get_HasValue)); 1615Debug.Assert(TypeSymbol.Equals(conditional.Type, conditional.Consequence.Type, TypeCompareKind.ConsiderEverything2)); 1616Debug.Assert(TypeSymbol.Equals(conditional.Type, conditional.Alternative.Type, TypeCompareKind.ConsiderEverything2)); 1689Debug.Assert(alwaysNull.Type is { }); 1690BoundExpression nullBool = new BoundDefaultExpression(syntax, alwaysNull.Type); 1702rewrittenType: alwaysNull.Type, 1729rewrittenType: alwaysNull.Type, 1731Debug.Assert(conditionalExpression.Type is { }); 1737type: conditionalExpression.Type); 1791rewrittenType: newNullBool.Type!, 1798type: conditionalExpression.Type!); 1878rewrittenType: alternative.Type!, 1886type: conditionalExpression.Type!); 1984return conditionalAccess.Update(conditionalAccess.Receiver, conditionalAccess.HasValueMethodOpt, whenNotNull, whenNull, conditionalAccess.Id, conditionalAccess.ForceCopyOfNullableValueType, whenNotNull.Type!); 2040Debug.Assert(loweredLeft.Type is { SpecialType: SpecialType.System_Decimal }); 2041Debug.Assert(loweredRight.Type is { SpecialType: SpecialType.System_Decimal }); 2074TypeSymbol? exprType = rewrittenExpr.Type; 2137Debug.Assert(loweredRight.Type is { }); 2138TypeSymbol rightType = loweredRight.Type; 2204Debug.Assert(loweredLeft.Type is { }); 2205TypeSymbol leftType = loweredLeft.Type; 2209Debug.Assert(loweredRight.Type is { }); 2210TypeSymbol rightType = loweredRight.Type; 2260Debug.Assert(loweredLeft.Type is { TypeKind: TypeKind.Pointer }); 2261loweredRight = MakeSizeOfMultiplication(loweredRight, (PointerTypeSymbol)loweredLeft.Type, kind.IsChecked()); 2265Debug.Assert(loweredRight.Type is { TypeKind: TypeKind.Pointer }); 2266loweredLeft = MakeSizeOfMultiplication(loweredLeft, (PointerTypeSymbol)loweredRight.Type, kind.IsChecked()); 2305Debug.Assert(sizeOfExpression.Type is { SpecialType: SpecialType.System_Int32 }); 2315Debug.Assert(numericOperand.Type is { }); 2316var numericSpecialType = numericOperand.Type.SpecialType; 2452Debug.Assert(loweredLeft.Type is { TypeKind: TypeKind.Pointer }); 2453Debug.Assert(loweredRight.Type is { TypeKind: TypeKind.Pointer }); 2456PointerTypeSymbol pointerType = (PointerTypeSymbol)loweredLeft.Type;
Lowering\LocalRewriter\LocalRewriter_Call.cs (15)
103if (module != null && receiver != null && receiver.Type is { }) 105var assembly = receiver.Type.ContainingAssembly; 122if (module != null && receiver is { Type: { } }) 124var assembly = receiver.Type.ContainingAssembly; 204var symbolForCompare = needToReduce ? ReducedExtensionMethodSymbol.Create(interceptor, receiverOpt!.Type, _compilation, out _) : interceptor; 275Debug.Assert(receiverOpt?.Type is not null); 281Debug.Assert(receiverOpt.Type.Equals(interceptor.Parameters[0].Type, TypeCompareKind.AllIgnoreOptions) 282|| (!receiverOpt.Type.IsReferenceType && interceptor.Parameters[0].Type.IsReferenceType)); 508Debug.Assert(rewrittenBoundCall.Type is not null); 517type: rewrittenBoundCall.Type); 678Debug.Assert(rewrittenReceiver.Type is { }); 692refKind = rewrittenReceiver.Type.IsValueType || rewrittenReceiver.Type.Kind == SymbolKind.TypeParameter ? RefKind.Ref : RefKind.None; 696if (rewrittenReceiver.Type.IsReferenceType) 1135optimized = CreateArrayEmptyCallIfAvailable(possibleParamsArray.Syntax, ((ArrayTypeSymbol)possibleParamsArray.Type!).ElementType);
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (25)
176Debug.Assert(singleSpread.Expression.Type is not null); 178if (!ShouldUseAddRangeOrToListMethod(singleSpread.Expression.Type, toListOfElementType.Parameters[0].Type, singleSpread.EnumeratorInfoOpt?.GetEnumeratorInfo.Method)) 221Elements: [BoundCollectionExpressionSpreadElement { Expression: { Type: NamedTypeSymbol spreadType } expr }], 309Debug.Assert(list.Type is { }); 310Debug.Assert(list.Type.OriginalDefinition.Equals(_compilation.GetWellKnownType(WellKnownType.System_Collections_Generic_List_T), TypeCompareKind.AllIgnoreOptions)); 312var listToArray = ((MethodSymbol)_factory.WellKnownMember(WellKnownMember.System_Collections_Generic_List_T__ToArray)).AsMember((NamedTypeSymbol)list.Type); 321Debug.Assert(TypeSymbol.Equals(array.Type, spanConstructor.Parameters[0].Type, TypeCompareKind.AllIgnoreOptions)); 657var spreadTypeOriginalDefinition = spreadExpression.Type!.OriginalDefinition; 661return _factory.Call(rewrittenSpreadExpression, listToArrayMethod.AsMember((NamedTypeSymbol)spreadExpression.Type!)); 664if (TryGetSpanConversion(spreadExpression.Type, writableOnly: false, out var asSpanMethod)) 666var spanType = CallAsSpanMethod(spreadExpression, asSpanMethod).Type!.OriginalDefinition; 671return _factory.Call(rewrittenSpreadExpression, toArrayMethod.AsMember((NamedTypeSymbol)rewrittenSpreadExpression.Type!)); 743Debug.Assert(arrayTemp.Type is ArrayTypeSymbol); 747var elementType = ((ArrayTypeSymbol)arrayTemp.Type).ElementType; 858var type = expression.Type; 925if (spreadOperandAsSpan.Type!.OriginalDefinition.Equals(this._compilation.GetWellKnownType(wellKnownSpanType)) 964var spreadLength = _factory.Call(spreadOperandAsSpan, getLengthMethod.AsMember((NamedTypeSymbol)spreadOperandAsSpan.Type!)); 965var targetSlice = _factory.Call(spanTemp, spanSliceMethod.AsMember((NamedTypeSymbol)spanTemp.Type!), indexTemp, spreadLength); 966sideEffects.Add(_factory.Call(spreadOperandAsSpan, copyToMethod.AsMember((NamedTypeSymbol)spreadOperandAsSpan.Type!), targetSlice)); 1080Debug.Assert(spanTemp.Type is NamedTypeSymbol); 1084var elementType = ((NamedTypeSymbol)spanTemp.Type).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Type; 1133Debug.Assert(rewrittenSpreadOperand.Type is not null); 1138if (!ShouldUseAddRangeOrToListMethod(rewrittenSpreadOperand.Type, addRangeMethod.Parameters[0].Type, spreadElement.EnumeratorInfoOpt?.GetEnumeratorInfo.Method)) 1273_factory.Binary(BinaryOperatorKind.Addition, sum.Type!, sum, value); 1308if (convertedExpression.Operand.Type is ArrayTypeSymbol arrayType)
Lowering\LocalRewriter\LocalRewriter_CompoundAssignmentOperator.cs (27)
24Debug.Assert(TypeSymbol.Equals(node.Right.Type, node.Operator.RightType, TypeCompareKind.ConsiderEverything2)); 92Debug.Assert(rewrittenAssignment.Type is { }); 95var condition = _factory.Conditional(isEvent, invokeEventAccessor.ToExpression(), rewrittenAssignment, rewrittenAssignment.Type); 97rewrittenAssignment = new BoundSequence(node.Syntax, eventTemps.ToImmutableAndFree(), sequence.ToImmutableAndFree(), condition, condition.Type!); 104Debug.Assert(rewrittenAssignment.Type is { }); 112rewrittenAssignment.Type); 144Debug.Assert(node.Left.Type is { }); 156Debug.Assert(TypeSymbol.Equals(transformedLHS.Type, node.Left.Type, TypeCompareKind.AllIgnoreOptions)); 202Debug.Assert(rewrittenReceiver.Type is { }); 203var variableRepresentsLocation = rewrittenReceiver.Type.IsValueType || rewrittenReceiver.Type.Kind == SymbolKind.TypeParameter; 413indexerAccess.Argument.Type, 420throw ExceptionUtilities.UnexpectedValue(indexerAccess.Argument.Type); 441if (isDynamicAssignment || !IsInvariantArray(arrayAccess.Expression.Type)) 469Debug.Assert(receiver is { Type: { } }); 474else if (!receiver.Type.IsReferenceType) 479Debug.Assert(receiver.Type.IsReferenceType); 483Debug.Assert(rewrittenReceiver.Type is { }); 484if (rewrittenReceiver.Type.IsTypeParameter()) 622Debug.Assert(implicitIndexerAccess.Argument.Type!.Equals(_compilation.GetWellKnownType(WellKnownType.System_Index)) 623|| implicitIndexerAccess.Argument.Type!.Equals(_compilation.GetWellKnownType(WellKnownType.System_Range))); 652if (isDynamicAssignment || !IsInvariantArray(arrayAccess.Expression.Type)) 833var type = expression.Type; 849var type = expression.Type; 905Debug.Assert(expression.Type is { }); 906if (expression.Type.IsNullableType())
Lowering\LocalRewriter\LocalRewriter_ConditionalAccess.cs (10)
41Debug.Assert(node.AccessExpression.Type is { }); 44Debug.Assert(loweredReceiver.Type is { }); 45var receiverType = loweredReceiver.Type; 55var lowerToConditional = node.AccessExpression.Type.IsDynamic(); 120Debug.Assert(loweredAccessExpression.Type is { }); 126TypeSymbol accessExpressionType = loweredAccessExpression.Type; 149Debug.Assert(loweredReceiver.Type is { }); 154UnsafeGetNullableMethod(node.Syntax, loweredReceiver.Type, SpecialMember.System_Nullable_T_get_HasValue) : 205Debug.Assert(newtarget is { Type: { } }); 207if (newtarget.Type.IsNullableType())
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (65)
82Debug.Assert(result.Type!.Equals(toType, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 94Debug.Assert(node.Type is not null); 95Debug.Assert(_compilation.IsReadOnlySpanType(node.Type)); 96var byteType = ((NamedTypeSymbol)node.Type).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.Single().Type; 111result = BadExpression(node.Syntax, node.Type, ImmutableArray<BoundExpression>.Empty); 115result = new BoundObjectCreationExpression(node.Syntax, ctor.AsMember((NamedTypeSymbol)node.Type), utf8Bytes, _factory.Literal(0), _factory.Literal(length)); 226Debug.Assert(rewrittenNode.Type is { }); 227var type = rewrittenNode.Type; 273Debug.Assert(result.Type is { } rt && rt.Equals(rewrittenType, TypeCompareKind.AllIgnoreOptions)); 291type: result.Type); 314@checked = @checked && NeedsCheckedConversionInExpressionTree(rewrittenOperand.Type, rewrittenType, explicitCastInCode); 320Debug.Assert(rewrittenOperand.Type is { }); 333if (_inExpressionLambda || !rewrittenOperand.Type.Equals(rewrittenType, TypeCompareKind.ConsiderEverything)) 428Debug.Assert(rewrittenOperand.Type is { }); 434if (rewrittenType.SpecialType == SpecialType.System_Decimal || rewrittenOperand.Type.SpecialType == SpecialType.System_Decimal) 436return RewriteDecimalConversion(syntax, rewrittenOperand, rewrittenOperand.Type, rewrittenType, @checked, conversion.Kind.IsImplicitConversion(), constantValueOpt); 443Debug.Assert(rewrittenOperand.Type is { }); 446Debug.Assert(rewrittenOperand.Type.Equals(rewrittenType, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 489Debug.Assert(rewrittenOperand.Type is { }); 499Debug.Assert(rewrittenOperand.Type.IsEnumType()); 500var underlyingTypeFrom = rewrittenOperand.Type.GetEnumUnderlyingType()!; 504else if (rewrittenOperand.Type.SpecialType == SpecialType.System_Decimal) 512var rewrittenNode = RewriteDecimalConversion(syntax, rewrittenOperand, rewrittenOperand.Type, underlyingTypeTo, @checked, isImplicit: false, constantValueOpt: constantValueOpt); 557(symbolOpt.IsAbstract || symbolOpt.IsVirtual) ? mg.ReceiverOpt?.Type : null, 596Debug.Assert(rewrittenOperand.Type is not null); 611createSpan = createSpan.Construct(rewrittenOperand.Type, spanType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.Single().Type); 612_ = rewrittenOperand.Type.HasInlineArrayAttribute(out int length); 620var sourceType = rewrittenOperand.Type; 813Debug.Assert(rewrittenOperand.Type is { }); 815Conversion conversion = compilation.Conversions.ClassifyConversionFromType(rewrittenOperand.Type, rewrittenType, isChecked: @checked, ref useSiteInfo); 821rewrittenOperand.Type.SpecialType != SpecialType.System_Decimal && 822rewrittenOperand.Type.SpecialType != SpecialType.System_DateTime) 828rewrittenOperand.Type, 874if (!TypeSymbol.Equals(rewrittenOperand.Type, conversion.BestUserDefinedConversionAnalysis.FromType, TypeCompareKind.ConsiderEverything2)) 884if (!TypeSymbol.Equals(rewrittenOperand.Type, conversion.Method.GetParameterType(0), TypeCompareKind.ConsiderEverything2)) 897Debug.Assert(rewrittenOperand.Type is { }); 898if (rewrittenOperand.Type.IsNullableType() && 899conversion.Method.GetParameterType(0).Equals(rewrittenOperand.Type.GetNullableUnderlyingType(), TypeCompareKind.AllIgnoreOptions) && 903userDefinedConversionRewrittenType = ((NamedTypeSymbol)rewrittenOperand.Type.OriginalDefinition).Construct(userDefinedConversionRewrittenType); 913if (!TypeSymbol.Equals(userDefined.Type, conversion.BestUserDefinedConversionAnalysis.ToType, TypeCompareKind.ConsiderEverything2)) 922if (!TypeSymbol.Equals(userDefined.Type, rewrittenType, TypeCompareKind.ConsiderEverything2)) 954Debug.Assert(rewrittenOperand.Type is { }); 958var tupleTypeSymbol = (NamedTypeSymbol)rewrittenOperand.Type; 995Debug.Assert(expression.Type is { }); 996if (!expression.Type.IsNullableType()) 1008when convertedArgument.Type!.Equals(expression.Type.StrippedType(), TypeCompareKind.AllIgnoreOptions): 1013when underlying.Length == 1 && underlying[0].Kind == ConversionKind.ImplicitTuple && !convertedArgument.Type!.IsNullableType(): 1048TypeSymbol? rewrittenOperandType = rewrittenOperand.Type; 1098Debug.Assert(rewrittenOperand.Type is { }); 1099TypeSymbol rewrittenOperandType = rewrittenOperand.Type; 1312Debug.Assert(TypeSymbol.Equals(conditional.Type, conditional.Consequence.Type, TypeCompareKind.ConsiderEverything2)); 1313Debug.Assert(TypeSymbol.Equals(conditional.Type, conditional.Alternative.Type, TypeCompareKind.ConsiderEverything2)); 1345Debug.Assert(rewrittenOperand.Type is { }); 1346if (rewrittenOperand.Type.IsNullableType()) 1349if (parameterType.Equals(rewrittenOperand.Type.GetNullableUnderlyingType(), TypeCompareKind.AllIgnoreOptions) && 1363if ((rewrittenOperand.Type.IsArray()) && _compilation.IsReadOnlySpanType(rewrittenType)) 1375Debug.Assert(TypeSymbol.Equals(result.Type, rewrittenType, TypeCompareKind.ConsiderEverything2)); 1398Debug.Assert(rewrittenOperand.Type is { }); 1401Conversion conv = TryMakeConversion(syntax, conversion, rewrittenOperand.Type, rewrittenType, @checked: @checked); 1413Debug.Assert(rewrittenOperand.Type.IsNullableType()); 1490Debug.Assert(rewrittenOperand.Type is { }); 1493TypeSymbol source = rewrittenOperand.Type; 1716Debug.Assert(operand.Type is { }); 1717return RewriteDecimalConversionCore(syntax, operand, operand.Type, toType, isImplicit, constantValueOpt);
Lowering\LocalRewriter\LocalRewriter_DeconstructionAssignmentOperator.cs (10)
42Debug.Assert(left.Type is { }); 43BoundExpression? result = RewriteDeconstruction(lhsTargets, conversion, left.Type, right, isUsed); 247Debug.Assert(leftTarget is { Type: { } }); 318Debug.Assert(right.Type is { }); 319if (right.Type.IsTupleType) 337Debug.Assert(expression.Type is { }); 338Debug.Assert(expression.Type.IsTupleType); 339var tupleType = expression.Type; 462Debug.Assert(variable.Type is { }); 464effects, temps, isDynamicAssignment: variable.Type.IsDynamic());
Lowering\LocalRewriter\LocalRewriter_Event.cs (1)
188return new BoundSequence(syntax, tempSymbols, sideEffects.ToImmutableAndFree(), marshalCall, marshalCall.Type!);
Lowering\LocalRewriter\LocalRewriter_FixedStatement.cs (8)
209else if (fixedCollectionInitializer.Expression.Type is { SpecialType: SpecialType.System_String }) 213else if (fixedCollectionInitializer.Expression.Type is { TypeKind: TypeKind.Array }) 241Debug.Assert(initializerExpr.Type is { TypeKind: TypeKind.Pointer }); 247TypeSymbol initializerType = ((PointerTypeSymbol)initializerExpr.Type).PointedAtType; 308Debug.Assert(initializerExpr.Type is { }); 310var initializerType = initializerExpr.Type; 443TypeSymbol? initializerType = initializerExpr.Type; 512TypeSymbol? initializerType = initializerExpr.Type;
Lowering\LocalRewriter\LocalRewriter_ForEachStatement.cs (11)
42TypeSymbol? nodeExpressionType = collectionExpression.Type; 497Debug.Assert(receiver.Type is { }); 498if (!receiver.Type.IsReferenceType && method.ContainingType.IsInterface) 609NamedTypeSymbol? collectionType = (NamedTypeSymbol?)collectionExpression.Type; 748Debug.Assert(rewrittenExpression.Type is not null); 877Debug.Assert(collectionExpression.Type is { TypeKind: TypeKind.Array }); 905Debug.Assert(collectionExpression.Type is { TypeKind: TypeKind.Array }); 909ArrayTypeSymbol arrayType = (ArrayTypeSymbol)collectionExpression.Type; 1026Debug.Assert(collectionExpression.Type is { TypeKind: TypeKind.Array }); 1054Debug.Assert(collectionExpression.Type is { TypeKind: TypeKind.Array }); 1058ArrayTypeSymbol arrayType = (ArrayTypeSymbol)collectionExpression.Type;
Lowering\LocalRewriter\LocalRewriter_Index.cs (2)
24operand = new BoundDefaultExpression(operand.Syntax, operand.Type!.GetNullableUnderlyingType()); 72Debug.Assert(TypeSymbol.Equals(targetNullableType.GetNullableUnderlyingType(), underlyingValue.Type, TypeCompareKind.AllIgnoreOptions));
Lowering\LocalRewriter\LocalRewriter_IndexerAccess.cs (37)
119Debug.Assert(oldNode.Type is not null); 120Debug.Assert(oldNode.Type.Equals(type, TypeCompareKind.ConsiderEverything)); 180Debug.Assert(call.Type is not null); 194call.Type); 203Debug.Assert(node.Expression.Type is object); 204Debug.Assert(node.Argument.Type is object); 219_ = node.Expression.Type.HasInlineArrayAttribute(out int length); 221if (node.Argument.Type.SpecialType == SpecialType.System_Int32) 229if (TypeSymbol.Equals(node.Argument.Type, _compilation.GetWellKnownType(WellKnownType.System_Index), TypeCompareKind.AllIgnoreOptions)) 241Debug.Assert(TypeSymbol.Equals(node.Argument.Type, _compilation.GetWellKnownType(WellKnownType.System_Range), TypeCompareKind.AllIgnoreOptions)); 323Debug.Assert(node.Expression.Type is object); 335return createSpan.Construct(node.Expression.Type, node.Expression.Type.TryGetInlineArrayElementField()!.Type); 340Debug.Assert(node.Expression.Type is object); 341Debug.Assert(index.Type?.SpecialType == SpecialType.System_Int32); 343var intType = (NamedTypeSymbol)index.Type; 362elementRef = elementRef.Construct(node.Expression.Type, node.Expression.Type.TryGetInlineArrayElementField()!.Type); 381elementRef = elementRef.Construct(node.Expression.Type, node.Expression.Type.TryGetInlineArrayElementField()!.Type); 436node.Argument.Type, 445node.Argument.Type, 483node.Argument.Type, 499Debug.Assert(receiver.Type is { }); 505receiver.Type.IsReferenceType ? RefKind.None : RefKind.Ref); 563Debug.Assert(integerArgument.Type!.SpecialType == SpecialType.System_Int32); 659Debug.Assert(loweredExpr.Type!.SpecialType == SpecialType.System_Int32); 670Debug.Assert(loweredExpr.Type!.SpecialType == SpecialType.System_Int32); 677loweredExpr.Type, 710unloweredExpr.Type, 718Debug.Assert(hatExpression.Operand is { Type: { SpecialType: SpecialType.System_Int32 } }); 722else if (unloweredExpr is BoundConversion { Operand: { Type: { SpecialType: SpecialType.System_Int32 } } operand }) 731arguments[0] is { Type.SpecialType: SpecialType.System_Int32, ConstantValueOpt.Value: int _ and >= 0 } index && 732arguments[1] is { Type.SpecialType: SpecialType.System_Boolean, ConstantValueOpt.Value: bool fromEnd }) 775node.Argument.Type, 801Debug.Assert(receiver.Type is { }); 807receiver.Type.IsReferenceType ? RefKind.None : RefKind.Ref);
Lowering\LocalRewriter\LocalRewriter_IsOperator.cs (1)
48var operandType = rewrittenOperand.Type;
Lowering\LocalRewriter\LocalRewriter_IsPatternOperator.cs (4)
119Debug.Assert(node.Type is { SpecialType: SpecialType.System_Boolean }); 120LocalSymbol resultTemp = _factory.SynthesizedLocal(node.Type, node.Syntax, kind: SynthesizedLocalKind.LoweringTemp); 175if (test.Type?.IsErrorType() != false) 178Debug.Assert(test.Type.SpecialType == SpecialType.System_Boolean);
Lowering\LocalRewriter\LocalRewriter_Literal.cs (1)
20return MakeLiteral(node.Syntax, node.ConstantValueOpt, node.Type, oldNodeOpt: node);
Lowering\LocalRewriter\LocalRewriter_LockStatement.cs (1)
30TypeSymbol? argumentType = rewrittenArgument.Type;
Lowering\LocalRewriter\LocalRewriter_NullCoalescingAssignmentOperator.cs (16)
16Debug.Assert(node.Type is { }); 20Debug.Assert(node.LeftOperand.Type is { }); 24Debug.Assert(transformedLHS.Type is { }); 41Debug.Assert(TypeSymbol.Equals(transformedLHS.Type, node.LeftOperand.Type, TypeCompareKind.AllIgnoreOptions)); 45var leftPlaceholder = new BoundValuePlaceholder(lhsRead.Syntax, lhsRead.Type); 46BoundExpression conditionalExpression = MakeNullCoalescingOperator(syntax, lhsRead, assignment, leftPlaceholder: leftPlaceholder, leftConversion: leftPlaceholder, BoundNullCoalescingOperatorResultKind.LeftType, node.LeftOperand.Type); 47Debug.Assert(conditionalExpression.Type is { }); 56conditionalExpression.Type); 63Debug.Assert(node.LeftOperand.Type.IsNullableType()); 72leftOperand.Type, 80leftOperand.Type, 112Debug.Assert(transformedLHS.Type.GetNullableUnderlyingType().Equals(tmp.Type.StrippedType(), TypeCompareKind.AllIgnoreOptions)); 115Debug.Assert(TypeSymbol.Equals(transformedLHS.Type, node.LeftOperand.Type, TypeCompareKind.AllIgnoreOptions)); 120MakeConversionNode(tmp, transformedLHS.Type, @checked: false, markAsChecked: true),
Lowering\LocalRewriter\LocalRewriter_NullCoalescingOperator.cs (18)
35Debug.Assert(rewrittenRight.Type is { }); 36Debug.Assert(rewrittenRight.Type.Equals(rewrittenResultType, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 42Debug.Assert(rewrittenLeft.Type is { }); 59var isUnconstrainedTypeParameter = rewrittenLeft.Type is { IsReferenceType: false, IsValueType: false }; 90Debug.Assert(rewrittenLeft.Type is { }); 91if (rewrittenLeft.Type.IsReferenceType && 110if (whenNullOpt.Type.IsNullableType()) 115if (whenNullOpt.IsDefaultValue() && whenNullOpt.Type.SpecialType != SpecialType.System_Decimal) 133if (rewrittenLeft.Type.IsNullableType() && 134rewrittenRight.Type.Equals(rewrittenLeft.Type.GetNullableUnderlyingType(), TypeCompareKind.AllIgnoreOptions)) 140TryGetNullableMethod(rewrittenLeft.Syntax, rewrittenLeft.Type, SpecialMember.System_Nullable_T_GetValueOrDefault, out MethodSymbol? getValueOrDefault, isOptional: true)) 147TryGetNullableMethod(rewrittenLeft.Syntax, rewrittenLeft.Type, SpecialMember.System_Nullable_T_GetValueOrDefaultDefaultValue, out MethodSymbol? getValueOrDefaultDefaultValue, isOptional: true)) 167Debug.Assert(convertedLeft.HasErrors || convertedLeft.Type!.Equals(rewrittenResultType, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 180Debug.Assert(conditionalExpression.Type!.Equals(rewrittenResultType, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 238Debug.Assert(rewrittenLeft.Type is { }); 242TypeSymbol rewrittenLeftType = rewrittenLeft.Type; 250var conversionTakesNullableType = leftPlaceholder?.Type?.IsNullableType() == true;
Lowering\LocalRewriter\LocalRewriter_ObjectCreationExpression.cs (5)
81Debug.Assert(TypeSymbol.Equals(rewrittenObjectCreation.Type, ((NamedTypeSymbol)node.Type).ComImportCoClass, TypeCompareKind.ConsiderEverything2)); 99rewrittenObjectCreation = new BoundDefaultExpression(rewrittenObjectCreation.Syntax, rewrittenObjectCreation.Type!); 114Debug.Assert(TypeSymbol.Equals(rewrittenObjectCreation.Type, ((NamedTypeSymbol)node.Type).ComImportCoClass, TypeCompareKind.ConsiderEverything2)); 135Debug.Assert(receiver.Type!.Equals(type, TypeCompareKind.ConsiderEverything)); 320return MakeExpressionWithInitializer(node.Syntax, rewrittenNewT, node.InitializerExpressionOpt, rewrittenNewT.Type!);
Lowering\LocalRewriter\LocalRewriter_ObjectOrCollectionInitializerExpression.cs (8)
367Debug.Assert(assignment.Type.IsDynamic() || TypeSymbol.Equals(rewrittenAccess.Type, assignment.Type, TypeCompareKind.AllIgnoreOptions)); 421Debug.Assert(TypeSymbol.Equals(rangeArgument.Type, _compilation.GetWellKnownType(WellKnownType.System_Range), TypeCompareKind.ConsiderEverything)); 439Debug.Assert(TypeSymbol.Equals(rewrittenAccess.Type, assignment.Type, TypeCompareKind.AllIgnoreOptions)); 472Debug.Assert(TypeSymbol.Equals(rewrittenAccess.Type, assignment.Type, TypeCompareKind.AllIgnoreOptions)); 484if (TypeSymbol.Equals(implicitIndexer.Argument.Type, _compilation.GetWellKnownType(WellKnownType.System_Index), TypeCompareKind.ConsiderEverything)) 506Debug.Assert(TypeSymbol.Equals(rewrittenAccess.Type, assignment.Type, TypeCompareKind.AllIgnoreOptions)); 667Debug.Assert(_compilation.Conversions.ClassifyConversionFromType(rewrittenReceiver.Type, memberSymbol.ContainingType, isChecked: false, ref discardedUseSiteInfo).IsImplicit || 668_compilation.Conversions.HasImplicitConversionToOrImplementsVarianceCompatibleInterface(rewrittenReceiver.Type, memberSymbol.ContainingType, ref discardedUseSiteInfo, out _));
Lowering\LocalRewriter\LocalRewriter_PointerElementAccess.cs (5)
46Debug.Assert(rewrittenExpression.Type is { }); 47Debug.Assert(rewrittenIndex.Type is { }); 48switch (rewrittenIndex.Type.SpecialType) 63throw ExceptionUtilities.UnexpectedValue(rewrittenIndex.Type.SpecialType); 78rewrittenExpression.Type,
Lowering\LocalRewriter\LocalRewriter_PropertyAccess.cs (2)
37if (rewrittenReceiverOpt is { Type: { TypeKind: TypeKind.Array } } && !isLeftOfAssignment) 39var asArrayType = (ArrayTypeSymbol)rewrittenReceiverOpt.Type;
Lowering\LocalRewriter\LocalRewriter_Range.cs (8)
56Debug.Assert(operand.Type is { }); 60operand = new BoundDefaultExpression(operand.Syntax, operand.Type.GetNullableUnderlyingType()); 65Debug.Assert(operand.Type is { }); 67if (operand.Type.IsNullableType()) 80Debug.Assert(left?.Type?.IsNullableType() == true || right?.Type?.IsNullableType() == true); 131Debug.Assert(tempOperand.Type is { }); 133if (tempOperand.Type.IsNullableType())
Lowering\LocalRewriter\LocalRewriter_StackAlloc.cs (1)
28var type = stackAllocNode.Type;
Lowering\LocalRewriter\LocalRewriter_StringConcat.cs (43)
53Debug.Assert(loweredLeft.Type is { } && (loweredLeft.Type.IsStringType() || loweredLeft.Type.IsErrorType()) || loweredLeft.ConstantValueOpt?.IsNull == true); 54Debug.Assert(loweredRight.Type is { } && (loweredRight.Type.IsStringType() || loweredRight.Type.IsErrorType()) || loweredRight.ConstantValueOpt?.IsNull == true); 243SideEffects: [BoundAssignmentOperator { Right.Type.SpecialType: SpecialType.System_Char } assignment], 371Debug.Assert(loweredLeft.HasAnyErrors || loweredLeft.Type is { } && loweredLeft.Type.IsStringType()); 372Debug.Assert(loweredRight.HasAnyErrors || loweredRight.Type is { } && loweredRight.Type.IsStringType()); 382Debug.Assert(loweredFirst.HasAnyErrors || loweredFirst.Type is { } && loweredFirst.Type.IsStringType()); 383Debug.Assert(loweredSecond.HasAnyErrors || loweredSecond.Type is { } && loweredSecond.Type.IsStringType()); 384Debug.Assert(loweredThird.HasAnyErrors || loweredThird.Type is { } && loweredThird.Type.IsStringType()); 394Debug.Assert(loweredFirst.HasAnyErrors || loweredFirst.Type is { } && loweredFirst.Type.IsStringType()); 395Debug.Assert(loweredSecond.HasAnyErrors || loweredSecond.Type is { } && loweredSecond.Type.IsStringType()); 396Debug.Assert(loweredThird.HasAnyErrors || loweredThird.Type is { } && loweredThird.Type.IsStringType()); 397Debug.Assert(loweredFourth.HasAnyErrors || loweredFourth.Type is { } && loweredFourth.Type.IsStringType()); 408Debug.Assert(loweredArgs.All(a => a.HasErrors || a.Type is { } && a.Type.IsStringType())); 434if (arg is BoundCall { ReceiverOpt: { Type: NamedTypeSymbol { SpecialType: SpecialType.System_Char } receiverCharType } receiver } potentialToStringCall && 537Debug.Assert(arg.Type is not null); 539if (arg.Type.SpecialType == SpecialType.System_Char) 568Debug.Assert(arg.HasAnyErrors || arg.Type.SpecialType == SpecialType.System_String); 626if (expr is BoundCall { Type.SpecialType: SpecialType.System_String, Method: { Name: "ToString" } method, ReceiverOpt: { Type: NamedTypeSymbol { SpecialType: SpecialType.System_Char } charType, ConstantValueOpt.IsChar: true } } call && 648Debug.Assert(expr.Type is not null); 651if (expr.Type.IsStringType()) 663if (expr.Type.IsValueType && !expr.Type.IsTypeParameter()) 665var type = (NamedTypeSymbol)expr.Type; 686expr.Type.SpecialType.CanOptimizeBehavior() && 702bool callWithoutCopy = expr.Type.IsReferenceType || 704(structToStringMethod == null && !expr.Type.IsTypeParameter()) || 708if (expr.Type.IsValueType) 712expr = new BoundPassByCopy(syntax, expr, expr.Type); 744new BoundConditionalReceiver(syntax, currentConditionalAccessID, expr.Type),
Lowering\LocalRewriter\LocalRewriter_StringInterpolation.cs (8)
145Debug.Assert(node.Type is { SpecialType: SpecialType.System_String }); // if target-converted, we should not get here. 149return LowerPartsToString(data, node.Parts, node.Syntax, node.Type); 183_factory.Binary(BinaryOperatorKind.StringConcatenation, node.Type, result, part); 194Debug.Assert(result.Type is not null); 195Debug.Assert(result.Type.SpecialType == SpecialType.System_String || result.Type.IsErrorType()); 196var placeholder = new BoundValuePlaceholder(result.Syntax, result.Type); 197result = new BoundNullCoalescingOperator(result.Syntax, result, _factory.StringLiteral(""), leftPlaceholder: placeholder, leftConversion: placeholder, BoundNullCoalescingOperatorResultKind.LeftType, @checked: false, result.Type) { WasCompilerGenerated = true };
Lowering\LocalRewriter\LocalRewriter_TupleBinaryOperator.cs (32)
54Debug.Assert(expr.Type == (object?)o.Type || expr.Type is { } && expr.Type.Equals(o.Type, TypeCompareKind.AllIgnoreOptions)); 90expr.Type is { } exprType && exprType.IsNullableType() && exprType.StrippedType().Equals(o.Type, TypeCompareKind.AllIgnoreOptions): 107Debug.Assert(expr.Type is { }); 108var destElementTypes = expr.Type.TupleElementTypesWithAnnotations; 110Debug.Assert(boundConversion.Operand.Type is { }); 111var srcElementFields = boundConversion.Operand.Type.TupleElements; 127ImmutableArray<bool>.Empty, expr.Type, expr.HasErrors); 163ImmutableArray<bool>.Empty, tuple.Type, tuple.HasErrors); 206return new BoundLiteral(expr.Syntax, ConstantValue.Null, expr.Type); 356isNullable = !(expr is BoundTupleExpression) && expr.Type is { } && expr.Type.IsNullableType(); 368Debug.Assert(expr.Type is { }); 371value = new BoundDefaultExpression(expr.Syntax, expr.Type.StrippedType()); 398Debug.Assert(expr.Type is { }); 404when expr.Type.IsNullableType() && o.Type is { } && o.Type.IsNullableType() && !underlying[0].IsUserDefined: 438expr.Type is { } exprType && exprType.IsNullableType() && o.Type is { } && o.Type.IsNullableType() && nested[0] is { IsTupleConversion: true } tupleConversion: 440Debug.Assert(expr.Type is { }); 443Debug.Assert(operand.Type is { }); 444var types = expr.Type.GetNullableUnderlyingType().TupleElementTypesWithAnnotations; 445int tupleCardinality = operand.Type.TupleElementTypesWithAnnotations.Length; 461type: expr.Type, 524Debug.Assert(tuple.Type is { IsTupleType: true }); 530return MakeTupleFieldAccessAndReportUseSiteDiagnostics(tuple, tuple.Syntax, tuple.Type.TupleElements[i]);
Lowering\LocalRewriter\LocalRewriter_TupleCreationExpression.cs (2)
39Debug.Assert(node.Type is { }); 40return MakeTupleCreationExpression(node.Syntax, (NamedTypeSymbol)node.Type, rewrittenArguments);
Lowering\LocalRewriter\LocalRewriter_UnaryOperator.cs (23)
132var underlyingType = loweredOperand.Type.GetEnumUnderlyingType(); 276Debug.Assert(result.Type is { }); 285type: result.Type 328Debug.Assert(TypeSymbol.Equals(conditional.Type, conditional.Consequence.Type, TypeCompareKind.ConsiderEverything2)); 329Debug.Assert(TypeSymbol.Equals(conditional.Type, conditional.Alternative.Type, TypeCompareKind.ConsiderEverything2)); 439TypeSymbol? operandType = transformedLHS.Type; //type of the variable being incremented 512Debug.Assert(boundTemp.Type is not null); 527type: boundTemp.Type); 540Debug.Assert(boundTemp.Type is not null); 543Debug.Assert(tempValue.Type is { }); 552tempValue.Type); 566type: boundTemp.Type); 772Debug.Assert(binaryOperand.Type is { TypeKind: TypeKind.Pointer }); 773Debug.Assert(boundOne.Type is { SpecialType: SpecialType.System_Int32 }); 774return MakeBinaryOperator(node.Syntax, binaryOperatorKind, binaryOperand, boundOne, binaryOperand.Type, method: null, constrainedToTypeOpt: null); 826Debug.Assert(operand.Type is { SpecialType: SpecialType.System_Decimal }); 833Debug.Assert(operand.Type is { } && operand.Type.IsNullableType() && operand.Type.GetNullableUnderlyingType().SpecialType == SpecialType.System_Decimal); 837MethodSymbol getValueOrDefault = UnsafeGetNullableMethod(syntax, operand.Type, SpecialMember.System_Nullable_T_GetValueOrDefault); 838MethodSymbol ctor = UnsafeGetNullableMethod(syntax, operand.Type, SpecialMember.System_Nullable_T__ctor); 849BoundExpression alternative = new BoundDefaultExpression(syntax, operand.Type); 852return RewriteConditionalOperator(syntax, condition, consequence, alternative, ConstantValue.NotAvailable, operand.Type, isRef: false);
Lowering\LocalRewriter\LocalRewriter_UsingStatement.cs (2)
149Debug.Assert(rewrittenExpression.Type is { }); 150TypeSymbol expressionType = rewrittenExpression.Type;
Lowering\LocalRewriter\LoweredDynamicOperationFactory.cs (6)
544Debug.Assert(loweredReceiver.Type is { }); 545if (!loweredReceiver.Type.IsValueType) 829var argType = boundArgument.Type; 908result[j++] = receiver.Type ?? systemObjectType; 914result[j++] = arguments[i].Type ?? systemObjectType; 920result[j++] = right.Type ?? systemObjectType;
Lowering\SpillSequenceSpiller.cs (19)
45: base(SpillSequenceBuilderKind, syntax, value?.Type) 174new TreeDumperNode("type", this.Type, null) 337if (refKind != RefKind.None || expression.Type?.IsRefLikeOrAllowsRefLikeType() == true) 380if (refKind != RefKind.None || expression.Type.IsReferenceType) 497if (expression.Type.IsVoidType() || sideEffectsOnly) 1034Debug.Assert(refKind == RefKind.None || !receiver.Type.IsReferenceType); 1043var receiverType = receiver.Type; 1074if (!receiver.Type.IsReferenceType && LocalRewriter.CanBePassedByReference(receiver)) 1076result = receiver.Type.IsReadOnly ? RefKind.In : RefKind.Ref; 1147Debug.Assert(condition.Type.SpecialType == SpecialType.System_Boolean); 1150var tmp = _F.SynthesizedLocal(condition.Type, kind: SynthesizedLocalKind.Spill, syntax: _F.Syntax); 1197type: node.Type)); 1254_F.ObjectEqual(_F.Local(tmp), _F.Null(left.Type)), 1286if (receiver.Type.IsReferenceType || receiver.Type.IsValueType || receiverRefKind == RefKind.None) 1306var clone = _F.SynthesizedLocal(receiver.Type, _F.Syntax, refKind: RefKind.None, kind: SynthesizedLocalKind.Spill); 1310var isNotClass = _F.IsNotNullReference(_F.Default(receiver.Type)); 1478return UpdateExpression(builder, node.Update(operand, node.Type)); 1522return UpdateExpression(builder, node.Update(expression, node.Type));
Lowering\StateMachineRewriter\CapturedSymbol.cs (2)
42var field = this.HoistedField.AsMember((NamedTypeSymbol)frame.Type); 60var field = this.HoistedField.AsMember((NamedTypeSymbol)frame.Type);
Lowering\StateMachineRewriter\MethodToStateMachineRewriter.cs (5)
145Debug.Assert(thisProxyReplacement.Type is not null); 146this.cachedThis = F.SynthesizedLocal(thisProxyReplacement.Type, syntax: F.Syntax, kind: SynthesizedLocalKind.FrameCache); 542Debug.Assert(TypeSymbol.Equals(type, replacement.Type, TypeCompareKind.ConsiderEverything2)); 661TypeSymbol fieldType = expr.Type; 688hoistedField = F.StateMachineField(expr.Type, fieldName, new LocalSlotDebugInfo(kind, id), slotIndex);
Lowering\SyntheticBoundNodeFactory.cs (54)
259Debug.Assert(receiverOpt is null || receiverOpt.Type is { } && 260receiverOpt.Type.GetMembers(propertySym.Name).OfType<PropertySymbol>().Single() == propertySym); 271Debug.Assert(!(receiverOpt is { Type: ArrayTypeSymbol { IsSZArray: true } } && 431Debug.Assert(left.Type is { } && right.Type is { } && 432(left.Type.Equals(right.Type, TypeCompareKind.AllIgnoreOptions) || 434right.Type.IsErrorType() || left.Type.IsErrorType())); 436var assignment = new BoundAssignmentOperator(syntax, left, right, isRef, left.Type, hasErrors) { WasCompilerGenerated = wasCompilerGenerated }; 556var conversion = Compilation.Conversions.ClassifyConversionFromType(expression.Type, CurrentFunction.ReturnType, isChecked: false, ref useSiteInfo); 644Conversion c = Compilation.Conversions.ClassifyBuiltInConversion(operand.Type, type, isChecked: false, ref discardedUseSiteInfo); 650Debug.Assert(left.Type?.SpecialType == CodeAnalysis.SpecialType.System_Boolean); 651Debug.Assert(right.Type?.SpecialType == CodeAnalysis.SpecialType.System_Boolean); 657Debug.Assert(left.Type?.SpecialType == CodeAnalysis.SpecialType.System_Boolean); 658Debug.Assert(right.Type?.SpecialType == CodeAnalysis.SpecialType.System_Boolean); 772switch (input.Type) 781throw ExceptionUtilities.UnexpectedValue(input.Type); 901Debug.Assert(valueTypeReceiver.Type is { }); 902Debug.Assert(TypeSymbol.Equals(valueTypeReceiver.Type, referenceTypeReceiver.Type, TypeCompareKind.ConsiderEverything2)); 903return new BoundComplexConditionalReceiver(Syntax, valueTypeReceiver, referenceTypeReceiver, valueTypeReceiver.Type) { WasCompilerGenerated = true }; 908Debug.Assert(left.Type!.Equals(right.Type, TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes) || left.Type.IsErrorType()); 909Debug.Assert(left.Type.IsReferenceType); 911return new BoundNullCoalescingOperator(Syntax, left, right, leftPlaceholder: null, leftConversion: null, BoundNullCoalescingOperatorResultKind.LeftType, @checked: false, left.Type) { WasCompilerGenerated = true }; 1019Debug.Assert(result.Type is { }); 1020var resultType = type ?? result.Type; 1026Debug.Assert(result.Type is { }); 1030: new BoundSequence(Syntax, locals, sideEffects, result, result.Type) { WasCompilerGenerated = true }; 1035Debug.Assert(result.Type is { }); 1036return new BoundSpillSequence(Syntax, locals, sideEffects, result, result.Type) { WasCompilerGenerated = true }; 1065Debug.Assert(ex.Type is { SpecialType: CodeAnalysis.SpecialType.System_Int32 }); 1160Debug.Assert(array.Type is { TypeKind: TypeKind.Array }); 1166Debug.Assert(array.Type is { TypeKind: TypeKind.Array }); 1167int rank = ((ArrayTypeSymbol)array.Type).Rank; 1179Debug.Assert(array.Type is { TypeKind: TypeKind.Array }); 1180return new BoundArrayAccess(Syntax, array, indices, ((ArrayTypeSymbol)array.Type).ElementType); 1466if (TypeSymbol.Equals(type, arg.Type, TypeCompareKind.ConsiderEverything2)) 1480arg.Type is TypeParameterSymbol { AllowsRefLikeType: true } && type.IsObjectType()) 1496if (conversion.Method is { } && !TypeSymbol.Equals(conversion.Method.Parameters[0].Type, arg.Type, TypeCompareKind.ConsiderEverything2)) 1506Debug.Assert(arg.Type is { }); 1508arg.Type.IsNullableType() && 1509arg.Type.GetNullableUnderlyingType().Equals(type, TypeCompareKind.AllIgnoreOptions)) 1513return this.Call(arg, this.SpecialMethod(CodeAnalysis.SpecialMember.System_Nullable_T_get_Value).AsMember((NamedTypeSymbol)arg.Type)); 1602return new BoundCatchBlock(Syntax, ImmutableArray<LocalSymbol>.Empty, source, source.Type, exceptionFilterPrologueOpt: null, exceptionFilterOpt: null, body: block, isSynthesizedAsyncCatchAll: false); 1622Debug.Assert(expression is { Type: { SpecialType: CodeAnalysis.SpecialType.System_Boolean } }); 1623return new BoundUnaryOperator(expression.Syntax, UnaryOperatorKind.BoolLogicalNegation, expression, null, null, constrainedToTypeOpt: null, LookupResultKind.Viable, expression.Type); 1643Debug.Assert(argument.Type is { }); 1676var type = argument.Type; 1746TypeSymbol exprType = rewrittenExpr.Type; 1800LocalRewriter.UnsafeGetNullableMethod(syntax, expression.Type, CodeAnalysis.SpecialMember.System_Nullable_T_get_HasValue, Compilation, Diagnostics)); 1864return conditionalAccess.Update(conditionalAccess.Receiver, conditionalAccess.HasValueMethodOpt, whenNotNull, whenNull, conditionalAccess.Id, conditionalAccess.ForceCopyOfNullableValueType, whenNotNull.Type);
Operations\CSharpOperationFactory.cs (3)
1082if (boundOperand.Kind == BoundKind.ConvertedTupleLiteral && TypeSymbol.Equals(boundOperand.Type, boundConversion.Type, TypeCompareKind.ConsiderEverything2)) 1103!TypeSymbol.Equals(nestedConversion.Type, nestedOperand.Type, TypeCompareKind.ConsiderEverything2)) 1596boundNullCoalescingOperator.Type.Equals(boundNullCoalescingOperator.LeftOperand.Type?.StrippedType(), TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes))
Operations\CSharpOperationFactory_Methods.cs (1)
348argumentKind = argument.Type?.IsSZArray() == true ? ArgumentKind.ParamArray : ArgumentKind.ParamCollection;
Symbols\ConstantValueUtils.cs (2)
165if (!(expression.Type is null) && expression.Type.IsStringType())
Symbols\Source\ParameterHelpers.cs (7)
779conversion.IsIdentity && parameterType.SpecialType == SpecialType.System_Object && defaultExpression.Type.IsDynamic()) 793(object)defaultExpression.Type != null && 794defaultExpression.Type.SpecialType == SpecialType.System_String || 804else if (((conversion.IsNullable && !defaultExpression.Type.IsNullableType()) || 805(conversion.IsObjectCreation && convertedExpression.Type.IsNullableType())) && 822(defaultExpression.IsImplicitObjectCreation() ? convertedExpression.Type.StrippedType() : defaultExpression.Type), parameterSyntax.Identifier.ValueText);
Symbols\Source\SourceLocalSymbol.cs (1)
564return TypeWithAnnotations.Create(initializerOpt?.Type);
Symbols\Source\SourceMemberFieldSymbol.cs (3)
543if ((object)initializerOpt.Type != null && !initializerOpt.Type.IsErrorType()) 545type = TypeWithAnnotations.Create(initializerOpt.Type);
Symbols\Synthesized\SynthesizedEntryPointSymbol.cs (1)
392public override TypeWithAnnotations ReturnTypeWithAnnotations => TypeWithAnnotations.Create(_getAwaiterGetResultCall.Type);