src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\PredefinedTypeExtensions.cs (41)
13public static SpecialType ToSpecialType(this PredefinedType predefinedType)
16PredefinedType.Object => SpecialType.System_Object,
17PredefinedType.Void => SpecialType.System_Void,
18PredefinedType.Boolean => SpecialType.System_Boolean,
19PredefinedType.Char => SpecialType.System_Char,
20PredefinedType.SByte => SpecialType.System_SByte,
21PredefinedType.Byte => SpecialType.System_Byte,
22PredefinedType.Int16 => SpecialType.System_Int16,
23PredefinedType.UInt16 => SpecialType.System_UInt16,
24PredefinedType.Int32 => SpecialType.System_Int32,
25PredefinedType.UInt32 => SpecialType.System_UInt32,
26PredefinedType.Int64 => SpecialType.System_Int64,
27PredefinedType.UInt64 => SpecialType.System_UInt64,
28PredefinedType.Decimal => SpecialType.System_Decimal,
29PredefinedType.Single => SpecialType.System_Single,
30PredefinedType.Double => SpecialType.System_Double,
31PredefinedType.String => SpecialType.System_String,
32PredefinedType.DateTime => SpecialType.System_DateTime,
33PredefinedType.IntPtr => SpecialType.System_IntPtr,
34PredefinedType.UIntPtr => SpecialType.System_UIntPtr,
35_ => SpecialType.None,
38public static PredefinedType ToPredefinedType(this SpecialType specialType)
41SpecialType.System_Object => PredefinedType.Object,
42SpecialType.System_Void => PredefinedType.Void,
43SpecialType.System_Boolean => PredefinedType.Boolean,
44SpecialType.System_Char => PredefinedType.Char,
45SpecialType.System_SByte => PredefinedType.SByte,
46SpecialType.System_Byte => PredefinedType.Byte,
47SpecialType.System_Int16 => PredefinedType.Int16,
48SpecialType.System_UInt16 => PredefinedType.UInt16,
49SpecialType.System_Int32 => PredefinedType.Int32,
50SpecialType.System_UInt32 => PredefinedType.UInt32,
51SpecialType.System_Int64 => PredefinedType.Int64,
52SpecialType.System_UInt64 => PredefinedType.UInt64,
53SpecialType.System_Decimal => PredefinedType.Decimal,
54SpecialType.System_Single => PredefinedType.Single,
55SpecialType.System_Double => PredefinedType.Double,
56SpecialType.System_String => PredefinedType.String,
57SpecialType.System_DateTime => PredefinedType.DateTime,
58SpecialType.System_IntPtr => PredefinedType.IntPtr,
59SpecialType.System_UIntPtr => PredefinedType.UIntPtr,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (12)
83public static bool IsSpecialType([NotNullWhen(true)] ITypeSymbol? type, SpecialType specialType)
136SpecialType.System_SByte => value is sbyte,
137SpecialType.System_Byte => value is byte,
138SpecialType.System_Int16 => value is short,
139SpecialType.System_UInt16 => value is ushort,
140SpecialType.System_Int32 => value is int,
141SpecialType.System_UInt32 => value is uint,
142SpecialType.System_Int64 => value is long,
143SpecialType.System_UInt64 => value is ulong,
144SpecialType.System_Decimal => value is decimal,
145SpecialType.System_Single => value is float,
146SpecialType.System_Double => value is double,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractNamedTypeSymbol.cs (1)
29SpecialType specialType,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationArrayTypeSymbol.cs (1)
10internal sealed class CodeGenerationArrayTypeSymbol(ITypeSymbol elementType, int rank, NullableAnnotation nullableAnnotation) : CodeGenerationTypeSymbol(null, null, default, Accessibility.NotApplicable, default, string.Empty, SpecialType.None, nullableAnnotation), IArrayTypeSymbol
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationNamedTypeSymbol.cs (1)
34SpecialType specialType,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\PredefinedTypeExtensions.cs (41)
13public static SpecialType ToSpecialType(this PredefinedType predefinedType)
16PredefinedType.Object => SpecialType.System_Object,
17PredefinedType.Void => SpecialType.System_Void,
18PredefinedType.Boolean => SpecialType.System_Boolean,
19PredefinedType.Char => SpecialType.System_Char,
20PredefinedType.SByte => SpecialType.System_SByte,
21PredefinedType.Byte => SpecialType.System_Byte,
22PredefinedType.Int16 => SpecialType.System_Int16,
23PredefinedType.UInt16 => SpecialType.System_UInt16,
24PredefinedType.Int32 => SpecialType.System_Int32,
25PredefinedType.UInt32 => SpecialType.System_UInt32,
26PredefinedType.Int64 => SpecialType.System_Int64,
27PredefinedType.UInt64 => SpecialType.System_UInt64,
28PredefinedType.Decimal => SpecialType.System_Decimal,
29PredefinedType.Single => SpecialType.System_Single,
30PredefinedType.Double => SpecialType.System_Double,
31PredefinedType.String => SpecialType.System_String,
32PredefinedType.DateTime => SpecialType.System_DateTime,
33PredefinedType.IntPtr => SpecialType.System_IntPtr,
34PredefinedType.UIntPtr => SpecialType.System_UIntPtr,
35_ => SpecialType.None,
38public static PredefinedType ToPredefinedType(this SpecialType specialType)
41SpecialType.System_Object => PredefinedType.Object,
42SpecialType.System_Void => PredefinedType.Void,
43SpecialType.System_Boolean => PredefinedType.Boolean,
44SpecialType.System_Char => PredefinedType.Char,
45SpecialType.System_SByte => PredefinedType.SByte,
46SpecialType.System_Byte => PredefinedType.Byte,
47SpecialType.System_Int16 => PredefinedType.Int16,
48SpecialType.System_UInt16 => PredefinedType.UInt16,
49SpecialType.System_Int32 => PredefinedType.Int32,
50SpecialType.System_UInt32 => PredefinedType.UInt32,
51SpecialType.System_Int64 => PredefinedType.Int64,
52SpecialType.System_UInt64 => PredefinedType.UInt64,
53SpecialType.System_Decimal => PredefinedType.Decimal,
54SpecialType.System_Single => PredefinedType.Single,
55SpecialType.System_Double => PredefinedType.Double,
56SpecialType.System_String => PredefinedType.String,
57SpecialType.System_DateTime => PredefinedType.DateTime,
58SpecialType.System_IntPtr => PredefinedType.IntPtr,
59SpecialType.System_UIntPtr => PredefinedType.UIntPtr,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (12)
83public static bool IsSpecialType([NotNullWhen(true)] ITypeSymbol? type, SpecialType specialType)
136SpecialType.System_SByte => value is sbyte,
137SpecialType.System_Byte => value is byte,
138SpecialType.System_Int16 => value is short,
139SpecialType.System_UInt16 => value is ushort,
140SpecialType.System_Int32 => value is int,
141SpecialType.System_UInt32 => value is uint,
142SpecialType.System_Int64 => value is long,
143SpecialType.System_UInt64 => value is ulong,
144SpecialType.System_Decimal => value is decimal,
145SpecialType.System_Single => value is float,
146SpecialType.System_Double => value is double,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractNamedTypeSymbol.cs (1)
29SpecialType specialType,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationArrayTypeSymbol.cs (1)
10internal sealed class CodeGenerationArrayTypeSymbol(ITypeSymbol elementType, int rank, NullableAnnotation nullableAnnotation) : CodeGenerationTypeSymbol(null, null, default, Accessibility.NotApplicable, default, string.Empty, SpecialType.None, nullableAnnotation), IArrayTypeSymbol
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationNamedTypeSymbol.cs (1)
34SpecialType specialType,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (12)
83public static bool IsSpecialType([NotNullWhen(true)] ITypeSymbol? type, SpecialType specialType)
136SpecialType.System_SByte => value is sbyte,
137SpecialType.System_Byte => value is byte,
138SpecialType.System_Int16 => value is short,
139SpecialType.System_UInt16 => value is ushort,
140SpecialType.System_Int32 => value is int,
141SpecialType.System_UInt32 => value is uint,
142SpecialType.System_Int64 => value is long,
143SpecialType.System_UInt64 => value is ulong,
144SpecialType.System_Decimal => value is decimal,
145SpecialType.System_Single => value is float,
146SpecialType.System_Double => value is double,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractNamedTypeSymbol.cs (1)
29SpecialType specialType,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationArrayTypeSymbol.cs (1)
10internal sealed class CodeGenerationArrayTypeSymbol(ITypeSymbol elementType, int rank, NullableAnnotation nullableAnnotation) : CodeGenerationTypeSymbol(null, null, default, Accessibility.NotApplicable, default, string.Empty, SpecialType.None, nullableAnnotation), IArrayTypeSymbol
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationNamedTypeSymbol.cs (1)
34SpecialType specialType,
Binder\Binder_Expressions.cs (77)
1079if (boundArgument.Type?.SpecialType == SpecialType.System_Void)
1262TypeSymbol typedReferenceType = this.Compilation.GetSpecialType(SpecialType.System_TypedReference);
1286TypeSymbol typedReferenceType = GetSpecialType(SpecialType.System_TypedReference, diagnostics, node);
1310TypeSymbol typedReferenceType = this.Compilation.GetSpecialType(SpecialType.System_TypedReference);
1352TypeSymbol runtimeArgumentHandleType = GetSpecialType(SpecialType.System_RuntimeArgumentHandle, diagnostics, node);
1477this.GetSpecialType(SpecialType.System_Int32, diagnostics, node), hasErrors);
2686GetSpecialType(SpecialType.System_Boolean, diagnostics, node);
2689TypeSymbol intType = GetSpecialType(SpecialType.System_Int32, diagnostics, node);
2696NamedTypeSymbol nullableType = GetSpecialType(SpecialType.System_Nullable_T, diagnostics, node);
2774GetSpecialType(SpecialType.System_Boolean, diagnostics, node);
2776NamedTypeSymbol nullableType = GetSpecialType(SpecialType.System_Nullable_T, diagnostics, node);
2803NamedTypeSymbol nullableType = GetSpecialType(SpecialType.System_Nullable_T, diagnostics, operand);
4464this.Compilation.CreateArrayTypeSymbol(GetSpecialType(SpecialType.System_Object, diagnostics, node)),
4565GetSpecialType(SpecialType.System_Int32, diagnostics, nonNullSyntax))
4646count = GenerateConversionForAssignment(GetSpecialType(SpecialType.System_Int32, diagnostics, node), count, diagnostics);
4802GetSpecialType(SpecialType.System_Int32, diagnostics, node))
4823if (constantValue == null || constantValue.IsBad || expression.Type.SpecialType != SpecialType.System_Int32)
4846var type = expression.Type.SpecialType;
4847if (type == SpecialType.System_Int32)
4852if (type == SpecialType.System_Int64)
4859Debug.Assert(type == SpecialType.System_UInt32 || type == SpecialType.System_UInt64);
4963containingType.SpecialType == SpecialType.System_Object ||
4966if ((object)initializerType == null || containingType.SpecialType == SpecialType.System_Object) //e.g. when defining System.Object in source
5217if (baseType.SpecialType == SpecialType.System_Object)
5219if (resultMember is null || resultMember.ContainingType.SpecialType != SpecialType.System_Object)
5438lengthOrCount = new BoundLiteral(expression.Syntax, ConstantValue.Create(length), @this.GetSpecialType(SpecialType.System_Int32, diagnostics, expression.Syntax)) { WasCompilerGenerated = true };
5485type: @this.Compilation.GetSpecialType(SpecialType.System_Object));
6466NamedTypeSymbol collectionsIEnumerableType = this.GetSpecialType(SpecialType.System_Collections_IEnumerable, diagnostics, node);
6647type: GetSpecialType(SpecialType.System_Void, diagnostics, elementInitializer),
7511var specialType = type.SpecialType;
7520case SpecialType.System_SByte:
7521case SpecialType.System_Int16:
7522case SpecialType.System_Int32:
7523case SpecialType.System_Int64:
7524case SpecialType.System_Byte:
7525case SpecialType.System_UInt16:
7526case SpecialType.System_UInt32:
7527case SpecialType.System_UInt64:
7528case SpecialType.System_Single:
7529case SpecialType.System_Double:
7530case SpecialType.System_Decimal:
7531case SpecialType.System_Boolean:
7532case SpecialType.System_Char:
7573var specialType = SpecialTypeExtensions.FromRuntimeTypeOfLiteralValue(value);
7577specialType != SpecialType.None &&
7578specialType != SpecialType.System_Byte &&
7579specialType != SpecialType.System_SByte &&
7580specialType != SpecialType.System_Int16 &&
7581specialType != SpecialType.System_UInt16);
7608var type = GetWellKnownType(WellKnownType.System_ReadOnlySpan_T, diagnostics, node).Construct(GetSpecialType(SpecialType.System_Byte, diagnostics, node));
9196Debug.Assert(left.Type.SpecialType != SpecialType.System_String);
9293Debug.Assert(left.Type.SpecialType != SpecialType.System_String);
9619var intPlaceholder = new BoundImplicitIndexerValuePlaceholder(syntax, binder.GetSpecialType(SpecialType.System_Int32, diagnostics, syntax)) { WasCompilerGenerated = true };
9652if (receiver.Type.SpecialType == SpecialType.System_String && !scope.HasValue)
10400BoundExpression convertedIndex = TryImplicitConversionToArrayIndex(index, SpecialType.System_Int32, node, diagnostics);
10488if (convertedIndex.ConstantValueOpt is { SpecialType: SpecialType.System_Int32, Int32Value: int constIndex })
10569if (hatExpression.Operand.ConstantValueOpt is { SpecialType: SpecialType.System_Int32, Int32Value: int constIndex })
10575else if (convertedIndex is BoundConversion { Operand: { ConstantValueOpt: { SpecialType: SpecialType.System_Int32, Int32Value: int constIndex } } operand })
10582arguments[0] is { ConstantValueOpt: { SpecialType: SpecialType.System_Int32, Int32Value: int constIndex1 } } index &&
10583arguments[1] is { ConstantValueOpt: { SpecialType: SpecialType.System_Boolean, BooleanValue: bool isFromEnd } })
10704var int32 = GetSpecialType(SpecialType.System_Int32, diagnostics, node);
10739TryImplicitConversionToArrayIndex(index, SpecialType.System_Int32, node, diagnostics) ??
10740TryImplicitConversionToArrayIndex(index, SpecialType.System_UInt32, node, diagnostics) ??
10741TryImplicitConversionToArrayIndex(index, SpecialType.System_Int64, node, diagnostics) ??
10742TryImplicitConversionToArrayIndex(index, SpecialType.System_UInt64, node, diagnostics);
10776NamedTypeSymbol int32 = GetSpecialType(SpecialType.System_Int32, diagnostics, node);
10810private BoundExpression TryImplicitConversionToArrayIndex(BoundExpression expr, SpecialType specialType, SyntaxNode node, BindingDiagnosticBag diagnostics)
10956else if (expr.Type.SpecialType != SpecialType.System_String)
11409var startArgumentPlaceholder = new BoundImplicitIndexerValuePlaceholder(syntax, GetSpecialType(SpecialType.System_Int32, diagnostics, syntax)) { WasCompilerGenerated = true };
11410var lengthArgumentPlaceholder = new BoundImplicitIndexerValuePlaceholder(syntax, GetSpecialType(SpecialType.System_Int32, diagnostics, syntax)) { WasCompilerGenerated = true };
11461original.Parameters[parameterOffset] is { Type.SpecialType: SpecialType.System_Int32, RefKind: RefKind.None } &&
11462original.Parameters[parameterOffset + 1] is { Type.SpecialType: SpecialType.System_Int32, RefKind: RefKind.None };
11473getMethod.ReturnType.SpecialType == SpecialType.System_Int32 &&
11485original.Parameters[0] is { Type.SpecialType: SpecialType.System_Int32, RefKind: RefKind.None };
12388accessType = GetSpecialType(SpecialType.System_Void, diagnostics, node);
12399accessType = GetSpecialType(SpecialType.System_Nullable_T, diagnostics, node).Construct(accessType);
Binder\Binder_InterpolatedString.cs (18)
41var stringType = GetSpecialType(SpecialType.System_String, diagnostics, node);
55var intType = GetSpecialType(SpecialType.System_Int32, diagnostics, node);
167var constantValue = ConstantValue.Create(text, SpecialType.System_String);
219Debug.Assert(unconvertedInterpolatedString.Type?.SpecialType == SpecialType.System_String);
245Debug.Assert(unconvertedInterpolatedString.Parts.All(static part => part.Type is null or { SpecialType: SpecialType.System_String }));
304fillin.Value.Type?.SpecialType != SpecialType.System_String ||
414expressions[0] = new BoundLiteral(syntax, ConstantValue.Create(formatString.ToStringAndFree()), GetSpecialType(Microsoft.CodeAnalysis.SpecialType.System_String, diagnostics, syntax)) { WasCompilerGenerated = true };
436=> parts.All(p => p is BoundLiteral or BoundStringInsert { Value.Type.SpecialType: SpecialType.System_String, Alignment: null, Format: null });
517var @string = GetSpecialType(SpecialType.System_String, diagnostics, rootSyntax);
674TypeSymbol objectType = GetSpecialType(SpecialType.System_Object, diagnostics, syntax);
711var intType = GetSpecialType(SpecialType.System_Int32, diagnostics, syntax);
722var boolType = GetSpecialType(SpecialType.System_Boolean, diagnostics, syntax);
853var objectType = GetSpecialType(SpecialType.System_Object, diagnostics, unconvertedInterpolatedString.Syntax);
887Debug.Assert(part is BoundLiteral { Type: { SpecialType: SpecialType.System_String }, ConstantValueOpt.IsString: true });
985bool methodReturnsBool = returnType.SpecialType == SpecialType.System_Boolean;
986if (!methodReturnsBool && returnType.SpecialType != SpecialType.System_Void)
998var expected = builderPatternExpectsBool == true ? Compilation.GetSpecialType(SpecialType.System_Boolean) : Compilation.GetSpecialType(SpecialType.System_Void);
Binder\Binder_Invocation.cs (13)
276TypeSymbol objType = GetSpecialType(SpecialType.System_Object, diagnostics, node);
1468Debug.Assert(parameterType.IsDynamic() || parameterType.SpecialType == SpecialType.System_Object);
1733defaultValue = new BoundLiteral(syntax, ConstantValue.Create(line), Compilation.GetSpecialType(SpecialType.System_Int32)) { WasCompilerGenerated = true };
1738defaultValue = new BoundLiteral(syntax, ConstantValue.Create(path), Compilation.GetSpecialType(SpecialType.System_String)) { WasCompilerGenerated = true };
1743defaultValue = new BoundLiteral(syntax, ConstantValue.Create(memberName), Compilation.GetSpecialType(SpecialType.System_String)) { WasCompilerGenerated = true };
1748&& Conversions.ClassifyBuiltInConversion(Compilation.GetSpecialType(SpecialType.System_String), parameterType, isChecked: false, ref discardedUseSiteInfo).Exists
1751defaultValue = new BoundLiteral(syntax, ConstantValue.Create(argument.Syntax.ToString()), Compilation.GetSpecialType(SpecialType.System_String)) { WasCompilerGenerated = true };
1756if (parameterType.IsDynamic() || parameterType.SpecialType == SpecialType.System_Object)
1776if (InAttributeArgument && parameterType.SpecialType == SpecialType.System_Object)
1787if (!conversion.IsValid && defaultConstantValue is { SpecialType: SpecialType.System_Decimal or SpecialType.System_DateTime })
1880TypeSymbol int32Type = GetSpecialType(SpecialType.System_Int32, diagnostics, node);
2471return new BoundNameOfOperator(node, boundArgument, ConstantValue.Create(name), Compilation.GetSpecialType(SpecialType.System_String));
Binder\Binder_Lookup.cs (10)
1072var iFaceSpecial = iFaceOriginal.SpecialType;
1075return iFaceSpecial == SpecialType.System_Collections_Generic_IEnumerable_T ||
1076iFaceSpecial == SpecialType.System_Collections_Generic_IList_T ||
1077iFaceSpecial == SpecialType.System_Collections_Generic_ICollection_T ||
1079iFaceSpecial == SpecialType.System_Collections_Generic_IReadOnlyList_T ||
1080iFaceSpecial == SpecialType.System_Collections_Generic_IReadOnlyCollection_T ||
1082iFaceSpecial == SpecialType.System_Collections_IEnumerable ||
1263this.LookupMembersInClass(tmp, this.Compilation.GetSpecialType(SpecialType.System_Object), name, arity, basesBeingResolved, options, originalBinder, type, diagnose, ref useSiteInfo);
1356hiddenContainer.SpecialType != SpecialType.System_Object)
2135this.AddMemberLookupSymbolsInfoInClass(result, Compilation.GetSpecialType(SpecialType.System_Object), options, originalBinder, accessThroughType);
Binder\Binder_Operators.cs (45)
563return ResultIsUsed(node) ? leftType : GetSpecialType(SpecialType.System_Void, diagnostics, node);
721type = this.GetSpecialType(SpecialType.System_Void, diagnostics, node); //we know the return type would have been void
755type = this.GetSpecialType(SpecialType.System_Void, diagnostics, node);
973return new BoundLiteral(node, ConstantValue.Create(kind == BinaryOperatorKind.Equal), GetSpecialType(SpecialType.System_Boolean, diagnostics, node));
988Debug.Assert(right.Type.SpecialType == SpecialType.System_String);
1202GetSpecialType(SpecialType.System_Boolean, diagnostics, node));
1381namedType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.Single().Type.SpecialType is SpecialType.System_Byte;
1441if ((object)left.Type != null && left.Type.SpecialType == SpecialType.System_Boolean &&
1442(object)right.Type != null && right.Type.SpecialType == SpecialType.System_Boolean)
1505bool bothBool = signature.LeftType.SpecialType == SpecialType.System_Boolean &&
1506signature.RightType.SpecialType == SpecialType.System_Boolean;
1603var booleanType = Compilation.GetSpecialType(SpecialType.System_Boolean);
2022return GetSpecialType(SpecialType.System_Boolean, diagnostics, node);
2362(operand.Type.SpecialType == SpecialType.System_UInt64 || isNuint(operand.Type)))
2391return type.SpecialType == SpecialType.System_UIntPtr
2656internal static SpecialType GetEnumPromotedType(SpecialType underlyingType)
2660case SpecialType.System_Byte:
2661case SpecialType.System_SByte:
2662case SpecialType.System_Int16:
2663case SpecialType.System_UInt16:
2664return SpecialType.System_Int32;
2666case SpecialType.System_Int32:
2667case SpecialType.System_UInt32:
2668case SpecialType.System_Int64:
2669case SpecialType.System_UInt64:
2706SpecialType operandSpecialType = GetEnumPromotedType(underlyingType.SpecialType);
2732Debug.Assert(resultTypeSymbol.SpecialType == SpecialType.System_Boolean);
2741if (resultTypeSymbol.SpecialType != SpecialType.System_Boolean && constantValue != null && !constantValue.IsBad)
2801SpecialType resultType = resultTypeSymbol.SpecialType;
3671return mode == InstanceUserDefinedIncrementUsageMode.ResultIsUsed ? operandType : GetSpecialType(SpecialType.System_Void, diagnostics, node);
4447var upconvertSpecialType = GetEnumPromotedType(underlyingType.SpecialType);
4496SpecialType resultType = resultTypeSymbol.SpecialType;
4708return new BoundLiteral(node, ConstantValue.Create((int)-2147483648), GetSpecialType(SpecialType.System_Int32, diagnostics, node));
4723return new BoundLiteral(node, ConstantValue.Create(-9223372036854775808), GetSpecialType(SpecialType.System_Int64, diagnostics, node));
4847var resultType = (TypeSymbol)GetSpecialType(SpecialType.System_Boolean, diagnostics, node);
4923GetSpecialType(SpecialType.System_Object, diagnostics, node).Name // a pretty way of getting the string "Object"
4931inputType = GetSpecialType(SpecialType.System_Object, diagnostics, node);
5016boolType: GetSpecialType(SpecialType.System_Boolean, diagnostics, node),
5186if (operandType.IsValueType && targetType.IsClassType() && targetType.SpecialType != SpecialType.System_Enum ||
5187targetType.IsValueType && operandType.IsClassType() && operandType.SpecialType != SpecialType.System_Enum)
5471type: GetSpecialType(SpecialType.System_Object, diagnostics, node));
5489operandType = GetSpecialType(SpecialType.System_Object, diagnostics, node);
5496targetType = GetSpecialType(SpecialType.System_Object, diagnostics, node);
5726var objectType = GetSpecialType(SpecialType.System_Object, diagnostics, node);
Binder\Binder_Patterns.cs (28)
38inputType = unionTypeOverride.UnionValueProperty(ref useSiteInfo)?.Type ?? Compilation.GetSpecialType(SpecialType.System_Object);
85node, expression, pattern, hasUnionMatching, GetSpecialType(SpecialType.System_Boolean, diagnostics, node),
515if (convertedType.SpecialType == SpecialType.System_String && inputType.IsSpanOrReadOnlySpanChar())
654strippedInputType.SpecialType is not SpecialType.System_Object and not SpecialType.System_ValueType)
745if (expression.Type?.SpecialType == SpecialType.System_String && inputType.IsSpanOrReadOnlySpanChar())
1010expressionType = conversions.CorLibrary.GetSpecialType(SpecialType.System_Object);
1343var objectType = Compilation.GetSpecialType(SpecialType.System_Object);
1477if (declType != (object)Compilation.GetSpecialType(SpecialType.System_Object) &&
1696var objectType = Compilation.GetSpecialType(SpecialType.System_Object);
1747if (memberType.SpecialType == SpecialType.System_Int32 &&
1953bool isExplicitNotNullTest = patternType.Type.SpecialType == SpecialType.System_Object;
2052SpecialType.System_Single => BinaryOperatorKind.Float,
2053SpecialType.System_Double => BinaryOperatorKind.Double,
2054SpecialType.System_Char => BinaryOperatorKind.Char,
2055SpecialType.System_SByte => BinaryOperatorKind.Int, // operands are converted to int
2056SpecialType.System_Byte => BinaryOperatorKind.Int, // operands are converted to int
2057SpecialType.System_UInt16 => BinaryOperatorKind.Int, // operands are converted to int
2058SpecialType.System_Int16 => BinaryOperatorKind.Int, // operands are converted to int
2059SpecialType.System_Int32 => BinaryOperatorKind.Int,
2060SpecialType.System_UInt32 => BinaryOperatorKind.UInt,
2061SpecialType.System_Int64 => BinaryOperatorKind.Long,
2062SpecialType.System_UInt64 => BinaryOperatorKind.ULong,
2063SpecialType.System_Decimal => BinaryOperatorKind.Decimal,
2064SpecialType.System_String => BinaryOperatorKind.String,
2065SpecialType.System_Boolean => BinaryOperatorKind.Bool,
2066SpecialType.System_IntPtr when type.IsNativeIntegerType => BinaryOperatorKind.NInt,
2067SpecialType.System_UIntPtr when type.IsNativeIntegerType => BinaryOperatorKind.NUInt,
Binder\Binder_Statements.cs (11)
1283if (initializerType.SpecialType == SpecialType.System_String &&
1284((object)fixedPatternMethod == null || fixedPatternMethod.ContainingType.SpecialType != SpecialType.System_String))
1287elementType = this.GetSpecialType(SpecialType.System_Char, diagnostics, initializerSyntax);
1535type = this.GetSpecialType(SpecialType.System_Void, diagnostics, node);
2291if (sourceType.SpecialType == SpecialType.System_Double && syntax.Kind() == SyntaxKind.NumericLiteralExpression &&
2292(targetType.SpecialType == SpecialType.System_Single || targetType.SpecialType == SpecialType.System_Decimal))
2294Error(diagnostics, ErrorCode.ERR_LiteralDoubleCast, syntax, (targetType.SpecialType == SpecialType.System_Single) ? "F" : "M", targetType);
2687var boolean = GetSpecialType(SpecialType.System_Boolean, diagnostics, node);
3607else if (expression.Type?.SpecialType == SpecialType.System_Void)
3932if (baseType.SpecialType == SpecialType.System_Object)
Binder\DecisionDagBuilder.cs (59)
376(pattern.InputType.SpecialType == SpecialType.System_Object));
462Type.SpecialType: SpecialType.System_Object
485Property: { Name: WellKnownMemberNames.ValuePropertyName, Type.SpecialType: SpecialType.System_Object } property,
508RoslynDebug.Assert(getLengthProperty.Type.SpecialType == SpecialType.System_Int32);
733Type.SpecialType: SpecialType.System_Boolean,
849if (input.Type.IsDynamic() ? type.SpecialType == SpecialType.System_Object : conversion.IsImplicit)
1174bin.NarrowedType.SpecialType == SpecialType.System_Object));
2729case (SpecialType.System_SByte, SpecialType.System_Byte):
2730case (SpecialType.System_Byte, SpecialType.System_SByte):
2731case (SpecialType.System_Int16, SpecialType.System_UInt16):
2732case (SpecialType.System_UInt16, SpecialType.System_Int16):
2733case (SpecialType.System_Int32, SpecialType.System_UInt32):
2734case (SpecialType.System_UInt32, SpecialType.System_Int32):
2735case (SpecialType.System_Int64, SpecialType.System_UInt64):
2736case (SpecialType.System_UInt64, SpecialType.System_Int64):
2737case (SpecialType.System_IntPtr, SpecialType.System_UIntPtr):
2738case (SpecialType.System_UIntPtr, SpecialType.System_IntPtr):
2743case (SpecialType.System_Int32, SpecialType.System_IntPtr):
2744case (SpecialType.System_Int32, SpecialType.System_UIntPtr):
2745case (SpecialType.System_UInt32, SpecialType.System_IntPtr):
2746case (SpecialType.System_UInt32, SpecialType.System_UIntPtr):
2747case (SpecialType.System_IntPtr, SpecialType.System_Int32):
2748case (SpecialType.System_IntPtr, SpecialType.System_UInt32):
2749case (SpecialType.System_UIntPtr, SpecialType.System_Int32):
2750case (SpecialType.System_UIntPtr, SpecialType.System_UInt32):
2755case (SpecialType.System_Int64, SpecialType.System_IntPtr):
2756case (SpecialType.System_Int64, SpecialType.System_UIntPtr):
2757case (SpecialType.System_UInt64, SpecialType.System_IntPtr):
2758case (SpecialType.System_UInt64, SpecialType.System_UIntPtr):
2759case (SpecialType.System_IntPtr, SpecialType.System_Int64):
2760case (SpecialType.System_IntPtr, SpecialType.System_UInt64):
2761case (SpecialType.System_UIntPtr, SpecialType.System_Int64):
2762case (SpecialType.System_UIntPtr, SpecialType.System_UInt64):
Binder\ForEachLoopBinder.cs (22)
266if (!hasErrors && (moveNextAwaitableInfo.GetResult ?? moveNextAwaitableInfo.RuntimeAsyncAwaitCall?.Method)?.ReturnType.SpecialType != SpecialType.System_Boolean)
595(collectionConversionClassification.Kind == ConversionKind.ExplicitReference && collectionExpr.Type.SpecialType == SpecialType.System_String));
705else if (collectionExpr.Type.SpecialType == SpecialType.System_String && builder.CollectionType.SpecialType == SpecialType.System_Collections_IEnumerable)
711inferredType = TypeWithAnnotations.Create(GetSpecialType(SpecialType.System_Char, diagnostics, collectionExpr.Syntax));
1021if (!isAsync && collectionExprType.SpecialType == SpecialType.System_String)
1089this.Compilation.GetSpecialType(SpecialType.System_Collections_Generic_IEnumerable_T));
1127Debug.Assert(collectionType.OriginalDefinition.SpecialType == SpecialType.System_Collections_Generic_IEnumerable_T);
1186Debug.Assert(collectionType.SpecialType == SpecialType.System_Collections_IEnumerable);
1191builder.ElementTypeWithAnnotations = builder.CurrentPropertyGetter?.ReturnTypeWithAnnotations ?? TypeWithAnnotations.Create(GetSpecialType(SpecialType.System_Object, diagnostics, errorLocationSyntax));
1194builder.GetEnumeratorInfo.Method.ReturnType.SpecialType == SpecialType.System_Collections_IEnumerator);
1283NamedTypeSymbol targetInterface = isAsync ? this.Compilation.GetWellKnownType(WellKnownType.System_IAsyncDisposable) : this.Compilation.GetSpecialType(SpecialType.System_IDisposable);
1306builder.CollectionType = GetSpecialType(SpecialType.System_Collections_IEnumerable, diagnostics, syntax);
1313GetSpecialType(SpecialType.System_Object, diagnostics, syntax));
1317builder.ElementTypeWithAnnotations = collectionExprType.SpecialType == SpecialType.System_String ?
1318TypeWithAnnotations.Create(GetSpecialType(SpecialType.System_Char, diagnostics, syntax)) :
1330TypeSymbol.Equals(builder.GetEnumeratorInfo.Method.ReturnType, this.Compilation.GetSpecialType(SpecialType.System_Collections_IEnumerator), TypeCompareKind.ConsiderEverything2));
1761return moveNextMethodCandidate.OriginalDefinition.ReturnType.SpecialType != SpecialType.System_Boolean;
1779case SpecialType.System_Collections_IEnumerable:
1780case SpecialType.System_Collections_Generic_IEnumerable_T:
1821var implementedNonGeneric = this.Compilation.GetSpecialType(SpecialType.System_Collections_IEnumerable);
1901return type.SpecialType == SpecialType.System_Collections_Generic_IEnumerable_T;
Binder\PatternExplainer.cs (28)
838if (underlyingType.SpecialType == SpecialType.System_IntPtr)
846else if (underlyingType.SpecialType == SpecialType.System_UIntPtr)
864SpecialType.System_Int32 => true,
865SpecialType.System_Int64 => true,
866SpecialType.System_UInt32 => true,
867SpecialType.System_UInt64 => true,
868SpecialType.System_String => true,
869SpecialType.System_Decimal => true,
870SpecialType.System_Single => true,
871SpecialType.System_Double => true,
872SpecialType.System_Boolean => true,
873SpecialType.System_Char => true,
885case SpecialType.System_Boolean:
886case SpecialType.System_Byte:
887case SpecialType.System_SByte:
888case SpecialType.System_UInt16:
889case SpecialType.System_Int16:
890case SpecialType.System_Int32:
891case SpecialType.System_UInt32:
892case SpecialType.System_UInt64:
893case SpecialType.System_Int64:
894case SpecialType.System_IntPtr when type.IsNativeIntegerType:
895case SpecialType.System_UIntPtr when type.IsNativeIntegerType:
896case SpecialType.System_Decimal:
897case SpecialType.System_Char:
898case SpecialType.System_String:
901case SpecialType.System_Single:
910case SpecialType.System_Double:
Binder\Semantics\Conversions\ConversionsBase.cs (85)
250var sourceIsVoid = source?.SpecialType == SpecialType.System_Void;
251var destIsVoid = destination.SpecialType == SpecialType.System_Void;
1378var specialSource = source.Type.GetSpecialTypeSafe();
1380if (specialSource == SpecialType.System_Int32)
1386case SpecialType.System_Byte:
1388case SpecialType.System_SByte:
1390case SpecialType.System_Int16:
1392case SpecialType.System_IntPtr when destination.IsNativeIntegerType:
1394case SpecialType.System_UInt32:
1395case SpecialType.System_UIntPtr when destination.IsNativeIntegerType:
1397case SpecialType.System_UInt64:
1399case SpecialType.System_UInt16:
1405else if (specialSource == SpecialType.System_Int64 && destination.GetSpecialTypeSafe() == SpecialType.System_UInt64 && (constantValue.IsBad || 0 <= constantValue.Int64Value))
1634var multicastDelegateType = corLibrary.GetSpecialType(SpecialType.System_MulticastDelegate);
1694else if (implementsSpecialInterface(compilation, destination, SpecialType.System_Collections_IEnumerable))
1713static bool implementsSpecialInterface(CSharpCompilation compilation, TypeSymbol targetType, SpecialType specialInterface)
1771TypeSymbol expectedAttributeType = corLibrary.GetSpecialType(SpecialType.System_Int32);
1798TypeSymbol expectedAttributeType = corLibrary.GetSpecialType(SpecialType.System_String);
2117case SpecialType.System_Char:
2118case SpecialType.System_SByte:
2119case SpecialType.System_Byte:
2120case SpecialType.System_Int16:
2121case SpecialType.System_UInt16:
2122case SpecialType.System_Int32:
2123case SpecialType.System_UInt32:
2124case SpecialType.System_Int64:
2125case SpecialType.System_UInt64:
2126case SpecialType.System_Single:
2127case SpecialType.System_Double:
2128case SpecialType.System_Decimal:
2129case SpecialType.System_IntPtr when type.IsNativeIntegerType:
2130case SpecialType.System_UIntPtr when type.IsNativeIntegerType:
2202case SpecialType.System_SByte:
2203case SpecialType.System_Byte:
2204case SpecialType.System_Int16:
2205case SpecialType.System_UInt16:
2206case SpecialType.System_Char:
2207case SpecialType.System_Int32:
2208case SpecialType.System_UInt32:
2209case SpecialType.System_Int64:
2210case SpecialType.System_UInt64:
2211case SpecialType.System_Double:
2212case SpecialType.System_Single:
2213case SpecialType.System_Decimal:
2220(type.SpecialType == SpecialType.System_IntPtr || type.SpecialType == SpecialType.System_UIntPtr) && !type.IsNativeIntegerType;
2595if (destination.SpecialType == SpecialType.System_Collections_IEnumerable)
2665if (destination.SpecialType == SpecialType.System_Object || destination.Kind == SymbolKind.DynamicType)
2759if (destination.GetSpecialTypeSafe() == SpecialType.System_Array)
2764if (IsBaseInterface(destination, this.corLibrary.GetDeclaredSpecialType(SpecialType.System_Array), ref useSiteInfo))
2797var specialDestination = destination.GetSpecialTypeSafe();
2799if (specialDestination == SpecialType.System_MulticastDelegate ||
2800specialDestination == SpecialType.System_Delegate ||
2801IsBaseInterface(destination, this.corLibrary.GetDeclaredSpecialType(SpecialType.System_MulticastDelegate), ref useSiteInfo))
2830if (destination.SpecialType == SpecialType.System_MulticastDelegate)
2840var derivedType = this.corLibrary.GetDeclaredSpecialType(SpecialType.System_MulticastDelegate);
3393return source.IsPointerOrFunctionPointer() && destination is PointerTypeSymbol { PointedAtType: { SpecialType: SpecialType.System_Void } };
3484if (source.SpecialType == SpecialType.System_Object)
3662if (source.SpecialType == SpecialType.System_Delegate || source.SpecialType == SpecialType.System_MulticastDelegate)
3667if (HasImplicitConversionToInterface(this.corLibrary.GetDeclaredSpecialType(SpecialType.System_Delegate), source, ref useSiteInfo))
3769if (source.SpecialType == SpecialType.System_Array)
3774foreach (var iface in this.corLibrary.GetDeclaredSpecialType(SpecialType.System_Array).AllInterfacesWithDefinitionUseSiteDiagnostics(ref useSiteInfo))
3803var specialDefinition = ((TypeSymbol)source.OriginalDefinition).SpecialType;
3805if (specialDefinition == SpecialType.System_Collections_Generic_IList_T ||
3806specialDefinition == SpecialType.System_Collections_Generic_ICollection_T ||
3807specialDefinition == SpecialType.System_Collections_Generic_IEnumerable_T ||
3808specialDefinition == SpecialType.System_Collections_Generic_IReadOnlyList_T ||
3809specialDefinition == SpecialType.System_Collections_Generic_IReadOnlyCollection_T)
3852var specialTypeSource = source.SpecialType;
3854if (specialTypeSource == SpecialType.System_Object || specialTypeSource == SpecialType.System_ValueType)
3873if (source.SpecialType == SpecialType.System_Enum && destination.IsEnumType())
3946case SpecialType.System_SByte:
3947case SpecialType.System_Byte:
3948case SpecialType.System_Int16:
3949case SpecialType.System_UInt16:
3950case SpecialType.System_Int32:
3951case SpecialType.System_UInt32:
3952case SpecialType.System_Int64:
3953case SpecialType.System_UInt64:
3955case SpecialType.System_IntPtr:
3956case SpecialType.System_UIntPtr:
4014return spanElementType.SpecialType is SpecialType.System_Char;
Binder\Semantics\Operators\BinaryOperatorOverloadResolution.cs (26)
325operators.Add(new BinaryOperatorSignature(kind | BinaryOperatorKind.Delegate, delegateType, delegateType, Compilation.GetSpecialType(SpecialType.System_Boolean)));
393TypeSymbol systemDelegateType = _binder.Compilation.GetSpecialType(SpecialType.System_Delegate);
489Debug.Assert(underlying.SpecialType != SpecialType.None);
540var boolean = Compilation.GetSpecialType(SpecialType.System_Boolean);
564operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerAndIntAddition, pointerType, Compilation.GetSpecialType(SpecialType.System_Int32), pointerType));
565operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerAndUIntAddition, pointerType, Compilation.GetSpecialType(SpecialType.System_UInt32), pointerType));
566operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerAndLongAddition, pointerType, Compilation.GetSpecialType(SpecialType.System_Int64), pointerType));
567operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerAndULongAddition, pointerType, Compilation.GetSpecialType(SpecialType.System_UInt64), pointerType));
568operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.IntAndPointerAddition, Compilation.GetSpecialType(SpecialType.System_Int32), pointerType, pointerType));
569operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.UIntAndPointerAddition, Compilation.GetSpecialType(SpecialType.System_UInt32), pointerType, pointerType));
570operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.LongAndPointerAddition, Compilation.GetSpecialType(SpecialType.System_Int64), pointerType, pointerType));
571operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.ULongAndPointerAddition, Compilation.GetSpecialType(SpecialType.System_UInt64), pointerType, pointerType));
574operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerAndIntSubtraction, pointerType, Compilation.GetSpecialType(SpecialType.System_Int32), pointerType));
575operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerAndUIntSubtraction, pointerType, Compilation.GetSpecialType(SpecialType.System_UInt32), pointerType));
576operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerAndLongSubtraction, pointerType, Compilation.GetSpecialType(SpecialType.System_Int64), pointerType));
577operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerAndULongSubtraction, pointerType, Compilation.GetSpecialType(SpecialType.System_UInt64), pointerType));
578operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerSubtraction, pointerType, pointerType, Compilation.GetSpecialType(SpecialType.System_Int64)));
595var voidPointerType = new PointerTypeSymbol(TypeWithAnnotations.Create(Compilation.GetSpecialType(SpecialType.System_Void)));
596operators.Add(new BinaryOperatorSignature(kind | BinaryOperatorKind.Pointer, voidPointerType, voidPointerType, Compilation.GetSpecialType(SpecialType.System_Boolean)));
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));
798var @object = Compilation.GetSpecialType(SpecialType.System_Object);
799operators.Add(new BinaryOperatorSignature(kind | BinaryOperatorKind.Object, @object, @object, Compilation.GetSpecialType(SpecialType.System_Boolean)));
1090return result.SpecialType == SpecialType.System_Boolean ?
CodeGen\EmitStatement.cs (8)
1072_module.GetSpecialType(SpecialType.System_Object, catchBlock.Syntax, _diagnostics.DiagnosticBag);
1335expression.Type.SpecialType == SpecialType.System_String || expression.Type.IsSpanOrReadOnlySpanChar());
1338if (expression.Type.SpecialType == SpecialType.System_String || expression.Type.IsSpanOrReadOnlySpanChar())
1420var int32Type = Binder.GetSpecialType(_module.Compilation, SpecialType.System_Int32, syntaxNode, _diagnostics);
1448var charType = Binder.GetSpecialType(_module.Compilation, SpecialType.System_Char, syntaxNode, _diagnostics);
1551var UInt32Type = Binder.GetSpecialType(_module.Compilation, SpecialType.System_UInt32, syntaxNode, _diagnostics);
1572var sequenceEqualsCharMethod = sequenceEqualsTMethod.Construct(Binder.GetSpecialType(_module.Compilation, SpecialType.System_Char, syntaxNode, _diagnostics));
1833? _module.GetSpecialType(SpecialType.System_IntPtr, syntaxNode, _diagnostics.DiagnosticBag)
Compilation\BuiltInOperators.cs (54)
264case UnaryOperatorKind.SByte: opType = _compilation.GetSpecialType(SpecialType.System_SByte); break;
265case UnaryOperatorKind.Byte: opType = _compilation.GetSpecialType(SpecialType.System_Byte); break;
266case UnaryOperatorKind.Short: opType = _compilation.GetSpecialType(SpecialType.System_Int16); break;
267case UnaryOperatorKind.UShort: opType = _compilation.GetSpecialType(SpecialType.System_UInt16); break;
268case UnaryOperatorKind.Int: opType = _compilation.GetSpecialType(SpecialType.System_Int32); break;
269case UnaryOperatorKind.UInt: opType = _compilation.GetSpecialType(SpecialType.System_UInt32); break;
270case UnaryOperatorKind.Long: opType = _compilation.GetSpecialType(SpecialType.System_Int64); break;
271case UnaryOperatorKind.ULong: opType = _compilation.GetSpecialType(SpecialType.System_UInt64); break;
274case UnaryOperatorKind.Char: opType = _compilation.GetSpecialType(SpecialType.System_Char); break;
275case UnaryOperatorKind.Float: opType = _compilation.GetSpecialType(SpecialType.System_Single); break;
276case UnaryOperatorKind.Double: opType = _compilation.GetSpecialType(SpecialType.System_Double); break;
277case UnaryOperatorKind.Decimal: opType = _compilation.GetSpecialType(SpecialType.System_Decimal); break;
278case UnaryOperatorKind.Bool: opType = _compilation.GetSpecialType(SpecialType.System_Boolean); break;
693Debug.Assert(((NamedTypeSymbol)readonlySpanOfByte).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.Single().Type.SpecialType is SpecialType.System_Byte);
720TypeSymbol rightType = _compilation.GetSpecialType(SpecialType.System_Int32);
733return new BinaryOperatorSignature(kind, left, left, _compilation.GetSpecialType(SpecialType.System_Boolean));
748case BinaryOperatorKind.Int: return _compilation.GetSpecialType(SpecialType.System_Int32);
749case BinaryOperatorKind.UInt: return _compilation.GetSpecialType(SpecialType.System_UInt32);
750case BinaryOperatorKind.Long: return _compilation.GetSpecialType(SpecialType.System_Int64);
751case BinaryOperatorKind.ULong: return _compilation.GetSpecialType(SpecialType.System_UInt64);
754case BinaryOperatorKind.Float: return _compilation.GetSpecialType(SpecialType.System_Single);
755case BinaryOperatorKind.Double: return _compilation.GetSpecialType(SpecialType.System_Double);
756case BinaryOperatorKind.Decimal: return _compilation.GetSpecialType(SpecialType.System_Decimal);
757case BinaryOperatorKind.Bool: return _compilation.GetSpecialType(SpecialType.System_Boolean);
760return _compilation.GetSpecialType(SpecialType.System_Object);
763return _compilation.GetSpecialType(SpecialType.System_String);
780case BinaryOperatorKind.Int: return _compilation.GetSpecialType(SpecialType.System_Int32);
781case BinaryOperatorKind.UInt: return _compilation.GetSpecialType(SpecialType.System_UInt32);
782case BinaryOperatorKind.Long: return _compilation.GetSpecialType(SpecialType.System_Int64);
783case BinaryOperatorKind.ULong: return _compilation.GetSpecialType(SpecialType.System_UInt64);
786case BinaryOperatorKind.Float: return _compilation.GetSpecialType(SpecialType.System_Single);
787case BinaryOperatorKind.Double: return _compilation.GetSpecialType(SpecialType.System_Double);
788case BinaryOperatorKind.Decimal: return _compilation.GetSpecialType(SpecialType.System_Decimal);
789case BinaryOperatorKind.Bool: return _compilation.GetSpecialType(SpecialType.System_Boolean);
792return _compilation.GetSpecialType(SpecialType.System_String);
795return _compilation.GetSpecialType(SpecialType.System_Object);
812case BinaryOperatorKind.Int: return _compilation.GetSpecialType(SpecialType.System_Int32);
813case BinaryOperatorKind.UInt: return _compilation.GetSpecialType(SpecialType.System_UInt32);
814case BinaryOperatorKind.Long: return _compilation.GetSpecialType(SpecialType.System_Int64);
815case BinaryOperatorKind.ULong: return _compilation.GetSpecialType(SpecialType.System_UInt64);
818case BinaryOperatorKind.Float: return _compilation.GetSpecialType(SpecialType.System_Single);
819case BinaryOperatorKind.Double: return _compilation.GetSpecialType(SpecialType.System_Double);
820case BinaryOperatorKind.Decimal: return _compilation.GetSpecialType(SpecialType.System_Decimal);
821case BinaryOperatorKind.Bool: return _compilation.GetSpecialType(SpecialType.System_Boolean);
822case BinaryOperatorKind.Object: return _compilation.GetSpecialType(SpecialType.System_Object);
826return _compilation.GetSpecialType(SpecialType.System_String);
839BinaryOperatorKind.Int => _compilation.GetSpecialType(SpecialType.System_Int32),
840BinaryOperatorKind.UInt => _compilation.GetSpecialType(SpecialType.System_UInt32),
841BinaryOperatorKind.Long => _compilation.GetSpecialType(SpecialType.System_Int64),
842BinaryOperatorKind.ULong => _compilation.GetSpecialType(SpecialType.System_UInt64),
845BinaryOperatorKind.Float => _compilation.GetSpecialType(SpecialType.System_Single),
846BinaryOperatorKind.Double => _compilation.GetSpecialType(SpecialType.System_Double),
847BinaryOperatorKind.Decimal => _compilation.GetSpecialType(SpecialType.System_Decimal),
848BinaryOperatorKind.Bool => _compilation.GetSpecialType(SpecialType.System_Boolean),
Emitter\Model\PEAssemblyBuilder.cs (9)
381[new TypedConstant(Compilation.GetSpecialType(SpecialType.System_String), TypedConstantKind.Primitive, markerName)],
606GetSpecialType(SpecialType.System_Byte, diagnostics));
614GetSpecialType(SpecialType.System_Byte, diagnostics));
622GetSpecialType(SpecialType.System_Boolean, diagnostics));
630GetSpecialType(SpecialType.System_Boolean, diagnostics));
645GetSpecialType(SpecialType.System_Int32, diagnostics));
653int32Type: GetSpecialType(SpecialType.System_Int32, diagnostics));
661GetSpecialType(SpecialType.System_String, diagnostics));
741private NamedTypeSymbol GetSpecialType(SpecialType type, BindingDiagnosticBag diagnostics)
Emitter\Model\PEModuleBuilder.cs (19)
966private NamedTypeSymbol GetUntranslatedSpecialType(SpecialType specialType, SyntaxNode syntaxNodeOpt, DiagnosticBag diagnostics)
983internal sealed override Cci.INamedTypeReference GetSpecialType(SpecialType specialType, SyntaxNode syntaxNodeOpt, DiagnosticBag diagnostics)
1006return namedType.SpecialType == (SpecialType)platformType;
1236if ((object)declaredBase != null && declaredBase.SpecialType == SpecialType.System_ValueType)
1594return GetSpecialType(SpecialType.System_Object, syntaxNodeOpt, diagnostics);
1639return new SynthesizedPrivateImplementationDetailsStaticConstructor(GetPrivateImplClass(syntaxOpt, diagnostics), GetUntranslatedSpecialType(SpecialType.System_Void, syntaxOpt, diagnostics)).GetCciAdapter();
1741NamedTypeSymbol byteType = Compilation.GetSpecialType(SpecialType.System_Byte);
1762NamedTypeSymbol byteType = Compilation.GetSpecialType(SpecialType.System_Byte);
1785ImmutableArray.Create(new TypedConstant(Compilation.GetSpecialType(SpecialType.System_Byte), TypedConstantKind.Primitive, value)));
1825NamedTypeSymbol booleanType = Compilation.GetSpecialType(SpecialType.System_Boolean);
1927[new TypedConstant(Compilation.GetSpecialType(SpecialType.System_String), TypedConstantKind.Primitive, markerName)]);
2018TypeSymbol returnType = factory.SpecialType(SpecialType.System_Void);
2019TypeSymbol unmatchedValueType = factory.SpecialType(SpecialType.System_Object);
2065TypeSymbol returnType = factory.SpecialType(SpecialType.System_Void);
2085TypeSymbol returnType = factory.SpecialType(SpecialType.System_Void);
2099Debug.Assert(intType.SpecialType == SpecialType.System_Int32);
2170Debug.Assert(intType.SpecialType == SpecialType.System_Int32);
2187Debug.Assert(intType.SpecialType == SpecialType.System_Int32);
2203Debug.Assert(intType.SpecialType == SpecialType.System_Int32);
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (116)
97Debug.Assert(byteType.SpecialType == SpecialType.System_Byte);
143Debug.Assert(byteArray.ElementType.SpecialType == SpecialType.System_Byte);
226if (type.SpecialType != SpecialType.System_Double && type.SpecialType != SpecialType.System_Single)
439if (rewrittenType.SpecialType == SpecialType.System_Decimal || rewrittenOperand.Type.SpecialType == SpecialType.System_Decimal)
502if (rewrittenType.SpecialType == SpecialType.System_Decimal)
509else if (rewrittenOperand.Type.SpecialType == SpecialType.System_Decimal)
609createSpan = _factory.ModuleBuilderOpt.EnsureInlineArrayAsReadOnlySpanExists(syntax, spanType.OriginalDefinition, _factory.SpecialType(SpecialType.System_Int32), _diagnostics.DiagnosticBag);
614createSpan = _factory.ModuleBuilderOpt.EnsureInlineArrayAsSpanExists(syntax, spanType.OriginalDefinition, _factory.SpecialType(SpecialType.System_Int32), _diagnostics.DiagnosticBag);
777SpecialType GetUnderlyingSpecialType(TypeSymbol type) =>
780bool IsInRange(SpecialType type, SpecialType low, SpecialType high) =>
783SpecialType sourceST = GetUnderlyingSpecialType(source);
784SpecialType targetST = GetUnderlyingSpecialType(target);
789IsInRange(sourceST, SpecialType.System_Char, SpecialType.System_Double) &&
790IsInRange(targetST, SpecialType.System_Char, SpecialType.System_UInt64);
840rewrittenOperand.Type.SpecialType != SpecialType.System_Decimal &&
841rewrittenOperand.Type.SpecialType != SpecialType.System_DateTime)
1174if (!TypeSymbol.Equals(typeFrom, typeTo, TypeCompareKind.ConsiderEverything2) && (typeFrom.SpecialType == SpecialType.System_Decimal || typeTo.SpecialType == SpecialType.System_Decimal))
1657SpecialType t0Type = t0.IsEnumType() ? t0.GetEnumUnderlyingType()!.SpecialType : t0.SpecialType;
1658SpecialType s0Type = s0.IsEnumType() ? s0.GetEnumUnderlyingType()!.SpecialType : s0.SpecialType;
1660if (t0Type == SpecialType.System_IntPtr)
1669case SpecialType.System_Byte:
1670case SpecialType.System_SByte:
1671case SpecialType.System_Int16:
1672case SpecialType.System_UInt16:
1673case SpecialType.System_Char:
1674case SpecialType.System_Int32:
1676case SpecialType.System_UInt32:
1677case SpecialType.System_UInt64:
1678case SpecialType.System_Int64:
1679case SpecialType.System_Single:
1680case SpecialType.System_Double:
1681case SpecialType.System_Decimal:
1685else if (t0Type == SpecialType.System_UIntPtr)
1694case SpecialType.System_Byte:
1695case SpecialType.System_UInt16:
1696case SpecialType.System_Char:
1697case SpecialType.System_UInt32:
1699case SpecialType.System_SByte:
1700case SpecialType.System_Int16:
1701case SpecialType.System_Int32:
1702case SpecialType.System_UInt64:
1703case SpecialType.System_Int64:
1704case SpecialType.System_Single:
1705case SpecialType.System_Double:
1706case SpecialType.System_Decimal:
1710else if (s0Type == SpecialType.System_IntPtr)
1719case SpecialType.System_Byte:
1720case SpecialType.System_SByte:
1721case SpecialType.System_Int16:
1722case SpecialType.System_UInt16:
1723case SpecialType.System_Char:
1724case SpecialType.System_UInt32:
1725case SpecialType.System_Int32:
1727case SpecialType.System_UInt64:
1728case SpecialType.System_Int64:
1729case SpecialType.System_Single:
1730case SpecialType.System_Double:
1731case SpecialType.System_Decimal:
1735else if (s0Type == SpecialType.System_UIntPtr)
1744case SpecialType.System_SByte:
1745case SpecialType.System_Int16:
1746case SpecialType.System_Int32:
1747case SpecialType.System_Byte:
1748case SpecialType.System_UInt16:
1749case SpecialType.System_Char:
1750case SpecialType.System_UInt32:
1752case SpecialType.System_UInt64:
1753case SpecialType.System_Int64:
1754case SpecialType.System_Single:
1755case SpecialType.System_Double:
1756case SpecialType.System_Decimal:
1767if (typeFrom.SpecialType == SpecialType.System_Decimal)
1772case SpecialType.System_Char: return SpecialMember.System_Decimal__op_Explicit_ToChar;
1773case SpecialType.System_SByte: return SpecialMember.System_Decimal__op_Explicit_ToSByte;
1774case SpecialType.System_Byte: return SpecialMember.System_Decimal__op_Explicit_ToByte;
1775case SpecialType.System_Int16: return SpecialMember.System_Decimal__op_Explicit_ToInt16;
1776case SpecialType.System_UInt16: return SpecialMember.System_Decimal__op_Explicit_ToUInt16;
1777case SpecialType.System_Int32: return SpecialMember.System_Decimal__op_Explicit_ToInt32;
1778case SpecialType.System_UInt32: return SpecialMember.System_Decimal__op_Explicit_ToUInt32;
1779case SpecialType.System_Int64: return SpecialMember.System_Decimal__op_Explicit_ToInt64;
1780case SpecialType.System_UInt64: return SpecialMember.System_Decimal__op_Explicit_ToUInt64;
1781case SpecialType.System_Single: return SpecialMember.System_Decimal__op_Explicit_ToSingle;
1782case SpecialType.System_Double: return SpecialMember.System_Decimal__op_Explicit_ToDouble;
1792case SpecialType.System_Char: return SpecialMember.System_Decimal__op_Implicit_FromChar;
1793case SpecialType.System_SByte: return SpecialMember.System_Decimal__op_Implicit_FromSByte;
1794case SpecialType.System_Byte: return SpecialMember.System_Decimal__op_Implicit_FromByte;
1795case SpecialType.System_Int16: return SpecialMember.System_Decimal__op_Implicit_FromInt16;
1796case SpecialType.System_UInt16: return SpecialMember.System_Decimal__op_Implicit_FromUInt16;
1797case SpecialType.System_Int32: return SpecialMember.System_Decimal__op_Implicit_FromInt32;
1798case SpecialType.System_UInt32: return SpecialMember.System_Decimal__op_Implicit_FromUInt32;
1799case SpecialType.System_Int64: return SpecialMember.System_Decimal__op_Implicit_FromInt64;
1800case SpecialType.System_UInt64: return SpecialMember.System_Decimal__op_Implicit_FromUInt64;
1801case SpecialType.System_Single: return SpecialMember.System_Decimal__op_Explicit_FromSingle;
1802case SpecialType.System_Double: return SpecialMember.System_Decimal__op_Explicit_FromDouble;
1811Debug.Assert(fromType.SpecialType == SpecialType.System_Decimal || toType.SpecialType == SpecialType.System_Decimal);
1813if (fromType.SpecialType == SpecialType.System_Decimal)
1817case SpecialType.System_IntPtr:
1818case SpecialType.System_UIntPtr:
1819operand = RewriteDecimalConversionCore(syntax, operand, fromType, get64BitType(_compilation, signed: toType.SpecialType == SpecialType.System_IntPtr), isImplicit, constantValueOpt);
1827case SpecialType.System_IntPtr:
1828case SpecialType.System_UIntPtr:
1829operand = MakeConversionNode(operand, get64BitType(_compilation, signed: fromType.SpecialType == SpecialType.System_IntPtr), @checked);
1837static TypeSymbol get64BitType(CSharpCompilation compilation, bool signed) => compilation.GetSpecialType(signed ? SpecialType.System_Int64 : SpecialType.System_UInt64);
1927if (fromType.SpecialType == SpecialType.System_Decimal || toType.SpecialType == SpecialType.System_Decimal)
1942if (fromType.SpecialType == SpecialType.System_Decimal)
1955else if (toType.SpecialType == SpecialType.System_Decimal)
Lowering\LocalRewriter\LocalRewriter_Literal.cs (15)
30Debug.Assert(type is { SpecialType: SpecialType.System_Decimal });
38Debug.Assert(type is { SpecialType: SpecialType.System_DateTime });
73curMethod.ContainingType.SpecialType != SpecialType.System_Decimal) &&
100arguments.Add(new BoundLiteral(syntax, ConstantValue.Create((int)value), _compilation.GetSpecialType(SpecialType.System_Int32)));
106arguments.Add(new BoundLiteral(syntax, ConstantValue.Create((uint)value), _compilation.GetSpecialType(SpecialType.System_UInt32)));
112arguments.Add(new BoundLiteral(syntax, ConstantValue.Create((long)value), _compilation.GetSpecialType(SpecialType.System_Int64)));
118arguments.Add(new BoundLiteral(syntax, ConstantValue.Create((ulong)value), _compilation.GetSpecialType(SpecialType.System_UInt64)));
124arguments.Add(new BoundLiteral(syntax, ConstantValue.Create(low), _compilation.GetSpecialType(SpecialType.System_Int32)));
125arguments.Add(new BoundLiteral(syntax, ConstantValue.Create(mid), _compilation.GetSpecialType(SpecialType.System_Int32)));
126arguments.Add(new BoundLiteral(syntax, ConstantValue.Create(high), _compilation.GetSpecialType(SpecialType.System_Int32)));
127arguments.Add(new BoundLiteral(syntax, ConstantValue.Create(isNegative), _compilation.GetSpecialType(SpecialType.System_Boolean)));
128arguments.Add(new BoundLiteral(syntax, ConstantValue.Create(scale), _compilation.GetSpecialType(SpecialType.System_Byte)));
133Debug.Assert(ctor.ContainingType.SpecialType == SpecialType.System_Decimal);
148arguments.Add(new BoundLiteral(syntax, ConstantValue.Create(constantValue.DateTimeValue.Ticks), _compilation.GetSpecialType(SpecialType.System_Int64)));
152Debug.Assert(ctor.ContainingType.SpecialType == SpecialType.System_DateTime);
Lowering\LocalRewriter\LocalRewriter.PatternLocalRewriter.cs (16)
196Debug.Assert(method.ReturnType.SpecialType == SpecialType.System_Boolean);
219inputType = _factory.SpecialType(SpecialType.System_Object);
262Debug.Assert(e.Property.GetMethod.Parameters[0].Type.SpecialType == SpecialType.System_Int32);
402TypeSymbol objectType = _factory.SpecialType(SpecialType.System_Object);
403var operandType = new PointerTypeSymbol(TypeWithAnnotations.Create(_factory.SpecialType(SpecialType.System_Void)));
409_factory.SpecialType(SpecialType.System_Boolean),
432if (input.Type.SpecialType == SpecialType.System_Double && double.IsNaN(value.DoubleValue) ||
433input.Type.SpecialType == SpecialType.System_Single && float.IsNaN(value.SingleValue))
441if (operatorKind.OperandTypes() == BinaryOperatorKind.Int && comparisonType.SpecialType != SpecialType.System_Int32)
446SpecialType.System_Byte => true,
447SpecialType.System_SByte => true,
448SpecialType.System_Int16 => true,
449SpecialType.System_UInt16 => true,
452comparisonType = _factory.SpecialType(SpecialType.System_Int32);
463return this._localRewriter.MakeBinaryOperator(_factory.Syntax, operatorKind, input, literal, _factory.SpecialType(SpecialType.System_Boolean), method: null, constrainedToTypeOpt: null);
474.Construct(_factory.SpecialType(SpecialType.System_Char));
Lowering\SyntheticBoundNodeFactory.cs (41)
301public NamedTypeSymbol SpecialType(SpecialType st)
664return new BoundIsOperator(this.Syntax, operand, Type(type), c.Kind, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean)) { WasCompilerGenerated = true };
669Debug.Assert(left.Type?.SpecialType == CodeAnalysis.SpecialType.System_Boolean);
670Debug.Assert(right.Type?.SpecialType == CodeAnalysis.SpecialType.System_Boolean);
671return Binary(BinaryOperatorKind.LogicalBoolAnd, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean), left, right);
676Debug.Assert(left.Type?.SpecialType == CodeAnalysis.SpecialType.System_Boolean);
677Debug.Assert(right.Type?.SpecialType == CodeAnalysis.SpecialType.System_Boolean);
678return Binary(BinaryOperatorKind.LogicalBoolOr, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean), left, right);
683return Binary(BinaryOperatorKind.IntEqual, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean), left, right);
688return Binary(BinaryOperatorKind.ObjectEqual, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean), left, right);
693var objectType = SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Object);
714var objectType = SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Object);
735return Binary(BinaryOperatorKind.ObjectNotEqual, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean), left, right);
740return Binary(BinaryOperatorKind.IntNotEqual, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean), left, right);
745return Binary(BinaryOperatorKind.IntLessThan, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean), left, right);
750return Binary(BinaryOperatorKind.IntGreaterThanOrEqual, SpecialType(CodeAnalysis.SpecialType.System_Boolean), left, right);
755return Binary(BinaryOperatorKind.IntSubtraction, SpecialType(CodeAnalysis.SpecialType.System_Int32), left, right);
760return Binary(BinaryOperatorKind.IntMultiplication, SpecialType(CodeAnalysis.SpecialType.System_Int32), left, right);
765return new BoundLiteral(Syntax, ConstantValue.Create(value), SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Byte)) { WasCompilerGenerated = true };
770return new BoundLiteral(Syntax, ConstantValue.Create(value), SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Int32)) { WasCompilerGenerated = true };
778return new BoundLiteral(Syntax, ConstantValue.Create(value), SpecialType(Microsoft.CodeAnalysis.SpecialType.System_UInt32)) { WasCompilerGenerated = true };
829case { SpecialType: CodeAnalysis.SpecialType.System_Double }:
832case { SpecialType: CodeAnalysis.SpecialType.System_Single }:
1125Debug.Assert(ex.Type is { SpecialType: CodeAnalysis.SpecialType.System_Int32 });
1187return new BoundLiteral(Syntax, ConstantValue.Create(value), SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean)) { WasCompilerGenerated = true };
1199return new BoundLiteral(Syntax, stringConst, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_String)) { WasCompilerGenerated = true };
1210return new BoundLiteral(Syntax, charConst, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Char)) { WasCompilerGenerated = true };
1221return new BoundArrayLength(Syntax, array, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Int32));
1352return new BoundSizeOfOperator(Syntax, Type(type), Binder.GetConstantSizeOf(type), SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Int32)) { WasCompilerGenerated = true };
1378SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Int32))
1388SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Int32))
1398SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Int32))
1406SpecialType(Microsoft.CodeAnalysis.SpecialType.System_UInt64))
1421return new BoundModuleVersionIdString(Syntax, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_String)) { WasCompilerGenerated = true };
1430=> new BoundThrowIfModuleCancellationRequested(Syntax, SpecialType(CodeAnalysis.SpecialType.System_Void)) { WasCompilerGenerated = true };
1439SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Int32))
1451SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Int32))
1662Debug.Assert(expression is { Type: { SpecialType: CodeAnalysis.SpecialType.System_Boolean } });
1795TypeSymbol boolType = Compilation.GetSpecialType(CodeAnalysis.SpecialType.System_Boolean);
1809TypeSymbol objectType = SpecialType(CodeAnalysis.SpecialType.System_Object);
1862Debug.Assert(returnType.SpecialType == CodeAnalysis.SpecialType.System_Boolean);
Symbols\Source\SourceDelegateMethodSymbol.cs (7)
61var voidType = TypeWithAnnotations.Create(binder.GetSpecialType(SpecialType.System_Void, diagnostics, syntax));
63var objectType = TypeWithAnnotations.Create(binder.GetSpecialType(SpecialType.System_Object, diagnostics, syntax));
64var intPtrType = TypeWithAnnotations.Create(binder.GetSpecialType(SpecialType.System_IntPtr, diagnostics, syntax));
81if (binder.Compilation.GetSpecialType(SpecialType.System_IAsyncResult).TypeKind != TypeKind.Error &&
82binder.Compilation.GetSpecialType(SpecialType.System_AsyncCallback).TypeKind != TypeKind.Error &&
86var iAsyncResultType = TypeWithAnnotations.Create(binder.GetSpecialType(SpecialType.System_IAsyncResult, diagnostics, syntax));
87var asyncCallbackType = TypeWithAnnotations.Create(binder.GetSpecialType(SpecialType.System_AsyncCallback, diagnostics, syntax));
Symbols\Source\SourceNamedTypeSymbol.cs (15)
948string? name = attributeData.GetConstructorArgument<string>(0, SpecialType.System_String);
1022int length = attributeData.GetConstructorArgument<int>(0, SpecialType.System_Int32);
1042string? methodName = attributeData.GetConstructorArgument<string>(1, SpecialType.System_String);
1076Debug.Assert(this.SpecialType == SpecialType.System_Object || this.DeclaringCompilation.IsAttributeType(this));
1209string? methodName = attribute.CommonConstructorArguments[1].DecodeValue<string>(SpecialType.System_String);
1221int length = attribute.CommonConstructorArguments[0].DecodeValue<int>(SpecialType.System_Int32);
1418string name = attribute.GetConstructorArgument<string>(0, SpecialType.System_String);
1661if ((object)baseType != null && baseType.SpecialType != SpecialType.System_Object)
1766new TypedConstant(compilation.GetSpecialType(SpecialType.System_String), TypedConstantKind.Primitive, PEModule.ByRefLikeMarker), // message
1767new TypedConstant(compilation.GetSpecialType(SpecialType.System_Boolean), TypedConstantKind.Primitive, true)), // error=true
1772ImmutableArray.Create(new TypedConstant(compilation.GetSpecialType(SpecialType.System_String), TypedConstantKind.Primitive, nameof(CompilerFeatureRequiredFeatures.RefStructs))),
1785var defaultMemberNameConstant = new TypedConstant(compilation.GetSpecialType(SpecialType.System_String), TypedConstantKind.Primitive, defaultMemberName);
1914Debug.Assert(this.SpecialType == SpecialType.System_IntPtr || this.SpecialType == SpecialType.System_UIntPtr);
2033(type.SpecialType == SpecialType.System_Int32 ||
Symbols\Synthesized\SynthesizedSimpleProgramEntryPointSymbol.cs (4)
45_returnType = Binder.GetSpecialType(compilation, SpecialType.System_Void, NoLocation.Singleton, diagnostics);
49Construct(Binder.GetSpecialType(compilation, SpecialType.System_Int32, NoLocation.Singleton, diagnostics));
52_returnType = Binder.GetSpecialType(compilation, SpecialType.System_Int32, NoLocation.Singleton, diagnostics);
59TypeWithAnnotations.Create(Binder.GetSpecialType(compilation, SpecialType.System_String, NoLocation.Singleton, diagnostics)))), 0, RefKind.None, "args"));
Utilities\ValueSetFactory.cs (17)
33public static IConstantValueSetFactory? ForSpecialType(SpecialType specialType, bool isNative = false)
37SpecialType.System_Byte => ForByte,
38SpecialType.System_SByte => ForSByte,
39SpecialType.System_Char => ForChar,
40SpecialType.System_Int16 => ForShort,
41SpecialType.System_UInt16 => ForUShort,
42SpecialType.System_Int32 => ForInt,
43SpecialType.System_UInt32 => ForUInt,
44SpecialType.System_Int64 => ForLong,
45SpecialType.System_UInt64 => ForULong,
46SpecialType.System_Boolean => ForBool,
47SpecialType.System_Single => ForFloat,
48SpecialType.System_Double => ForDouble,
49SpecialType.System_String => ForString,
50SpecialType.System_Decimal => ForDecimal,
51SpecialType.System_IntPtr when isNative => ForNint,
52SpecialType.System_UIntPtr when isNative => ForNuint,
Completion\Providers\DefaultArgumentProvider.cs (13)
39SpecialType.System_Boolean => "false",
40SpecialType.System_Char => @"'\\0'",
41SpecialType.System_Byte => "(byte)0",
42SpecialType.System_SByte => "(sbyte)0",
43SpecialType.System_Int16 => "(short)0",
44SpecialType.System_UInt16 => "(ushort)0",
45SpecialType.System_Int32 => "0",
46SpecialType.System_UInt32 => "0U",
47SpecialType.System_Int64 => "0L",
48SpecialType.System_UInt64 => "0UL",
49SpecialType.System_Decimal => "0.0m",
50SpecialType.System_Single => "0.0f",
51SpecialType.System_Double => "0.0",
ReverseForStatement\CSharpReverseForStatementCodeRefactoringProvider.cs (4)
96SpecialType.System_Byte => IsUnsignedBoundary(startValue, endValue, byte.MaxValue),
97SpecialType.System_UInt16 => IsUnsignedBoundary(startValue, endValue, ushort.MaxValue),
98SpecialType.System_UInt32 => IsUnsignedBoundary(startValue, endValue, uint.MaxValue),
99SpecialType.System_UInt64 => IsUnsignedBoundary(startValue, endValue, ulong.MaxValue),
Microsoft.CodeQuality.Analyzers\Maintainability\UseCrossPlatformIntrinsicsAnalyzer.cs (26)
103(invocation.Arguments[1].Parameter?.Type.SpecialType is SpecialType.System_Byte or SpecialType.System_Int32) &&
145AddBinaryOperatorMethods(methodSymbols, "AddScalar", armAdvSimdTypeSymbol, RuleKind.op_Addition, [SpecialType.System_Int64, SpecialType.System_UInt64, SpecialType.System_Double]);
147AddBinaryOperatorMethods(methodSymbols, "DivideScalar", armAdvSimdTypeSymbol, RuleKind.op_Division, [SpecialType.System_Double]);
149AddBinaryOperatorMethods(methodSymbols, "MultiplyScalar", armAdvSimdTypeSymbol, RuleKind.op_Multiply, [SpecialType.System_Double]);
152AddBinaryOperatorMethods(methodSymbols, "SubtractScalar", armAdvSimdTypeSymbol, RuleKind.op_Subtraction, [SpecialType.System_Int64, SpecialType.System_UInt64, SpecialType.System_Double]);
156AddShiftOperatorMethods(methodSymbols, "ShiftLeftLogicalScalar", armAdvSimdTypeSymbol, RuleKind.op_LeftShift, [SpecialType.System_Int64, SpecialType.System_UInt64]);
158AddShiftOperatorMethods(methodSymbols, "ShiftRightArithmeticScalar", armAdvSimdTypeSymbol, RuleKind.op_RightShift, [SpecialType.System_Int64, SpecialType.System_UInt64]);
160AddShiftOperatorMethods(methodSymbols, "ShiftRightLogicalScalar", armAdvSimdTypeSymbol, RuleKind.op_UnsignedRightShift, [SpecialType.System_Int64, SpecialType.System_UInt64]);
163AddUnaryOperatorMethods(methodSymbols, "NegateScalar", armAdvSimdTypeSymbol, RuleKind.op_UnaryNegation, [SpecialType.System_Double]);
175AddUnaryOperatorMethods(methodSymbols, "NegateScalar", armAdvSimdArm64TypeSymbol, RuleKind.op_UnaryNegation, [SpecialType.System_Int64]);
250AddBinaryOperatorMethods(methodSymbols, "Multiply", x86Avx512FTypeSymbol, RuleKind.op_Multiply, [SpecialType.System_Single, SpecialType.System_Double]);
282AddBinaryOperatorMethods(methodSymbols, "Multiply", x86Sse2TypeSymbol, RuleKind.op_Multiply, [SpecialType.System_Double]);
303static void AddBinaryOperatorMethods(Dictionary<IMethodSymbol, RuleKind> methodSymbols, string name, INamedTypeSymbol typeSymbol, RuleKind ruleKind, params SpecialType[] supportedTypes)
321static void AddShiftOperatorMethods(Dictionary<IMethodSymbol, RuleKind> methodSymbols, string name, INamedTypeSymbol typeSymbol, RuleKind ruleKind, params SpecialType[] supportedTypes)
334(m.Parameters[1].Type.SpecialType is SpecialType.System_Byte or SpecialType.System_Int32) &&
340static void AddUnaryOperatorMethods(Dictionary<IMethodSymbol, RuleKind> methodSymbols, string name, INamedTypeSymbol typeSymbol, RuleKind ruleKind, params SpecialType[] supportedTypes)
Microsoft.NetCore.Analyzers\Performance\ConstantExpectedAnalyzer.cs (41)
263SpecialType.System_Char => true,
264SpecialType.System_Byte => true,
265SpecialType.System_UInt16 => true,
266SpecialType.System_UInt32 => true,
267SpecialType.System_UInt64 => true,
268SpecialType.System_SByte => true,
269SpecialType.System_Int16 => true,
270SpecialType.System_Int32 => true,
271SpecialType.System_Int64 => true,
272SpecialType.System_Single => true,
273SpecialType.System_Double => true,
274SpecialType.System_Boolean => true,
275SpecialType.System_String => true,
276SpecialType.None when type.TypeKind == TypeKind.TypeParameter => true,
300case SpecialType.System_Char:
302case SpecialType.System_Byte:
304case SpecialType.System_UInt16:
306case SpecialType.System_UInt32:
308case SpecialType.System_UInt64:
310case SpecialType.System_SByte:
312case SpecialType.System_Int16:
314case SpecialType.System_Int32:
316case SpecialType.System_Int64:
318case SpecialType.System_Single:
320case SpecialType.System_Double:
322case SpecialType.System_Boolean:
324case SpecialType.System_String:
352case SpecialType.System_Char:
354case SpecialType.System_Byte:
356case SpecialType.System_UInt16:
358case SpecialType.System_UInt32:
360case SpecialType.System_UInt64:
362case SpecialType.System_SByte:
364case SpecialType.System_Int16:
366case SpecialType.System_Int32:
368case SpecialType.System_Int64:
370case SpecialType.System_Single:
372case SpecialType.System_Double:
374case SpecialType.System_Boolean:
376case SpecialType.System_String:
378case SpecialType.None when parameterSymbol.Type.TypeKind == TypeKind.TypeParameter:
Microsoft.NetCore.Analyzers\Performance\UseCountProperly.cs (22)
389if (type != null && !TypeContainsVisibleProperty(context, type, propertyName, SpecialType.System_Int32, SpecialType.System_UInt64, out _))
392if (!TypeContainsVisibleProperty(context, type, propertyName, SpecialType.System_Int32, SpecialType.System_UInt64, out _))
505TypeContainsVisibleProperty(context, type, IsEmpty, SpecialType.System_Boolean, out ISymbol? isEmptyPropertySymbol) &&
510else if (TypeContainsVisibleProperty(context, type, Length, SpecialType.System_Int32, SpecialType.System_UInt64, out _))
514else if (TypeContainsVisibleProperty(context, type, Count, SpecialType.System_Int32, SpecialType.System_UInt64, out _))
535TypeContainsVisibleProperty(context, type, IsEmpty, SpecialType.System_Boolean, out ISymbol? isEmptyPropertySymbol) &&
558&& IsInRangeInclusive((uint)methodSymbol.ContainingType.SpecialType, (uint)SpecialType.System_Int32, (uint)SpecialType.System_UInt64);
661private static bool TypeContainsVisibleProperty(OperationAnalysisContext context, ITypeSymbol type, string propertyName, SpecialType propertyType, out ISymbol? propertySymbol)
664private static bool TypeContainsVisibleProperty(OperationAnalysisContext context, ITypeSymbol type, string propertyName, SpecialType lowerBound, SpecialType upperBound, out ISymbol? propertySymbol)
699OperationAnalysisContext context, ITypeSymbol type, string propertyName, SpecialType lowerBound, SpecialType upperBound,
728case SpecialType.System_Int32:
729case SpecialType.System_Int64:
730case SpecialType.System_UInt32:
731case SpecialType.System_UInt64:
732case SpecialType.System_Object:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\PredefinedTypeExtensions.cs (41)
13public static SpecialType ToSpecialType(this PredefinedType predefinedType)
16PredefinedType.Object => SpecialType.System_Object,
17PredefinedType.Void => SpecialType.System_Void,
18PredefinedType.Boolean => SpecialType.System_Boolean,
19PredefinedType.Char => SpecialType.System_Char,
20PredefinedType.SByte => SpecialType.System_SByte,
21PredefinedType.Byte => SpecialType.System_Byte,
22PredefinedType.Int16 => SpecialType.System_Int16,
23PredefinedType.UInt16 => SpecialType.System_UInt16,
24PredefinedType.Int32 => SpecialType.System_Int32,
25PredefinedType.UInt32 => SpecialType.System_UInt32,
26PredefinedType.Int64 => SpecialType.System_Int64,
27PredefinedType.UInt64 => SpecialType.System_UInt64,
28PredefinedType.Decimal => SpecialType.System_Decimal,
29PredefinedType.Single => SpecialType.System_Single,
30PredefinedType.Double => SpecialType.System_Double,
31PredefinedType.String => SpecialType.System_String,
32PredefinedType.DateTime => SpecialType.System_DateTime,
33PredefinedType.IntPtr => SpecialType.System_IntPtr,
34PredefinedType.UIntPtr => SpecialType.System_UIntPtr,
35_ => SpecialType.None,
38public static PredefinedType ToPredefinedType(this SpecialType specialType)
41SpecialType.System_Object => PredefinedType.Object,
42SpecialType.System_Void => PredefinedType.Void,
43SpecialType.System_Boolean => PredefinedType.Boolean,
44SpecialType.System_Char => PredefinedType.Char,
45SpecialType.System_SByte => PredefinedType.SByte,
46SpecialType.System_Byte => PredefinedType.Byte,
47SpecialType.System_Int16 => PredefinedType.Int16,
48SpecialType.System_UInt16 => PredefinedType.UInt16,
49SpecialType.System_Int32 => PredefinedType.Int32,
50SpecialType.System_UInt32 => PredefinedType.UInt32,
51SpecialType.System_Int64 => PredefinedType.Int64,
52SpecialType.System_UInt64 => PredefinedType.UInt64,
53SpecialType.System_Decimal => PredefinedType.Decimal,
54SpecialType.System_Single => PredefinedType.Single,
55SpecialType.System_Double => PredefinedType.Double,
56SpecialType.System_String => PredefinedType.String,
57SpecialType.System_DateTime => PredefinedType.DateTime,
58SpecialType.System_IntPtr => PredefinedType.IntPtr,
59SpecialType.System_UIntPtr => PredefinedType.UIntPtr,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (12)
83public static bool IsSpecialType([NotNullWhen(true)] ITypeSymbol? type, SpecialType specialType)
136SpecialType.System_SByte => value is sbyte,
137SpecialType.System_Byte => value is byte,
138SpecialType.System_Int16 => value is short,
139SpecialType.System_UInt16 => value is ushort,
140SpecialType.System_Int32 => value is int,
141SpecialType.System_UInt32 => value is uint,
142SpecialType.System_Int64 => value is long,
143SpecialType.System_UInt64 => value is ulong,
144SpecialType.System_Decimal => value is decimal,
145SpecialType.System_Single => value is float,
146SpecialType.System_Double => value is double,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractNamedTypeSymbol.cs (1)
29SpecialType specialType,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationArrayTypeSymbol.cs (1)
10internal sealed class CodeGenerationArrayTypeSymbol(ITypeSymbol elementType, int rank, NullableAnnotation nullableAnnotation) : CodeGenerationTypeSymbol(null, null, default, Accessibility.NotApplicable, default, string.Empty, SpecialType.None, nullableAnnotation), IArrayTypeSymbol
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationNamedTypeSymbol.cs (1)
34SpecialType specialType,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\PredefinedTypeExtensions.cs (41)
13public static SpecialType ToSpecialType(this PredefinedType predefinedType)
16PredefinedType.Object => SpecialType.System_Object,
17PredefinedType.Void => SpecialType.System_Void,
18PredefinedType.Boolean => SpecialType.System_Boolean,
19PredefinedType.Char => SpecialType.System_Char,
20PredefinedType.SByte => SpecialType.System_SByte,
21PredefinedType.Byte => SpecialType.System_Byte,
22PredefinedType.Int16 => SpecialType.System_Int16,
23PredefinedType.UInt16 => SpecialType.System_UInt16,
24PredefinedType.Int32 => SpecialType.System_Int32,
25PredefinedType.UInt32 => SpecialType.System_UInt32,
26PredefinedType.Int64 => SpecialType.System_Int64,
27PredefinedType.UInt64 => SpecialType.System_UInt64,
28PredefinedType.Decimal => SpecialType.System_Decimal,
29PredefinedType.Single => SpecialType.System_Single,
30PredefinedType.Double => SpecialType.System_Double,
31PredefinedType.String => SpecialType.System_String,
32PredefinedType.DateTime => SpecialType.System_DateTime,
33PredefinedType.IntPtr => SpecialType.System_IntPtr,
34PredefinedType.UIntPtr => SpecialType.System_UIntPtr,
35_ => SpecialType.None,
38public static PredefinedType ToPredefinedType(this SpecialType specialType)
41SpecialType.System_Object => PredefinedType.Object,
42SpecialType.System_Void => PredefinedType.Void,
43SpecialType.System_Boolean => PredefinedType.Boolean,
44SpecialType.System_Char => PredefinedType.Char,
45SpecialType.System_SByte => PredefinedType.SByte,
46SpecialType.System_Byte => PredefinedType.Byte,
47SpecialType.System_Int16 => PredefinedType.Int16,
48SpecialType.System_UInt16 => PredefinedType.UInt16,
49SpecialType.System_Int32 => PredefinedType.Int32,
50SpecialType.System_UInt32 => PredefinedType.UInt32,
51SpecialType.System_Int64 => PredefinedType.Int64,
52SpecialType.System_UInt64 => PredefinedType.UInt64,
53SpecialType.System_Decimal => PredefinedType.Decimal,
54SpecialType.System_Single => PredefinedType.Single,
55SpecialType.System_Double => PredefinedType.Double,
56SpecialType.System_String => PredefinedType.String,
57SpecialType.System_DateTime => PredefinedType.DateTime,
58SpecialType.System_IntPtr => PredefinedType.IntPtr,
59SpecialType.System_UIntPtr => PredefinedType.UIntPtr,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (12)
83public static bool IsSpecialType([NotNullWhen(true)] ITypeSymbol? type, SpecialType specialType)
136SpecialType.System_SByte => value is sbyte,
137SpecialType.System_Byte => value is byte,
138SpecialType.System_Int16 => value is short,
139SpecialType.System_UInt16 => value is ushort,
140SpecialType.System_Int32 => value is int,
141SpecialType.System_UInt32 => value is uint,
142SpecialType.System_Int64 => value is long,
143SpecialType.System_UInt64 => value is ulong,
144SpecialType.System_Decimal => value is decimal,
145SpecialType.System_Single => value is float,
146SpecialType.System_Double => value is double,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractNamedTypeSymbol.cs (1)
29SpecialType specialType,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationArrayTypeSymbol.cs (1)
10internal sealed class CodeGenerationArrayTypeSymbol(ITypeSymbol elementType, int rank, NullableAnnotation nullableAnnotation) : CodeGenerationTypeSymbol(null, null, default, Accessibility.NotApplicable, default, string.Empty, SpecialType.None, nullableAnnotation), IArrayTypeSymbol
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationNamedTypeSymbol.cs (1)
34SpecialType specialType,