2 writes to Type
Microsoft.CodeAnalysis.CSharp (2)
Generated\BoundNodes.xml.Generated.cs (2)
411this.Type = type; 417this.Type = type;
1745 references to Type
Microsoft.CodeAnalysis.CSharp (1717)
Binder\Binder.cs (2)
879RoslynDebug.Assert(expression.Type is object); 880return expression.Type;
Binder\Binder.ValueChecks.cs (32)
927Debug.Assert(!checkingReceiver || expr.Type.IsValueType || expr.Type.IsTypeParameter()); 954if ((expr.ConstantValueOpt != null) || (expr.Type.GetSpecialTypeSafe() == SpecialType.System_Void)) 1144getItemOrSliceHelper = getItemOrSliceHelper.AsMember(getItemOrSliceHelper.ContainingType.Construct(ImmutableArray.Create(elementAccess.Expression.Type.TryGetInlineArrayElementField().TypeWithAnnotations))); 1215indices[0].Type, 1248Error(diagnostics, ErrorCode.ERR_BadSKunknown, expr.Syntax, expr.Type, MessageID.IDS_SK_TYPE.Localize()); 1887&& receiver?.Type?.IsValueType == true; 2119if (receiver is BoundObjectOrCollectionValuePlaceholder && receiver.Type.IsAnonymousType) 2283if (methodInvocationInfo.MethodInfo.Method?.RequiresInstanceReceiver == true && methodInvocationInfo.Receiver?.Type?.IsRefLikeOrAllowsRefLikeType() == true) 2509if (receiver?.Type?.IsRefLikeOrAllowsRefLikeType() == true) 2622Debug.Assert(receiver.Type is { }); 2627Debug.Assert(receiver is not BoundValuePlaceholderBase && method is not null && receiver.Type?.IsReferenceType == false); 2632receiver = new BoundCapturedReceiverPlaceholder(receiver.Syntax, receiver, _localScopeDepth, receiver.Type).MakeCompilerGenerated(); 2751if (receiver.Type is TypeParameterSymbol typeParameter) 2990if (argument.Type?.IsRefLikeOrAllowsRefLikeType() == true) 3050if (argument.Type?.IsRefLikeOrAllowsRefLikeType() == true) 3188&& argument.Type?.IsRefLikeOrAllowsRefLikeType() == true) 3650Debug.Assert(expr.Type is not null); 3682if (expr.Type?.GetSpecialTypeSafe() == SpecialType.System_Void) 3959Debug.Assert(!checkingReceiver || expr.Type.IsValueType || expr.Type.IsTypeParameter()); 3974if (expr.Type?.GetSpecialTypeSafe() == SpecialType.System_Void) 4343if (expr.Type?.IsRefLikeOrAllowsRefLikeType() != true) 4765RoslynDebug.Assert(false, $"{expr.Kind} expression of {expr.Type} type"); 4990Debug.Assert(!checkingReceiver || expr.Type.IsValueType || expr.Type.IsTypeParameter()); 5011if (expr.Type?.IsRefLikeOrAllowsRefLikeType() != true) 5076Error(diagnostics, inUnsafeRegion ? ErrorCode.WRN_EscapeStackAlloc : ErrorCode.ERR_EscapeStackAlloc, node, expr.Type); 5341Error(diagnostics, ErrorCode.ERR_CollectionExpressionEscape, node, expr.Type); 5533RoslynDebug.Assert(false, $"{expr.Kind} expression of {expr.Type} type"); 5706TypeWithAnnotations.Create(elementAccess.Expression.Type), 5746TypeWithAnnotations.Create(inlineArray.Type),
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)
841RoslynDebug.Assert(node.Type is object); 842var typedConstantKind = node.Type.GetAttributeParameterTypedConstantKind(_binder.Compilation); 895return new TypedConstant(spread.Expression.Type, TypedConstantKind.Error, value: null); 914var operandType = operand.Type; 1017var type = node.Type;
Binder\Binder_Await.cs (15)
32var placeholder = new BoundAwaitableValuePlaceholder(expression.Syntax, expression.Type); 87var type = expression.Type; 269Debug.Assert(TypeSymbol.Equals(expression.Type, getAwaiterArgument.Type, TypeCompareKind.ConsiderEverything)); 305TypeSymbol awaiterType = getAwaiter.Type!; 306return GetIsCompletedProperty(awaiterType, node, expression.Type!, diagnostics, out isCompleted) 308&& GetGetResultMethod(getAwaiter, node, expression.Type!, diagnostics, out getResult, out getAwaiterGetResultCall) 333if (expression.Type is not NamedTypeSymbol { Arity: 0 or 1 } exprType) 360placeholder = new BoundAwaitableValuePlaceholder(expression.Syntax, expression.Type); 550if (expression.Type is null) 572RoslynDebug.Assert(expression.Type is object); 573if (expression.Type.IsVoidType()) 589Error(diagnostics, ErrorCode.ERR_BadAwaitArg, node, expression.Type); 602Error(diagnostics, ErrorCode.ERR_BadAwaitArg, node, expression.Type); 686var awaiterType = awaiterExpression.Type;
Binder\Binder_Conversions.cs (39)
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]]) 544if (source.Type.IsStringType()) 722unconvertedSource.Type, 1358Debug.Assert(methodGroup.ReceiverOpt.Type is not null); 1428diagnostics.Add(ErrorCode.ERR_CollectionExpressionMissingAdd, syntax, methodGroup.ReceiverOpt.Type); 1492TypeSymbol? receiverType = methodGroup.ReceiverOpt.Type; 1969Debug.Assert(targetTyped || destination.IsErrorType() || destination.Equals(source.Type, TypeCompareKind.ConsiderEverything)); 1988source.Syntax, source.Type, targetTyped, source.Expression, newSwitchArms, source.ReachabilityDecisionDag, 2074conversion: Conversions.ClassifyStandardConversion(convertedOperand.Type, conversionParameterType, ref useSiteInfo), 2679RoslynDebug.Assert(receiverOpt.Type is object); 2681diagnostics.Add(ErrorCode.ERR_QueryNoProvider, node.Location, receiverOpt.Type, memberSymbol.Name); 2699RoslynDebug.Assert(receiverOpt.Type is object); 2700diagnostics.Add(ErrorCode.ERR_BadAwaitArg, node.Location, receiverOpt.Type); 2835(Conversions.ConvertExtensionMethodThisArg(GetReceiverParameter(method)!.Type, receiverOpt!.Type, ref useSiteInfo, isMethodGroupConversion: true).Exists && useSiteInfo.Diagnostics.IsNullOrEmpty()));
Binder\Binder_Deconstruct.cs (20)
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) 321Debug.Assert(single.Type is not null); 323nestedConversion = this.Conversions.ClassifyConversionFromType(tupleOrDeconstructedTypes[i], single.Type, isChecked: CheckOverflowAtRuntime, ref useSiteInfo); 329GenerateImplicitConversionError(diagnostics, Compilation, single.Syntax, nestedConversion, tupleOrDeconstructedTypes[i], single.Type); 336nestedConversion, isCast: false, conversionGroupOpt: null, single.Type, diagnostics))); 357if ((object?)pending.Type != null) 421Debug.Assert((object?)variables[i].Single!.Type != null); 481TypeSymbol? mergedType = element.Type; 502if ((object?)variable.Single.Type != null) 505mergedType = variable.Single.Type; 569typesWithAnnotationsBuilder.Add(TypeWithAnnotations.Create(value.Type)); 622if (receiver.Type?.IsDynamic() ?? false) 718if (receiver.Type?.IsErrorType() == false) 720Error(diagnostics, ErrorCode.ERR_MissingDeconstruct, rightSyntax, receiver.Type!, numParameters);
Binder\Binder_Expressions.cs (96)
205TypeSymbol resultType = expr.Type; 303var commonType = expr.Type; 379case BoundStackAllocArrayCreation { Type: null } boundStackAlloc: 580TypeSymbol exprType = expr.Type; 997subExpressions.SelectAsArray(e => TypeWithAnnotations.Create(e.Type)), 1054if (boundArgument.Type?.SpecialType == SpecialType.System_Void) 1064var elementTypeWithAnnotations = TypeWithAnnotations.Create(boundArgument.Type); 1263if ((object)argument.Type != null && argument.Type.IsRestrictedType()) 1266Error(diagnostics, ErrorCode.ERR_MethodArgCantBeRefAny, node, argument.Type); 1716type: expression.Type, 2608(object)operand.Type != null && 2609!operand.Type.IsNullableType() && 2610!TypeSymbol.Equals(targetType.GetNullableUnderlyingType(), operand.Type, TypeCompareKind.ConsiderEverything2)) 2631if ((object)boundOperand.Type != null && boundOperand.Type.IsNullableType()) 2710if (left?.Type.IsNullableType() == true || right?.Type.IsNullableType() == true) 2738if (boundOperand.Type?.IsNullableType() == true) 2830SymbolDistinguisher distinguisher1 = new SymbolDistinguisher(this.Compilation, operand.Type, targetType); 2879case BoundKind.UnconvertedConditionalOperator when operand.Type is null: 2880case BoundKind.UnconvertedSwitchExpression when operand.Type is null: 2904Debug.Assert((object)operand.Type != null); 2905SymbolDistinguisher distinguisher = new SymbolDistinguisher(this.Compilation, operand.Type, targetType); 2946Debug.Assert((object)operand.Type != null && !operand.Type.IsNullableType()); 2952var underlyingConversion = Conversions.ClassifyBuiltInConversion(operand.Type, underlyingTargetTypeWithAnnotations.Type, isChecked: CheckOverflowAtRuntime, ref discardedUseSiteInfo); 3805Debug.Assert(receiver!.Type is not null); 3807placeholderType = receiver.Type; 4252if ((object)boundExpression.Type == null || !boundExpression.Type.IsErrorType()) 4336Debug.Assert(init.Type.IsErrorType()); 4746if (constantValue == null || constantValue.IsBad || expression.Type.SpecialType != SpecialType.System_Int32) 4769var type = expression.Type.SpecialType; 5327Debug.Assert(expression.Type is { }); 5329var expressionPlaceholder = new BoundCollectionExpressionSpreadExpressionPlaceholder(syntax.Expression, expression.Type); 5342_ = expression.Type.HasInlineArrayAttribute(out int length); 5472else if ((object)argument.Type == null) 5484else if (argument.Type.TypeKind == TypeKind.Delegate) 5486var sourceDelegate = (NamedTypeSymbol)argument.Type; 5490if (ReportDelegateInvokeUseSiteDiagnostic(diagnostics, argument.Type, node: node)) 5771Debug.Assert((object)boundLeft.Type != null); 5780type: boundLeft.Type, 6068type: boundMember.Type, 6482({ Type: null } or BoundLiteral or BoundUnconvertedInterpolatedString or BoundBinaryOperator { IsUnconvertedInterpolatedStringAddition: true }) && 7554var leftType = boundValue.Type; 7562if (TypeSymbol.Equals(boundType.Type, leftType, TypeCompareKind.AllIgnoreOptions)) 7594TypeSymbol.Equals(BindNamespaceOrType(id, BindingDiagnosticBag.Discarded).Type, type, TypeCompareKind.AllIgnoreOptions); 7698TypeSymbol leftType = boundLeft.Type; 7736leftType = boundLeft.Type; 7979Error(diagnostics, ErrorCode.WRN_DotOnDefault, node, boundLeft.Type); 8106var leftType = boundLeft.Type; 8241if ((object)boundLeft.Type == null) 8250Error(diagnostics, ErrorCode.ERR_NoSuchMember, name, boundLeft.Type, plainName); 8252else if (WouldUsingSystemFindExtension(boundLeft.Type, plainName)) 8254Error(diagnostics, ErrorCode.ERR_NoSuchMemberOrExtensionNeedUsing, name, boundLeft.Type, plainName, "System"); 8258Error(diagnostics, ErrorCode.ERR_NoSuchMemberOrExtension, name, boundLeft.Type, plainName); 8558Debug.Assert(left.Type is not null); 8559Debug.Assert(!left.Type.IsDynamic()); 8651Debug.Assert(left.Type is not null); 8763TypeSymbol? receiverType = left.Type; 8895errorInfo = new CSDiagnosticInfo(ErrorCode.ERR_ExtensionResolutionFailed, left.Type, memberName); 8948TypeSymbol receiverType = receiver.Type; 9119if (receiverOpt is { Type: TypeParameterSymbol { AllowsRefLikeType: true } } && 9161bool isUsableAsField = eventSymbol.HasAssociatedField && this.IsAccessible(eventSymbol.AssociatedField, ref useSiteInfo, (receiver != null) ? receiver.Type : null); 9401if ((object)expr.Type == null) 9422expr.Type.HasInlineArrayAttribute(out int length) && expr.Type.TryGetPossiblyUnsupportedByLanguageInlineArrayElementField() is FieldSymbol elementField) 9434Debug.Assert(expr.Type.TryGetInlineArrayElementField() is not null); 9454{ Code: (int)ErrorCode.ERR_BadIndexLHS, Arguments: [TypeSymbol type] } && type.Equals(expr.Type, TypeCompareKind.ConsiderEverything)) 9581CheckInlineArrayTypeIsSupported(node, expr.Type, elementField.Type, diagnostics); 9632if (TypeSymbol.Equals(convertedIndex.Type, compilation.GetWellKnownType(WellKnownType.System_Index), TypeCompareKind.AllIgnoreOptions)) 9680Debug.Assert((object)expr.Type != null); 9683var exprType = expr.Type; 9726var arrayType = (ArrayTypeSymbol)expr.Type; 9773var receiverPlaceholder = new BoundImplicitIndexerReceiverPlaceholder(expr.Syntax, isEquivalentToThisReference: expr.IsEquivalentToThisReference, expr.Type) { WasCompilerGenerated = true }; 9937Debug.Assert(expr.Type.IsPointerType()); 9938PointerTypeSymbol pointerType = (PointerTypeSymbol)expr.Type; 9984Debug.Assert((object)expr.Type != null); 9990this.LookupMembersWithFallback(lookupResult, expr.Type, WellKnownMemberNames.Indexer, arity: 0, useSiteInfo: ref useSiteInfo, options: lookupOptions); 10305var argType = argument.Type; 10311Debug.Assert(receiver.Type is not null); 10318var receiverPlaceholder = new BoundImplicitIndexerReceiverPlaceholder(receiver.Syntax, isEquivalentToThisReference: receiver.IsEquivalentToThisReference, receiver.Type) { WasCompilerGenerated = true }; 10327Debug.Assert(indexerOrSliceAccess.Type is not null); 10337indexerOrSliceAccess.Type); 10551Debug.Assert(receiverPlaceholder.Type is not null); 10552if (TryLookupLengthOrCount(syntax, receiverPlaceholder.Type, lookupResult, out var lengthOrCountProperty, diagnostics)) 10911Debug.Assert(node.ReceiverOpt!.Type is not null); // extensions are only considered on member access 10942var substituted = (MethodSymbol?)extensionMember.GetReducedAndFilteredSymbol(typeArguments, receiver.Type, Compilation, checkFullyInferred: true); 10948else if (m.ReduceExtensionMethod(receiver.Type, Compilation) is { } reduced) 11127Debug.Assert(node.ReceiverOpt!.Type is not null); // extensions are only considered on member access 11153var substituted = (MethodSymbol?)extensionMember.GetReducedAndFilteredSymbol(typeArguments, receiver.Type, Compilation, checkFullyInferred: true); 11402var receiverType = receiver.Type; 11411var accessType = access.Type; 11547var receiverType = receiver.Type; 11578var 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 (27)
285else if ((object)argument.Type == null && !argument.HasAnyErrors) 296else if (argument.Type.IsVoidType()) 350if ((object)boundExpression.Type != null && boundExpression.Type.IsDynamic()) 378else if (boundExpression.Type?.Kind == SymbolKind.FunctionPointerType) 565Debug.Assert(receiver.Type is not null); 566Error(diagnostics, ErrorCode.ERR_CannotDynamicInvokeOnExpression, receiver.Syntax, receiver.Type); 617Debug.Assert((object?)arg.Type != null); 620Error(diagnostics, ErrorCode.ERR_BadDynamicMethodArg, arg.Syntax, arg.Type); 856Debug.Assert(methodGroup.ReceiverOpt != null && (object)methodGroup.ReceiverOpt.Type != null); 858Error(diagnostics, ErrorCode.ERR_BadArgTypeDynamicExtension, syntax, methodGroup.ReceiverOpt.Type, methodGroup.Name); 1085if (!call.HasAnyErrors && call.ReceiverOpt != null && (object)call.ReceiverOpt.Type != null && !call.Method.IsExtensionBlockMember()) 1090if (call.ReceiverOpt.Type.IsRestrictedType() && !call.Method.ContainingType.IsInterface && !TypeSymbol.Equals(call.Method.ContainingType, call.ReceiverOpt.Type, TypeCompareKind.ConsiderEverything2)) 1092SymbolDistinguisher distinguisher = new SymbolDistinguisher(compilation, call.ReceiverOpt.Type, call.Method.ContainingType); 1108(object)dynInvoke.Expression.Type != null && 1109dynInvoke.Expression.Type.IsRestrictedType()) 1113Error(diagnostics, ErrorCode.ERR_BadDynamicMethodArg, dynInvoke.Expression.Syntax, dynInvoke.Expression.Type); 1402if (receiver is BoundValuePlaceholderBase || receiver?.Type is null or { IsReferenceType: true }) 1904receiver.Type.IsValueType && 1967!(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. 2022var type = expr.Type as NamedTypeSymbol; 2077var methodContainer = (object)receiver != null && (object)receiver.Type != null 2078? receiver.Type 2320var methodContainer = expr.Type ?? this.ContainingType; 2514RoslynDebug.Assert(boundExpression.Type is FunctionPointerTypeSymbol); 2516var funcPtr = (FunctionPointerTypeSymbol)boundExpression.Type;
Binder\Binder_Operators.cs (90)
72Debug.Assert(left.Type is { }); 75var placeholder = new BoundValuePlaceholder(right.Syntax, left.HasDynamicType() ? left.Type : right.Type).MakeCompilerGenerated(); 76var finalDynamicConversion = this.Compilation.Conversions.ClassifyConversionFromExpression(placeholder, left.Type, isChecked: CheckOverflowAtRuntime, ref useSiteInfo); 78var conversion = (BoundConversion)CreateConversion(node, placeholder, finalDynamicConversion, isCast: true, conversionGroupOpt: null, left.Type, diagnostics); 87left.Type, 88right.Type, 96left.Type, 271var leftType = left.Type; 344var leftType = left.Type; 387var leftType = left.Type; 438var leftType = left.Type; 782TypeSymbol type = operand.Type; 810Debug.Assert((object)left.Type != null && left.Type.IsDynamic() || (object)right.Type != null && right.Type.IsDynamic()); 834Error(diagnostics, ErrorCode.ERR_InvalidDynamicCondition, node.Left, left.Type, kind == BinaryOperatorKind.LogicalAnd ? "false" : "true"); 840Debug.Assert(left.Type is not TypeParameterSymbol); 956TypeSymbol leftType = left.Type; 957TypeSymbol rightType = right.Type; 992Debug.Assert(right.Type.SpecialType == SpecialType.System_String); 993var stringConstant = FoldBinaryOperator(node, BinaryOperatorKind.StringConcatenation, left, right, right.Type, diagnostics); 994return new BoundBinaryOperator(node, BinaryOperatorKind.StringConcatenation, BoundBinaryOperator.UncommonData.UnconvertedInterpolatedStringAddition(stringConstant), LookupResultKind.Empty, left, right, right.Type); 1199TypeSymbol leftType = left.Type; 1200TypeSymbol rightType = right.Type; 1317(object?)left.Type != null && left.Type.TypeKind == TypeKind.Delegate) 1321var conversion = this.Conversions.ClassifyConversionFromExpression(right, left.Type, isChecked: CheckOverflowAtRuntime, ref discardedUseSiteInfo); 1323GenerateImplicitConversionError(diagnostics, right.Syntax, conversion, right, left.Type); 1351case (BoundKind.DefaultLiteral, _) when right.Type is TypeParameterSymbol: 1352Debug.Assert(!right.Type.IsReferenceType); 1353Error(diagnostics, ErrorCode.ERR_AmbigBinaryOpsOnUnconstrainedDefault, node, operatorToken.Text, right.Type); 1355case (_, BoundKind.DefaultLiteral) when left.Type is TypeParameterSymbol: 1356Debug.Assert(!left.Type.IsReferenceType); 1357Error(diagnostics, ErrorCode.ERR_AmbigBinaryOpsOnUnconstrainedDefault, node, operatorToken.Text, left.Type); 1375case LookupResultKind.OverloadResolutionFailure when operatorToken.Kind() is SyntaxKind.PlusToken && isReadOnlySpanOfByte(left.Type) && isReadOnlySpanOfByte(right.Type): 1449if ((object)left.Type != null && left.Type.SpecialType == SpecialType.System_Boolean && 1450(object)right.Type != null && right.Type.SpecialType == SpecialType.System_Boolean) 1452var constantValue = FoldBinaryOperator(node, kind | BinaryOperatorKind.Bool, left, right, left.Type, diagnostics); 1456resultKind: LookupResultKind.Viable, left, right, type: left.Type, hasErrors: constantValue != null && constantValue.IsBad); 1547Debug.Assert(resultLeft.Type.Equals(signature.LeftType, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 1548var operandPlaceholder = new BoundValuePlaceholder(resultLeft.Syntax, resultLeft.Type).MakeCompilerGenerated(); 1603var type = left.Type; 1620if (left.Type is not null) 1622CreateConversion(left.Syntax, new BoundValuePlaceholder(left.Syntax, left.Type).MakeCompilerGenerated(), implicitConversion, isCast: false, conversionGroupOpt: null, booleanType, diagnostics); 2112if (left.Type is null && right.Type is null) 2370(object)operand.Type != null && 2371(operand.Type.SpecialType == SpecialType.System_UInt64 || isNuint(operand.Type))) 2424operand.Type is null) // GetUserDefinedOperators performs this check too, let's optimize early 2657return left.Type; 2660return right.Type; 2724BinaryOperatorKind newKind = kind.Operator().WithType(newLeftOperand.Type!.SpecialType); 3284var operandType = operand.Type; 3438var operandType = operand.Type; 3485Debug.Assert(operand.Type is not null); 3491operand.Type, 3528var operandType = operand.Type; 3679Debug.Assert(operand.Type is not null); 4076var operandType = operand.Type as PointerTypeSymbol; 4131TypeSymbol operandType = operand.Type; 4210if (receiver.Type.IsReferenceType) 4336if (isOperandNullOrNew || operand.Type?.IsErrorType() == true) 4364type: operand.Type!); 4418var underlyingType = operand.Type.GetEnumUnderlyingType()!; 4777if ((object)operand.Type == null && !operand.IsLiteralNull()) 4836if ((object)operand.Type == null) 4847var convertedExpression = BindExpressionForPattern(operand.Type, node.Right, ref hasErrors, isPatternDiagnostics, out var constantValueOpt, out var wasExpression, out _); 4854node.Right, convertedExpression, constantValueOpt ?? ConstantValue.Bad, operand.Type, convertedExpression.Type ?? operand.Type, hasErrors) 4874if (operandHasErrors || IsOperatorErrors(node, operand.Type, typeExpression, diagnostics)) 4895operand.Type.IsVoidType()) 4925var operandType = operand.Type; 5325if ((object)operand.Type == null) 5387Debug.Assert(operand.Type is null); 5388operandPlaceholder = new BoundValuePlaceholder(operand.Syntax, operand.Type).MakeCompilerGenerated(); 5402var operandType = operand.Type; 5435operandPlaceholder = new BoundValuePlaceholder(operand.Syntax, operand.Type).MakeCompilerGenerated(); 5614TypeSymbol optLeftType = leftOperand.Type; // "A" 5615TypeSymbol optRightType = rightOperand.Type; // "B" 5790TypeSymbol leftType = leftOperand.Type; 5808if (underlyingRightConversion.Exists && rightOperand.Type?.IsDynamic() != true) 5949TypeSymbol trueType = trueExpr.Type; 5950TypeSymbol falseType = falseExpr.Type;
Binder\Binder_Patterns.cs (20)
25TypeSymbol? expressionType = expression.Type; 38Debug.Assert(expression.Type is { }); 39BoundPattern pattern = BindPattern(node.Pattern, expression.Type, permitDesignations: true, hasErrors, diagnostics, underIsPattern: true); 67Debug.Assert(expression.Type is object); 68diagnostics.Add(ErrorCode.ERR_IsPatternImpossible, node.Location, expression.Type); 85Debug.Assert(expression.Type is object); 86diagnostics.Add(ErrorCode.WRN_IsPatternAlways, node.Location, expression.Type); 260Debug.Assert(indexerAccess.Type is not null); 261sliceType = indexerAccess.Type; 334Debug.Assert(indexerAccess!.Type is not null); 335elementType = indexerAccess.Type; 439var convertedType = convertedExpression.Type ?? inputType; 527Debug.Assert(expression is { Kind: BoundKind.TypeExpression, Type: { } }); 528hasErrors |= CheckValidPatternType(patternExpression, inputType, expression.Type, diagnostics: diagnostics); 590if (convertedExpression.Type is null && constantValueOpt != ConstantValue.Null) 631RoslynDebug.Assert(expression.Type is { }); 632ConstantValue match = ExpressionOfTypeMatchesPatternType(Conversions, inputType, expression.Type, ref useSiteInfo, out _, operandConstantValue: null); 664if (expression.Type?.SpecialType == SpecialType.System_String && inputType.IsSpanOrReadOnlySpanChar()) 719(conversion.ConversionKind == ConversionKind.NoConversion && convertedExpression.Type?.IsErrorType() == true)) 1645var type = value.Type ?? inputType;
Binder\Binder_Query.cs (14)
300Debug.Assert(state.fromExpression.Type is { }); 303ImmutableArray.Create(state.fromExpression), state.fromExpression.Type); 749else if (!yExpression.HasAnyErrors && yExpression.Type!.IsVoidType()) 751Error(d, ErrorCode.ERR_QueryRangeVariableAssignedBadValue, errorLocation, yExpression.Type!); 752Debug.Assert(yExpression.Type is { }); 753yExpression = new BoundBadExpression(yExpression.Syntax, LookupResultKind.Empty, ImmutableArray<Symbol?>.Empty, ImmutableArray.Create(yExpression), yExpression.Type); 814field2Value = new BoundBadExpression(field2Value.Syntax, LookupResultKind.Empty, ImmutableArray<Symbol?>.Empty, ImmutableArray.Create(field2Value), field2Value.Type, true); 834return e.Type ?? CreateErrorType(); 939Debug.Assert(receiver.Type is object || ultimateReceiver.Type is null); 940if ((object?)ultimateReceiver.Type == null) 974if (ultimateReceiver.Type.TypeKind == TypeKind.TypeParameter) 977Error(diagnostics, ErrorCode.ERR_BadSKunknown, ultimateReceiver.Syntax, ultimateReceiver.Type, MessageID.IDS_SK_TYVAR.Localize()); 985else 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; 764Debug.Assert(expr.Type is object); 765Debug.Assert(expr.Type.IsRefLikeType || hasAwait); // pattern dispose lookup is only valid on ref structs or asynchronous usings 1027TypeSymbol initializerType = initializerOpt?.Type; 1237TypeSymbol initializerType = initializerOpt.Type; 1253elementType = ((BoundAddressOfOperator)initializerOpt).Operand.Type; 1327if (initializer.Type.IsVoidType()) 1347additionalDiagnostics.Add(ErrorCode.WRN_PatternBadSignature, initializer.Syntax.Location, initializer.Type, "fixed", patternMethodSymbol); 1464var inferredType = op2.Type; 1490if (op1.Type is { } lhsType && !lhsType.IsErrorType()) 1538type = op1.Type; 1559Debug.Assert(op1.Type is { }); 1592Debug.Assert(leftEscape.Equals(rightEscape) || op1.Type.IsRefLikeOrAllowsRefLikeType()); 1627if (!hasErrors && op1.Type.IsRefLikeOrAllowsRefLikeType()) 1858Debug.Assert((object)receiver.Type != null); 1859return receiver.Type; 1985this.Conversions.ClassifyConversionFromType(expression.Type, targetType, isChecked: CheckOverflowAtRuntime, ref useSiteInfo); 2017expression.Type, 2477var sourceType = operand.Type; 3086hasErrors |= arg.HasErrors || ((object)arg.Type != null && arg.Type.IsErrorType()); 3161if ((object)arg?.Type != null && arg.Type.IsVoidType()) 3225&& TypeSymbol.Equals(argument.Type, this.GetCurrentReturnType(out unusedRefKind), TypeCompareKind.ConsiderEverything2)) 3228Error(diagnostics, ErrorCode.ERR_BadAsyncReturnExpression, argument.Syntax, returnType, argument.Type); 3562else if (expression.Type?.SpecialType == SpecialType.System_Void)
Binder\Binder_Symbols.cs (3)
1508receiver = new BoundBadExpression(receiver.Syntax, LookupResultKind.Ambiguous, ImmutableArray<Symbol>.Empty, ImmutableArray.Create(receiver), receiver.Type, hasErrors: true).MakeCompilerGenerated(); 1517Error(diagnostics, ErrorCode.ERR_NoSuchMemberOrExtension, right, receiver.Type, plainName); 1518receiver = new BoundBadExpression(receiver.Syntax, LookupResultKind.Empty, ImmutableArray<Symbol>.Empty, childBoundNodes: [receiver], receiver.Type, hasErrors: true).MakeCompilerGenerated();
Binder\Binder_TupleOperators.cs (16)
85TypeSymbol leftType = left.Type; 86TypeSymbol rightType = right.Type; 112return new TupleBinaryOperatorInfo.Single(binary.Left.Type, binary.Right.Type, binary.OperatorKind, binary.BinaryOperatorMethod, binary.ConstrainedToType, 187Debug.Assert((object)left.Type != null && left.Type.IsDynamic() || (object)right.Type != null && right.Type.IsDynamic()); 209left = GiveTupleTypeToDefaultLiteralIfNeeded(left, right.Type); 210right = GiveTupleTypeToDefaultLiteralIfNeeded(right, left.Type); 224Debug.Assert((object)left.Type != null || left.Kind == BoundKind.TupleLiteral); 225Debug.Assert((object)right.Type != null || right.Kind == BoundKind.TupleLiteral); 254bool leftNullable = left.Type?.IsNullableType() == true; 255bool rightNullable = right.Type?.IsNullableType() == true; 363TypeSymbol type = expr.Type; 390TypeSymbol tupleType = expr.Type.StrippedType();
Binder\Binder_WithExpression.cs (1)
20var receiverType = receiver.Type;
Binder\DecisionDagBuilder.cs (5)
453Debug.Assert(variableAccess.Type!.Equals(input.Type, TypeCompareKind.AllIgnoreOptions) || variableAccess.Type.IsErrorType()); 546Debug.Assert(constant.Value.Type is not null || constant.HasErrors); 547output = input = constant.Value.Type is { } type ? MakeConvertToType(input, constant.Syntax, type, isExplicitTest: false, tests) : input; 756var type = rel.Value.Type ?? input.Type;
Binder\ForEachLoopBinder.cs (21)
556(builder.ElementType.IsPointerOrFunctionPointer() && collectionExpr.Type.IsArray()) || 557(builder.ElementType.IsNullableType() && builder.ElementType.GetMemberTypeArgumentsNoUseSiteDiagnostics().Single().IsErrorType() && collectionExpr.Type.IsArray())); 593(collectionConversionClassification.Kind == ConversionKind.ExplicitReference && collectionExpr.Type.SpecialType == SpecialType.System_String)); 661Debug.Assert(collectionType.Equals(collectionExpr.Type, TypeCompareKind.AllIgnoreOptions)); // Should not create an Identity conversion that changes type. 700else if (collectionExpr.Type.SpecialType == SpecialType.System_String && builder.CollectionType.SpecialType == SpecialType.System_Collections_IEnumerable) 718TypeSymbol collectionExprType = collectionExpr.Type; 795TypeSymbol collectionExprType = collectionExpr.Type; 834if (!isAsync && collectionExpr.Type?.HasInlineArrayAttribute(out _) == true && collectionExpr.Type.TryGetPossiblyUnsupportedByLanguageInlineArrayElementField() is FieldSymbol elementField) 865diagnostics.Add(ErrorCode.ERR_InlineArrayForEachNotSupported, collectionExpr.Syntax.GetLocation(), collectionExpr.Type); 888builder.CollectionType = collectionExpr.Type; 905CheckInlineArrayTypeIsSupported(collectionExpr.Syntax, collectionExpr.Type, elementField.Type, diagnostics); 913diagnostics.Add(ErrorCode.ERR_InlineArrayForEachNotSupported, collectionExpr.Syntax.GetLocation(), collectionExpr.Type); 926(originalCollectionExpr.Type?.IsNullableType() == true && originalCollectionExpr.Type.StrippedType().Equals(collectionExpr.Type, TypeCompareKind.AllIgnoreOptions))); 937TypeSymbol collectionExprType = collectionExpr.Type; 977var unwrappedCollectionExprType = unwrappedCollectionExpr.Type; 1047builder.CollectionType = collectionExpr.Type; 1344getEnumeratorInfo = FindForEachPatternMethod(syntax, collectionSyntax, collectionExpr.Type, methodName, lookupResult, warningsOnly: true, diagnostics, isAsync); 1593diagnostics.Add(ErrorCode.WRN_PatternIsAmbiguous, collectionSyntax.Location, collectionExpr.Type, MessageID.IDS_Collection.Localize(),
Binder\LockBinder.cs (1)
40TypeSymbol? exprType = expr.Type;
Binder\RefSafetyAnalysis.cs (3)
289return placeholder.Type?.SpecialType == SpecialType.System_Int32; 582if (node.ExpressionOpt is { Type: { } } expr) 592if (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)
480if (method.RequiresInstanceReceiver && methodGroup.Receiver?.Type?.IsRestrictedType() == true) 511Debug.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) && 1923Debug.Assert(sourceExpressionOpt == null || (object)sourceExpressionOpt.Type == sourceType); 1960conversions.ClassifyImplicitExtensionMethodThisArgConversion(s, s.Type, d.Type, ref u, isMethodGroupConversion: false), 3043if (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 (35)
78TypeSymbol leftOperatorSourceOpt = left.Type?.StrippedType(); 79TypeSymbol rightOperatorSourceOpt = right.Type?.StrippedType(); 373var leftType = left.Type; 375var rightType = right.Type; 517bool isExactSubtraction = TypeSymbol.Equals(right.Type?.StrippedType(), underlying, TypeCompareKind.ConsiderEverything2); 621var leftType = left.Type; 627var rightType = right.Type; 696var leftType = left.Type as PointerTypeSymbol; 697var rightType = right.Type as PointerTypeSymbol; 712if ((object)leftType != null || (object)rightType != null || left.Type is FunctionPointerTypeSymbol || right.Type is FunctionPointerTypeSymbol) 734if ((left.Type is TypeParameterSymbol { AllowsRefLikeType: true } && right.IsLiteralNull()) || 735(right.Type is TypeParameterSymbol { AllowsRefLikeType: true } && left.IsLiteralNull())) 754this.Compilation.BuiltInOperators.GetSimpleBuiltInOperators(kind, operators, skipNativeIntegerOperators: !left.Type.IsNativeIntegerOrNullableThereof() && !right.Type.IsNativeIntegerOrNullableThereof()); 769this.Compilation.BuiltInOperators.GetUtf8ConcatenationBuiltInOperator(left.Type, operators); 780BuiltInOperators.IsValidObjectEquality(conversions, left.Type, left.IsLiteralNull(), leftIsDefault: false, right.Type, right.IsLiteralNull(), rightIsDefault: false, ref useSiteInfo) && 781((object)left.Type == null || (!left.Type.IsDelegateType() && left.Type.SpecialType != SpecialType.System_String && left.Type.SpecialType != SpecialType.System_Delegate)) && 782((object)right.Type == null || (!right.Type.IsDelegateType() && right.Type.SpecialType != SpecialType.System_String && right.Type.SpecialType != SpecialType.System_Delegate)); 792return (operand.Type is TypeParameterSymbol { AllowsRefLikeType: true }) ? Conversion.Boxing : Conversions.ClassifyConversionFromExpression(operand, objectType, isChecked: isChecked, ref useSiteInfo); 1448if (left.Type?.IsNullableType() == true || right.Type?.IsNullableType() == true) // Wouldn't be applicable to the receiver type otherwise 1590if (left.Type is not null && parameterMatchesReceiver(in candidate, 0) && isOperandApplicableToReceiver(in candidate, left, ref useSiteInfo)) 1595if (!kind.IsShift() && right.Type is not null && parameterMatchesReceiver(in candidate, 1) && isOperandApplicableToReceiver(in candidate, right, ref useSiteInfo)) 1614Debug.Assert(operand.Type is not null); 1617if (candidate.Kind.IsLifted() && operand.Type.IsNullableType()) 1620!Conversions.ConvertExtensionMethodThisArg(MakeNullable(candidate.Method.ContainingType.ExtensionParameter.Type), operand.Type, ref useSiteInfo, isMethodGroupConversion: false).Exists) 1625else if (!Conversions.ConvertExtensionMethodThisArg(candidate.Method.ContainingType.ExtensionParameter.Type, operand.Type, ref useSiteInfo, isMethodGroupConversion: false).Exists)
Binder\Semantics\Operators\UnaryOperatorEasyOut.cs (1)
99var operandType = operand.Type;
Binder\Semantics\Operators\UnaryOperatorOverloadResolution.cs (11)
83Debug.Assert(operand.Type is not null); 89if (operand.Type.IsNullableType()) // Wouldn't be applicable to the receiver type otherwise 220Debug.Assert(operand.Type is not null); 225Debug.Assert(operand.Type.IsNullableType()); 228!Conversions.ConvertExtensionMethodThisArg(MakeNullable(candidate.Method.ContainingType.ExtensionParameter.Type), operand.Type, ref useSiteInfo, isMethodGroupConversion: false).Exists) 233else if (!Conversions.ConvertExtensionMethodThisArg(candidate.Method.ContainingType.ExtensionParameter.Type, operand.Type, ref useSiteInfo, isMethodGroupConversion: false).Exists) 514this.Compilation.BuiltInOperators.GetSimpleBuiltInOperators(kind, operators, skipNativeIntegerOperators: !operand.Type.IsNativeIntegerOrNullableThereof()); 553var enumType = operand.Type; 584var pointerType = operand.Type as PointerTypeSymbol; 615if ((object)operand.Type == null) 643return GetUserDefinedOperators(operand.Type.StrippedType(), kind, isChecked, name1, name2Opt, operand, results, ref useSiteInfo);
Binder\Semantics\OverloadResolution\AnalyzedArguments.cs (2)
101if ((object?)argument.Type != null && argument.Type.IsDynamic() && (!hasRefKinds || RefKinds[i] == Microsoft.CodeAnalysis.RefKind.None))
Binder\Semantics\OverloadResolution\MethodTypeInference.cs (3)
381sb.AppendFormat("Argument types ({0})\n", string.Join(", ", from a in _arguments select a.Type)); 879if (argument.Kind == BoundKind.TupleLiteral && (object)argument.Type == null) 3311TypeSymbol source = argument.Type;
Binder\Semantics\OverloadResolution\OverloadResolution.cs (5)
3263if ((object)node.Type != null && Conversions.HasIdentityConversion(node.Type, t)) 4724var argType = argument.Type; 4738Conversions.ClassifyImplicitExtensionMethodThisArgConversion(argument, argument.Type, parameterType, ref useSiteInfo, isMethodGroupConversion: isMethodGroupConversion) : 4739((!dynamicConvertsToAnything || !argument.Type.IsDynamic()) ?
Binder\Semantics\OverloadResolution\OverloadResolutionResult.cs (7)
540diagnostics.Add(ErrorCode.ERR_CollectionExpressionMissingAdd, location, receiver.Type); 680diagnostics.Add(ErrorCode.ERR_QueryNoProvider, location, receiverOpt.Type, symbol.Name); 688diagnostics.Add(ErrorCode.ERR_BadAwaitArg, location, receiverOpt.Type); 808new object[] { instanceArgument.Type, inferenceFailed.Member.Name }, 1162diagnostics.Add(ErrorCode.ERR_CollectionExpressionMissingAdd, location, receiver.Type); 1401=> argument is BoundLiteral { Type.SpecialType: SpecialType.System_String } && 1440diagnostics.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)
156var type = @case.Value.Type; 193Debug.Assert(inputExpression.Type is not null); 204Debug.Assert(inputExpression.Type is not null); 205return inputExpression.Type; 211if (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; 294(fromExpression ? expressionOpt!.Type : declarationTypeOpt)!.ContainingModule != originalBinder.Compilation.SourceModule)
BoundTree\BoundConstantPattern.cs (1)
14NarrowedType.Equals(Value.Type, TypeCompareKind.AllIgnoreOptions));
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; 156if (expr.Type is { } type) 274TypeSymbol? 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\BoundRelationalPattern.cs (1)
14NarrowedType.Equals(Value.Type, TypeCompareKind.AllIgnoreOptions));
BoundTree\Constructors.cs (1)
644public 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)
394expression.Type?.SetUnknownNullabilityForReferenceTypes();
CodeGen\CodeGenerator_HasHome.cs (3)
54if (addressKind == AddressKind.ReadOnly && !expression.Type.IsValueType && peVerifyCompatEnabled) 68var type = expression.Type; 229if (receiver?.Type.IsValueType == true)
CodeGen\EmitAddress.cs (14)
41Debug.Assert(!expression.Type.IsReferenceType); 42Debug.Assert(!expression.Type.IsValueType || expression.Type.IsNullableType()); 65Debug.Assert(expression.Type.IsValueType || IsAnyReadOnly(addressKind), "'this' is readonly in classes"); 67if (expression.Type.IsValueType) 102Debug.Assert(operand.Type.IsPointerType()); 134var type = expression.Type; 331var value = this.AllocateTemp(expression.Type, expression.Syntax); 372if (!receiver.Type.IsReferenceType) 389TreatLongsAsNative(index.Type.PrimitiveTypeCode); 403if (((ArrayTypeSymbol)arrayAccess.Expression.Type).IsSZArray) 411_builder.EmitArrayElementAddress(_module.Translate((ArrayTypeSymbol)arrayAccess.Expression.Type), 504var receiverType = receiver.Type; 524EmitBox(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); 730Debug.Assert(refKind is RefKind.In || argument.Type.IsDynamic() || argument is BoundFieldAccess { FieldSymbol.RefKind: not RefKind.None }, "passing args byref should not clone them into temps"); 803EmitLoadIndirect(expression.Type, expression.Syntax); 812var meth = expression.MethodOpt ?? receiver.Type.DelegateInvokeMethod(); 1025if (((ArrayTypeSymbol)arrayAccess.Expression.Type).IsSZArray) 1112_builder.EmitArrayElementLoad(_module.Translate((ArrayTypeSymbol)arrayAccess.Expression.Type), arrayAccess.Expression.Syntax); 1143if (!field.IsVolatile && !field.IsStatic && fieldAccess.ReceiverOpt.Type.IsVerifierValue() && field.RefKind == RefKind.None) 1182if (fieldType.IsValueType && (object)fieldType == (object)receiver.Type) 1238if (receiver == null || !receiver.Type.IsValueType) 1249EmitSymbolToken(receiver.Type, receiver.Syntax); 1278if (!receiver.Type.IsVerifierValue()) 1330var type = expr.Type; 1521if (receiver.Type.IsTypeParameter()) 1526Debug.Assert(receiver.Type.IsVerifierReference(), "this is not a reference"); 1656Debug.Assert(TypeSymbol.Equals(method.ContainingType, receiver.Type, TypeCompareKind.ConsiderEverything2)); 1691EmitSymbolToken(receiver.Type, receiver.Syntax); 1858var receiverType = receiver.Type; 1944var receiverType = receiver.Type; 2004Debug.Assert(receiver.Type.IsVerifierReference()); 2015Debug.Assert(receiver.Type.IsVerifierReference()); 2035EmitSymbolToken(receiver.Type, receiver.Syntax); 2050var receiverType = receiver.Type; 2113var receiverType = receiver.Type; 2630var rightType = right.Type; 2686if (left.Kind == BoundKind.ArrayAccess && left.Type.TypeKind == TypeKind.TypeParameter && !left.Type.IsValueType) 2710EmitSymbolToken(target.Type, target.Syntax); 3089assignmentOperator.Left.Type, 3136var arrayType = (ArrayTypeSymbol)array.Type; 3150EmitIndirectStore(expression.Type, expression.Syntax); 3155EmitIndirectStore(expression.Type, expression.Syntax); 3161EmitIndirectStore(expression.Type, expression.Syntax); 3173EmitIndirectStore(expression.Type, expression.Syntax); 3178EmitIndirectStore(expression.Type, expression.Syntax); 3424Debug.Assert((object)operand.Type != null); 3425if (!operand.Type.IsVerifierReference()) 3428EmitBox(operand.Type, operand.Syntax); 3451var operandType = operand.Type; 3945if (!(expr.Type.IsInterfaceType() || expr.Type.IsDelegateType())) 3947return expr.Type; 3992return expr.Type; 4063temp = 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; 925_module.Translate(expressionOpt.Type, boundReturnStatement.Syntax, _diagnostics.DiagnosticBag); 1150if (!exceptionSourceOpt.Type.IsVerifierReference()) 1152Debug.Assert(exceptionSourceOpt.Type.IsTypeParameter()); // only expecting type parameters 1154EmitSymbolToken(exceptionSourceOpt.Type, exceptionSourceOpt.Syntax); 1181Debug.Assert(!left.ReceiverOpt.Type.IsTypeParameter()); 1192var temp = AllocateTemp(exceptionSource.Type, exceptionSource.Syntax); 1259Debug.Assert((object)dispatch.Expression.Type != null); 1260Debug.Assert(dispatch.Expression.Type.IsValidV6SwitchGoverningType() || dispatch.Expression.Type.IsSpanOrReadOnlySpanChar()); 1263Debug.Assert(!dispatch.Expression.Type.IsNullableType()); 1282Debug.Assert((object)expression.Type != null && 1283(expression.Type.IsValidV6SwitchGoverningType() || expression.Type.IsSpanOrReadOnlySpanChar())); 1328temp = AllocateTemp(expression.Type, expression.Syntax); 1335expression.Type.SpecialType == SpecialType.System_String || expression.Type.IsSpanOrReadOnlySpanChar()); 1338if (expression.Type.SpecialType == SpecialType.System_String || expression.Type.IsSpanOrReadOnlySpanChar()) 1342this.EmitStringSwitchJumpTable(switchCaseLabels, fallThroughLabel, key, expression.Syntax, expression.Type); 1346this.EmitLengthBasedStringSwitchJumpTable(lengthBasedSwitchStringJumpTableOpt, fallThroughLabel, key, expression.Syntax, expression.Type); 1351_builder.EmitIntegerSwitchJumpTable(switchCaseLabels, fallThroughLabel, key, expression.Type.EnumUnderlyingTypeOrSelf().PrimitiveTypeCode, expression.Syntax);
CodeGen\Optimizer.cs (12)
609node.Type); 950right.Type.IsVerifierValue() && 973node.Left.Type.Equals(node.Right.Type, TypeCompareKind.AllIgnoreOptions) || 1029left.Type.Equals(((PointerTypeSymbol)right.Type).PointedAtType, TypeCompareKind.AllIgnoreOptions); 1046Debug.Assert(lhs.Type.IsValueType, "'this' is assignable only in structs"); 1204var receiverType = receiver.Type; 1239var receiverType = receiver.Type; 1357if (receiver.Type.IsTypeParameter()) 1366if (receiver.Type.IsValueType && ( 1669PushEvalStack(new BoundDefaultExpression(node.Syntax, node.Operand.Type), ExprContext.Value);
Compilation\CSharpCompilation.cs (2)
2277Debug.Assert(result is { Type: not null } || runtimeAwaitCall is { Type: not null }); 2278var returnType = result?.Type ?? runtimeAwaitCall!.Type;
Compilation\CSharpSemanticModel.cs (18)
2052type = boundExpr.Type; 2171convertedType = highestBoundExpr.Type; 2177convertedType = highestBoundExpr.Type; 2266static (TypeSymbol, NullabilityInfo) getTypeAndNullability(BoundExpression expr) => (expr.Type, expr.TopLevelNullability); 3378else if (expr.Type.IsDelegateType()) 3687var thisParam = GetThisParameter(boundNode.Type, containingType, containingMember, out resultKind); 3816symbols = OneOrMany.Create<Symbol>(new SynthesizedIntrinsicOperatorSymbol(unaryOperator.Operand.Type.StrippedType(), 3839TypeSymbol opType = increment.Operand.Type.StrippedType(); 3866((binaryOperator.Left.IsLiteralNull() && binaryOperator.Right.Type.IsNullableType()) || 3867(binaryOperator.Right.IsLiteralNull() && binaryOperator.Left.Type.IsNullableType())) && 3881binaryOperator.Left.Type, 3882binaryOperator.Right.Type, 4092TypeSymbol type = boundNode.Type; 4616if (node.SearchExtensions && receiver.Type is { } receiverType) 4758receiverType = call.ReceiverOpt.Type; 4762receiverType = call.Arguments[0].Type; 4792MethodSymbol reduced = method.ReduceExtensionMethod(receiver.Type, Compilation); 4807MethodSymbol reduced = method.ReduceExtensionMethod(receiverOpt.Type, Compilation);
Compilation\MemberSemanticModel.cs (1)
1183return (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)
1381Translate(optArgList.Arguments[i].Type, syntaxNodeOpt, diagnostics));
FlowAnalysis\AbstractFlowPass.cs (6)
643else if ((object)node.Type == null || node.Type.SpecialType != SpecialType.System_Boolean) 1676&& node.Type.SpecialType == SpecialType.System_Boolean) 2247(object)receiverOpt.Type != null && 2248!receiverOpt.Type.IsPrimitiveRecursiveStruct()); 2665&& conv.Operand.Type!.IsNonNullableValueType());
FlowAnalysis\AbstractFlowPass_Switch.cs (1)
101if (!node.Expression.Type.IsValidV6SwitchGoverningType())
FlowAnalysis\DefiniteAssignment.cs (7)
1077MayRequireTrackingReceiverType(receiver.Type); 1094MayRequireTrackingReceiverType(receiverOpt.Type) && 1095!receiverOpt.Type.IsPrimitiveRecursiveStruct(); 1333if (_emptyStructTypeCache.IsEmptyStructType(node.Type)) return true; 1546if (elementAccess.Expression.Type.HasInlineArrayAttribute(out int length) && 1550int slot = MakeMemberSlot(elementAccess.Expression, elementAccess.Expression.Type.TryGetInlineArrayElementField()); 2539if (refKind != RefKind.None && ((object)method == null || method.IsExtern) && arg.Type is TypeSymbol type)
FlowAnalysis\NullableWalker.cs (62)
436expr.Type?.Equals(result.RValueType.Type, TypeCompareKind.AllIgnoreOptions) == true ? result.RValueType.Type : expr.Type); 572Debug.Assert(AreCloseEnough(placeholder.Type, result.RValueType.Type)); 2116receiver.Type is object; 2127TypeSymbol? nodeType = node.Type; 2163var operandType = operand.Type; 2181TypeSymbol.Equals(conv.Type, conv.Operand.Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes): 3726Debug.Assert(AreCloseEnough(resultType.Type, node.Type)); 4626SetAnalyzedNullability(node.ImplicitReceiverOpt, new VisitResult(node.ImplicitReceiverOpt.Type, NullableAnnotation.NotAnnotated, NullableFlowState.NotNull)); 4684SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 4689var resultType = TypeWithState.Create(node.Type, NullableFlowState.NotNull); 4736Debug.Assert(node.Type is object); 4737if (IsEmptyStructType(node.Type)) 4742return GetOrCreatePlaceholderSlot(node, TypeWithAnnotations.Create(node.Type, NullableAnnotation.NotAnnotated)); 5060Debug.Assert(!node.Expression.Type!.IsValueType); 5074TypeSymbol.Equals(node.Indices[0].Type, compilation.GetWellKnownType(WellKnownType.System_Range), TypeCompareKind.ConsiderEverything2)) 5393if (expr.Type is null) 5403TypeWithAnnotations.Create(expr.Type), 5417Debug.Assert(binary.Type!.SpecialType == SpecialType.System_Boolean); 5680var receiverType = conditional.Receiver.Type!; 5709if (slot > 0 && PossiblyNullableType(operand.Type)) 5779LearnFromNullTest(slot, expressionWithoutConversion.Type, ref state, markDependentSlotsNotNull: false); 5893node.Type?.ContainsErrorType() == true || 5894TypeSymbol.Equals(targetType.Type.GetNullableUnderlyingType(), node.Type, TypeCompareKind.AllIgnoreOptions)); 5900targetType = TypeWithAnnotations.Create(node.Type, NullableAnnotation.NotAnnotated); 6190if (slot > 0 && receiver.Type?.IsNullableType() == true) 6191slot = GetNullableOfTValueSlot(receiver.Type, slot, out _); 6235TypeSymbol? refResultType = node.Type?.SetUnknownNullabilityForReferenceTypes(); 6301resultType ??= node.Type?.SetUnknownNullabilityForReferenceTypes(); 7498TrackAnalyzedNullabilityThroughConversionGroup(TypeWithState.Create(argument.Type, result.RValueType.State), argument as BoundConversion, argumentNoConversion); 7616completion(TypeWithAnnotations.Create(argument.Type)); 8760if (value.Type is null || value.Type.IsDynamic() || value.ConstantValueOpt != null) 8770value.Type.HasInlineArrayAttribute(out _) == true && 8771value.Type.TryGetInlineArrayElementField() is not null) 8911if (TypeAllowsConditionalState(targetType.Type) && TypeAllowsConditionalState(operand.Type)) 9059var tupleOpt = (NamedTypeSymbol?)node.Type; 10259case BoundExpression arg when arg.Type is { TypeKind: TypeKind.Delegate }: 10373Debug.Assert(arg.Type is not null); 10374TypeSymbol argType = arg.Type; 10392Debug.Assert(arg.Type is not null); 10393TypeSymbol argType = arg.Type; 10573var rvalueResult = TypeWithState.Create(node.Type, NullableFlowState.NotNull); 10574var lvalueResult = TypeWithAnnotations.Create(node.Type, NullableAnnotation.NotAnnotated); 11072if (expr.Type is NamedTypeSymbol { IsTupleType: true } tupleType) 11403SetResultType(node.Expression, TypeWithState.Create(node.Expression.Type, ResultType.State)); 11770if (collectionExpression.Type!.SpecialType == SpecialType.System_Collections_IEnumerable) 11773targetTypeWithAnnotations = TypeWithAnnotations.Create(collectionExpression.Type); 11775else if (ForEachLoopBinder.IsIEnumerableT(collectionExpression.Type.OriginalDefinition, isAsync, compilation)) 12032var type = TypeWithAnnotations.Create(node.Type); 12549SetResultType(node, TypeWithState.Create(node.Type, node.Type?.CanContainNull() != false && node.ConstantValueOpt?.IsNull == true ? NullableFlowState.MaybeDefault : NullableFlowState.NotNull)); 12726SetResultType(expression, TypeWithState.Create(expression.Type, default)); 12760Debug.Assert(receiverOpt.Type is null || AreCloseEnough(receiverOpt.Type, resultTypeSymbol)); 12848SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 12881Debug.Assert(node.Type is null || node.Type.IsErrorType() || node.Type.IsRefLikeType); 12897SetResultType(node, TypeWithState.Create(node.Type, NullableFlowState.NotNull)); 12901Debug.Assert(node.Type is not null); 12902var type = VisitArrayInitialization(node.Type, initialization, node.HasErrors);
FlowAnalysis\NullableWalker_Patterns.cs (4)
29LearnFromAnyNullPatterns(slot, expression.Type, pattern); 279var originalInputType = node.Expression.Type; 885var originalInputType = node.Expression.Type; 955?? node.Type?.SetUnknownNullabilityForReferenceTypes();
FlowAnalysis\ReadWriteWalker.cs (1)
221if (receiver.Type.IsStructType() && receiverSyntax.Span.OverlapsWith(RegionSpan))
Generated\BoundNodes.xml.Generated.cs (187)
469if (!TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 499if (receiver != this.Receiver || localScopeDepth != this.LocalScopeDepth || !TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 531public new TypeSymbol Type => base.Type!; 568public new TypeSymbol Type => base.Type!; 597public new TypeSymbol? Type => base.Type; 632public new TypeSymbol Type => base.Type!; 669public new TypeSymbol Type => base.Type!; 705public new TypeSymbol Type => base.Type!; 742public new TypeSymbol Type => base.Type!; 778public new TypeSymbol Type => base.Type!; 813public new TypeSymbol Type => base.Type!; 848public new TypeSymbol Type => base.Type!; 883public new TypeSymbol Type => base.Type!; 921if (refKind != this.RefKind || !TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 949if (expression != this.Expression || !TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 982if (resultKind != this.ResultKind || symbols != this.Symbols || childBoundNodes != this.ChildBoundNodes || !TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 1065public new TypeSymbol Type => base.Type!; 1103public new TypeSymbol Type => base.Type!; 1143public new TypeSymbol? Type => base.Type; 1180public new TypeSymbol Type => base.Type!; 1225public new TypeSymbol Type => base.Type!; 1265public new TypeSymbol Type => base.Type!; 1296public new TypeSymbol? Type => base.Type; 1339public new TypeSymbol Type => base.Type!; 1369public new TypeSymbol Type => base.Type!; 1404public new TypeSymbol Type => base.Type!; 1441public new TypeSymbol Type => base.Type!; 1475public new TypeSymbol Type => base.Type!; 1506public new TypeSymbol Type => base.Type!; 1537public new TypeSymbol Type => base.Type!; 1569public new TypeSymbol Type => base.Type!; 1601public new TypeSymbol Type => base.Type!; 1635public new TypeSymbol Type => base.Type!; 1695public new TypeSymbol Type => base.Type!; 1790public new TypeSymbol Type => base.Type!; 1830public new TypeSymbol Type => base.Type!; 1865public new TypeSymbol Type => base.Type!; 1903public new TypeSymbol Type => base.Type!; 1947if (leftOperand != this.LeftOperand || rightOperand != this.RightOperand || !TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 1974public new TypeSymbol? Type => base.Type; 2016public new TypeSymbol Type => base.Type!; 2054public new TypeSymbol Type => base.Type!; 2084public new TypeSymbol? Type => base.Type; 2114public new TypeSymbol Type => base.Type!; 2188public new TypeSymbol Type => base.Type!; 2228public new TypeSymbol Type => base.Type!; 2319public new TypeSymbol Type => base.Type!; 2361public new TypeSymbol Type => base.Type!; 2404public new TypeSymbol Type => base.Type!; 2441public new TypeSymbol Type => base.Type!; 2476public new TypeSymbol Type => base.Type!; 2514public new TypeSymbol Type => base.Type!; 2549public new TypeSymbol Type => base.Type!; 2584public new TypeSymbol Type => base.Type!; 2619public new TypeSymbol Type => base.Type!; 2654public new TypeSymbol Type => base.Type!; 2693public new TypeSymbol Type => base.Type!; 2735public new TypeSymbol Type => base.Type!; 2778public new TypeSymbol Type => base.Type!; 2809public new TypeSymbol? Type => base.Type; 2832public new TypeSymbol Type => base.Type!; 2866public new TypeSymbol Type => base.Type!; 2902public new TypeSymbol Type => base.Type!; 2936public new TypeSymbol Type => base.Type!; 2973public new TypeSymbol Type => base.Type!; 3011public new TypeSymbol Type => base.Type!; 3048public new TypeSymbol Type => base.Type!; 3077public new TypeSymbol? Type => base.Type; 3113public new TypeSymbol Type => base.Type!; 4325if (constantValueOpt != this.ConstantValueOpt || !TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 4357public new TypeSymbol Type => base.Type!; 4393public new TypeSymbol Type => base.Type!; 4428public new TypeSymbol Type => base.Type!; 4463public new TypeSymbol Type => base.Type!; 4492public new TypeSymbol? Type => base.Type; 4537public new TypeSymbol Type => base.Type!; 4584public new TypeSymbol Type => base.Type!; 4617public new TypeSymbol Type => base.Type!; 4658public new TypeSymbol Type => base.Type!; 4803if (!Symbols.SymbolEqualityComparer.ConsiderEverything.Equals(label, this.Label) || !TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 4964if (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)) 4989public new TypeSymbol Type => base.Type!; 5736public new TypeSymbol? Type => base.Type; 5759if (expression != this.Expression || !TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 5785public new TypeSymbol Type => base.Type!; 5821public new TypeSymbol Type => base.Type!; 5858public new TypeSymbol Type => base.Type!; 5913public new TypeSymbol Type => base.Type!; 5947public new TypeSymbol Type => base.Type!; 5984public new TypeSymbol Type => base.Type!; 6027public new TypeSymbol Type => base.Type!; 6059public new TypeSymbol Type => base.Type!; 6176public new TypeSymbol Type => base.Type!; 6223public new TypeSymbol Type => base.Type!; 6265public new TypeSymbol Type => base.Type!; 6306public new TypeSymbol? Type => base.Type; 6346public new TypeSymbol Type => base.Type!; 6424public new TypeSymbol? Type => base.Type; 6461public new TypeSymbol Type => base.Type!; 6504if (!TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 6582public new TypeSymbol? Type => base.Type; 6619if (sourceTuple != this.SourceTuple || wasTargetTyped != this.WasTargetTyped || arguments != this.Arguments || argumentNamesOpt != this.ArgumentNamesOpt || inferredNamesOpt != this.InferredNamesOpt || !TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 6718public new TypeSymbol Type => base.Type!; 6773public new TypeSymbol Type => base.Type!; 6826public new TypeSymbol Type => base.Type!; 6893public new TypeSymbol Type => base.Type!; 6932public new TypeSymbol Type => base.Type!; 6968public new TypeSymbol Type => base.Type!; 7001public new TypeSymbol Type => base.Type!; 7043public new TypeSymbol Type => base.Type!; 7106public new TypeSymbol Type => base.Type!; 7140public new TypeSymbol Type => base.Type!; 7171public new TypeSymbol? Type => base.Type; 7226if (!TypeSymbol.Equals(elementType, this.ElementType, TypeCompareKind.ConsiderEverything) || count != this.Count || initializerOpt != this.InitializerOpt || !TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 7248public new TypeSymbol Type => base.Type!; 7282public new TypeSymbol Type => base.Type!; 7327public new TypeSymbol Type => base.Type!; 7361public new TypeSymbol Type => base.Type!; 7398public new TypeSymbol Type => base.Type!; 7442public new TypeSymbol Type => base.Type!; 7496public new TypeSymbol Type => base.Type!; 7539public new TypeSymbol Type => base.Type!; 7578public new TypeSymbol Type => base.Type!; 7620public new TypeSymbol? Type => base.Type; 7664public new TypeSymbol? Type => base.Type; 7702public new TypeSymbol Type => base.Type!; 7765public new TypeSymbol Type => base.Type!; 7816if (parts != this.Parts || constantValueOpt != this.ConstantValueOpt || !TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 7844if (!interpolationData.Equals(this.InterpolationData) || parts != this.Parts || constantValueOpt != this.ConstantValueOpt || !TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 7872if (!TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 7902public new TypeSymbol Type => base.Type!; 7934public new TypeSymbol? Type => base.Type; 7987if (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)) 8587public new TypeSymbol? Type => base.Type; 8624if (expression != this.Expression || !TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) 8646public new TypeSymbol? Type => base.Type; 8719public new TypeSymbol? Type => base.Type; 8817public new TypeSymbol? Type => base.Type; 8850public new TypeSymbol Type => base.Type!; 10874TypeSymbol? type = this.VisitType(node.Type); 10880TypeSymbol? type = this.VisitType(node.Type); 10941TypeSymbol? type = this.VisitType(node.Type); 10947TypeSymbol? type = this.VisitType(node.Type); 10954TypeSymbol? type = this.VisitType(node.Type); 11149TypeSymbol? type = this.VisitType(node.Type); 11567TypeSymbol? type = this.VisitType(node.Type); 11641TypeSymbol? type = this.VisitType(node.Type); 11670TypeSymbol? type = this.VisitType(node.Type); 11818TypeSymbol? type = this.VisitType(node.Type); 11955TypeSymbol? type = this.VisitType(node.Type); 11978TypeSymbol? type = this.VisitType(node.Type); 12089TypeSymbol? type = this.VisitType(node.Type); 12200TypeSymbol? type = this.VisitType(node.Type); 12206TypeSymbol? type = this.VisitType(node.Type); 12211TypeSymbol? type = this.VisitType(node.Type); 12234TypeSymbol? type = this.VisitType(node.Type); 12359TypeSymbol? type = this.VisitType(node.Type); 12473updatedNode = node.Update(receiver, node.LocalScopeDepth, node.Type); 12639updatedNode = node.Update(expression, node.Type); 12657updatedNode = node.Update(node.ResultKind, node.Symbols, childBoundNodes, node.Type); 13029updatedNode = node.Update(leftOperand, rightOperand, node.Type); 13830updatedNode = node.Update(expression, switchArms, reachabilityDecisionDag, node.DefaultLabel, node.ReportedNotExhaustive, node.Type); 13925updatedNode = node.Update(expression, node.Type); 14287updatedNode = node.Update(sourceTuple, node.WasTargetTyped, arguments, node.ArgumentNamesOpt, node.InferredNamesOpt, node.Type); 14570updatedNode = node.Update(elementType, count, initializerOpt, node.Type); 14808updatedNode = node.Update(parts, node.ConstantValueOpt, node.Type); 14825updatedNode = node.Update(node.InterpolationData, parts, node.ConstantValueOpt, node.Type); 14887updatedNode = node.Update(expression, pattern, node.IsNegated, reachabilityDecisionDag, node.WhenTrueLabel, node.WhenFalseLabel, node.Type); 15027updatedNode = node.Update(expression, node.Type); 15169new TreeDumperNode("type", node.Type, null), 15178new TreeDumperNode("type", node.Type, null), 15267new TreeDumperNode("type", node.Type, null), 15275new TreeDumperNode("type", node.Type, null), 15285new TreeDumperNode("type", node.Type, null), 15557new TreeDumperNode("type", node.Type, null), 16120new TreeDumperNode("type", node.Type, null), 16222new TreeDumperNode("type", node.Type, null), 16258new TreeDumperNode("type", node.Type, null), 16444new TreeDumperNode("type", node.Type, null), 16661new TreeDumperNode("type", node.Type, null), 16695new TreeDumperNode("type", node.Type, null), 16861new TreeDumperNode("type", node.Type, null), 17028new TreeDumperNode("type", node.Type, null), 17038new TreeDumperNode("type", node.Type, null), 17045new TreeDumperNode("type", node.Type, null), 17077new TreeDumperNode("type", node.Type, null), 17231new TreeDumperNode("type", node.Type, null),
Lowering\AsyncRewriter\AsyncExceptionHandlerRewriter.cs (2)
734rewrittenSource.Type, 1082this.returnValue = returnValue = new SynthesizedLocal(containingMethod, TypeWithAnnotations.Create(valueOpt.Type), SynthesizedLocalKind.AsyncMethodReturnValue, _syntaxOpt);
Lowering\AsyncRewriter\AsyncMethodToStateMachineRewriter.cs (1)
379var awaiterTemp = F.SynthesizedLocal(getAwaiter.Type, syntax: node.Syntax, kind: SynthesizedLocalKind.Awaiter);
Lowering\AsyncRewriter\AsyncRewriter.AsyncIteratorRewriter.cs (1)
237F.Call(parameterProxy, WellKnownMember.System_Threading_CancellationToken__Equals, F.Default(parameterProxy.Type)),
Lowering\AsyncRewriter\RuntimeAsyncRewriter.cs (1)
110var nodeType = node.Expression.Type;
Lowering\ClosureConversion\ClosureConversion.cs (4)
585Debug.Assert(TypeSymbol.Equals(result.Type, frameType, TypeCompareKind.ConsiderEverything2)); 700BoundExpression assignment = new BoundAssignmentOperator(syntax, left, right, left.Type); 793var assignToProxy = new BoundAssignmentOperator(syntax, left, value, value.Type); 1254rewrittenExceptionSource.Type);
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (28)
118if (!node.Type.Equals(result.Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)) 299if (!TypeSymbol.Equals(index.Type, _int32Type, TypeCompareKind.ConsiderEverything2)) 301index = ConvertIndex(index, arg.Type, _int32Type); 317if (!TypeSymbol.Equals(index.Type, _int32Type, TypeCompareKind.ConsiderEverything2)) 319index = ConvertIndex(index, arg.Type, _int32Type); 368if (node.Operand.IsLiteralNull() && (object)node.Operand.Type == null) 494if ((object)left.Type == null && left.IsLiteralNull()) 496left = _bound.Default(right.Type); 498if ((object)right.Type == null && right.IsLiteralNull()) 500right = _bound.Default(left.Type); 511var promotedType = PromotedType(enumOperand.Type.StrippedType().GetEnumUnderlyingType()); 564return Convert(loweredOperand, operand.Type, promotedType, isChecked, false); 701var operandType = node.Operand.Type; 710? Convert(Visit(node.Operand), node.Operand.Type, method.Parameters[0].Type, node.Checked, false) 726if (node.Operand.Type.IsNullableType()) 728return Convert(Visit(node.Operand), node.Operand.Type, node.Type, node.Checked, node.ExplicitCastInCode); 735var e1 = Convert(Visit(node.Operand), node.Operand.Type, intermediate, node.Checked, false); 741return Convert(Visit(node.Operand), node.Operand.Type, node.Type, node.Checked, node.ExplicitCastInCode); 761receiver = requiresInstanceReceiver ? nullObject : receiver.Type.IsReferenceType ? receiver : _bound.Convert(_objectType, receiver); 799var d = node.Argument.Type as NamedTypeSymbol; 820if ((object)operand.Type == null && operand.ConstantValueOpt != null && operand.ConstantValueOpt.IsNull) 881TypeSymbol lambdaParamType = node.LeftPlaceholder.Type; 882return _bound.StaticCall(WellKnownMember.System_Linq_Expressions_Expression__Coalesce_Lambda, left, right, MakeConversionLambda(leftConversion, lambdaParamType, node.LeftConversion.Type)); 1118if (node.ReceiverOpt?.Type.IsTypeParameter() == true && 1119!node.ReceiverOpt.Type.IsReferenceType) 1189var promotedType = PromotedType(arg.Type.StrippedType().GetEnumUnderlyingType()); 1191loweredArg = Convert(loweredArg, arg.Type, promotedType, isChecked, false); 1208_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()) 402expr.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\ExtensionMethodReferenceRewriter.cs (1)
123Debug.Assert(receiverOpt.Type!.Equals(method.Parameters[0].Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
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)
573Debug.Assert(invocation.Type is not null); 583if (invocation.Type.SpecialType != SpecialType.System_Void)
Lowering\Instrumentation\ModuleCancellationInstrumenter.cs (1)
130if (arguments is [.., { Type: { } lastArgumentType } lastArgument] &&
Lowering\IteratorRewriter\IteratorMethodToStateMachineRewriter.cs (1)
308_methodValue = F.SynthesizedLocal(result.Type);
Lowering\LocalRewriter\LocalRewriter.cs (20)
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; 1065Debug.Assert(eventAccess.ReceiverOpt.Type is { }); 1066return !eventAccess.ReceiverOpt.Type.IsValueType || CanBePassedByReference(eventAccess.ReceiverOpt); 1076Debug.Assert(fieldAccess.ReceiverOpt.Type is { }); 1077return !fieldAccess.ReceiverOpt.Type.IsValueType || CanBePassedByReference(fieldAccess.ReceiverOpt); 1153Debug.Assert(Conversions.IsValidExtensionMethodThisArgConversion(this._compilation.Conversions.ClassifyConversionFromType(receiver.Type, extensionParameter.Type, isChecked: false, ref discardedUseSiteInfo)));
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)
202TypeSymbol inputType = input.Type; 215Conversion conversion = _factory.Compilation.Conversions.ClassifyBuiltInConversion(inputType, output.Type, isChecked: false, ref useSiteInfo); 223inputType.GetNullableUnderlyingType().Equals(output.Type, TypeCompareKind.AllIgnoreOptions) && 344Debug.Assert(input.Type is { }); 348return MakeNullCheck(d.Syntax, input, input.Type.IsNullableType() ? BinaryOperatorKind.NullableNullNotEqual : BinaryOperatorKind.NotEqual); 355return MakeNullCheck(d.Syntax, input, input.Type.IsNullableType() ? BinaryOperatorKind.NullableNullEqual : BinaryOperatorKind.Equal); 358Debug.Assert(!input.Type.IsNullableType()); 362Debug.Assert(!input.Type.IsNullableType()); 363Debug.Assert(input.Type.IsValueType); 373Debug.Assert(!rewrittenExpr.Type.IsSpanOrReadOnlySpanChar()); 375if (rewrittenExpr.Type.IsPointerOrFunctionPointer()) 393if (value.IsString && input.Type.IsSpanOrReadOnlySpanChar()) 398TypeSymbol comparisonType = input.Type.EnumUnderlyingTypeOrSelf(); 407if (input.Type.SpecialType == SpecialType.System_Double && double.IsNaN(value.DoubleValue) || 408input.Type.SpecialType == SpecialType.System_Single && float.IsNaN(value.SingleValue)) 414BoundExpression literal = _localRewriter.MakeLiteral(syntax, value, input.Type); 415TypeSymbol comparisonType = input.Type.EnumUnderlyingTypeOrSelf(); 437var isReadOnlySpan = input.Type.IsReadOnlySpanChar(); 479Debug.Assert(output.Type is { }); 481testExpression = _factory.ObjectNotEqual(output, _factory.Null(output.Type)); 515Debug.Assert(loweredInput.Type is { }); 556if (loweredInput.Type.IsTupleType && 557!loweredInput.Type.OriginalDefinition.Equals(_factory.Compilation.GetWellKnownType(WellKnownType.System_ValueTuple_TRest)) && 631var 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)
395TypeSymbol? exprType = rewrittenRight.Type;
Lowering\LocalRewriter\LocalRewriter_BinaryOperator.cs (55)
340Debug.Assert(loweredLeft.Type is { }); 341Debug.Assert(loweredRight.Type is { }); 343return MakeUnaryOperator(UnaryOperatorKind.BoolLogicalNegation, syntax, method: null, constrainedToTypeOpt: null, loweredRight, loweredRight.Type); 346return MakeUnaryOperator(UnaryOperatorKind.BoolLogicalNegation, syntax, method: null, constrainedToTypeOpt: null, loweredLeft, loweredLeft.Type); 354Debug.Assert(loweredLeft.Type is { }); 355Debug.Assert(loweredRight.Type is { }); 357return MakeUnaryOperator(UnaryOperatorKind.BoolLogicalNegation, syntax, method: null, constrainedToTypeOpt: null, loweredRight, loweredRight.Type); 360return MakeUnaryOperator(UnaryOperatorKind.BoolLogicalNegation, syntax, method: null, constrainedToTypeOpt: null, loweredLeft, loweredLeft.Type); 368Debug.Assert(loweredLeft.Type is { }); 369Debug.Assert(loweredRight.Type is { }); 371return MakeUnaryOperator(UnaryOperatorKind.BoolLogicalNegation, syntax, method: null, constrainedToTypeOpt: null, loweredRight, loweredRight.Type); 374return MakeUnaryOperator(UnaryOperatorKind.BoolLogicalNegation, syntax, method: null, constrainedToTypeOpt: null, loweredLeft, loweredLeft.Type); 577Debug.Assert(loweredLeft.Type is { }); 578whenNullOpt = RewriteLiftedBinaryOperator(syntax, operatorKind, _factory.Default(loweredLeft.Type), loweredRight, type, method, constrainedToTypeOpt); 588type: result.Type! 771conversion = _compilation.Conversions.ClassifyConversionFromType(loweredLeft.Type, parameterType, isChecked: operatorKind.IsChecked(), ref useSiteInfo); 909Debug.Assert(expression.Type is { }); 913if (expression.Type.IsNullableType()) 919UnsafeGetNullableMethod(syntax, expression.Type, SpecialMember.System_Nullable_T_GetValueOrDefault)); 932Debug.Assert(expression.Type is { }); 936if (expression.Type.IsNullableType()) 946Debug.Assert(expression.Type is { }); 951UnsafeGetNullableMethod(syntax, expression.Type, SpecialMember.System_Nullable_T_get_HasValue)); 1634Debug.Assert(TypeSymbol.Equals(conditional.Type, conditional.Consequence.Type, TypeCompareKind.ConsiderEverything2)); 1635Debug.Assert(TypeSymbol.Equals(conditional.Type, conditional.Alternative.Type, TypeCompareKind.ConsiderEverything2)); 1708Debug.Assert(alwaysNull.Type is { }); 1709BoundExpression nullBool = new BoundDefaultExpression(syntax, alwaysNull.Type); 1721rewrittenType: alwaysNull.Type, 1748rewrittenType: alwaysNull.Type, 1750Debug.Assert(conditionalExpression.Type is { }); 1756type: conditionalExpression.Type); 1810rewrittenType: newNullBool.Type!, 1817type: conditionalExpression.Type!); 1897rewrittenType: alternative.Type!, 1905type: conditionalExpression.Type!); 2003return conditionalAccess.Update(conditionalAccess.Receiver, conditionalAccess.HasValueMethodOpt, whenNotNull, whenNull, conditionalAccess.Id, conditionalAccess.ForceCopyOfNullableValueType, whenNotNull.Type!); 2059Debug.Assert(loweredLeft.Type is { SpecialType: SpecialType.System_Decimal }); 2060Debug.Assert(loweredRight.Type is { SpecialType: SpecialType.System_Decimal }); 2093TypeSymbol? exprType = rewrittenExpr.Type; 2156Debug.Assert(loweredRight.Type is { }); 2157TypeSymbol rightType = loweredRight.Type; 2223Debug.Assert(loweredLeft.Type is { }); 2224TypeSymbol leftType = loweredLeft.Type; 2228Debug.Assert(loweredRight.Type is { }); 2229TypeSymbol rightType = loweredRight.Type; 2279Debug.Assert(loweredLeft.Type is { TypeKind: TypeKind.Pointer }); 2280loweredRight = MakeSizeOfMultiplication(loweredRight, (PointerTypeSymbol)loweredLeft.Type, kind.IsChecked()); 2284Debug.Assert(loweredRight.Type is { TypeKind: TypeKind.Pointer }); 2285loweredLeft = MakeSizeOfMultiplication(loweredLeft, (PointerTypeSymbol)loweredRight.Type, kind.IsChecked()); 2324Debug.Assert(sizeOfExpression.Type is { SpecialType: SpecialType.System_Int32 }); 2334Debug.Assert(numericOperand.Type is { }); 2335var numericSpecialType = numericOperand.Type.SpecialType; 2471Debug.Assert(loweredLeft.Type is { TypeKind: TypeKind.Pointer }); 2472Debug.Assert(loweredRight.Type is { TypeKind: TypeKind.Pointer }); 2475PointerTypeSymbol pointerType = (PointerTypeSymbol)loweredLeft.Type;
Lowering\LocalRewriter\LocalRewriter_Call.cs (19)
103if (module != null && receiver != null && receiver.Type is { }) 105var assembly = receiver.Type.ContainingAssembly; 122if (module != null && receiver is { Type: { } }) 124var assembly = receiver.Type.ContainingAssembly; 216var symbolForCompare = needToReduce ? ReducedExtensionMethodSymbol.Create(interceptor, receiverOpt!.Type, _compilation, out _) : interceptor; 290Debug.Assert(receiverOpt?.Type is not null); 296Debug.Assert(receiverOpt.Type.Equals(interceptor.Parameters[0].Type, TypeCompareKind.AllIgnoreOptions) 297|| (!receiverOpt.Type.IsReferenceType && interceptor.Parameters[0].Type.IsReferenceType)); 525Debug.Assert(rewrittenBoundCall.Type is not null); 534type: rewrittenBoundCall.Type); 686Debug.Assert(rewrittenReceiver.Type is { }); 706refKind = rewrittenReceiver.Type.IsValueType || rewrittenReceiver.Type.Kind == SymbolKind.TypeParameter ? RefKind.Ref : RefKind.None; 710if (rewrittenReceiver.Type.IsReferenceType) 951Debug.Assert(rewrittenReceiver.Type is { }); 957if (rewrittenReceiver.Type.IsReferenceType || 1195optimized = CreateArrayEmptyCallIfAvailable(possibleParamsArray.Syntax, ((ArrayTypeSymbol)possibleParamsArray.Type!).ElementType); 1637Debug.Assert(value.Type is { }); 1666value.Type);
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (25)
160Debug.Assert(singleSpread.Expression.Type is not null); 162if (!ShouldUseIEnumerableBulkAddMethod(singleSpread.Expression.Type, toListOfElementType.Parameters[0].Type, singleSpread.EnumeratorInfoOpt?.GetEnumeratorInfo.Method)) 208Elements: [BoundCollectionExpressionSpreadElement { Expression: { Type: NamedTypeSymbol spreadType } expr }], 377Debug.Assert(list.Type is { }); 378Debug.Assert(list.Type.OriginalDefinition.Equals(_compilation.GetWellKnownType(WellKnownType.System_Collections_Generic_List_T), TypeCompareKind.AllIgnoreOptions)); 380var listToArray = ((MethodSymbol)_factory.WellKnownMember(WellKnownMember.System_Collections_Generic_List_T__ToArray)).AsMember((NamedTypeSymbol)list.Type); 734var spreadTypeOriginalDefinition = spreadExpression.Type!.OriginalDefinition; 740return _factory.Call(rewrittenSpreadExpression, listToArrayMethod.AsMember((NamedTypeSymbol)spreadExpression.Type!)); 750&& ShouldUseIEnumerableBulkAddMethod(spreadExpression.Type!, linqToArrayMethod.Parameters[0].Type, spreadElement.EnumeratorInfoOpt?.GetEnumeratorInfo.Method)) 757&& TryGetSpanConversion(spreadExpression.Type, writableOnly: false, out var asSpanMethod)) 759var spanType = CallAsSpanMethod(spreadExpression, asSpanMethod).Type!.OriginalDefinition; 764return _factory.Call(rewrittenSpreadExpression, toArrayMethod.AsMember((NamedTypeSymbol)rewrittenSpreadExpression.Type!)); 867Debug.Assert(arrayTemp.Type is ArrayTypeSymbol); 870var elementType = ((ArrayTypeSymbol)arrayTemp.Type).ElementType; 998var type = expression.Type; 1065if (spreadOperandAsSpan.Type!.OriginalDefinition.Equals(this._compilation.GetWellKnownType(wellKnownSpanType)) 1104var spreadLength = _factory.Call(spreadOperandAsSpan, getLengthMethod.AsMember((NamedTypeSymbol)spreadOperandAsSpan.Type!)); 1105var targetSlice = _factory.Call(spanTemp, spanSliceMethod.AsMember((NamedTypeSymbol)spanTemp.Type!), indexTemp, spreadLength); 1106sideEffects.Add(_factory.Call(spreadOperandAsSpan, copyToMethod.AsMember((NamedTypeSymbol)spreadOperandAsSpan.Type!), targetSlice)); 1228Debug.Assert(spanTemp.Type is NamedTypeSymbol); 1231var elementType = ((NamedTypeSymbol)spanTemp.Type).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Type; 1298Debug.Assert(rewrittenSpreadOperand.Type is not null); 1303if (!ShouldUseIEnumerableBulkAddMethod(rewrittenSpreadOperand.Type, addRangeMethod.Parameters[0].Type, spreadElement.EnumeratorInfoOpt?.GetEnumeratorInfo.Method)) 1438_factory.Binary(BinaryOperatorKind.Addition, sum.Type!, sum, value); 1473if (convertedExpression.Operand.Type is ArrayTypeSymbol arrayType)
Lowering\LocalRewriter\LocalRewriter_CompoundAssignmentOperator.cs (32)
24Debug.Assert(TypeSymbol.Equals(node.Right.Type, node.Operator.RightType, TypeCompareKind.ConsiderEverything2)); 39Debug.Assert(node.LeftConversion is null || (node.Left.Type!.IsReferenceType && node.Operator.Method.IsExtensionBlockMember())); 53TypeSymbol? leftType = node.Left.Type; // type of the target 153Debug.Assert(rewrittenAssignment.Type is { }); 156var condition = _factory.Conditional(isEvent, invokeEventAccessor.ToExpression(), rewrittenAssignment, rewrittenAssignment.Type); 158rewrittenAssignment = new BoundSequence(node.Syntax, eventTemps.ToImmutableAndFree(), sequence.ToImmutableAndFree(), condition, condition.Type!); 165Debug.Assert(rewrittenAssignment.Type is { }); 173rewrittenAssignment.Type); 216Debug.Assert(node.Left.Type is { }); 228Debug.Assert(TypeSymbol.Equals(transformedLHS.Type, node.Left.Type, TypeCompareKind.AllIgnoreOptions)); 235Debug.Assert(assignment.Type is { }); 236return new BoundSequence(syntax, [binaryResult.LocalSymbol], [assignmentToTemp], assignment, assignment.Type); 292Debug.Assert(rewrittenReceiver.Type is { }); 312var variableRepresentsLocation = rewrittenReceiver.Type.IsValueType || rewrittenReceiver.Type.Kind == SymbolKind.TypeParameter; 315isKnownToReferToTempIfReferenceType = !variableRepresentsLocation || rewrittenReceiver.Type.IsValueType || 544indexerAccess.Argument.Type, 551throw ExceptionUtilities.UnexpectedValue(indexerAccess.Argument.Type); 572if (isDynamicAssignment || !IsInvariantArray(arrayAccess.Expression.Type)) 600Debug.Assert(receiver is { Type: { } }); 605else if (!receiver.Type.IsReferenceType) 610Debug.Assert(receiver.Type.IsReferenceType); 614Debug.Assert(rewrittenReceiver.Type is { }); 615if (rewrittenReceiver.Type.IsTypeParameter()) 753Debug.Assert(implicitIndexerAccess.Argument.Type!.Equals(_compilation.GetWellKnownType(WellKnownType.System_Index)) 754|| implicitIndexerAccess.Argument.Type!.Equals(_compilation.GetWellKnownType(WellKnownType.System_Range))); 783if (isDynamicAssignment || !IsInvariantArray(arrayAccess.Expression.Type)) 964var type = expression.Type; 980var type = expression.Type; 1036Debug.Assert(expression.Type is { }); 1037if (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)); 224Debug.Assert(rewrittenNode.Type is { }); 225var type = rewrittenNode.Type; 271Debug.Assert(result.Type is { } rt && rt.Equals(rewrittenType, TypeCompareKind.AllIgnoreOptions)); 289type: result.Type); 312@checked = @checked && NeedsCheckedConversionInExpressionTree(rewrittenOperand.Type, rewrittenType, explicitCastInCode); 318Debug.Assert(rewrittenOperand.Type is { }); 331if (_inExpressionLambda || !rewrittenOperand.Type.Equals(rewrittenType, TypeCompareKind.ConsiderEverything)) 426Debug.Assert(rewrittenOperand.Type is { }); 432if (rewrittenType.SpecialType == SpecialType.System_Decimal || rewrittenOperand.Type.SpecialType == SpecialType.System_Decimal) 434return RewriteDecimalConversion(syntax, rewrittenOperand, rewrittenOperand.Type, rewrittenType, @checked, conversion.Kind.IsImplicitConversion(), constantValueOpt); 441Debug.Assert(rewrittenOperand.Type is { }); 444Debug.Assert(rewrittenOperand.Type.Equals(rewrittenType, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 487Debug.Assert(rewrittenOperand.Type is { }); 497Debug.Assert(rewrittenOperand.Type.IsEnumType()); 498var underlyingTypeFrom = rewrittenOperand.Type.GetEnumUnderlyingType()!; 502else if (rewrittenOperand.Type.SpecialType == SpecialType.System_Decimal) 510var rewrittenNode = RewriteDecimalConversion(syntax, rewrittenOperand, rewrittenOperand.Type, underlyingTypeTo, @checked, isImplicit: false, constantValueOpt: constantValueOpt); 555(symbolOpt.IsAbstract || symbolOpt.IsVirtual) ? mg.ReceiverOpt?.Type : null, 594Debug.Assert(rewrittenOperand.Type is not null); 609createSpan = createSpan.Construct(rewrittenOperand.Type, spanType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.Single().Type); 610_ = rewrittenOperand.Type.HasInlineArrayAttribute(out int length); 618var sourceType = rewrittenOperand.Type; 815Debug.Assert(rewrittenOperand.Type is { }); 817Conversion conversion = compilation.Conversions.ClassifyConversionFromType(rewrittenOperand.Type, rewrittenType, isChecked: @checked, ref useSiteInfo); 823rewrittenOperand.Type.SpecialType != SpecialType.System_Decimal && 824rewrittenOperand.Type.SpecialType != SpecialType.System_DateTime) 830rewrittenOperand.Type, 876if (!TypeSymbol.Equals(rewrittenOperand.Type, conversion.BestUserDefinedConversionAnalysis.FromType, TypeCompareKind.ConsiderEverything2)) 886if (!TypeSymbol.Equals(rewrittenOperand.Type, conversion.Method.GetParameterType(0), TypeCompareKind.ConsiderEverything2)) 899Debug.Assert(rewrittenOperand.Type is { }); 900if (rewrittenOperand.Type.IsNullableType() && 901conversion.Method.GetParameterType(0).Equals(rewrittenOperand.Type.GetNullableUnderlyingType(), TypeCompareKind.AllIgnoreOptions) && 905userDefinedConversionRewrittenType = ((NamedTypeSymbol)rewrittenOperand.Type.OriginalDefinition).Construct(userDefinedConversionRewrittenType); 915if (!TypeSymbol.Equals(userDefined.Type, conversion.BestUserDefinedConversionAnalysis.ToType, TypeCompareKind.ConsiderEverything2)) 924if (!TypeSymbol.Equals(userDefined.Type, rewrittenType, TypeCompareKind.ConsiderEverything2)) 956Debug.Assert(rewrittenOperand.Type is { }); 960var tupleTypeSymbol = (NamedTypeSymbol)rewrittenOperand.Type; 997Debug.Assert(expression.Type is { }); 998if (!expression.Type.IsNullableType()) 1010when convertedArgument.Type!.Equals(expression.Type.StrippedType(), TypeCompareKind.AllIgnoreOptions): 1015when underlying.Length == 1 && underlying[0].Kind == ConversionKind.ImplicitTuple && !convertedArgument.Type!.IsNullableType(): 1050TypeSymbol? rewrittenOperandType = rewrittenOperand.Type; 1100Debug.Assert(rewrittenOperand.Type is { }); 1101TypeSymbol rewrittenOperandType = rewrittenOperand.Type; 1314Debug.Assert(TypeSymbol.Equals(conditional.Type, conditional.Consequence.Type, TypeCompareKind.ConsiderEverything2)); 1315Debug.Assert(TypeSymbol.Equals(conditional.Type, conditional.Alternative.Type, TypeCompareKind.ConsiderEverything2)); 1347Debug.Assert(rewrittenOperand.Type is { }); 1348if (rewrittenOperand.Type.IsNullableType()) 1351if (parameterType.Equals(rewrittenOperand.Type.GetNullableUnderlyingType(), TypeCompareKind.AllIgnoreOptions) && 1365if ((rewrittenOperand.Type.IsArray()) && _compilation.IsReadOnlySpanType(rewrittenType)) 1377Debug.Assert(TypeSymbol.Equals(result.Type, rewrittenType, TypeCompareKind.ConsiderEverything2)); 1400Debug.Assert(rewrittenOperand.Type is { }); 1403Conversion conv = TryMakeConversion(syntax, conversion, rewrittenOperand.Type, rewrittenType, @checked: @checked); 1415Debug.Assert(rewrittenOperand.Type.IsNullableType()); 1492Debug.Assert(rewrittenOperand.Type is { }); 1495TypeSymbol source = rewrittenOperand.Type; 1718Debug.Assert(operand.Type is { }); 1719return RewriteDecimalConversionCore(syntax, operand, operand.Type, toType, isImplicit, constantValueOpt);
Lowering\LocalRewriter\LocalRewriter_DeconstructionAssignmentOperator.cs (11)
42Debug.Assert(left.Type is { }); 43BoundExpression? result = RewriteDeconstruction(lhsTargets, conversion, left.Type, right, isUsed); 247Debug.Assert(leftTarget is { Type: { } }); 264var tupleType = NamedTypeSymbol.CreateTuple(locationOpt: null, elementTypesWithAnnotations: builder!.SelectAsArray(e => TypeWithAnnotations.Create(e.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; 445TypeSymbol? initializerType = initializerExpr.Type; 514TypeSymbol? initializerType = initializerExpr.Type;
Lowering\LocalRewriter\LocalRewriter_ForEachStatement.cs (11)
43TypeSymbol? nodeExpressionType = collectionExpression.Type; 501Debug.Assert(receiver.Type is { }); 502if (!receiver.Type.IsReferenceType && method.ContainingType.IsInterface) 600NamedTypeSymbol? collectionType = (NamedTypeSymbol?)collectionExpression.Type; 739Debug.Assert(rewrittenExpression.Type is not null); 868Debug.Assert(collectionExpression.Type is { TypeKind: TypeKind.Array }); 896Debug.Assert(collectionExpression.Type is { TypeKind: TypeKind.Array }); 900ArrayTypeSymbol arrayType = (ArrayTypeSymbol)collectionExpression.Type; 1017Debug.Assert(collectionExpression.Type is { TypeKind: TypeKind.Array }); 1045Debug.Assert(collectionExpression.Type is { TypeKind: TypeKind.Array }); 1049ArrayTypeSymbol 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)
121Debug.Assert(oldNode.Type is not null); 122Debug.Assert(oldNode.Type.Equals(type, TypeCompareKind.ConsiderEverything)); 218Debug.Assert(call.Type is not null); 233call.Type); 242Debug.Assert(node.Expression.Type is object); 243Debug.Assert(node.Argument.Type is object); 258_ = node.Expression.Type.HasInlineArrayAttribute(out int length); 260if (node.Argument.Type.SpecialType == SpecialType.System_Int32) 268if (TypeSymbol.Equals(node.Argument.Type, _compilation.GetWellKnownType(WellKnownType.System_Index), TypeCompareKind.AllIgnoreOptions)) 280Debug.Assert(TypeSymbol.Equals(node.Argument.Type, _compilation.GetWellKnownType(WellKnownType.System_Range), TypeCompareKind.AllIgnoreOptions)); 362Debug.Assert(node.Expression.Type is object); 374return createSpan.Construct(node.Expression.Type, node.Expression.Type.TryGetInlineArrayElementField()!.Type); 379Debug.Assert(node.Expression.Type is object); 380Debug.Assert(index.Type?.SpecialType == SpecialType.System_Int32); 382var intType = (NamedTypeSymbol)index.Type; 401elementRef = elementRef.Construct(node.Expression.Type, node.Expression.Type.TryGetInlineArrayElementField()!.Type); 420elementRef = elementRef.Construct(node.Expression.Type, node.Expression.Type.TryGetInlineArrayElementField()!.Type); 475node.Argument.Type, 484node.Argument.Type, 522node.Argument.Type, 538Debug.Assert(receiver.Type is { }); 544receiver.Type.IsReferenceType ? RefKind.None : RefKind.Ref); 602Debug.Assert(integerArgument.Type!.SpecialType == SpecialType.System_Int32); 699Debug.Assert(loweredExpr.Type!.SpecialType == SpecialType.System_Int32); 710Debug.Assert(loweredExpr.Type!.SpecialType == SpecialType.System_Int32); 717loweredExpr.Type, 750unloweredExpr.Type, 758Debug.Assert(hatExpression.Operand is { Type: { SpecialType: SpecialType.System_Int32 } }); 762else if (unloweredExpr is BoundConversion { Operand: { Type: { SpecialType: SpecialType.System_Int32 } } operand }) 771arguments[0] is { Type.SpecialType: SpecialType.System_Int32, ConstantValueOpt.Value: int _ and >= 0 } index && 772arguments[1] is { Type.SpecialType: SpecialType.System_Boolean, ConstantValueOpt.Value: bool fromEnd }) 815node.Argument.Type, 841Debug.Assert(receiver.Type is { }); 847receiver.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 (18)
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)); 49Debug.Assert(assignment.Type is { }); 50assignment = new BoundSequence(syntax, [rightResult.LocalSymbol], [assignmentToTemp], assignment, assignment.Type); 58var leftPlaceholder = new BoundValuePlaceholder(lhsRead.Syntax, lhsRead.Type); 59BoundExpression conditionalExpression = MakeNullCoalescingOperator(syntax, lhsRead, assignment, leftPlaceholder: leftPlaceholder, leftConversion: leftPlaceholder, BoundNullCoalescingOperatorResultKind.LeftType, node.LeftOperand.Type); 60Debug.Assert(conditionalExpression.Type is { }); 69conditionalExpression.Type); 76Debug.Assert(node.LeftOperand.Type.IsNullableType()); 85leftOperand.Type, 93leftOperand.Type, 125Debug.Assert(transformedLHS.Type.GetNullableUnderlyingType().Equals(tmp.Type.StrippedType(), TypeCompareKind.AllIgnoreOptions)); 128Debug.Assert(TypeSymbol.Equals(transformedLHS.Type, node.LeftOperand.Type, TypeCompareKind.AllIgnoreOptions)); 133MakeConversionNode(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 (9)
400Debug.Assert(assignment.Type.IsDynamic() || TypeSymbol.Equals(rewrittenAccess.Type, assignment.Type, TypeCompareKind.AllIgnoreOptions)); 454Debug.Assert(TypeSymbol.Equals(rangeArgument.Type, _compilation.GetWellKnownType(WellKnownType.System_Range), TypeCompareKind.ConsiderEverything)); 472Debug.Assert(TypeSymbol.Equals(rewrittenAccess.Type, assignment.Type, TypeCompareKind.AllIgnoreOptions)); 505Debug.Assert(TypeSymbol.Equals(rewrittenAccess.Type, assignment.Type, TypeCompareKind.AllIgnoreOptions)); 517if (TypeSymbol.Equals(implicitIndexer.Argument.Type, _compilation.GetWellKnownType(WellKnownType.System_Index), TypeCompareKind.ConsiderEverything)) 539Debug.Assert(TypeSymbol.Equals(rewrittenAccess.Type, assignment.Type, TypeCompareKind.AllIgnoreOptions)); 700Debug.Assert(_compilation.Conversions.ClassifyConversionFromType(rewrittenReceiver.Type, memberSymbol.ContainingType, isChecked: false, ref discardedUseSiteInfo).IsImplicit || 701(memberSymbol.IsExtensionBlockMember() && !memberSymbol.IsStatic && ConversionsBase.IsValidExtensionMethodThisArgConversion(_compilation.Conversions.ClassifyConversionFromType(rewrittenReceiver.Type, memberSymbol.ContainingType.ExtensionParameter!.Type, isChecked: false, ref discardedUseSiteInfo))) || 702_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 (20)
75Debug.Assert(visitedArguments.All(arg => arg.Type!.SpecialType is SpecialType.System_String or SpecialType.System_Char or SpecialType.System_Object)); 107var argumentType = arg.Type; 153bool needsImplicitConversionFromStringToSpan = visitedArguments.Any(arg => arg.Type is { SpecialType: SpecialType.System_String }); 289if (argument is BoundConversion { ConversionKind: ConversionKind.Boxing, Type.SpecialType: SpecialType.System_Object, Operand: { Type.SpecialType: SpecialType.System_Char } operand }) 305else if (argument is BoundNullCoalescingOperator { LeftOperand: { Type.SpecialType: SpecialType.System_String } left, RightOperand: BoundLiteral { ConstantValueOpt: { IsString: true, RopeValue.IsEmpty: true } } }) 444if (call is { Arguments: [], ReceiverOpt.Type: NamedTypeSymbol { SpecialType: SpecialType.System_Char } charType, Method: { Name: "ToString" } method } 521Debug.Assert(arg.Type is not null); 523if (arg.Type.SpecialType == SpecialType.System_Char) 552Debug.Assert(arg.HasAnyErrors || arg.Type.SpecialType == SpecialType.System_String); 652Debug.Assert(expr.Type is not null); 655if (expr.Type.IsStringType()) 667if (expr.Type.IsValueType && !expr.Type.IsTypeParameter()) 669var type = (NamedTypeSymbol)expr.Type; 690expr.Type.SpecialType.CanOptimizeBehavior() && 706bool callWithoutCopy = expr.Type.IsReferenceType || 708(structToStringMethod == null && !expr.Type.IsTypeParameter()) || 712if (expr.Type.IsValueType) 716expr = new BoundPassByCopy(syntax, expr, expr.Type); 748new BoundConditionalReceiver(syntax, currentConditionalAccessID, expr.Type),
Lowering\LocalRewriter\LocalRewriter_StringInterpolation.cs (9)
107if (actualCall.Type!.IsDynamic()) 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 (27)
133var underlyingType = loweredOperand.Type.GetEnumUnderlyingType(); 277Debug.Assert(result.Type is { }); 286type: result.Type 329Debug.Assert(TypeSymbol.Equals(conditional.Type, conditional.Consequence.Type, TypeCompareKind.ConsiderEverything2)); 330Debug.Assert(TypeSymbol.Equals(conditional.Type, conditional.Alternative.Type, TypeCompareKind.ConsiderEverything2)); 408Debug.Assert(node.OperandConversion is null || (node.Operand.Type!.IsReferenceType && node.MethodOpt.IsExtensionBlockMember())); 421TypeSymbol? operandType = node.Operand.Type; //type of the variable being incremented 458TypeSymbol? operandType = left.Type; //type of the variable being incremented 467Debug.Assert(TypeSymbol.Equals(operandType, transformedLHS.Type, TypeCompareKind.AllIgnoreOptions)); 586TypeSymbol? operandType = transformedLHS.Type; //type of the variable being incremented 660Debug.Assert(boundTemp.Type is not null); 686type: boundTemp.Type); 699Debug.Assert(boundTemp.Type is not null); 702Debug.Assert(tempValue.Type is { }); 711tempValue.Type); 725type: boundTemp.Type); 931Debug.Assert(binaryOperand.Type is { TypeKind: TypeKind.Pointer }); 932Debug.Assert(boundOne.Type is { SpecialType: SpecialType.System_Int32 }); 933return MakeBinaryOperator(node.Syntax, binaryOperatorKind, binaryOperand, boundOne, binaryOperand.Type, method: null, constrainedToTypeOpt: null); 985Debug.Assert(operand.Type is { SpecialType: SpecialType.System_Decimal }); 992Debug.Assert(operand.Type is { } && operand.Type.IsNullableType() && operand.Type.GetNullableUnderlyingType().SpecialType == SpecialType.System_Decimal); 996MethodSymbol getValueOrDefault = UnsafeGetNullableMethod(syntax, operand.Type, SpecialMember.System_Nullable_T_GetValueOrDefault); 997MethodSymbol ctor = UnsafeGetNullableMethod(syntax, operand.Type, SpecialMember.System_Nullable_T__ctor); 1008BoundExpression alternative = new BoundDefaultExpression(syntax, operand.Type); 1011return 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)
545Debug.Assert(loweredReceiver.Type is { }); 546if (!loweredReceiver.Type.IsValueType) 830var argType = boundArgument.Type; 909result[j++] = receiver.Type ?? systemObjectType; 915result[j++] = arguments[i].Type ?? systemObjectType; 921result[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) 1047Debug.Assert(refKind == RefKind.None || !receiver.Type.IsReferenceType); 1056var receiverType = receiver.Type; 1087if (!receiver.Type.IsReferenceType && LocalRewriter.CanBePassedByReference(receiver)) 1089result = receiver.Type.IsReadOnly ? RefKind.In : RefKind.Ref; 1160Debug.Assert(condition.Type.SpecialType == SpecialType.System_Boolean); 1163var tmp = _F.SynthesizedLocal(condition.Type, kind: SynthesizedLocalKind.Spill, syntax: _F.Syntax); 1210type: node.Type)); 1267_F.ObjectEqual(_F.Local(tmp), _F.Null(left.Type)), 1299if (receiver.Type.IsReferenceType || receiver.Type.IsValueType || receiverRefKind == RefKind.None) 1319var clone = _F.SynthesizedLocal(receiver.Type, _F.Syntax, refKind: RefKind.None, kind: SynthesizedLocalKind.Spill); 1323var isNotClass = _F.IsNotNullReference(_F.Default(receiver.Type)); 1491return UpdateExpression(builder, node.Update(operand, node.Type)); 1535return 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 (2)
152Debug.Assert(thisProxyReplacement.Type is not null); 153this.cachedThis = F.SynthesizedLocal(thisProxyReplacement.Type, syntax: F.Syntax, kind: SynthesizedLocalKind.FrameCache);
Lowering\StateMachineRewriter\RefInitializationHoister.cs (4)
98Debug.Assert(TypeSymbol.Equals(type, replacement.Type, TypeCompareKind.ConsiderEverything2)); 285Debug.Assert(_reportedError || isFieldAccessOfStruct || expr.Type!.IsTypeParameter()); 295Debug.Assert(expr.Type is not null); 296var hoistedSymbol = createHoistedSymbol(expr.Type, arg, assignedLocal);
Lowering\SyntheticBoundNodeFactory.cs (54)
267Debug.Assert(receiverOpt is null || receiverOpt.Type is { } && 268receiverOpt.Type.GetMembers(propertySym.Name).OfType<PropertySymbol>().Single() == propertySym); 279Debug.Assert(!(receiverOpt is { Type: ArrayTypeSymbol { IsSZArray: true } } && 439Debug.Assert(left.Type is { } && right.Type is { } && 440(left.Type.Equals(right.Type, TypeCompareKind.AllIgnoreOptions) || 442right.Type.IsErrorType() || left.Type.IsErrorType())); 444var assignment = new BoundAssignmentOperator(syntax, left, right, isRef, left.Type, hasErrors) { WasCompilerGenerated = wasCompilerGenerated }; 569var conversion = Compilation.Conversions.ClassifyConversionFromType(expression.Type, CurrentFunction.ReturnType, isChecked: false, ref useSiteInfo); 657Conversion c = Compilation.Conversions.ClassifyBuiltInConversion(operand.Type, type, isChecked: false, ref discardedUseSiteInfo); 663Debug.Assert(left.Type?.SpecialType == CodeAnalysis.SpecialType.System_Boolean); 664Debug.Assert(right.Type?.SpecialType == CodeAnalysis.SpecialType.System_Boolean); 670Debug.Assert(left.Type?.SpecialType == CodeAnalysis.SpecialType.System_Boolean); 671Debug.Assert(right.Type?.SpecialType == CodeAnalysis.SpecialType.System_Boolean); 785switch (input.Type) 794throw ExceptionUtilities.UnexpectedValue(input.Type); 919Debug.Assert(valueTypeReceiver.Type is { }); 920Debug.Assert(TypeSymbol.Equals(valueTypeReceiver.Type, referenceTypeReceiver.Type, TypeCompareKind.ConsiderEverything2)); 921return new BoundComplexConditionalReceiver(Syntax, valueTypeReceiver, referenceTypeReceiver, valueTypeReceiver.Type) { WasCompilerGenerated = true }; 926Debug.Assert(left.Type!.Equals(right.Type, TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes) || left.Type.IsErrorType()); 927Debug.Assert(left.Type.IsReferenceType); 929return new BoundNullCoalescingOperator(Syntax, left, right, leftPlaceholder: null, leftConversion: null, BoundNullCoalescingOperatorResultKind.LeftType, @checked: false, left.Type) { WasCompilerGenerated = true }; 1037Debug.Assert(result.Type is { }); 1038var resultType = type ?? result.Type; 1044Debug.Assert(result.Type is { }); 1048: new BoundSequence(Syntax, locals, sideEffects, result, result.Type) { WasCompilerGenerated = true }; 1053Debug.Assert(result.Type is { }); 1054return new BoundSpillSequence(Syntax, locals, sideEffects, result, result.Type) { WasCompilerGenerated = true }; 1083Debug.Assert(ex.Type is { SpecialType: CodeAnalysis.SpecialType.System_Int32 }); 1178Debug.Assert(array.Type is { TypeKind: TypeKind.Array }); 1184Debug.Assert(array.Type is { TypeKind: TypeKind.Array }); 1185int rank = ((ArrayTypeSymbol)array.Type).Rank; 1197Debug.Assert(array.Type is { TypeKind: TypeKind.Array }); 1198return new BoundArrayAccess(Syntax, array, indices, ((ArrayTypeSymbol)array.Type).ElementType); 1484if (TypeSymbol.Equals(type, arg.Type, TypeCompareKind.ConsiderEverything2)) 1498arg.Type is TypeParameterSymbol { AllowsRefLikeType: true } && type.IsObjectType()) 1514if (conversion.Method is { } && !TypeSymbol.Equals(conversion.Method.Parameters[0].Type, arg.Type, TypeCompareKind.ConsiderEverything2)) 1524Debug.Assert(arg.Type is { }); 1526arg.Type.IsNullableType() && 1527arg.Type.GetNullableUnderlyingType().Equals(type, TypeCompareKind.AllIgnoreOptions)) 1531return this.Call(arg, this.SpecialMethod(CodeAnalysis.SpecialMember.System_Nullable_T_get_Value).AsMember((NamedTypeSymbol)arg.Type)); 1620return new BoundCatchBlock(Syntax, ImmutableArray<LocalSymbol>.Empty, source, source.Type, exceptionFilterPrologueOpt: null, exceptionFilterOpt: null, body: block, isSynthesizedAsyncCatchAll: false); 1640Debug.Assert(expression is { Type: { SpecialType: CodeAnalysis.SpecialType.System_Boolean } }); 1641return new BoundUnaryOperator(expression.Syntax, UnaryOperatorKind.BoolLogicalNegation, expression, null, null, constrainedToTypeOpt: null, LookupResultKind.Viable, expression.Type); 1661Debug.Assert(argument.Type is { }); 1694var type = argument.Type; 1764TypeSymbol exprType = rewrittenExpr.Type; 1818LocalRewriter.UnsafeGetNullableMethod(syntax, expression.Type, CodeAnalysis.SpecialMember.System_Nullable_T_get_HasValue, Compilation, Diagnostics)); 1882return 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)) 1587boundNullCoalescingOperator.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)
982conversion.IsIdentity && parameterType.SpecialType == SpecialType.System_Object && defaultExpression.Type.IsDynamic()) 996(object)defaultExpression.Type != null && 997defaultExpression.Type.SpecialType == SpecialType.System_String || 1007else if (((conversion.IsNullable && !defaultExpression.Type.IsNullableType()) || 1008(conversion.IsObjectCreation && convertedExpression.Type.IsNullableType())) && 1025(defaultExpression.IsImplicitObjectCreation() ? convertedExpression.Type.StrippedType() : defaultExpression.Type), parameterSyntax.Identifier.ValueText);
Symbols\Source\SourceLocalSymbol.cs (1)
662return TypeWithAnnotations.Create(initializerOpt?.Type);
Symbols\Source\SourceMemberFieldSymbol.cs (3)
554if ((object)initializerOpt.Type != null && !initializerOpt.Type.IsErrorType()) 556type = TypeWithAnnotations.Create(initializerOpt.Type);
Symbols\Synthesized\Records\SynthesizedRecordPrintMembers.cs (3)
208Debug.Assert(value.Type is not null); 209if (value.Type.IsValueType) 216else if (!value.Type.IsRestrictedType())
Symbols\Synthesized\SynthesizedEntryPointSymbol.cs (1)
428public override TypeWithAnnotations ReturnTypeWithAnnotations => TypeWithAnnotations.Create(_userEntryPointInvocation.Type);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (28)
Semantics\ForEachTests.cs (28)
1736Assert.Equal(SpecialType.System_Collections_IEnumerable, boundNode.Expression.Type.SpecialType); 1737Assert.Equal(SymbolKind.ArrayType, ((BoundConversion)boundNode.Expression).Operand.Type.Kind); 1774Assert.Equal(SpecialType.System_String, boundNode.Expression.Type.SpecialType); 1775Assert.Equal(SpecialType.System_String, ((BoundConversion)boundNode.Expression).Operand.Type.SpecialType); 1818Assert.Equal("Enumerable", boundNode.Expression.Type.ToTestDisplayString()); 1819Assert.Equal("Enumerable", ((BoundConversion)boundNode.Expression).Operand.Type.ToTestDisplayString()); 1862Assert.Equal("Enumerable", boundNode.Expression.Type.ToTestDisplayString()); 1863Assert.Equal("Enumerable", ((BoundConversion)boundNode.Expression).Operand.Type.ToTestDisplayString()); 1895Assert.Equal("System.Collections.IEnumerable", boundNode.Expression.Type.ToTestDisplayString()); 1896Assert.Equal("System.Collections.IEnumerable", ((BoundConversion)boundNode.Expression).Operand.Type.ToTestDisplayString()); 1935Assert.Equal("System.Collections.Generic.IEnumerable<System.Int32>", boundNode.Expression.Type.ToTestDisplayString()); 1936Assert.Equal("Enumerable", ((BoundConversion)boundNode.Expression).Operand.Type.ToTestDisplayString()); 1977Assert.Equal(SpecialType.System_Collections_IEnumerable, boundNode.Expression.Type.SpecialType); 1978Assert.Equal("Enumerable", ((BoundConversion)boundNode.Expression).Operand.Type.ToTestDisplayString()); 2016Assert.Equal(SpecialType.System_Collections_IEnumerable, boundNode.Expression.Type.SpecialType); 2017Assert.Equal("Enumerable", ((BoundConversion)boundNode.Expression).Operand.Type.ToTestDisplayString()); 2197Assert.Equal(SpecialType.System_Collections_IEnumerable, boundNode.Expression.Type.SpecialType); 2198Assert.Equal(TypeKind.Dynamic, ((BoundConversion)boundNode.Expression).Operand.Type.TypeKind); 2230Assert.Equal(SpecialType.System_Collections_IEnumerable, boundNode.Expression.Type.SpecialType); 2231Assert.Equal(SymbolKind.DynamicType, ((BoundConversion)boundNode.Expression).Operand.Type.Kind); 2271Assert.Equal("Enumerable<T>", boundNode.Expression.Type.ToTestDisplayString()); 2272Assert.Equal("Enumerable<T>", ((BoundConversion)boundNode.Expression).Operand.Type.ToTestDisplayString()); 2355Assert.Equal("Enumerable<T>", boundNode.Expression.Type.ToTestDisplayString()); 2356Assert.Equal("Enumerable<T>", ((BoundConversion)boundNode.Expression).Operand.Type.ToTestDisplayString()); 2402Assert.Equal("Enumerable", boundNode.Expression.Type.ToTestDisplayString()); 2403Assert.Equal("Enumerable", ((BoundConversion)boundNode.Expression).Operand.Type.ToTestDisplayString()); 3754Assert.Equal("C", info.GetEnumeratorInfo.Arguments.Single().Type.ToTestDisplayString()); 3764Assert.Equal("C", boundNode.Expression.Type.ToDisplayString());