752 references to TypedConstantKind
ILLink.RoslynAnalyzer (1)
DataFlow\LocalDataFlowVisitor.cs (1)
762
if (attributeArgument.Kind !=
TypedConstantKind
.Primitive)
Microsoft.AspNetCore.App.Analyzers (1)
RouteEmbeddedLanguage\Infrastructure\RouteStringSyntaxDetector.cs (1)
358
if (argument.Kind !=
TypedConstantKind
.Primitive || argument.Value is not string argString)
Microsoft.AspNetCore.Mvc.Analyzers (2)
TopLevelParameterNameAnalyzer.cs (2)
164
namedArgumentValue.Kind ==
TypedConstantKind
.Primitive &&
187
namedArgumentValue.Kind ==
TypedConstantKind
.Type)
Microsoft.AspNetCore.Mvc.Api.Analyzers (9)
ActualApiResponseMetadataFactory.cs (1)
250
attribute.ConstructorArguments[0].Kind ==
TypedConstantKind
.Primitive &&
SymbolApiConventionMatcher.cs (2)
66
attribute.ConstructorArguments[0].Kind !=
TypedConstantKind
.Enum)
88
attribute.ConstructorArguments[0].Kind !=
TypedConstantKind
.Enum)
SymbolApiResponseMetadataProvider.cs (6)
55
errorTypeAttribute.ConstructorArguments[0].Kind ==
TypedConstantKind
.Type &&
98
if (attribute.ConstructorArguments[0].Kind !=
TypedConstantKind
.Type ||
104
if (attribute.ConstructorArguments[1].Kind !=
TypedConstantKind
.Primitive ||
174
attribute.ConstructorArguments[0].Kind !=
TypedConstantKind
.Type ||
194
namedArgumentValue.Kind ==
TypedConstantKind
.Primitive &&
220
if (argument.Kind ==
TypedConstantKind
.Primitive && argument.Value is int statusCode)
Microsoft.CodeAnalysis (29)
MetadataReader\MetadataDecoder.cs (11)
1528
TypedConstantKind
kind = PEModule.CrackStringInAttributeValue(out s, ref argReader) ?
1529
TypedConstantKind
.Primitive :
1530
TypedConstantKind
.Error;
1540
return CreateTypedConstant(type,
TypedConstantKind
.Type, serializedType);
1547
private static
TypedConstantKind
GetPrimitiveOrEnumTypedConstantKind(TypeSymbol type)
1549
return (type.TypeKind == TypeKind.Enum) ?
TypedConstantKind
.Enum :
TypedConstantKind
.Primitive;
2146
return new TypedConstant(type,
TypedConstantKind
.Error, null);
2153
private static TypedConstant CreateTypedConstant(TypeSymbol type,
TypedConstantKind
kind, object value)
2157
return new TypedConstant(type,
TypedConstantKind
.Error, null);
2163
private static TypedConstant CreateTypedConstant(TypeSymbol type,
TypedConstantKind
kind, bool value)
Symbols\Attributes\UnmanagedCallersOnlyAttributeData.cs (2)
37
&& value.Kind ==
TypedConstantKind
.Array
38
&& (value.Values.IsDefaultOrEmpty || value.Values.All(v => v.Kind ==
TypedConstantKind
.Type));
Symbols\TypedConstant.cs (16)
19
private readonly
TypedConstantKind
_kind;
23
internal TypedConstant(ITypeSymbolInternal? type,
TypedConstantKind
kind, object? value)
25
Debug.Assert(kind ==
TypedConstantKind
.Array || !(value is ImmutableArray<TypedConstant>));
27
Debug.Assert(type is object || kind ==
TypedConstantKind
.Error);
35
: this(type,
TypedConstantKind
.Array, value: array.IsDefault ? null : (object)array)
42
public
TypedConstantKind
Kind
97
if (Kind ==
TypedConstantKind
.Array)
115
if (Kind !=
TypedConstantKind
.Array)
137
if (_kind ==
TypedConstantKind
.Error)
158
internal static
TypedConstantKind
GetTypedConstantKind(ITypeSymbolInternal type, Compilation compilation)
178
return
TypedConstantKind
.Primitive;
183
return
TypedConstantKind
.Array;
185
return
TypedConstantKind
.Enum;
187
return
TypedConstantKind
.Error;
193
return
TypedConstantKind
.Type;
196
return
TypedConstantKind
.Error;
Microsoft.CodeAnalysis.CodeStyle (3)
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (2)
833
attribute.ConstructorArguments is [_, { Kind:
TypedConstantKind
.Primitive, Value: string checkId }, ..])
844
Kind:
TypedConstantKind
.Primitive,
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
734
attribute.ConstructorArguments is [{ Kind:
TypedConstantKind
.Primitive, Type.SpecialType: SpecialType.System_String, Value: string value }])
Microsoft.CodeAnalysis.CSharp (109)
Binder\Binder_Attributes.cs (22)
723
if (reorderedArgument.Kind ==
TypedConstantKind
.Error)
727
else if (reorderedArgument.Kind ==
TypedConstantKind
.Array &&
741
Debug.Assert(hasErrors || reorderedArguments.All(arg => arg.Kind !=
TypedConstantKind
.Error));
840
var
typedConstantKind = node.Type.GetAttributeParameterTypedConstantKind(_binder.Compilation);
842
return VisitExpression(node, typedConstantKind, diagnostics, ref attrHasErrors, curArgumentHasErrors || typedConstantKind ==
TypedConstantKind
.Error);
845
private TypedConstant VisitExpression(BoundExpression node,
TypedConstantKind
typedConstantKind, BindingDiagnosticBag diagnostics, ref bool attrHasErrors, bool curArgumentHasErrors)
854
typedConstantKind =
TypedConstantKind
.Error;
871
return CreateTypedConstant(node,
TypedConstantKind
.Error, diagnostics, ref attrHasErrors, curArgumentHasErrors);
877
var
typedConstantKind = type.GetAttributeParameterTypedConstantKind(_binder.Compilation);
893
return new TypedConstant(spread.Expression.Type,
TypedConstantKind
.Error, value: null);
927
var
typedConstantKind = operandType.GetAttributeParameterTypedConstantKind(_binder.Compilation);
932
return CreateTypedConstant(node,
TypedConstantKind
.Error, diagnostics, ref attrHasErrors, curArgumentHasErrors);
968
return CreateTypedConstant(node,
TypedConstantKind
.Type, diagnostics, ref attrHasErrors, curArgumentHasErrors, simpleValue: node.SourceType.Type);
978
return CreateTypedConstant(node,
TypedConstantKind
.Error, diagnostics, ref attrHasErrors, curArgumentHasErrors);
982
var
typedConstantKind = type.GetAttributeParameterTypedConstantKind(_binder.Compilation);
1000
initializer = ImmutableArray.Create(CreateTypedConstant(node,
TypedConstantKind
.Error, diagnostics, ref attrHasErrors, curArgumentHasErrors));
1012
private static TypedConstant CreateTypedConstant(BoundExpression node,
TypedConstantKind
typedConstantKind, BindingDiagnosticBag diagnostics, ref bool attrHasErrors, bool curArgumentHasErrors,
1018
if (typedConstantKind !=
TypedConstantKind
.Error && type.ContainsTypeParameter())
1039
typedConstantKind =
TypedConstantKind
.Error;
1042
if (typedConstantKind ==
TypedConstantKind
.Error)
1050
return new TypedConstant(type,
TypedConstantKind
.Error, null);
1052
else if (typedConstantKind ==
TypedConstantKind
.Array)
Compiler\ClsComplianceChecker.cs (1)
286
paramType.Type.GetAttributeParameterTypedConstantKind(_compilation) ==
TypedConstantKind
.Error)
Emitter\Model\AttributeDataAdapter.cs (3)
30
Debug.Assert(argument.Kind !=
TypedConstantKind
.Error);
108
case
TypedConstantKind
.Array:
111
case
TypedConstantKind
.Type:
Emitter\Model\PEModuleBuilder.cs (4)
1580
var value = flagsBuilder.SelectAsArray((flag, byteType) => new TypedConstant(byteType,
TypedConstantKind
.Primitive, flag), byteType);
1602
ImmutableArray.Create(new TypedConstant(byteType,
TypedConstantKind
.Primitive, nullableValue)));
1622
ImmutableArray.Create(new TypedConstant(Compilation.GetSpecialType(SpecialType.System_Byte),
TypedConstantKind
.Primitive, value)));
1664
var transformFlags = builder.SelectAsArray((flag, constantType) => new TypedConstant(constantType,
TypedConstantKind
.Primitive, flag), booleanType);
Emitter\NoPia\EmbeddedType.cs (2)
280
ImmutableArray.Create(new TypedConstant(stringType,
TypedConstantKind
.Primitive, guidString),
281
new TypedConstant(stringType,
TypedConstantKind
.Primitive,
Emitter\NoPia\EmbeddedTypesManager.cs (1)
148
ImmutableArray.Create(new TypedConstant(ctor.Parameters[0].Type,
TypedConstantKind
.Type, ctor.ContainingAssembly.GetSpecialType(SpecialType.System_Object))),
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.FieldSymbol.cs (1)
155
new TypedConstant(manager.System_Diagnostics_DebuggerBrowsableState,
TypedConstantKind
.Enum, DebuggerBrowsableState.Never))));
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.TemplateSymbol.cs (2)
220
arguments: ImmutableArray.Create(new TypedConstant(Manager.System_String,
TypedConstantKind
.Primitive, displayString)),
223
new TypedConstant(Manager.System_String,
TypedConstantKind
.Primitive, "<Anonymous Type>"))));
Symbols\Attributes\AttributeData.cs (8)
261
if (value.Kind !=
TypedConstantKind
.Array)
312
if (value.Kind !=
TypedConstantKind
.Array)
577
Debug.Assert(ctorArgument.Kind ==
TypedConstantKind
.Enum || ctorArgument.Kind ==
TypedConstantKind
.Primitive);
579
ClassInterfaceType interfaceType = ctorArgument.Kind ==
TypedConstantKind
.Enum ?
602
Debug.Assert(ctorArgument.Kind ==
TypedConstantKind
.Enum || ctorArgument.Kind ==
TypedConstantKind
.Primitive);
604
ComInterfaceType interfaceType = ctorArgument.Kind ==
TypedConstantKind
.Enum ?
Symbols\Compilation_WellKnownMembers.cs (13)
471
new TypedConstant(systemByte,
TypedConstantKind
.Primitive, scale),
472
new TypedConstant(systemByte,
TypedConstantKind
.Primitive, (byte)(isNegative ? 128 : 0)),
473
new TypedConstant(systemUnit32,
TypedConstantKind
.Primitive, high),
474
new TypedConstant(systemUnit32,
TypedConstantKind
.Primitive, mid),
475
new TypedConstant(systemUnit32,
TypedConstantKind
.Primitive, low)
481
var ticks = new TypedConstant(GetSpecialType(SpecialType.System_Int64),
TypedConstantKind
.Primitive, value.Ticks);
498
TypedConstantKind
.Enum,
763
var typedConstantDebugMode = new TypedConstant(debuggingModesType,
TypedConstantKind
.Enum, constantVal);
816
new TypedConstant(attributeTargetsType,
TypedConstantKind
.Enum, targets));
818
new KeyValuePair<WellKnownMember, TypedConstant>(WellKnownMember.System_AttributeUsageAttribute__AllowMultiple, new TypedConstant(boolType,
TypedConstantKind
.Primitive, allowMultiple)),
819
new KeyValuePair<WellKnownMember, TypedConstant>(WellKnownMember.System_AttributeUsageAttribute__Inherited, new TypedConstant(boolType,
TypedConstantKind
.Primitive, inherited)));
849
new TypedConstant(constantType,
TypedConstantKind
.Primitive, name), stringType);
896
var result = flagsBuilder.SelectAsArray((flag, constantType) => new TypedConstant(constantType,
TypedConstantKind
.Primitive, flag), booleanType);
Symbols\MethodSymbol.cs (4)
1012
Debug.Assert(callConvTypedConstant.Kind ==
TypedConstantKind
.Type);
1281
new TypedConstant(declaringCompilation.GetSpecialType(SpecialType.System_String),
TypedConstantKind
.Primitive, PEModule.RequiredMembersMarker), // message
1282
new TypedConstant(declaringCompilation.GetSpecialType(SpecialType.System_Boolean),
TypedConstantKind
.Primitive, true)) // error
1287
ImmutableArray.Create(new TypedConstant(declaringCompilation.GetSpecialType(SpecialType.System_String),
TypedConstantKind
.Primitive, nameof(CompilerFeatureRequiredFeatures.RequiredMembers)))
Symbols\Retargeting\RetargetingSymbolTranslator.cs (2)
1228
if (oldConstant.Kind ==
TypedConstantKind
.Array)
1244
if ((oldConstant.Kind ==
TypedConstantKind
.Type) && (oldConstantValue != null))
Symbols\Source\SourceAssemblySymbol.cs (6)
1828
var typedConstantRequestMinimum = new TypedConstant(securityActionType,
TypedConstantKind
.Enum, constantValue);
1834
var typedConstantTrue = new TypedConstant(boolType,
TypedConstantKind
.Primitive, value: true);
1972
var typedConstantNoStringInterning = new TypedConstant(int32Type,
TypedConstantKind
.Primitive, Cci.Constants.CompilationRelaxations_NoStringInterning);
1991
var typedConstantTrue = new TypedConstant(boolType,
TypedConstantKind
.Primitive, value: true);
2025
var typedConstant = new TypedConstant(stringType,
TypedConstantKind
.Primitive, _compilation.Options.CryptoKeyContainer);
2035
var typedConstant = new TypedConstant(stringType,
TypedConstantKind
.Primitive, _compilation.Options.CryptoKeyFile);
Symbols\Source\SourceComplexParameterSymbol.cs (2)
986
SpecialType specialType = arg.Kind ==
TypedConstantKind
.Enum ?
995
if (arg.Kind !=
TypedConstantKind
.Array && arg.ValueInternal == null)
Symbols\Source\SourceFixedFieldSymbol.cs (2)
47
var item1 = new TypedConstant(systemType,
TypedConstantKind
.Type, ((PointerTypeSymbol)this.Type).PointedAtType);
48
var item2 = new TypedConstant(intType,
TypedConstantKind
.Primitive, this.FixedSize);
Symbols\Source\SourceMemberContainerSymbol.cs (1)
1432
&& attr.CommonConstructorArguments[0].Kind ==
TypedConstantKind
.Type)
Symbols\Source\SourceMemberMethodSymbol.cs (1)
1045
TypedConstantKind
.Type, stateMachineType.GetUnboundGenericTypeOrSelf());
Symbols\Source\SourceMethodSymbolWithAttributes.cs (2)
997
{ Kind: not
TypedConstantKind
.Array, Value: int lineNumberOneBased },
998
{ Kind: not
TypedConstantKind
.Array, Value: int characterNumberOneBased }])
Symbols\Source\SourceModuleSymbol.cs (2)
641
var version = ImmutableArray.Create(new TypedConstant(compilation.GetSpecialType(SpecialType.System_Int32),
TypedConstantKind
.Primitive, 11));
648
new TypedConstant(compilation.GetSpecialType(SpecialType.System_Boolean),
TypedConstantKind
.Primitive, _assemblySymbol.InternalsAreVisible));
Symbols\Source\SourceNamedTypeSymbol.cs (7)
1030
Debug.Assert(attributeData.CommonConstructorArguments[0].Kind ==
TypedConstantKind
.Type);
1336
Debug.Assert(argument.Kind ==
TypedConstantKind
.Type);
1693
new TypedConstant(compilation.GetSpecialType(SpecialType.System_String),
TypedConstantKind
.Primitive, PEModule.ByRefLikeMarker), // message
1694
new TypedConstant(compilation.GetSpecialType(SpecialType.System_Boolean),
TypedConstantKind
.Primitive, true)), // error=true
1699
ImmutableArray.Create(new TypedConstant(compilation.GetSpecialType(SpecialType.System_String),
TypedConstantKind
.Primitive, nameof(CompilerFeatureRequiredFeatures.RefStructs))),
1712
var defaultMemberNameConstant = new TypedConstant(compilation.GetSpecialType(SpecialType.System_String),
TypedConstantKind
.Primitive, defaultMemberName);
1748
ImmutableArray.Create(new TypedConstant(compilation.GetWellKnownType(WellKnownType.System_Type),
TypedConstantKind
.Type, originalType)),
Symbols\Synthesized\SynthesizedInlineArrayTypeSymbol.cs (1)
200
arguments: ImmutableArray.Create(new TypedConstant(compilation.GetSpecialType(SpecialType.System_Int32),
TypedConstantKind
.Primitive, _arrayLength)),
Symbols\TypedConstantExtensions.cs (6)
25
if (constant.Kind ==
TypedConstantKind
.Array)
30
if (constant.Kind ==
TypedConstantKind
.Type || constant.TypeInternal!.SpecialType == SpecialType.System_Object)
36
if (constant.Kind ==
TypedConstantKind
.Enum)
49
Debug.Assert(constant.Kind ==
TypedConstantKind
.Enum);
69
Debug.Assert(constant.Kind ==
TypedConstantKind
.Enum);
148
Debug.Assert(constant.Kind ==
TypedConstantKind
.Enum);
Symbols\TypeSymbolExtensions.cs (16)
240
return GetAttributeParameterTypedConstantKind(type, compilation) !=
TypedConstantKind
.Error;
249
public static
TypedConstantKind
GetAttributeParameterTypedConstantKind(this TypeSymbol type, CSharpCompilation compilation)
261
TypedConstantKind
kind =
TypedConstantKind
.Error;
264
return
TypedConstantKind
.Error;
272
return
TypedConstantKind
.Error;
275
kind =
TypedConstantKind
.Array;
285
if (kind ==
TypedConstantKind
.Error)
288
kind =
TypedConstantKind
.Enum;
294
var
typedConstantKind = TypedConstant.GetTypedConstantKind(type, compilation);
297
case
TypedConstantKind
.Array:
298
case
TypedConstantKind
.Enum:
299
case
TypedConstantKind
.Error:
300
return
TypedConstantKind
.Error;
303
if (kind ==
TypedConstantKind
.Array || kind ==
TypedConstantKind
.Enum)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (4)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ExpressionGenerator.cs (4)
30
case
TypedConstantKind
.Primitive:
31
case
TypedConstantKind
.Enum:
34
case
TypedConstantKind
.Type:
39
case
TypedConstantKind
.Array:
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (229)
Attributes\AttributeTests.cs (178)
491
attrs[0].VerifyValue(0,
TypedConstantKind
.Primitive, "Roslyn.Compilers.UnitTests");
493
attrs[1].VerifyValue(0,
TypedConstantKind
.Primitive, "Roslyn.Compilers.CSharp");
495
attrs[2].VerifyValue(0,
TypedConstantKind
.Primitive, "Roslyn.Compilers.CSharp.UnitTests");
497
attrs[3].VerifyValue(0,
TypedConstantKind
.Primitive, "Roslyn.Compilers.CSharp.Test.Utilities");
499
attrs[4].VerifyValue(0,
TypedConstantKind
.Primitive, "Roslyn.Compilers.VisualBasic");
654
Assert.Equal(
TypedConstantKind
.Array, attributeData.ConstructorArguments.Single().Kind);
684
Assert.Equal(
TypedConstantKind
.Error, attrs[0].ConstructorArguments.Single().Kind);
1029
Assert.Equal(
TypedConstantKind
.Array, arguments0[2].Kind);
1036
Assert.Equal(
TypedConstantKind
.Array, arguments1[2].Kind);
1435
a.VerifyValue(0,
TypedConstantKind
.Enum, (int)System.Configuration.Assemblies.AssemblyHashAlgorithm.MD5);
1439
a.VerifyValue(0,
TypedConstantKind
.Primitive, "");
1443
a.VerifyValue(0,
TypedConstantKind
.Primitive, true);
1447
a.VerifyValue(0,
TypedConstantKind
.Enum, (int)AssemblyNameFlags.Retargetable);
1451
a.VerifyValue(0,
TypedConstantKind
.Primitive, "MyKey.snk");
1455
a.VerifyValue(0,
TypedConstantKind
.Primitive, "Key Name");
1459
a.VerifyValue(0,
TypedConstantKind
.Primitive, "1.2.*");
1463
a.VerifyValue(0,
TypedConstantKind
.Primitive, "4.3.2.100");
1520
attrs.First().VerifyValue<object>(0,
TypedConstantKind
.Primitive, null);
1606
attrs.First().VerifyValue(0,
TypedConstantKind
.Primitive, true);
1710
attrs.First().VerifyValue<object>(0,
TypedConstantKind
.Type, typeof(object));
1711
attrs.First().VerifyNamedArgumentValue<object>(0, "O",
TypedConstantKind
.Primitive, null);
1716
attrs.First().VerifyValue(0,
TypedConstantKind
.Array, new object[] { typeof(string) });
1721
attrs.First().VerifyValue(0,
TypedConstantKind
.Array, new object[] { 1, "two", typeof(string), 3.1415926 });
1724
attrs.First().VerifyValue(0,
TypedConstantKind
.Array, new object[] { new object[] { typeof(string) } });
3106
attrs[1].VerifyNamedArgumentValue<ushort>(0, "UShortField",
TypedConstantKind
.Primitive, 1234);
3115
attrs[0].VerifyValue(0,
TypedConstantKind
.Enum, (int)FileMode.Open);
3116
attrs[0].VerifyValue(1,
TypedConstantKind
.Enum, (int)(BindingFlags.DeclaredOnly | BindingFlags.Public));
3117
attrs[0].VerifyNamedArgumentValue<uint>(0, "UIntField",
TypedConstantKind
.Primitive, 1230);
3122
attrs[0].VerifyValue(0,
TypedConstantKind
.Array, new char[] { 'q', 'c' });
3131
attrs[0].VerifyValue<object>(0,
TypedConstantKind
.Primitive, null);
3132
attrs[0].VerifyValue<long>(1,
TypedConstantKind
.Primitive, 256);
3133
attrs[0].VerifyValue<float>(2,
TypedConstantKind
.Primitive, 0);
3134
attrs[0].VerifyValue<short>(3,
TypedConstantKind
.Primitive, -1);
3135
attrs[0].VerifyNamedArgumentValue<ulong[]>(0, "AryField",
TypedConstantKind
.Array, new ulong[] { 0, 1, 12345657 });
3137
attrs[1].VerifyValue<object>(0,
TypedConstantKind
.Type, typeof(Dictionary<string, int>));
3138
attrs[1].VerifyValue<long>(1,
TypedConstantKind
.Primitive, 265);
3139
attrs[1].VerifyValue<float>(2,
TypedConstantKind
.Primitive, -0.0001f);
3140
attrs[1].VerifyValue<short>(3,
TypedConstantKind
.Primitive, 2);
3177
attrs.First().VerifyValue<object>(0,
TypedConstantKind
.Array, new object[] { 0, "", null });
3178
attrs.First().VerifyValue<byte>(1,
TypedConstantKind
.Primitive, 255);
3179
attrs.First().VerifyValue<sbyte>(2,
TypedConstantKind
.Primitive, -128);
3180
attrs.First().VerifyNamedArgumentValue<object[]>(0, "AryProp",
TypedConstantKind
.Array, new object[] { new object[] { "", typeof(IList<string>) } });
3186
attrs[0].VerifyValue<object>(0,
TypedConstantKind
.Type, typeof(string[,,]));
3219
attrs.First().VerifyValue<object>(0,
TypedConstantKind
.Array, new object[] { 1, null, "Hi" });
3220
attrs.First().VerifyNamedArgumentValue<object>(0, "ObjectField",
TypedConstantKind
.Primitive, 2);
3451
attrs.First().VerifyValue<char[]>(0,
TypedConstantKind
.Array, new char[] { ' ' });
3452
attrs.First().VerifyValue<string[]>(1,
TypedConstantKind
.Array, new string[] { "" });
3464
attrs.First().VerifyValue<char[]>(0,
TypedConstantKind
.Array, new char[] { ' ' });
3465
attrs.First().VerifyValue<string[]>(1,
TypedConstantKind
.Array, new string[] { "" });
3533
attr.VerifyValue<string>(0,
TypedConstantKind
.Primitive, "MultipleArgumentsToParamsParameter");
3534
attr.VerifyValue<int[]>(1,
TypedConstantKind
.Array, new int[] { 4, 5, 6 });
3540
attr.VerifyValue<string>(0,
TypedConstantKind
.Primitive, "NoArgumentsToParamsParameter");
3541
attr.VerifyValue<int[]>(1,
TypedConstantKind
.Array, new int[] { });
3547
attr.VerifyValue<string>(0,
TypedConstantKind
.Primitive, "NullArgumentToParamsParameter");
3548
attr.VerifyValue<int[]>(1,
TypedConstantKind
.Array, null);
3590
attrs.First().VerifyValue<char[]>(0,
TypedConstantKind
.Array, new char[] { ' ' });
3591
attrs.First().VerifyValue<string[]>(1,
TypedConstantKind
.Array, new string[] { "whatever" });
3603
attrs.First().VerifyValue<char[]>(0,
TypedConstantKind
.Array, new char[] { ' ' });
3604
attrs.First().VerifyValue<string[]>(1,
TypedConstantKind
.Array, new string[] { "whatever" });
3639
attrs.First().VerifyValue(0,
TypedConstantKind
.Type, typeof(Object));
3684
attrs.First().VerifyValue(0,
TypedConstantKind
.Array, (object[])null);
4086
attr.VerifyValue(0,
TypedConstantKind
.Enum, (int)(AttributeTargets.Field | AttributeTargets.Event));
4089
attr.VerifyNamedArgumentValue(0, "Inherited",
TypedConstantKind
.Primitive, false);
4090
attr.VerifyNamedArgumentValue(1, "AllowMultiple",
TypedConstantKind
.Primitive, true);
4140
attrs.First().VerifyValue(0,
TypedConstantKind
.Primitive, 4);
4141
attrs.First().VerifyValue(1,
TypedConstantKind
.Primitive, 5);
4143
attrs.First().VerifyNamedArgumentValue(0, "X",
TypedConstantKind
.Primitive, 6);
4183
attrs.First().VerifyValue(0,
TypedConstantKind
.Primitive, 3);
4184
attrs.First().VerifyValue(1,
TypedConstantKind
.Primitive, 4);
4185
attrs.First().VerifyValue(2,
TypedConstantKind
.Primitive, 5);
4187
attrs.First().VerifyNamedArgumentValue(0, "X",
TypedConstantKind
.Primitive, 6);
4229
attrs.First().VerifyValue(0,
TypedConstantKind
.Primitive, 2);
4230
attrs.First().VerifyValue(1,
TypedConstantKind
.Primitive, 1);
4272
attrs.First().VerifyValue(0,
TypedConstantKind
.Primitive, 3);
4273
attrs.First().VerifyValue(1,
TypedConstantKind
.Primitive, 4);
4274
attrs.First().VerifyValue(2,
TypedConstantKind
.Primitive, 5);
4276
attrs.First().VerifyNamedArgumentValue(0, "X",
TypedConstantKind
.Primitive, 6);
4318
attr.VerifyValue<int>(0,
TypedConstantKind
.Primitive, 2);
4521
attrs.First().VerifyValue(0,
TypedConstantKind
.Primitive, 2);
4527
attrs.First().VerifyValue(0,
TypedConstantKind
.Primitive, 2);
4576
attrs.First().VerifyValue(0,
TypedConstantKind
.Type, cClass.AsUnboundGenericType());
4616
attrs.First().VerifyValue(0,
TypedConstantKind
.Type, bClass.AsUnboundGenericType());
4966
enumerator.Current.VerifyNamedArgumentValue(0, "X",
TypedConstantKind
.Enum, (int)new DayOfWeek());
4968
enumerator.Current.VerifyNamedArgumentValue(0, "X",
TypedConstantKind
.Primitive, new bool());
4970
enumerator.Current.VerifyNamedArgumentValue(0, "X",
TypedConstantKind
.Primitive, new sbyte());
4972
enumerator.Current.VerifyNamedArgumentValue(0, "X",
TypedConstantKind
.Primitive, new byte());
4974
enumerator.Current.VerifyNamedArgumentValue(0, "X",
TypedConstantKind
.Primitive, new short());
4976
enumerator.Current.VerifyNamedArgumentValue(0, "X",
TypedConstantKind
.Primitive, new ushort());
4978
enumerator.Current.VerifyNamedArgumentValue(0, "X",
TypedConstantKind
.Primitive, new int());
4980
enumerator.Current.VerifyNamedArgumentValue(0, "X",
TypedConstantKind
.Primitive, new uint());
4982
enumerator.Current.VerifyNamedArgumentValue(0, "X",
TypedConstantKind
.Primitive, new char());
4984
enumerator.Current.VerifyNamedArgumentValue(0, "X",
TypedConstantKind
.Primitive, new float());
4986
enumerator.Current.VerifyNamedArgumentValue(0, "X",
TypedConstantKind
.Primitive, new Single());
4988
enumerator.Current.VerifyNamedArgumentValue(0, "X",
TypedConstantKind
.Primitive, new double());
5253
attr.VerifyValue<object>(0,
TypedConstantKind
.Primitive, null);
5259
attr.VerifyValue<int>(0,
TypedConstantKind
.Primitive, 1);
5314
attr.VerifyValue<object>(0,
TypedConstantKind
.Primitive, null);
5318
attr.VerifyValue<object>(0,
TypedConstantKind
.Primitive, null);
5326
attr.VerifyValue<object>(0,
TypedConstantKind
.Primitive, null);
5330
attr.VerifyValue<object>(0,
TypedConstantKind
.Primitive, null);
5493
attrs.First().VerifyValue<object>(0,
TypedConstantKind
.Type, typeArg);
5498
attrs.First().VerifyValue<object>(0,
TypedConstantKind
.Type, typeArg);
5504
attrs.First().VerifyValue<object>(0,
TypedConstantKind
.Type, typeArg);
5511
attrs.First().VerifyValue<object>(0,
TypedConstantKind
.Type, typeArg);
5520
attrs.First().VerifyValue<object>(0,
TypedConstantKind
.Type, typeArg);
5527
attrs.First().VerifyValue<object>(0,
TypedConstantKind
.Type, typeArg);
5616
attributes[0].VerifyValue(0,
TypedConstantKind
.Primitive, value);
9413
attrs1[0].VerifyValue(0,
TypedConstantKind
.Array, value1);
9414
attrs1[1].VerifyValue(0,
TypedConstantKind
.Array, value1);
9415
attrs1[2].VerifyValue(0,
TypedConstantKind
.Array, value1);
9418
attrs2[0].VerifyValue(0,
TypedConstantKind
.Array, (object[])null);
9419
attrs2[1].VerifyValue(0,
TypedConstantKind
.Primitive, (object)null);
9420
attrs2[2].VerifyValue(0,
TypedConstantKind
.Array, (object[])null);
9424
attrs3[0].VerifyValue(0,
TypedConstantKind
.Array, value3);
9425
attrs3[1].VerifyValue(0,
TypedConstantKind
.Array, value3);
9426
attrs3[2].VerifyValue(0,
TypedConstantKind
.Array, value3);
9494
attrs1[0].VerifyValue(0,
TypedConstantKind
.Array, value1);
9495
attrs1[1].VerifyValue(0,
TypedConstantKind
.Array, value1);
9496
attrs1[2].VerifyValue(0,
TypedConstantKind
.Array, value1);
9500
attrs2[0].VerifyValue(0,
TypedConstantKind
.Array, (object[])null);
9501
attrs2[1].VerifyValue(0,
TypedConstantKind
.Primitive, (object)null);
9502
attrs2[2].VerifyValue(0,
TypedConstantKind
.Array, (object[])null);
9507
attrs3[0].VerifyValue(0,
TypedConstantKind
.Array, value3);
9508
attrs3[1].VerifyValue(0,
TypedConstantKind
.Array, value3);
9509
attrs3[2].VerifyValue(0,
TypedConstantKind
.Array, value3);
9512
attrs4[0].VerifyValue(0,
TypedConstantKind
.Array, new object[] { "A" });
9513
attrs4[1].VerifyValue(0,
TypedConstantKind
.Primitive, "A");
9514
attrs4[2].VerifyValue(0,
TypedConstantKind
.Primitive, "A");
9578
attrs1[0].VerifyValue(0,
TypedConstantKind
.Array, value1);
9579
attrs1[1].VerifyValue(0,
TypedConstantKind
.Array, value1);
9580
attrs1[2].VerifyValue(0,
TypedConstantKind
.Array, value1);
9583
attrs2[0].VerifyValue(0,
TypedConstantKind
.Array, (object[])null);
9584
attrs2[1].VerifyValue(0,
TypedConstantKind
.Array, (object[])null);
9585
attrs2[2].VerifyValue(0,
TypedConstantKind
.Array, (string[])null);
9589
attrs3[0].VerifyValue(0,
TypedConstantKind
.Array, value3);
9590
attrs3[1].VerifyValue(0,
TypedConstantKind
.Array, value3);
9594
attrs4[0].VerifyValue(0,
TypedConstantKind
.Array, value4);
9595
attrs4[1].VerifyValue(0,
TypedConstantKind
.Array, value4);
9596
attrs4[2].VerifyValue(0,
TypedConstantKind
.Array, value4);
9651
attrs1[0].VerifyValue(0,
TypedConstantKind
.Array, value1);
9652
attrs1[1].VerifyValue(0,
TypedConstantKind
.Array, value1);
9655
attrs2[0].VerifyValue(0,
TypedConstantKind
.Array, (object[])null);
9656
attrs2[1].VerifyValue(0,
TypedConstantKind
.Primitive, (object)null);
9657
attrs2[2].VerifyValue(0,
TypedConstantKind
.Array, (object[])null);
9661
attrs3[0].VerifyValue(0,
TypedConstantKind
.Array, value3);
9662
attrs3[1].VerifyValue(0,
TypedConstantKind
.Array, value3);
9663
attrs3[2].VerifyValue(0,
TypedConstantKind
.Array, value3);
9725
attrs1[0].VerifyValue(0,
TypedConstantKind
.Array, value1);
9726
attrs1[1].VerifyValue(0,
TypedConstantKind
.Array, value1);
9730
attrs2[0].VerifyValue(0,
TypedConstantKind
.Array, (object[])null);
9731
attrs2[1].VerifyValue(0,
TypedConstantKind
.Primitive, (object)null);
9732
attrs2[2].VerifyValue(0,
TypedConstantKind
.Array, (object[])null);
9737
attrs3[0].VerifyValue(0,
TypedConstantKind
.Array, value3);
9738
attrs3[1].VerifyValue(0,
TypedConstantKind
.Array, value3);
9739
attrs3[2].VerifyValue(0,
TypedConstantKind
.Array, value3);
9742
attrs4[0].VerifyValue(0,
TypedConstantKind
.Array, new object[] { 1 });
9743
attrs4[1].VerifyValue(0,
TypedConstantKind
.Primitive, 1);
9744
attrs4[2].VerifyValue(0,
TypedConstantKind
.Primitive, 1);
9805
attrs1[0].VerifyValue(0,
TypedConstantKind
.Array, value1);
9806
attrs1[1].VerifyValue(0,
TypedConstantKind
.Array, new object[] { value1 });
9807
attrs1[2].VerifyValue(0,
TypedConstantKind
.Array, value1);
9811
attrs2[0].VerifyValue(0,
TypedConstantKind
.Array, value2);
9812
attrs2[1].VerifyValue(0,
TypedConstantKind
.Array, value2);
9816
attrs3[0].VerifyValue(0,
TypedConstantKind
.Array, value3);
9817
attrs3[1].VerifyValue(0,
TypedConstantKind
.Array, value3);
9821
attrs4[0].VerifyValue(0,
TypedConstantKind
.Array, value4);
9822
attrs4[1].VerifyValue(0,
TypedConstantKind
.Array, value4);
9823
attrs4[2].VerifyValue(0,
TypedConstantKind
.Array, value4);
9875
attrs[0].VerifyValue(0,
TypedConstantKind
.Array, nullArray);
9877
attrs[1].VerifyValue(0,
TypedConstantKind
.Array, emptyArray);
9879
attrs[2].VerifyValue(0,
TypedConstantKind
.Array, nullArray);
9880
attrs[2].VerifyNamedArgumentValue(0, fieldName,
TypedConstantKind
.Array, nullArray);
9882
attrs[3].VerifyValue(0,
TypedConstantKind
.Array, emptyArray);
9883
attrs[3].VerifyNamedArgumentValue(0, fieldName,
TypedConstantKind
.Array, nullArray);
9885
attrs[4].VerifyValue(0,
TypedConstantKind
.Array, nullArray);
9886
attrs[4].VerifyNamedArgumentValue(0, fieldName,
TypedConstantKind
.Array, emptyArray);
9888
attrs[5].VerifyValue(0,
TypedConstantKind
.Array, emptyArray);
9889
attrs[5].VerifyNamedArgumentValue(0, fieldName,
TypedConstantKind
.Array, emptyArray);
Attributes\AttributeTests_Dynamic.cs (2)
541
Assert.Equal(
TypedConstantKind
.Array, argument.Kind);
550
Assert.Equal(
TypedConstantKind
.Primitive, actualTransformFlag.Kind);
Attributes\AttributeTests_Security.cs (1)
63
typeAttribute.VerifyNamedArgumentValue(0, "MayLeakOnAbort",
TypedConstantKind
.Primitive, true);
Attributes\AttributeTests_Synthesized.cs (4)
70
attribute.VerifyValue(0,
TypedConstantKind
.Primitive, expectedArgValue);
82
attribute.VerifyNamedArgumentValue<bool>(0, "WrapNonExceptionThrows",
TypedConstantKind
.Primitive, true);
108
attribute.VerifyValue(0,
TypedConstantKind
.Enum, (int)expectedDebuggingMode);
1970
new TypedConstant(comp.GetSpecialType(SpecialType.System_String),
TypedConstantKind
.Primitive, "unused"))));
Attributes\AttributeTests_Tuples.cs (1)
638
Assert.Equal(
TypedConstantKind
.Array, arg.Kind);
Attributes\AttributeTests_WellKnownAttributes.cs (43)
141
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, 1);
165
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, "ABCDEF5D-2448-447A-B786-64682CBEF123");
168
attrSym.VerifyValue(0,
TypedConstantKind
.Enum, (int)ComInterfaceType.InterfaceIsIUnknown);
171
attrSym.VerifyValue(0,
TypedConstantKind
.Type, typeof(object));
174
attrSym.VerifyValue(0,
TypedConstantKind
.Enum, (int)TypeLibTypeFlags.FAggregatable);
177
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, false);
178
attrSym.VerifyNamedArgumentValue(0, "ThrowOnUnmappableChar",
TypedConstantKind
.Primitive, true);
267
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, false);
270
attrSym.VerifyValue(0,
TypedConstantKind
.Enum, (int)CallingConvention.StdCall);
273
attrSym.VerifyNamedArgumentValue(0, "BestFitMapping",
TypedConstantKind
.Primitive, true);
274
attrSym.VerifyNamedArgumentValue(1, "CharSet",
TypedConstantKind
.Enum, (int)CharSet.Ansi);
275
attrSym.VerifyNamedArgumentValue(2, "SetLastError",
TypedConstantKind
.Primitive, true);
276
attrSym.VerifyNamedArgumentValue(3, "ThrowOnUnmappableChar",
TypedConstantKind
.Primitive, true);
283
attrSym.VerifyValue(0,
TypedConstantKind
.Type, typeof(object));
286
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, "ProgId");
290
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, 123);
293
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, 1);
307
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, true);
310
attrSym.VerifyValue(1,
TypedConstantKind
.Primitive, "EGoo, InteropAttribute, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null");
318
attrSym.VerifyValue(0,
TypedConstantKind
.Enum, (int)TypeLibVarFlags.FDisplayBind);
322
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, "message");
323
attrSym.VerifyValue(1,
TypedConstantKind
.Primitive, false);
417
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, 99uL);
425
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, "Ref");
436
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, 0f);
456
attrSym.VerifyValue(2,
TypedConstantKind
.Primitive, 100);
470
attrSym.VerifyValue(0,
TypedConstantKind
.Enum, (int)LayoutKind.Explicit);
472
attrSym.VerifyNamedArgumentValue(0, "Size",
TypedConstantKind
.Primitive, 16);
473
attrSym.VerifyNamedArgumentValue(1, "Pack",
TypedConstantKind
.Primitive, 8);
474
attrSym.VerifyNamedArgumentValue(2, "CharSet",
TypedConstantKind
.Enum, (int)CharSet.Unicode);
481
attrSym.VerifyValue(0,
TypedConstantKind
.Enum, (int)UnmanagedType.I8);
483
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, 0);
2480
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, "unmanaged.dll");
2482
attrSym.VerifyNamedArgumentValue(0, "CallingConvention",
TypedConstantKind
.Enum, (int)CallingConvention.FastCall);
2483
attrSym.VerifyNamedArgumentValue(1, "SetLastError",
TypedConstantKind
.Primitive, true);
2488
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, "user32.dll");
2490
attrSym.VerifyNamedArgumentValue(0, "CharSet",
TypedConstantKind
.Enum, (int)CharSet.Unicode);
2491
attrSym.VerifyNamedArgumentValue(1, "ExactSpelling",
TypedConstantKind
.Primitive, false);
2492
attrSym.VerifyNamedArgumentValue(2, "EntryPoint",
TypedConstantKind
.Primitive, "MessageBox");
5156
attrSym.VerifyValue(0,
TypedConstantKind
.Enum, (int)AttributeTargets.Class);
5158
attrSym.VerifyNamedArgumentValue(0, "AllowMultiple",
TypedConstantKind
.Primitive, true);
5162
attrSym.VerifyValue(0,
TypedConstantKind
.Enum, (int)AttributeTargets.Class);
5164
attrSym.VerifyNamedArgumentValue(0, "AllowMultiple",
TypedConstantKind
.Primitive, false);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (111)
Symbols\Metadata\PE\LoadingAttributes.cs (94)
61
aBoolInst.VerifyValue(0,
TypedConstantKind
.Primitive, true);
64
aByteInst.VerifyValue(0,
TypedConstantKind
.Primitive, Convert.ToByte(1));
67
aCharInst.VerifyValue(0,
TypedConstantKind
.Primitive, 'a');
70
aSingleInst.VerifyValue(0,
TypedConstantKind
.Primitive, 3.14159f);
73
aDoubleInst.VerifyValue(0,
TypedConstantKind
.Primitive, 3.1415926);
76
aInt16Inst.VerifyValue(0,
TypedConstantKind
.Primitive, (Int16)16);
79
aInt32Inst.VerifyValue(0,
TypedConstantKind
.Primitive, 32);
82
aInt64Inst.VerifyValue(0,
TypedConstantKind
.Primitive, 64L);
85
aObjectInst.VerifyValue(0,
TypedConstantKind
.Primitive, "object");
88
aStringInst.VerifyValue(0,
TypedConstantKind
.Primitive, "assembly");
91
aTypeInst.VerifyValue(0,
TypedConstantKind
.Type, typeof(string));
133
aBoolInst.VerifyValue(0,
TypedConstantKind
.Primitive, true);
136
aByteInst.VerifyValue(0,
TypedConstantKind
.Primitive, Convert.ToByte(1));
139
aCharInst.VerifyValue(0,
TypedConstantKind
.Primitive, 'a');
142
aSingleInst.VerifyValue(0,
TypedConstantKind
.Primitive, 3.14159f);
145
aDoubleInst.VerifyValue(0,
TypedConstantKind
.Primitive, 3.1415926);
148
aInt16Inst.VerifyValue(0,
TypedConstantKind
.Primitive, (Int16)16);
151
aInt32Inst.VerifyValue(0,
TypedConstantKind
.Primitive, 32);
154
aInt64Inst.VerifyValue(0,
TypedConstantKind
.Primitive, 64L);
157
aObjectInst.VerifyValue(0,
TypedConstantKind
.Primitive, "object");
160
aStringInst.VerifyValue(0,
TypedConstantKind
.Primitive, "module");
163
aTypeInst.VerifyValue(0,
TypedConstantKind
.Type, typeof(string));
205
c1.GetAttributes().First().VerifyValue(0,
TypedConstantKind
.Primitive, "C1");
208
innerC1.GetAttributes().First().VerifyValue(0,
TypedConstantKind
.Primitive, "InnerC1");
215
innerC2.GetAttributes().First().VerifyValue(0,
TypedConstantKind
.Primitive, "InnerC2");
218
field1.GetAttributes().First().VerifyValue(0,
TypedConstantKind
.Primitive, "field1");
221
property1.GetAttributes().First().VerifyValue(0,
TypedConstantKind
.Primitive, "Property1");
224
sub1.GetAttributes().First().VerifyValue(0,
TypedConstantKind
.Primitive, "Sub1");
227
sub1P1.GetAttributes().First().VerifyValue(0,
TypedConstantKind
.Primitive, "p1");
230
function1.GetAttributes().First().VerifyValue(0,
TypedConstantKind
.Primitive, "Function1");
269
a.VerifyNamedArgumentValue(0, "B",
TypedConstantKind
.Primitive, true);
272
a.VerifyNamedArgumentValue(0, "B",
TypedConstantKind
.Primitive, Convert.ToByte(1));
275
a.VerifyNamedArgumentValue(0, "C",
TypedConstantKind
.Primitive, 'b');
278
a.VerifyNamedArgumentValue(0, "E",
TypedConstantKind
.Enum, 0);
281
a.VerifyNamedArgumentValue(0, "S",
TypedConstantKind
.Primitive, 3.14159f);
284
a.VerifyNamedArgumentValue(0, "D",
TypedConstantKind
.Primitive, 3.1415926);
287
a.VerifyNamedArgumentValue(0, "I",
TypedConstantKind
.Primitive, (Int16)16);
290
a.VerifyNamedArgumentValue(0, "I",
TypedConstantKind
.Primitive, 32);
293
a.VerifyNamedArgumentValue(0, "I",
TypedConstantKind
.Primitive, 64L);
296
a.VerifyNamedArgumentValue(0, "T",
TypedConstantKind
.Type, c3);
328
a.VerifyNamedArgumentValue(0, "IA",
TypedConstantKind
.Array, new int[] { 1, 2 });
332
a.VerifyNamedArgumentValue(0, "EA",
TypedConstantKind
.Array, new int[] { 0, 1 });
336
a.VerifyNamedArgumentValue(0, "SA",
TypedConstantKind
.Array, new string[] { "Yes", "No" });
340
a.VerifyNamedArgumentValue(0, "OA",
TypedConstantKind
.Array, new string[] { "Yes", "No" });
346
a.VerifyNamedArgumentValue(0, "TA",
TypedConstantKind
.Array, new TypeSymbol[] { c1, c3 });
385
c1.GetAttributes().First().VerifyValue(0,
TypedConstantKind
.Primitive, "C1");
432
l.GetAttributes().First().VerifyValue(0,
TypedConstantKind
.Type, "System.Collections.Generic.List<>");
435
l.GetAttributes().First().VerifyValue(0,
TypedConstantKind
.Type, "System.Collections.Generic.List<C1>");
438
l.GetAttributes().First().VerifyValue(0,
TypedConstantKind
.Type, "System.Collections.Generic.List<System.String>");
441
l.GetAttributes().First().VerifyValue(0,
TypedConstantKind
.Type, "System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<C1, System.String>>");
444
l.GetAttributes().First().VerifyValue(0,
TypedConstantKind
.Type, "System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String, C1.InnerC1<System.Int32>.InnerC2<System.String, System.String>>>");
477
arg.VerifyValue(0,
TypedConstantKind
.Array, new int[] { 1, 2 });
481
arg.VerifyValue(0,
TypedConstantKind
.Array, new object[] { stringType });
485
arg.VerifyValue(0,
TypedConstantKind
.Array, new object[] { stringType });
489
arg.VerifyValue(0,
TypedConstantKind
.Array, new object[] { stringType });
493
arg.VerifyValue(0,
TypedConstantKind
.Array, new object[] { new object[] { stringType } });
499
arg.VerifyValue(0,
TypedConstantKind
.Array, new object[] { 1, "two", stringType, 3.1415926 });
505
arg.VerifyValue(0,
TypedConstantKind
.Array, new object[] { 1, new object[] { 2, 3, 4 }, 5 });
511
arg.VerifyValue(0,
TypedConstantKind
.Array, new int[] { 1, 2, 3 });
606
a.VerifyValue(0,
TypedConstantKind
.Primitive, "InteropAttributes");
609
a.VerifyValue(1,
TypedConstantKind
.Primitive, 2);
612
a.VerifyValue(0,
TypedConstantKind
.Primitive, "1234C65D-1234-447A-B786-64682CBEF136");
615
a.VerifyValue(0,
TypedConstantKind
.Primitive, false);
616
a.VerifyNamedArgumentValue(0, "ThrowOnUnmappableChar",
TypedConstantKind
.Primitive, true);
619
a.VerifyValue(0,
TypedConstantKind
.Primitive, false);
630
a.VerifyValue(2,
TypedConstantKind
.Primitive, 3);
637
a.VerifyValue(0,
TypedConstantKind
.Primitive, true);
644
a.VerifyValue(0,
TypedConstantKind
.Primitive, 8);
647
a.VerifyNamedArgumentValue(0, "WrapNonExceptionThrows",
TypedConstantKind
.Primitive, true);
694
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, "ABCDEF5D-2448-447A-B786-64682CBEF123");
747
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, false);
757
attrSym.VerifyNamedArgumentValue(0, "BestFitMapping",
TypedConstantKind
.Primitive, true);
758
attrSym.VerifyNamedArgumentValue(1, "CharSet",
TypedConstantKind
.Enum, (int)CharSet.Ansi);
759
attrSym.VerifyNamedArgumentValue(2, "SetLastError",
TypedConstantKind
.Primitive, true);
760
attrSym.VerifyNamedArgumentValue(3, "ThrowOnUnmappableChar",
TypedConstantKind
.Primitive, true);
797
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, "message");
798
attrSym.VerifyValue(1,
TypedConstantKind
.Primitive, false);
854
attrSym.VerifyValue(0,
TypedConstantKind
.Type, cbar);
858
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, "MyIndex");
863
mem.GetAttributes().First().VerifyValue(0,
TypedConstantKind
.Primitive, 10);
897
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, 1);
927
attrSym.VerifyNamedArgumentValue(0, "UShortField",
TypedConstantKind
.Primitive, Convert.ToUInt16(321));
931
attrSym.VerifyNamedArgumentValue(0, "TypeField",
TypedConstantKind
.Type, typeof(Dictionary<string, int>));
968
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, 3.1415926);
977
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, 'q');
978
attrSym.VerifyValue(1,
TypedConstantKind
.Primitive, Convert.ToByte(2));
990
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, "555");
1005
attrSym.VerifyValue(0,
TypedConstantKind
.Array, new sbyte[] { -1, 0, 1 });
1183
attr1.VerifyValue(0,
TypedConstantKind
.Primitive, "4.6.1055.0");
1187
attr1.VerifyValue(0,
TypedConstantKind
.Primitive, "4.6.1055.0");
1243
attr.VerifyValue(0,
TypedConstantKind
.Primitive, "genericUriParserOptions");
1244
attr.VerifyNamedArgumentValue(1, "IsRequired",
TypedConstantKind
.Primitive, true);
1276
attr.VerifyValue(0,
TypedConstantKind
.Primitive, "DataCategory_Mapping");
1279
attr.VerifyValue(0,
TypedConstantKind
.Primitive, "DataAdapter_MissingMappingAction");
Symbols\Retargeting\RetargetCustomAttributes.cs (3)
152
attribute.VerifyValue(0,
TypedConstantKind
.Type, newMsCorLib_systemType);
155
attribute.VerifyNamedArgumentValue<object>(0, "Target",
TypedConstantKind
.Type, typeof(int[]));
156
attribute.VerifyNamedArgumentValue(1, "TargetTypeName",
TypedConstantKind
.Primitive, "IntArrayType");
Symbols\TypedConstantTests.cs (14)
44
TypedConstant common = new TypedConstant(_systemType,
TypedConstantKind
.Type, _namedType);
57
new[] { new TypedConstant(_systemType,
TypedConstantKind
.Type, _namedType) }.AsImmutableOrNull());
77
new TypedConstant(_intType,
TypedConstantKind
.Primitive, 1),
78
new TypedConstant(_intType,
TypedConstantKind
.Primitive, 1));
84
new TypedConstant(_stringType,
TypedConstantKind
.Primitive, s1),
85
new TypedConstant(_stringType,
TypedConstantKind
.Primitive, s2));
88
new TypedConstant(_stringType,
TypedConstantKind
.Primitive, null),
89
new TypedConstant(_stringType,
TypedConstantKind
.Primitive, null));
92
new TypedConstant(_enumString1,
TypedConstantKind
.Primitive, null),
93
new TypedConstant(_enumString2,
TypedConstantKind
.Primitive, null));
96
new TypedConstant(_stringType,
TypedConstantKind
.Primitive, null),
97
new TypedConstant(_stringType,
TypedConstantKind
.Error, null));
100
new TypedConstant(_stringType,
TypedConstantKind
.Primitive, null),
101
new TypedConstant(_systemType,
TypedConstantKind
.Primitive, null));
Microsoft.CodeAnalysis.CSharp.Test.Utilities (6)
Extensions.cs (5)
403
public static void VerifyValue<T>(this CSharpAttributeData attr, int i,
TypedConstantKind
kind, T v)
410
public static void VerifyNamedArgumentValue<T>(this CSharpAttributeData attr, int i, string name,
TypedConstantKind
kind, T v)
426
case
TypedConstantKind
.Array:
428
case
TypedConstantKind
.Enum:
430
case
TypedConstantKind
.Type:
TestAttributesVisitor.cs (1)
189
if (value.Kind ==
TypedConstantKind
.Array)
Microsoft.CodeAnalysis.CSharp.WinRT.UnitTests (4)
Metadata\WinMdDumpTest.cs (4)
292
case
TypedConstantKind
.Array:
309
case
TypedConstantKind
.Type:
315
case
TypedConstantKind
.Enum:
316
case
TypedConstantKind
.Primitive:
Microsoft.CodeAnalysis.CSharp.Workspaces (4)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ExpressionGenerator.cs (4)
30
case
TypedConstantKind
.Primitive:
31
case
TypedConstantKind
.Enum:
34
case
TypedConstantKind
.Type:
39
case
TypedConstantKind
.Array:
Microsoft.CodeAnalysis.Features (4)
EmbeddedLanguages\EmbeddedLanguageDetector.cs (1)
489
if (argument.Kind !=
TypedConstantKind
.Primitive || argument.Value is not string argString)
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (2)
833
attribute.ConstructorArguments is [_, { Kind:
TypedConstantKind
.Primitive, Value: string checkId }, ..])
844
Kind:
TypedConstantKind
.Primitive,
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
734
attribute.ConstructorArguments is [{ Kind:
TypedConstantKind
.Primitive, Type.SpecialType: SpecialType.System_String, Value: string value }])
Microsoft.CodeAnalysis.UnitTests (12)
CommonTypedConstantTests.cs (12)
42
new TypedConstant(_intType,
TypedConstantKind
.Primitive, 1),
43
new TypedConstant(_intType,
TypedConstantKind
.Primitive, 1));
49
new TypedConstant(_stringType,
TypedConstantKind
.Primitive, s1),
50
new TypedConstant(_stringType,
TypedConstantKind
.Primitive, s2));
53
new TypedConstant(_stringType,
TypedConstantKind
.Primitive, null),
54
new TypedConstant(_stringType,
TypedConstantKind
.Primitive, null));
57
new TypedConstant(_enumString1,
TypedConstantKind
.Primitive, null),
58
new TypedConstant(_enumString2,
TypedConstantKind
.Primitive, null));
61
new TypedConstant(_stringType,
TypedConstantKind
.Primitive, null),
62
new TypedConstant(_stringType,
TypedConstantKind
.Error, null));
65
new TypedConstant(_stringType,
TypedConstantKind
.Primitive, null),
66
new TypedConstant(_enumString1,
TypedConstantKind
.Primitive, null));
Microsoft.CodeAnalysis.VisualBasic (62)
Binding\Binder_Attributes.vb (2)
886
If kind =
TypedConstantKind
.Array Then
896
Return New TypedConstant(type,
TypedConstantKind
.Error, Nothing)
Emit\AttributeDataAdapter.vb (2)
71
Case
TypedConstantKind
.Array
73
Case
TypedConstantKind
.Type
Emit\NoPia\EmbeddedType.vb (2)
220
ImmutableArray.Create(New TypedConstant(stringType,
TypedConstantKind
.Primitive, guidString),
221
New TypedConstant(stringType,
TypedConstantKind
.Primitive, UnderlyingNamedType.AdaptedNamedTypeSymbol.ToDisplayString(SymbolDisplayFormat.QualifiedNameOnlyFormat))),
Emit\NoPia\EmbeddedTypesManager.vb (1)
109
ImmutableArray.Create(New TypedConstant(ctor.Parameters(0).Type,
TypedConstantKind
.Type, ctor.ContainingAssembly.GetSpecialType(SpecialType.System_Object))),
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousDelegate_TemplateSymbol.vb (1)
180
Dim value As New TypedConstant(Manager.System_String,
TypedConstantKind
.Primitive, "<generated method>")
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType_TemplateSymbol.vb (1)
184
ImmutableArray.Create(New TypedConstant(Manager.System_String,
TypedConstantKind
.Primitive, builder.ToStringAndFree())))
Symbols\Attributes\AttributeData.vb (9)
438
Debug.Assert(ctorArgument.Kind =
TypedConstantKind
.Enum OrElse ctorArgument.Kind =
TypedConstantKind
.Primitive)
440
Dim interfaceType As ClassInterfaceType = If(ctorArgument.Kind =
TypedConstantKind
.Enum,
465
Debug.Assert(ctorArgument.Kind =
TypedConstantKind
.Enum OrElse ctorArgument.Kind =
TypedConstantKind
.Primitive)
467
interfaceType = If(ctorArgument.Kind =
TypedConstantKind
.Enum,
483
Debug.Assert(ctorArgument.Kind =
TypedConstantKind
.Enum OrElse ctorArgument.Kind =
TypedConstantKind
.Primitive)
485
Return If(ctorArgument.Kind =
TypedConstantKind
.Enum,
Symbols\Retargeting\RetargetingSymbolTranslator.vb (2)
729
If oldConstant.Kind =
TypedConstantKind
.Array Then
741
If (oldConstant.Kind =
TypedConstantKind
.Type) AndAlso (oldConstantValue IsNot Nothing) Then
Symbols\Source\SourceAssemblySymbol.vb (5)
1550
Dim typedConstantNoStringInterning = New TypedConstant(int32Type,
TypedConstantKind
.Primitive, Cci.Constants.CompilationRelaxations_NoStringInterning)
1568
Dim typedConstantTrue = New TypedConstant(boolType,
TypedConstantKind
.Primitive, True)
1606
Dim typedConstantDebugMode = New TypedConstant(int32Type,
TypedConstantKind
.Enum, CInt(debuggingMode))
1623
Dim typedConstant = New TypedConstant(stringType,
TypedConstantKind
.Primitive, _compilation.Options.CryptoKeyContainer)
1632
Dim typedConstant = New TypedConstant(stringType,
TypedConstantKind
.Primitive, _compilation.Options.CryptoKeyFile)
Symbols\Source\SourceFieldSymbol.vb (1)
694
New TypedConstant(specialTypeInt64,
TypedConstantKind
.Primitive, attributeValue.Ticks))))
Symbols\Source\SourceMemberMethodSymbol.vb (1)
1013
If arg.Kind <>
TypedConstantKind
.Array AndAlso CInt(arg.ValueInternal) = DESIGNERSERIALIZATIONVISIBILITYTYPE_CONTENT Then
Symbols\Source\SourceNamedTypeSymbol.vb (7)
2203
If attrData.CommonConstructorArguments.Length = 1 AndAlso attrData.CommonConstructorArguments(0).Kind =
TypedConstantKind
.Primitive Then
2220
Debug.Assert(argument.Kind =
TypedConstantKind
.Type)
2491
New TypedConstant(stringType,
TypedConstantKind
.Primitive, DefaultPropertyName))))
2506
New TypedConstant(GetSpecialType(SpecialType.System_String),
TypedConstantKind
.Primitive, _comClassData.ClassId))))
2512
New TypedConstant(GetSpecialType(SpecialType.System_Int32),
TypedConstantKind
.Enum, CInt(ClassInterfaceType.None)))))
2533
New TypedConstant(GetSpecialType(SpecialType.System_String),
TypedConstantKind
.Primitive, eventInterfaceName))))
2559
ImmutableArray.Create(New TypedConstant(compilation.GetWellKnownType(WellKnownType.System_Type),
TypedConstantKind
.Type, originalType)),
Symbols\Source\SourceNamedTypeSymbol_ComClass.vb (11)
41
Dim strVal As String = If(args(0).Kind <>
TypedConstantKind
.Array, TryCast(args(0).ValueInternal, String), Nothing)
48
strVal = If(args(1).Kind <>
TypedConstantKind
.Array, TryCast(args(1).ValueInternal, String), Nothing)
54
strVal = If(args(2).Kind <>
TypedConstantKind
.Array, TryCast(args(2).ValueInternal, String), Nothing)
311
Dim value As Object = If(typedValue.Kind <>
TypedConstantKind
.Array, typedValue.ValueInternal, Nothing)
485
Dim value As Object = If(typedValue.Kind <>
TypedConstantKind
.Array, typedValue.ValueInternal, Nothing)
994
New TypedConstant(_comClass.GetSpecialType(SpecialType.System_String),
TypedConstantKind
.Primitive, id))))
1002
TypedConstantKind
.Primitive,
1009
TypedConstantKind
.Primitive,
1016
TypedConstantKind
.Primitive,
1364
TypedConstantKind
.Primitive,
1870
TypedConstantKind
.Primitive,
Symbols\Source\SourceParameterSymbol.vb (2)
421
Dim specialType = If(arg.Kind =
TypedConstantKind
.Enum,
427
If arg.Kind <>
TypedConstantKind
.Array AndAlso
Symbols\Source\SourceParameterSymbolBase.vb (1)
64
TypedConstantKind
.Primitive,
Symbols\Source\SourceWithEventsBackingFieldSymbol.vb (1)
76
TypedConstantKind
.Primitive,
Symbols\TypedConstant.vb (4)
33
If constant.Kind =
TypedConstantKind
.Array Then
37
If constant.Kind =
TypedConstantKind
.Type OrElse constant.TypeInternal.SpecialType = SpecialType.System_Object Then
41
If constant.Kind =
TypedConstantKind
.Enum Then
51
Debug.Assert(constant.Kind =
TypedConstantKind
.Enum)
Symbols\WellKnownMembers.vb (9)
221
TypedConstantKind
.Type,
245
New TypedConstant(specialTypeByte,
TypedConstantKind
.Primitive, scale),
246
New TypedConstant(specialTypeByte,
TypedConstantKind
.Primitive, CByte(If(isNegative, 128, 0))),
247
New TypedConstant(specialTypeUInt32,
TypedConstantKind
.Primitive, high),
248
New TypedConstant(specialTypeUInt32,
TypedConstantKind
.Primitive, mid),
249
New TypedConstant(specialTypeUInt32,
TypedConstantKind
.Primitive, low)
261
TypedConstantKind
.Enum,
277
TypedConstantKind
.Enum,
737
Return New TypedConstant(constantType,
TypedConstantKind
.Primitive, name)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (4)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\ExpressionGenerator.vb (4)
20
Case
TypedConstantKind
.Primitive,
TypedConstantKind
.Enum
23
Case
TypedConstantKind
.Array
30
Case
TypedConstantKind
.Type
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (113)
Attributes\AttributeTests.vb (78)
215
attrs(0).VerifyValue(0,
TypedConstantKind
.Primitive, "Roslyn.Compilers.UnitTests")
216
attrs(1).VerifyValue(0,
TypedConstantKind
.Primitive, "Roslyn.Compilers.CSharp")
217
attrs(2).VerifyValue(0,
TypedConstantKind
.Primitive, "Roslyn.Compilers.CSharp.UnitTests")
218
attrs(3).VerifyValue(0,
TypedConstantKind
.Primitive, "Roslyn.Compilers.CSharp.Test.Utilities")
219
attrs(4).VerifyValue(0,
TypedConstantKind
.Primitive, "Roslyn.Compilers.VisualBasic")
267
Assert.Equal(
TypedConstantKind
.Enum, a.CommonConstructorArguments(0).Kind)
272
Assert.Equal(
TypedConstantKind
.Primitive, a.CommonConstructorArguments(0).Kind)
277
Assert.Equal(
TypedConstantKind
.Primitive, a.CommonConstructorArguments(0).Kind)
282
Assert.Equal(
TypedConstantKind
.Enum, a.CommonConstructorArguments(0).Kind)
287
Assert.Equal(
TypedConstantKind
.Primitive, a.CommonConstructorArguments(0).Kind)
292
Assert.Equal(
TypedConstantKind
.Primitive, a.CommonConstructorArguments(0).Kind)
297
Assert.Equal(
TypedConstantKind
.Primitive, a.CommonConstructorArguments(0).Kind)
302
Assert.Equal(
TypedConstantKind
.Primitive, a.CommonConstructorArguments(0).Kind)
358
attrs(0).VerifyValue(0,
TypedConstantKind
.Primitive, 4)
652
attrs(0).VerifyValue(Of Object)(0,
TypedConstantKind
.Type, GetType(Object))
653
attrs(0).VerifyValue(Of Object)(0, "O",
TypedConstantKind
.Primitive, Nothing)
657
attrs(0).VerifyValue(0,
TypedConstantKind
.Array, {GetType(String)})
661
attrs(0).VerifyValue(Of Object())(0,
TypedConstantKind
.Array, {1, "two", GetType(String), 3.1415926})
663
attrs(0).VerifyValue(0,
TypedConstantKind
.Array, {New Object() {GetType(String)}})
771
attrs(0).VerifyValue(0, "TypeField",
TypedConstantKind
.Type, GetType(FileStream))
778
attrs(1).VerifyValue(Of UShort)(0, "UShortField",
TypedConstantKind
.Primitive, 1234)
782
attrs(4).VerifyValue(Of UShort)(0, "UShortField",
TypedConstantKind
.Primitive, 1234)
792
attrs(0).VerifyValue(0,
TypedConstantKind
.Enum, CInt(FileMode.Open))
793
attrs(0).VerifyValue(1,
TypedConstantKind
.Enum, CInt(BindingFlags.DeclaredOnly Or BindingFlags.Public))
794
attrs(0).VerifyValue(0, "UIntField",
TypedConstantKind
.Primitive, 1230)
799
attrs(0).VerifyValue(0,
TypedConstantKind
.Array, {"q"c, "c"c})
803
attrs(0).VerifyValue(Of Object)(0,
TypedConstantKind
.Primitive, Nothing)
804
attrs(0).VerifyValue(Of Long)(1,
TypedConstantKind
.Primitive, 256)
805
attrs(0).VerifyValue(Of Single)(2,
TypedConstantKind
.Primitive, 0)
806
attrs(0).VerifyValue(Of Short)(3,
TypedConstantKind
.Primitive, -1)
807
attrs(0).VerifyValue(Of ULong())(0, "AryField",
TypedConstantKind
.Array, New ULong() {0, 1, 12345657})
809
attrs(1).VerifyValue(Of Object)(0,
TypedConstantKind
.Type, GetType(Dictionary(Of String, Integer)))
810
attrs(1).VerifyValue(Of Long)(1,
TypedConstantKind
.Primitive, 265)
811
attrs(1).VerifyValue(Of Single)(2,
TypedConstantKind
.Primitive, -0.0001F)
812
attrs(1).VerifyValue(Of Short)(3,
TypedConstantKind
.Primitive, 2)
853
attrs(0).VerifyValue(Of Object)(0,
TypedConstantKind
.Array, New Object() {0, "", Nothing})
854
attrs(0).VerifyValue(Of Byte)(1,
TypedConstantKind
.Primitive, 255)
855
attrs(0).VerifyValue(Of SByte)(2,
TypedConstantKind
.Primitive, -128)
856
attrs(0).VerifyValue(Of Object())(0, "AryProp",
TypedConstantKind
.Array, New Object() {New Object() {"", GetType(IList(Of String))}})
866
attrs(1).VerifyValue(Of Object)(0,
TypedConstantKind
.Type, GetType(String(,,)))
906
attrs(0).VerifyValue(Of Object)(0,
TypedConstantKind
.Array, New Object() {1, Nothing, "Hi"})
907
attrs(0).VerifyValue(Of Object)(0, "ObjectField",
TypedConstantKind
.Primitive, 2)
941
attrs(0).VerifyValue(Of Char())(0,
TypedConstantKind
.Array, New Char() {" "c, Nothing})
942
attrs(0).VerifyValue(Of String())(1,
TypedConstantKind
.Array, New String() {""})
952
attrs(0).VerifyValue(Of Char())(0,
TypedConstantKind
.Array, New Char() {" "c, Nothing})
953
attrs(0).VerifyValue(Of String())(1,
TypedConstantKind
.Array, New String() {""})
1013
attrs(0).VerifyValue(Of Object)(0,
TypedConstantKind
.Primitive, "f1 return type")
1017
attrs(0).VerifyValue(Of Object)(0,
TypedConstantKind
.Primitive, "p1 return type")
1022
attrs(0).VerifyValue(Of Object)(0,
TypedConstantKind
.Primitive, "p2 return type")
1026
attrs(0).VerifyValue(Of Object)(0,
TypedConstantKind
.Primitive, "f2 returns an integer")
1170
attrs(0).VerifyValue(Of Object)(0,
TypedConstantKind
.Primitive, 1)
1171
attrs(1).VerifyValue(Of Object)(0,
TypedConstantKind
.Array, New String() {"a", "b"})
1172
attrs(2).VerifyValue(Of Object)(0, "X",
TypedConstantKind
.Primitive, 1)
1173
attrs(3).VerifyValue(Of Object)(0, "X",
TypedConstantKind
.Array, New String() {"a", "b"})
1221
Assert.Equal(tc.Kind,
TypedConstantKind
.Enum)
1262
attrs(0).VerifyValue(0,
TypedConstantKind
.Type, bClass.ConstructUnboundGenericType())
2178
attrs.First().VerifyValue(Of Object)(0,
TypedConstantKind
.Type, typeArg)
2183
attrs.First().VerifyValue(Of Object)(0,
TypedConstantKind
.Type, typeArg)
2189
attrs.First().VerifyValue(Of Object)(0,
TypedConstantKind
.Type, typeArg)
2196
attrs.First().VerifyValue(Of Object)(0,
TypedConstantKind
.Type, typeArg)
2205
attrs.First().VerifyValue(Of Object)(0,
TypedConstantKind
.Type, typeArg)
2212
attrs.First().VerifyValue(Of Object)(0,
TypedConstantKind
.Type, typeArg)
4327
methods(0).GetAttributes().Single().VerifyValue(0,
TypedConstantKind
.Array, New Integer() {1, 2, 3})
4328
methods(1).GetAttributes().Single().VerifyValue(0,
TypedConstantKind
.Array, New Object() {1, 2, 3})
4329
methods(2).GetAttributes().Single().VerifyValue(0,
TypedConstantKind
.Array, New String() {"A", "B", "C"})
4330
methods(3).GetAttributes().Single().VerifyValue(0,
TypedConstantKind
.Array, New Object() {"A", "B", "C"})
4331
methods(4).GetAttributes().Single().VerifyValue(0,
TypedConstantKind
.Array, New Object() {}) ' Value was invalid.
4332
methods(5).GetAttributes().Single().VerifyValue(0,
TypedConstantKind
.Array, New Object() {DirectCast({1, 2, 3}, Object), DirectCast({"A", "B", "C"}, Object)})
4398
attrs(0).VerifyValue(0,
TypedConstantKind
.Array, nullArray)
4400
attrs(1).VerifyValue(0,
TypedConstantKind
.Array, emptyArray)
4402
attrs(2).VerifyValue(0,
TypedConstantKind
.Array, nullArray)
4403
attrs(2).VerifyNamedArgumentValue(0, fieldName,
TypedConstantKind
.Array, nullArray)
4405
attrs(3).VerifyValue(0,
TypedConstantKind
.Array, emptyArray)
4406
attrs(3).VerifyNamedArgumentValue(0, fieldName,
TypedConstantKind
.Array, nullArray)
4408
attrs(4).VerifyValue(0,
TypedConstantKind
.Array, nullArray)
4409
attrs(4).VerifyNamedArgumentValue(0, fieldName,
TypedConstantKind
.Array, emptyArray)
4411
attrs(5).VerifyValue(0,
TypedConstantKind
.Array, emptyArray)
4412
attrs(5).VerifyNamedArgumentValue(0, fieldName,
TypedConstantKind
.Array, emptyArray)
Attributes\AttributeTests_Synthesized.vb (4)
727
attribute.VerifyValue(Of Integer)(0,
TypedConstantKind
.Primitive, expectedArgValue)
738
attribute.VerifyNamedArgumentValue(Of Boolean)(0, "WrapNonExceptionThrows",
TypedConstantKind
.Primitive, True)
1041
attribute.VerifyValue(0,
TypedConstantKind
.Enum, CInt(expectedDebuggingMode))
1829
New TypedConstant(comp.GetSpecialType(SpecialType.System_String),
TypedConstantKind
.Primitive, "unused"))))
Attributes\AttributeTests_Tuples.vb (1)
435
Assert.Equal(
TypedConstantKind
.Array, arg.Kind)
Attributes\AttributeTests_WellKnownAttributes.vb (18)
368
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, 99UL)
376
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, "Ref")
386
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, 0.0F)
400
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, 123456)
406
attrSym.VerifyValue(2,
TypedConstantKind
.Primitive, 100)
420
attrSym.VerifyValue(0,
TypedConstantKind
.Enum, CInt(LayoutKind.Explicit))
422
attrSym.VerifyValue(0, "Size",
TypedConstantKind
.Primitive, 16)
423
attrSym.VerifyValue(1, "Pack",
TypedConstantKind
.Primitive, 8)
424
attrSym.VerifyValue(2, "CharSet",
TypedConstantKind
.Enum, CInt(CharSet.Unicode))
431
attrSym.VerifyValue(0,
TypedConstantKind
.Enum, CInt(UnmanagedType.I8))
433
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, 0)
1233
Assert.Equal(
TypedConstantKind
.Enum, attrSym.CommonNamedArguments(0).Value.Kind)
1244
Assert.Equal(
TypedConstantKind
.Enum, attrSym.CommonNamedArguments(0).Value.Kind)
1247
Assert.Equal(
TypedConstantKind
.Primitive, attrSym.CommonNamedArguments(1).Value.Kind)
1470
Assert.Equal(
TypedConstantKind
.Enum, attrSym.CommonNamedArguments(0).Value.Kind)
3707
Assert.Equal(
TypedConstantKind
.Enum, attrSym.CommonConstructorArguments(0).Kind)
3716
Assert.Equal(
TypedConstantKind
.Enum, attrSym.CommonConstructorArguments(0).Kind)
3892
typeAttribute.VerifyNamedArgumentValue(0, "MayLeakOnAbort",
TypedConstantKind
.Primitive, True)
Emit\CompilationEmitTests.vb (12)
3291
typeAttribute.VerifyValue(0,
TypedConstantKind
.Enum, CInt(DeclarativeSecurityAction.RequestOptional))
3293
typeAttribute.VerifyNamedArgumentValue(0, "RemotingConfiguration",
TypedConstantKind
.Primitive, True)
3301
typeAttribute.VerifyValue(0,
TypedConstantKind
.Enum, CInt(DeclarativeSecurityAction.RequestMinimum))
3303
typeAttribute.VerifyNamedArgumentValue(0, "UnmanagedCode",
TypedConstantKind
.Primitive, True)
3321
typeAttribute.VerifyValue(0,
TypedConstantKind
.Enum, CInt(DeclarativeSecurityAction.Demand))
3323
typeAttribute.VerifyNamedArgumentValue(0, "Role",
TypedConstantKind
.Primitive, "User1")
3331
typeAttribute.VerifyValue(0,
TypedConstantKind
.Enum, CInt(DeclarativeSecurityAction.Assert))
3333
typeAttribute.VerifyNamedArgumentValue(0, "Role",
TypedConstantKind
.Primitive, "User2")
3346
methodAttribute.VerifyValue(0,
TypedConstantKind
.Enum, CInt(DeclarativeSecurityAction.Demand))
3348
methodAttribute.VerifyNamedArgumentValue(0, "Role",
TypedConstantKind
.Primitive, "User3")
3356
methodAttribute.VerifyValue(0,
TypedConstantKind
.Enum, CInt(DeclarativeSecurityAction.Assert))
3358
methodAttribute.VerifyNamedArgumentValue(0, "Role",
TypedConstantKind
.Primitive, "User4")
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (19)
SymbolsTests\Metadata\PE\LoadingAttributes.vb (14)
393
a.VerifyValue(0, "IA",
TypedConstantKind
.Array, {1, 2})
397
a.VerifyValue(0, "EA",
TypedConstantKind
.Array, {0, 1})
401
a.VerifyValue(0, "SA",
TypedConstantKind
.Array, {"Yes", "No"})
405
a.VerifyValue(0, "OA",
TypedConstantKind
.Array, {"Yes", "No"})
411
a.VerifyValue(0, "TA",
TypedConstantKind
.Array, {c1, c3})
540
arg.VerifyValue(0,
TypedConstantKind
.Array, {1, 2})
544
arg.VerifyValue(0,
TypedConstantKind
.Array, {stringType})
548
arg.VerifyValue(0,
TypedConstantKind
.Array, New Object() {stringType})
552
arg.VerifyValue(0,
TypedConstantKind
.Array, {stringType})
556
arg.VerifyValue(0,
TypedConstantKind
.Array, New Object() {New Object() {stringType}})
562
arg.VerifyValue(0,
TypedConstantKind
.Array, New Object() {1, "two", stringType, 3.1415926})
568
VerifyValue(arg, 0,
TypedConstantKind
.Array, New Object() {1, New Object() {2, 3, 4}, 5})
574
VerifyValue(arg, 0,
TypedConstantKind
.Array, New Integer() {1, 2, 3})
1101
attrSym.VerifyValue(0,
TypedConstantKind
.Array, New SByte() {-1, 0, 1})
SymbolsTests\Retargeting\RetargetingCustomAttributes.vb (3)
144
attribute.VerifyValue(0,
TypedConstantKind
.Type, NewMsCorLib_systemType)
147
attribute.VerifyValue(0, "Target",
TypedConstantKind
.Type, GetType(Integer()))
148
attribute.VerifyValue(1, "TargetTypeName",
TypedConstantKind
.Primitive, "IntArrayType")
SymbolsTests\TypedConstantTests.vb (2)
35
Dim common As TypedConstant = New TypedConstant(_systemType,
TypedConstantKind
.Type, _namedType)
48
{New TypedConstant(_systemType,
TypedConstantKind
.Type, _namedType)}.AsImmutableOrNull())
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (6)
Extensions.vb (6)
154
Friend Sub VerifyValue(Of T)(ByVal attr As VisualBasicAttributeData, ByVal i As Integer, ByVal kind As
TypedConstantKind
, ByVal v As T)
161
Friend Sub VerifyValue(Of T)(ByVal attr As VisualBasicAttributeData, ByVal i As Integer, ByVal name As String, ByVal kind As
TypedConstantKind
, ByVal v As T)
170
Friend Sub VerifyNamedArgumentValue(Of T)(ByVal attr As VisualBasicAttributeData, i As Integer, name As String, kind As
TypedConstantKind
, v As T)
181
Case
TypedConstantKind
.Array
183
Case
TypedConstantKind
.Enum
185
Case
TypedConstantKind
.Type
Microsoft.CodeAnalysis.VisualBasic.Workspaces (4)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\ExpressionGenerator.vb (4)
20
Case
TypedConstantKind
.Primitive,
TypedConstantKind
.Enum
23
Case
TypedConstantKind
.Array
30
Case
TypedConstantKind
.Type
Microsoft.Extensions.Logging.Generators (3)
LoggerMessageGenerator.Parser.cs (3)
140
if (typedConstant.Kind ==
TypedConstantKind
.Error)
196
if (typedConstant.Kind ==
TypedConstantKind
.Error)
854
private static object GetItem(TypedConstant arg) => arg.Kind ==
TypedConstantKind
.Array ? arg.Values : arg.Value;
Microsoft.Extensions.Options.SourceGeneration (2)
Parser.cs (2)
509
if (argument.Kind ==
TypedConstantKind
.Array)
522
if (namedArgument.Value.Kind ==
TypedConstantKind
.Array)
Microsoft.Gen.Metrics (5)
Parser.cs (5)
261
&& attributeData.ConstructorArguments[0].Kind ==
TypedConstantKind
.Primitive)
287
if (arg.Value.Kind ==
TypedConstantKind
.Primitive &&
300
if (arg.Kind !=
TypedConstantKind
.Array)
307
if (item.Kind !=
TypedConstantKind
.Primitive)
423
&& methodAttribute.ConstructorArguments[0].Kind ==
TypedConstantKind
.Type)
Microsoft.Gen.MetricsReports (5)
src\Generators\Microsoft.Gen.Metrics\Parser.cs (5)
261
&& attributeData.ConstructorArguments[0].Kind ==
TypedConstantKind
.Primitive)
287
if (arg.Value.Kind ==
TypedConstantKind
.Primitive &&
300
if (arg.Kind !=
TypedConstantKind
.Array)
307
if (item.Kind !=
TypedConstantKind
.Primitive)
423
&& methodAttribute.ConstructorArguments[0].Kind ==
TypedConstantKind
.Type)
System.Text.RegularExpressions.Generator (1)
RegexGenerator.Parser.cs (1)
69
if (generatedRegexAttr.ConstructorArguments.Any(ca => ca.Kind ==
TypedConstantKind
.Error))