713 references to TypedConstantKind
Microsoft.CodeAnalysis (29)
MetadataReader\MetadataDecoder.cs (11)
1589
TypedConstantKind
kind = PEModule.CrackStringInAttributeValue(out s, ref argReader) ?
1590
TypedConstantKind
.Primitive :
1591
TypedConstantKind
.Error;
1601
return CreateTypedConstant(type,
TypedConstantKind
.Type, serializedType);
1608
private static
TypedConstantKind
GetPrimitiveOrEnumTypedConstantKind(TypeSymbol type)
1610
return (type.TypeKind == TypeKind.Enum) ?
TypedConstantKind
.Enum :
TypedConstantKind
.Primitive;
2229
return new TypedConstant(type,
TypedConstantKind
.Error, null);
2236
private static TypedConstant CreateTypedConstant(TypeSymbol type,
TypedConstantKind
kind, object value)
2240
return new TypedConstant(type,
TypedConstantKind
.Error, null);
2246
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)
113
if (Kind !=
TypedConstantKind
.Array)
135
if (_kind ==
TypedConstantKind
.Error)
156
internal static
TypedConstantKind
GetTypedConstantKind(ITypeSymbolInternal type, Compilation compilation)
176
return
TypedConstantKind
.Primitive;
181
return
TypedConstantKind
.Array;
183
return
TypedConstantKind
.Enum;
185
return
TypedConstantKind
.Error;
191
return
TypedConstantKind
.Type;
194
return
TypedConstantKind
.Error;
Microsoft.CodeAnalysis.CodeStyle (3)
AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (2)
828
attribute.ConstructorArguments is [_, { Kind:
TypedConstantKind
.Primitive, Value: string checkId }, ..])
839
Kind:
TypedConstantKind
.Primitive,
AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
590
attribute.ConstructorArguments is [{ Kind:
TypedConstantKind
.Primitive, Type.SpecialType: SpecialType.System_String, Value: string value }])
Microsoft.CodeAnalysis.CSharp (105)
Binder\Binder_Attributes.cs (22)
725
if (reorderedArgument.Kind ==
TypedConstantKind
.Error)
729
else if (reorderedArgument.Kind ==
TypedConstantKind
.Array &&
744
if (expanded && reorderedArguments[^1].Kind ==
TypedConstantKind
.Error)
751
Debug.Assert(hasErrors || reorderedArguments.All(arg => arg.Kind !=
TypedConstantKind
.Error));
818
if (argument.Kind !=
TypedConstantKind
.Array)
935
var
typedConstantKind = node.Type.GetAttributeParameterTypedConstantKind(_binder.Compilation);
937
return VisitExpression(node, typedConstantKind, diagnostics, ref attrHasErrors, curArgumentHasErrors || typedConstantKind ==
TypedConstantKind
.Error);
940
private TypedConstant VisitExpression(BoundExpression node,
TypedConstantKind
typedConstantKind, BindingDiagnosticBag diagnostics, ref bool attrHasErrors, bool curArgumentHasErrors)
949
typedConstantKind =
TypedConstantKind
.Error;
966
return CreateTypedConstant(node,
TypedConstantKind
.Error, diagnostics, ref attrHasErrors, curArgumentHasErrors);
992
var
typedConstantKind = operandType.GetAttributeParameterTypedConstantKind(_binder.Compilation);
997
return CreateTypedConstant(node,
TypedConstantKind
.Error, diagnostics, ref attrHasErrors, curArgumentHasErrors);
1033
return CreateTypedConstant(node,
TypedConstantKind
.Type, diagnostics, ref attrHasErrors, curArgumentHasErrors, simpleValue: node.SourceType.Type);
1043
return CreateTypedConstant(node,
TypedConstantKind
.Error, diagnostics, ref attrHasErrors, curArgumentHasErrors);
1047
var
typedConstantKind = type.GetAttributeParameterTypedConstantKind(_binder.Compilation);
1065
initializer = ImmutableArray.Create(CreateTypedConstant(node,
TypedConstantKind
.Error, diagnostics, ref attrHasErrors, curArgumentHasErrors));
1077
private static TypedConstant CreateTypedConstant(BoundExpression node,
TypedConstantKind
typedConstantKind, BindingDiagnosticBag diagnostics, ref bool attrHasErrors, bool curArgumentHasErrors,
1083
if (typedConstantKind !=
TypedConstantKind
.Error && type.ContainsTypeParameter())
1104
typedConstantKind =
TypedConstantKind
.Error;
1107
if (typedConstantKind ==
TypedConstantKind
.Error)
1115
return new TypedConstant(type,
TypedConstantKind
.Error, null);
1117
else if (typedConstantKind ==
TypedConstantKind
.Array)
Compiler\ClsComplianceChecker.cs (1)
279
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)
1615
var value = flagsBuilder.SelectAsArray((flag, byteType) => new TypedConstant(byteType,
TypedConstantKind
.Primitive, flag), byteType);
1637
ImmutableArray.Create(new TypedConstant(byteType,
TypedConstantKind
.Primitive, nullableValue)));
1657
ImmutableArray.Create(new TypedConstant(Compilation.GetSpecialType(SpecialType.System_Byte),
TypedConstantKind
.Primitive, value)));
1699
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)
281
if (value.Kind !=
TypedConstantKind
.Array)
332
if (value.Kind !=
TypedConstantKind
.Array)
597
Debug.Assert(ctorArgument.Kind ==
TypedConstantKind
.Enum || ctorArgument.Kind ==
TypedConstantKind
.Primitive);
599
ClassInterfaceType interfaceType = ctorArgument.Kind ==
TypedConstantKind
.Enum ?
623
Debug.Assert(ctorArgument.Kind ==
TypedConstantKind
.Enum || ctorArgument.Kind ==
TypedConstantKind
.Primitive);
625
ComInterfaceType interfaceType = ctorArgument.Kind ==
TypedConstantKind
.Enum ?
Symbols\Compilation_WellKnownMembers.cs (13)
467
new TypedConstant(systemByte,
TypedConstantKind
.Primitive, scale),
468
new TypedConstant(systemByte,
TypedConstantKind
.Primitive, (byte)(isNegative ? 128 : 0)),
469
new TypedConstant(systemUnit32,
TypedConstantKind
.Primitive, high),
470
new TypedConstant(systemUnit32,
TypedConstantKind
.Primitive, mid),
471
new TypedConstant(systemUnit32,
TypedConstantKind
.Primitive, low)
477
var ticks = new TypedConstant(GetSpecialType(SpecialType.System_Int64),
TypedConstantKind
.Primitive, value.Ticks);
494
TypedConstantKind
.Enum,
735
var typedConstantDebugMode = new TypedConstant(debuggingModesType,
TypedConstantKind
.Enum, constantVal);
788
new TypedConstant(attributeTargetsType,
TypedConstantKind
.Enum, targets));
790
new KeyValuePair<WellKnownMember, TypedConstant>(WellKnownMember.System_AttributeUsageAttribute__AllowMultiple, new TypedConstant(boolType,
TypedConstantKind
.Primitive, allowMultiple)),
791
new KeyValuePair<WellKnownMember, TypedConstant>(WellKnownMember.System_AttributeUsageAttribute__Inherited, new TypedConstant(boolType,
TypedConstantKind
.Primitive, inherited)));
821
new TypedConstant(constantType,
TypedConstantKind
.Primitive, name), stringType);
868
var result = flagsBuilder.SelectAsArray((flag, constantType) => new TypedConstant(constantType,
TypedConstantKind
.Primitive, flag), booleanType);
Symbols\MethodSymbol.cs (4)
1002
Debug.Assert(callConvTypedConstant.Kind ==
TypedConstantKind
.Type);
1230
new TypedConstant(declaringCompilation.GetSpecialType(SpecialType.System_String),
TypedConstantKind
.Primitive, PEModule.RequiredMembersMarker), // message
1231
new TypedConstant(declaringCompilation.GetSpecialType(SpecialType.System_Boolean),
TypedConstantKind
.Primitive, true)) // error
1236
ImmutableArray.Create(new TypedConstant(declaringCompilation.GetSpecialType(SpecialType.System_String),
TypedConstantKind
.Primitive, nameof(CompilerFeatureRequiredFeatures.RequiredMembers)))
Symbols\Retargeting\RetargetingSymbolTranslator.cs (2)
1265
if (oldConstant.Kind ==
TypedConstantKind
.Array)
1281
if ((oldConstant.Kind ==
TypedConstantKind
.Type) && (oldConstantValue != null))
Symbols\Source\SourceAssemblySymbol.cs (6)
1819
var typedConstantRequestMinimum = new TypedConstant(securityActionType,
TypedConstantKind
.Enum, constantValue);
1825
var typedConstantTrue = new TypedConstant(boolType,
TypedConstantKind
.Primitive, value: true);
1957
var typedConstantNoStringInterning = new TypedConstant(int32Type,
TypedConstantKind
.Primitive, Cci.Constants.CompilationRelaxations_NoStringInterning);
1976
var typedConstantTrue = new TypedConstant(boolType,
TypedConstantKind
.Primitive, value: true);
2010
var typedConstant = new TypedConstant(stringType,
TypedConstantKind
.Primitive, _compilation.Options.CryptoKeyContainer);
2020
var typedConstant = new TypedConstant(stringType,
TypedConstantKind
.Primitive, _compilation.Options.CryptoKeyFile);
Symbols\Source\SourceComplexParameterSymbol.cs (2)
962
SpecialType specialType = arg.Kind ==
TypedConstantKind
.Enum ?
971
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\SourceMemberMethodSymbol.cs (1)
934
TypedConstantKind
.Type, stateMachineType.GetUnboundGenericTypeOrSelf());
Symbols\Source\SourceModuleSymbol.cs (2)
592
var version = ImmutableArray.Create(new TypedConstant(compilation.GetSpecialType(SpecialType.System_Int32),
TypedConstantKind
.Primitive, 11));
599
new TypedConstant(compilation.GetSpecialType(SpecialType.System_Boolean),
TypedConstantKind
.Primitive, _assemblySymbol.InternalsAreVisible));
Symbols\Source\SourceNamedTypeSymbol.cs (6)
1258
Debug.Assert(argument.Kind ==
TypedConstantKind
.Type);
1580
new TypedConstant(compilation.GetSpecialType(SpecialType.System_String),
TypedConstantKind
.Primitive, PEModule.ByRefLikeMarker), // message
1581
new TypedConstant(compilation.GetSpecialType(SpecialType.System_Boolean),
TypedConstantKind
.Primitive, true)), // error=true
1586
ImmutableArray.Create(new TypedConstant(compilation.GetSpecialType(SpecialType.System_String),
TypedConstantKind
.Primitive, nameof(CompilerFeatureRequiredFeatures.RefStructs))),
1599
var defaultMemberNameConstant = new TypedConstant(compilation.GetSpecialType(SpecialType.System_String),
TypedConstantKind
.Primitive, defaultMemberName);
1635
ImmutableArray.Create(new TypedConstant(compilation.GetWellKnownType(WellKnownType.System_Type),
TypedConstantKind
.Type, originalType)),
Symbols\SymbolExtensions.cs (1)
832
&& attr.CommonConstructorArguments[0].Kind ==
TypedConstantKind
.Type)
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)
219
return GetAttributeParameterTypedConstantKind(type, compilation) !=
TypedConstantKind
.Error;
228
public static
TypedConstantKind
GetAttributeParameterTypedConstantKind(this TypeSymbol type, CSharpCompilation compilation)
240
TypedConstantKind
kind =
TypedConstantKind
.Error;
243
return
TypedConstantKind
.Error;
251
return
TypedConstantKind
.Error;
254
kind =
TypedConstantKind
.Array;
264
if (kind ==
TypedConstantKind
.Error)
267
kind =
TypedConstantKind
.Enum;
273
var
typedConstantKind = TypedConstant.GetTypedConstantKind(type, compilation);
276
case
TypedConstantKind
.Array:
277
case
TypedConstantKind
.Enum:
278
case
TypedConstantKind
.Error:
279
return
TypedConstantKind
.Error;
282
if (kind ==
TypedConstantKind
.Array || kind ==
TypedConstantKind
.Enum)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (4)
ExpressionGenerator.cs (4)
29
case
TypedConstantKind
.Primitive:
30
case
TypedConstantKind
.Enum:
33
case
TypedConstantKind
.Type:
38
case
TypedConstantKind
.Array:
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (226)
Attributes\AttributeTests.cs (175)
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");
685
Assert.Equal(
TypedConstantKind
.Error, attrs[0].ConstructorArguments.Single().Kind);
1397
a.VerifyValue(0,
TypedConstantKind
.Enum, (int)System.Configuration.Assemblies.AssemblyHashAlgorithm.MD5);
1401
a.VerifyValue(0,
TypedConstantKind
.Primitive, "");
1405
a.VerifyValue(0,
TypedConstantKind
.Primitive, true);
1409
a.VerifyValue(0,
TypedConstantKind
.Enum, (int)AssemblyNameFlags.Retargetable);
1413
a.VerifyValue(0,
TypedConstantKind
.Primitive, "MyKey.snk");
1417
a.VerifyValue(0,
TypedConstantKind
.Primitive, "Key Name");
1421
a.VerifyValue(0,
TypedConstantKind
.Primitive, "1.2.*");
1425
a.VerifyValue(0,
TypedConstantKind
.Primitive, "4.3.2.100");
1482
attrs.First().VerifyValue<object>(0,
TypedConstantKind
.Primitive, null);
1568
attrs.First().VerifyValue(0,
TypedConstantKind
.Primitive, true);
1672
attrs.First().VerifyValue<object>(0,
TypedConstantKind
.Type, typeof(object));
1673
attrs.First().VerifyNamedArgumentValue<object>(0, "O",
TypedConstantKind
.Primitive, null);
1678
attrs.First().VerifyValue(0,
TypedConstantKind
.Array, new object[] { typeof(string) });
1683
attrs.First().VerifyValue(0,
TypedConstantKind
.Array, new object[] { 1, "two", typeof(string), 3.1415926 });
1686
attrs.First().VerifyValue(0,
TypedConstantKind
.Array, new object[] { new object[] { typeof(string) } });
3068
attrs[1].VerifyNamedArgumentValue<ushort>(0, "UShortField",
TypedConstantKind
.Primitive, 1234);
3077
attrs[0].VerifyValue(0,
TypedConstantKind
.Enum, (int)FileMode.Open);
3078
attrs[0].VerifyValue(1,
TypedConstantKind
.Enum, (int)(BindingFlags.DeclaredOnly | BindingFlags.Public));
3079
attrs[0].VerifyNamedArgumentValue<uint>(0, "UIntField",
TypedConstantKind
.Primitive, 1230);
3084
attrs[0].VerifyValue(0,
TypedConstantKind
.Array, new char[] { 'q', 'c' });
3093
attrs[0].VerifyValue<object>(0,
TypedConstantKind
.Primitive, null);
3094
attrs[0].VerifyValue<long>(1,
TypedConstantKind
.Primitive, 256);
3095
attrs[0].VerifyValue<float>(2,
TypedConstantKind
.Primitive, 0);
3096
attrs[0].VerifyValue<short>(3,
TypedConstantKind
.Primitive, -1);
3097
attrs[0].VerifyNamedArgumentValue<ulong[]>(0, "AryField",
TypedConstantKind
.Array, new ulong[] { 0, 1, 12345657 });
3099
attrs[1].VerifyValue<object>(0,
TypedConstantKind
.Type, typeof(Dictionary<string, int>));
3100
attrs[1].VerifyValue<long>(1,
TypedConstantKind
.Primitive, 265);
3101
attrs[1].VerifyValue<float>(2,
TypedConstantKind
.Primitive, -0.0001f);
3102
attrs[1].VerifyValue<short>(3,
TypedConstantKind
.Primitive, 2);
3139
attrs.First().VerifyValue<object>(0,
TypedConstantKind
.Array, new object[] { 0, "", null });
3140
attrs.First().VerifyValue<byte>(1,
TypedConstantKind
.Primitive, 255);
3141
attrs.First().VerifyValue<sbyte>(2,
TypedConstantKind
.Primitive, -128);
3142
attrs.First().VerifyNamedArgumentValue<object[]>(0, "AryProp",
TypedConstantKind
.Array, new object[] { new object[] { "", typeof(IList<string>) } });
3148
attrs[0].VerifyValue<object>(0,
TypedConstantKind
.Type, typeof(string[,,]));
3181
attrs.First().VerifyValue<object>(0,
TypedConstantKind
.Array, new object[] { 1, null, "Hi" });
3182
attrs.First().VerifyNamedArgumentValue<object>(0, "ObjectField",
TypedConstantKind
.Primitive, 2);
3413
attrs.First().VerifyValue<char[]>(0,
TypedConstantKind
.Array, new char[] { ' ' });
3414
attrs.First().VerifyValue<string[]>(1,
TypedConstantKind
.Array, new string[] { "" });
3424
attrs.First().VerifyValue<char[]>(0,
TypedConstantKind
.Array, new char[] { ' ' });
3425
attrs.First().VerifyValue<string[]>(1,
TypedConstantKind
.Array, new string[] { "" });
3493
attr.VerifyValue<string>(0,
TypedConstantKind
.Primitive, "MultipleArgumentsToParamsParameter");
3494
attr.VerifyValue<int[]>(1,
TypedConstantKind
.Array, new int[] { 4, 5, 6 });
3500
attr.VerifyValue<string>(0,
TypedConstantKind
.Primitive, "NoArgumentsToParamsParameter");
3501
attr.VerifyValue<int[]>(1,
TypedConstantKind
.Array, new int[] { });
3507
attr.VerifyValue<string>(0,
TypedConstantKind
.Primitive, "NullArgumentToParamsParameter");
3508
attr.VerifyValue<int[]>(1,
TypedConstantKind
.Array, null);
3550
attrs.First().VerifyValue<char[]>(0,
TypedConstantKind
.Array, new char[] { ' ' });
3551
attrs.First().VerifyValue<string[]>(1,
TypedConstantKind
.Array, new string[] { "whatever" });
3561
attrs.First().VerifyValue<char[]>(0,
TypedConstantKind
.Array, new char[] { ' ' });
3562
attrs.First().VerifyValue<string[]>(1,
TypedConstantKind
.Array, new string[] { "whatever" });
3597
attrs.First().VerifyValue(0,
TypedConstantKind
.Type, typeof(Object));
3642
attrs.First().VerifyValue(0,
TypedConstantKind
.Array, (object[])null);
4044
attr.VerifyValue(0,
TypedConstantKind
.Enum, (int)(AttributeTargets.Field | AttributeTargets.Event));
4047
attr.VerifyNamedArgumentValue(0, "Inherited",
TypedConstantKind
.Primitive, false);
4048
attr.VerifyNamedArgumentValue(1, "AllowMultiple",
TypedConstantKind
.Primitive, true);
4098
attrs.First().VerifyValue(0,
TypedConstantKind
.Primitive, 4);
4099
attrs.First().VerifyValue(1,
TypedConstantKind
.Primitive, 5);
4101
attrs.First().VerifyNamedArgumentValue(0, "X",
TypedConstantKind
.Primitive, 6);
4141
attrs.First().VerifyValue(0,
TypedConstantKind
.Primitive, 3);
4142
attrs.First().VerifyValue(1,
TypedConstantKind
.Primitive, 4);
4143
attrs.First().VerifyValue(2,
TypedConstantKind
.Primitive, 5);
4145
attrs.First().VerifyNamedArgumentValue(0, "X",
TypedConstantKind
.Primitive, 6);
4187
attrs.First().VerifyValue(0,
TypedConstantKind
.Primitive, 2);
4188
attrs.First().VerifyValue(1,
TypedConstantKind
.Primitive, 1);
4230
attrs.First().VerifyValue(0,
TypedConstantKind
.Primitive, 3);
4231
attrs.First().VerifyValue(1,
TypedConstantKind
.Primitive, 4);
4232
attrs.First().VerifyValue(2,
TypedConstantKind
.Primitive, 5);
4234
attrs.First().VerifyNamedArgumentValue(0, "X",
TypedConstantKind
.Primitive, 6);
4276
attr.VerifyValue<int>(0,
TypedConstantKind
.Primitive, 2);
4479
attrs.First().VerifyValue(0,
TypedConstantKind
.Primitive, 2);
4485
attrs.First().VerifyValue(0,
TypedConstantKind
.Primitive, 2);
4534
attrs.First().VerifyValue(0,
TypedConstantKind
.Type, cClass.AsUnboundGenericType());
4574
attrs.First().VerifyValue(0,
TypedConstantKind
.Type, bClass.AsUnboundGenericType());
4670
enumerator.Current.VerifyNamedArgumentValue(0, "X",
TypedConstantKind
.Enum, (int)new DayOfWeek());
4672
enumerator.Current.VerifyNamedArgumentValue(0, "X",
TypedConstantKind
.Primitive, new bool());
4674
enumerator.Current.VerifyNamedArgumentValue(0, "X",
TypedConstantKind
.Primitive, new sbyte());
4676
enumerator.Current.VerifyNamedArgumentValue(0, "X",
TypedConstantKind
.Primitive, new byte());
4678
enumerator.Current.VerifyNamedArgumentValue(0, "X",
TypedConstantKind
.Primitive, new short());
4680
enumerator.Current.VerifyNamedArgumentValue(0, "X",
TypedConstantKind
.Primitive, new ushort());
4682
enumerator.Current.VerifyNamedArgumentValue(0, "X",
TypedConstantKind
.Primitive, new int());
4684
enumerator.Current.VerifyNamedArgumentValue(0, "X",
TypedConstantKind
.Primitive, new uint());
4686
enumerator.Current.VerifyNamedArgumentValue(0, "X",
TypedConstantKind
.Primitive, new char());
4688
enumerator.Current.VerifyNamedArgumentValue(0, "X",
TypedConstantKind
.Primitive, new float());
4690
enumerator.Current.VerifyNamedArgumentValue(0, "X",
TypedConstantKind
.Primitive, new Single());
4692
enumerator.Current.VerifyNamedArgumentValue(0, "X",
TypedConstantKind
.Primitive, new double());
4957
attr.VerifyValue<object>(0,
TypedConstantKind
.Primitive, null);
4963
attr.VerifyValue<int>(0,
TypedConstantKind
.Primitive, 1);
5018
attr.VerifyValue<object>(0,
TypedConstantKind
.Primitive, null);
5022
attr.VerifyValue<object>(0,
TypedConstantKind
.Primitive, null);
5030
attr.VerifyValue<object>(0,
TypedConstantKind
.Primitive, null);
5034
attr.VerifyValue<object>(0,
TypedConstantKind
.Primitive, null);
5197
attrs.First().VerifyValue<object>(0,
TypedConstantKind
.Type, typeArg);
5202
attrs.First().VerifyValue<object>(0,
TypedConstantKind
.Type, typeArg);
5208
attrs.First().VerifyValue<object>(0,
TypedConstantKind
.Type, typeArg);
5215
attrs.First().VerifyValue<object>(0,
TypedConstantKind
.Type, typeArg);
5224
attrs.First().VerifyValue<object>(0,
TypedConstantKind
.Type, typeArg);
5231
attrs.First().VerifyValue<object>(0,
TypedConstantKind
.Type, typeArg);
5320
attributes[0].VerifyValue(0,
TypedConstantKind
.Primitive, value);
9115
attrs1[0].VerifyValue(0,
TypedConstantKind
.Array, value1);
9116
attrs1[1].VerifyValue(0,
TypedConstantKind
.Array, value1);
9117
attrs1[2].VerifyValue(0,
TypedConstantKind
.Array, value1);
9120
attrs2[0].VerifyValue(0,
TypedConstantKind
.Array, (object[])null);
9121
attrs2[1].VerifyValue(0,
TypedConstantKind
.Primitive, (object)null);
9122
attrs2[2].VerifyValue(0,
TypedConstantKind
.Array, (object[])null);
9126
attrs3[0].VerifyValue(0,
TypedConstantKind
.Array, value3);
9127
attrs3[1].VerifyValue(0,
TypedConstantKind
.Array, value3);
9128
attrs3[2].VerifyValue(0,
TypedConstantKind
.Array, value3);
9196
attrs1[0].VerifyValue(0,
TypedConstantKind
.Array, value1);
9197
attrs1[1].VerifyValue(0,
TypedConstantKind
.Array, value1);
9198
attrs1[2].VerifyValue(0,
TypedConstantKind
.Array, value1);
9202
attrs2[0].VerifyValue(0,
TypedConstantKind
.Array, (object[])null);
9203
attrs2[1].VerifyValue(0,
TypedConstantKind
.Primitive, (object)null);
9204
attrs2[2].VerifyValue(0,
TypedConstantKind
.Array, (object[])null);
9209
attrs3[0].VerifyValue(0,
TypedConstantKind
.Array, value3);
9210
attrs3[1].VerifyValue(0,
TypedConstantKind
.Array, value3);
9211
attrs3[2].VerifyValue(0,
TypedConstantKind
.Array, value3);
9214
attrs4[0].VerifyValue(0,
TypedConstantKind
.Array, new object[] { "A" });
9215
attrs4[1].VerifyValue(0,
TypedConstantKind
.Primitive, "A");
9216
attrs4[2].VerifyValue(0,
TypedConstantKind
.Primitive, "A");
9280
attrs1[0].VerifyValue(0,
TypedConstantKind
.Array, value1);
9281
attrs1[1].VerifyValue(0,
TypedConstantKind
.Array, value1);
9282
attrs1[2].VerifyValue(0,
TypedConstantKind
.Array, value1);
9285
attrs2[0].VerifyValue(0,
TypedConstantKind
.Array, (object[])null);
9286
attrs2[1].VerifyValue(0,
TypedConstantKind
.Array, (object[])null);
9287
attrs2[2].VerifyValue(0,
TypedConstantKind
.Array, (string[])null);
9291
attrs3[0].VerifyValue(0,
TypedConstantKind
.Array, value3);
9292
attrs3[1].VerifyValue(0,
TypedConstantKind
.Array, value3);
9296
attrs4[0].VerifyValue(0,
TypedConstantKind
.Array, value4);
9297
attrs4[1].VerifyValue(0,
TypedConstantKind
.Array, value4);
9298
attrs4[2].VerifyValue(0,
TypedConstantKind
.Array, value4);
9353
attrs1[0].VerifyValue(0,
TypedConstantKind
.Array, value1);
9354
attrs1[1].VerifyValue(0,
TypedConstantKind
.Array, value1);
9357
attrs2[0].VerifyValue(0,
TypedConstantKind
.Array, (object[])null);
9358
attrs2[1].VerifyValue(0,
TypedConstantKind
.Primitive, (object)null);
9359
attrs2[2].VerifyValue(0,
TypedConstantKind
.Array, (object[])null);
9363
attrs3[0].VerifyValue(0,
TypedConstantKind
.Array, value3);
9364
attrs3[1].VerifyValue(0,
TypedConstantKind
.Array, value3);
9365
attrs3[2].VerifyValue(0,
TypedConstantKind
.Array, value3);
9427
attrs1[0].VerifyValue(0,
TypedConstantKind
.Array, value1);
9428
attrs1[1].VerifyValue(0,
TypedConstantKind
.Array, value1);
9432
attrs2[0].VerifyValue(0,
TypedConstantKind
.Array, (object[])null);
9433
attrs2[1].VerifyValue(0,
TypedConstantKind
.Primitive, (object)null);
9434
attrs2[2].VerifyValue(0,
TypedConstantKind
.Array, (object[])null);
9439
attrs3[0].VerifyValue(0,
TypedConstantKind
.Array, value3);
9440
attrs3[1].VerifyValue(0,
TypedConstantKind
.Array, value3);
9441
attrs3[2].VerifyValue(0,
TypedConstantKind
.Array, value3);
9444
attrs4[0].VerifyValue(0,
TypedConstantKind
.Array, new object[] { 1 });
9445
attrs4[1].VerifyValue(0,
TypedConstantKind
.Primitive, 1);
9446
attrs4[2].VerifyValue(0,
TypedConstantKind
.Primitive, 1);
9507
attrs1[0].VerifyValue(0,
TypedConstantKind
.Array, value1);
9508
attrs1[1].VerifyValue(0,
TypedConstantKind
.Array, new object[] { value1 });
9509
attrs1[2].VerifyValue(0,
TypedConstantKind
.Array, value1);
9513
attrs2[0].VerifyValue(0,
TypedConstantKind
.Array, value2);
9514
attrs2[1].VerifyValue(0,
TypedConstantKind
.Array, value2);
9518
attrs3[0].VerifyValue(0,
TypedConstantKind
.Array, value3);
9519
attrs3[1].VerifyValue(0,
TypedConstantKind
.Array, value3);
9523
attrs4[0].VerifyValue(0,
TypedConstantKind
.Array, value4);
9524
attrs4[1].VerifyValue(0,
TypedConstantKind
.Array, value4);
9525
attrs4[2].VerifyValue(0,
TypedConstantKind
.Array, value4);
9577
attrs[0].VerifyValue(0,
TypedConstantKind
.Array, nullArray);
9579
attrs[1].VerifyValue(0,
TypedConstantKind
.Array, emptyArray);
9581
attrs[2].VerifyValue(0,
TypedConstantKind
.Array, nullArray);
9582
attrs[2].VerifyNamedArgumentValue(0, fieldName,
TypedConstantKind
.Array, nullArray);
9584
attrs[3].VerifyValue(0,
TypedConstantKind
.Array, emptyArray);
9585
attrs[3].VerifyNamedArgumentValue(0, fieldName,
TypedConstantKind
.Array, nullArray);
9587
attrs[4].VerifyValue(0,
TypedConstantKind
.Array, nullArray);
9588
attrs[4].VerifyNamedArgumentValue(0, fieldName,
TypedConstantKind
.Array, emptyArray);
9590
attrs[5].VerifyValue(0,
TypedConstantKind
.Array, emptyArray);
9591
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)
140
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, 1);
164
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, "ABCDEF5D-2448-447A-B786-64682CBEF123");
167
attrSym.VerifyValue(0,
TypedConstantKind
.Enum, (int)ComInterfaceType.InterfaceIsIUnknown);
170
attrSym.VerifyValue(0,
TypedConstantKind
.Type, typeof(object));
173
attrSym.VerifyValue(0,
TypedConstantKind
.Enum, (int)TypeLibTypeFlags.FAggregatable);
176
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, false);
177
attrSym.VerifyNamedArgumentValue(0, "ThrowOnUnmappableChar",
TypedConstantKind
.Primitive, true);
266
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, false);
269
attrSym.VerifyValue(0,
TypedConstantKind
.Enum, (int)CallingConvention.StdCall);
272
attrSym.VerifyNamedArgumentValue(0, "BestFitMapping",
TypedConstantKind
.Primitive, true);
273
attrSym.VerifyNamedArgumentValue(1, "CharSet",
TypedConstantKind
.Enum, (int)CharSet.Ansi);
274
attrSym.VerifyNamedArgumentValue(2, "SetLastError",
TypedConstantKind
.Primitive, true);
275
attrSym.VerifyNamedArgumentValue(3, "ThrowOnUnmappableChar",
TypedConstantKind
.Primitive, true);
282
attrSym.VerifyValue(0,
TypedConstantKind
.Type, typeof(object));
285
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, "ProgId");
289
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, 123);
292
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, 1);
306
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, true);
309
attrSym.VerifyValue(1,
TypedConstantKind
.Primitive, "EGoo, InteropAttribute, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null");
317
attrSym.VerifyValue(0,
TypedConstantKind
.Enum, (int)TypeLibVarFlags.FDisplayBind);
321
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, "message");
322
attrSym.VerifyValue(1,
TypedConstantKind
.Primitive, false);
416
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, 99uL);
424
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, "Ref");
435
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, 0f);
455
attrSym.VerifyValue(2,
TypedConstantKind
.Primitive, 100);
469
attrSym.VerifyValue(0,
TypedConstantKind
.Enum, (int)LayoutKind.Explicit);
471
attrSym.VerifyNamedArgumentValue(0, "Size",
TypedConstantKind
.Primitive, 16);
472
attrSym.VerifyNamedArgumentValue(1, "Pack",
TypedConstantKind
.Primitive, 8);
473
attrSym.VerifyNamedArgumentValue(2, "CharSet",
TypedConstantKind
.Enum, (int)CharSet.Unicode);
480
attrSym.VerifyValue(0,
TypedConstantKind
.Enum, (int)UnmanagedType.I8);
482
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, 0);
2399
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, "unmanaged.dll");
2401
attrSym.VerifyNamedArgumentValue(0, "CallingConvention",
TypedConstantKind
.Enum, (int)CallingConvention.FastCall);
2402
attrSym.VerifyNamedArgumentValue(1, "SetLastError",
TypedConstantKind
.Primitive, true);
2407
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, "user32.dll");
2409
attrSym.VerifyNamedArgumentValue(0, "CharSet",
TypedConstantKind
.Enum, (int)CharSet.Unicode);
2410
attrSym.VerifyNamedArgumentValue(1, "ExactSpelling",
TypedConstantKind
.Primitive, false);
2411
attrSym.VerifyNamedArgumentValue(2, "EntryPoint",
TypedConstantKind
.Primitive, "MessageBox");
5067
attrSym.VerifyValue(0,
TypedConstantKind
.Enum, (int)AttributeTargets.Class);
5069
attrSym.VerifyNamedArgumentValue(0, "AllowMultiple",
TypedConstantKind
.Primitive, true);
5073
attrSym.VerifyValue(0,
TypedConstantKind
.Enum, (int)AttributeTargets.Class);
5075
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.0.30319.18408");
1187
attr1.VerifyValue(0,
TypedConstantKind
.Primitive, "4.0.30319.18408");
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)
151
attribute.VerifyValue(0,
TypedConstantKind
.Type, newMsCorLib_systemType);
154
attribute.VerifyNamedArgumentValue<object>(0, "Target",
TypedConstantKind
.Type, typeof(int[]));
155
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)
366
public static void VerifyValue<T>(this CSharpAttributeData attr, int i,
TypedConstantKind
kind, T v)
373
public static void VerifyNamedArgumentValue<T>(this CSharpAttributeData attr, int i, string name,
TypedConstantKind
kind, T v)
386
case
TypedConstantKind
.Array:
388
case
TypedConstantKind
.Enum:
390
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)
ExpressionGenerator.cs (4)
29
case
TypedConstantKind
.Primitive:
30
case
TypedConstantKind
.Enum:
33
case
TypedConstantKind
.Type:
38
case
TypedConstantKind
.Array:
Microsoft.CodeAnalysis.Features (5)
AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (2)
828
attribute.ConstructorArguments is [_, { Kind:
TypedConstantKind
.Primitive, Value: string checkId }, ..])
839
Kind:
TypedConstantKind
.Primitive,
AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
590
attribute.ConstructorArguments is [{ Kind:
TypedConstantKind
.Primitive, Type.SpecialType: SpecialType.System_String, Value: string value }])
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (1)
6032
TypedConstantKind
.Array => x.Values.SequenceEqual(y.Values, TypedConstantComparer.Instance),
EmbeddedLanguages\EmbeddedLanguageDetector.cs (1)
360
if (argument.Kind !=
TypedConstantKind
.Primitive || argument.Value is not string argString)
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)
883
If kind =
TypedConstantKind
.Array Then
893
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)
441
Debug.Assert(ctorArgument.Kind =
TypedConstantKind
.Enum OrElse ctorArgument.Kind =
TypedConstantKind
.Primitive)
443
Dim interfaceType As ClassInterfaceType = If(ctorArgument.Kind =
TypedConstantKind
.Enum,
468
Debug.Assert(ctorArgument.Kind =
TypedConstantKind
.Enum OrElse ctorArgument.Kind =
TypedConstantKind
.Primitive)
470
interfaceType = If(ctorArgument.Kind =
TypedConstantKind
.Enum,
486
Debug.Assert(ctorArgument.Kind =
TypedConstantKind
.Enum OrElse ctorArgument.Kind =
TypedConstantKind
.Primitive)
488
Return If(ctorArgument.Kind =
TypedConstantKind
.Enum,
Symbols\Retargeting\RetargetingSymbolTranslator.vb (2)
736
If oldConstant.Kind =
TypedConstantKind
.Array Then
748
If (oldConstant.Kind =
TypedConstantKind
.Type) AndAlso (oldConstantValue IsNot Nothing) Then
Symbols\Source\SourceAssemblySymbol.vb (5)
1503
Dim typedConstantNoStringInterning = New TypedConstant(int32Type,
TypedConstantKind
.Primitive, Cci.Constants.CompilationRelaxations_NoStringInterning)
1521
Dim typedConstantTrue = New TypedConstant(boolType,
TypedConstantKind
.Primitive, True)
1559
Dim typedConstantDebugMode = New TypedConstant(int32Type,
TypedConstantKind
.Enum, CInt(debuggingMode))
1576
Dim typedConstant = New TypedConstant(stringType,
TypedConstantKind
.Primitive, _compilation.Options.CryptoKeyContainer)
1585
Dim typedConstant = New TypedConstant(stringType,
TypedConstantKind
.Primitive, _compilation.Options.CryptoKeyFile)
Symbols\Source\SourceFieldSymbol.vb (1)
675
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)
2193
If attrData.CommonConstructorArguments.Length = 1 AndAlso attrData.CommonConstructorArguments(0).Kind =
TypedConstantKind
.Primitive Then
2210
Debug.Assert(argument.Kind =
TypedConstantKind
.Type)
2481
New TypedConstant(stringType,
TypedConstantKind
.Primitive, DefaultPropertyName))))
2496
New TypedConstant(GetSpecialType(SpecialType.System_String),
TypedConstantKind
.Primitive, _comClassData.ClassId))))
2502
New TypedConstant(GetSpecialType(SpecialType.System_Int32),
TypedConstantKind
.Enum, CInt(ClassInterfaceType.None)))))
2523
New TypedConstant(GetSpecialType(SpecialType.System_String),
TypedConstantKind
.Primitive, eventInterfaceName))))
2549
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,
1349
TypedConstantKind
.Primitive,
1845
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.Emit.UnitTests (113)
Attributes\AttributeTests.vb (78)
214
attrs(0).VerifyValue(0,
TypedConstantKind
.Primitive, "Roslyn.Compilers.UnitTests")
215
attrs(1).VerifyValue(0,
TypedConstantKind
.Primitive, "Roslyn.Compilers.CSharp")
216
attrs(2).VerifyValue(0,
TypedConstantKind
.Primitive, "Roslyn.Compilers.CSharp.UnitTests")
217
attrs(3).VerifyValue(0,
TypedConstantKind
.Primitive, "Roslyn.Compilers.CSharp.Test.Utilities")
218
attrs(4).VerifyValue(0,
TypedConstantKind
.Primitive, "Roslyn.Compilers.VisualBasic")
266
Assert.Equal(
TypedConstantKind
.Enum, a.CommonConstructorArguments(0).Kind)
271
Assert.Equal(
TypedConstantKind
.Primitive, a.CommonConstructorArguments(0).Kind)
276
Assert.Equal(
TypedConstantKind
.Primitive, a.CommonConstructorArguments(0).Kind)
281
Assert.Equal(
TypedConstantKind
.Enum, a.CommonConstructorArguments(0).Kind)
286
Assert.Equal(
TypedConstantKind
.Primitive, a.CommonConstructorArguments(0).Kind)
291
Assert.Equal(
TypedConstantKind
.Primitive, a.CommonConstructorArguments(0).Kind)
296
Assert.Equal(
TypedConstantKind
.Primitive, a.CommonConstructorArguments(0).Kind)
301
Assert.Equal(
TypedConstantKind
.Primitive, a.CommonConstructorArguments(0).Kind)
357
attrs(0).VerifyValue(0,
TypedConstantKind
.Primitive, 4)
651
attrs(0).VerifyValue(Of Object)(0,
TypedConstantKind
.Type, GetType(Object))
652
attrs(0).VerifyValue(Of Object)(0, "O",
TypedConstantKind
.Primitive, Nothing)
656
attrs(0).VerifyValue(0,
TypedConstantKind
.Array, {GetType(String)})
660
attrs(0).VerifyValue(Of Object())(0,
TypedConstantKind
.Array, {1, "two", GetType(String), 3.1415926})
662
attrs(0).VerifyValue(0,
TypedConstantKind
.Array, {New Object() {GetType(String)}})
770
attrs(0).VerifyValue(0, "TypeField",
TypedConstantKind
.Type, GetType(FileStream))
777
attrs(1).VerifyValue(Of UShort)(0, "UShortField",
TypedConstantKind
.Primitive, 1234)
781
attrs(4).VerifyValue(Of UShort)(0, "UShortField",
TypedConstantKind
.Primitive, 1234)
791
attrs(0).VerifyValue(0,
TypedConstantKind
.Enum, CInt(FileMode.Open))
792
attrs(0).VerifyValue(1,
TypedConstantKind
.Enum, CInt(BindingFlags.DeclaredOnly Or BindingFlags.Public))
793
attrs(0).VerifyValue(0, "UIntField",
TypedConstantKind
.Primitive, 1230)
798
attrs(0).VerifyValue(0,
TypedConstantKind
.Array, {"q"c, "c"c})
802
attrs(0).VerifyValue(Of Object)(0,
TypedConstantKind
.Primitive, Nothing)
803
attrs(0).VerifyValue(Of Long)(1,
TypedConstantKind
.Primitive, 256)
804
attrs(0).VerifyValue(Of Single)(2,
TypedConstantKind
.Primitive, 0)
805
attrs(0).VerifyValue(Of Short)(3,
TypedConstantKind
.Primitive, -1)
806
attrs(0).VerifyValue(Of ULong())(0, "AryField",
TypedConstantKind
.Array, New ULong() {0, 1, 12345657})
808
attrs(1).VerifyValue(Of Object)(0,
TypedConstantKind
.Type, GetType(Dictionary(Of String, Integer)))
809
attrs(1).VerifyValue(Of Long)(1,
TypedConstantKind
.Primitive, 265)
810
attrs(1).VerifyValue(Of Single)(2,
TypedConstantKind
.Primitive, -0.0001F)
811
attrs(1).VerifyValue(Of Short)(3,
TypedConstantKind
.Primitive, 2)
852
attrs(0).VerifyValue(Of Object)(0,
TypedConstantKind
.Array, New Object() {0, "", Nothing})
853
attrs(0).VerifyValue(Of Byte)(1,
TypedConstantKind
.Primitive, 255)
854
attrs(0).VerifyValue(Of SByte)(2,
TypedConstantKind
.Primitive, -128)
855
attrs(0).VerifyValue(Of Object())(0, "AryProp",
TypedConstantKind
.Array, New Object() {New Object() {"", GetType(IList(Of String))}})
865
attrs(1).VerifyValue(Of Object)(0,
TypedConstantKind
.Type, GetType(String(,,)))
905
attrs(0).VerifyValue(Of Object)(0,
TypedConstantKind
.Array, New Object() {1, Nothing, "Hi"})
906
attrs(0).VerifyValue(Of Object)(0, "ObjectField",
TypedConstantKind
.Primitive, 2)
940
attrs(0).VerifyValue(Of Char())(0,
TypedConstantKind
.Array, New Char() {" "c, Nothing})
941
attrs(0).VerifyValue(Of String())(1,
TypedConstantKind
.Array, New String() {""})
951
attrs(0).VerifyValue(Of Char())(0,
TypedConstantKind
.Array, New Char() {" "c, Nothing})
952
attrs(0).VerifyValue(Of String())(1,
TypedConstantKind
.Array, New String() {""})
1012
attrs(0).VerifyValue(Of Object)(0,
TypedConstantKind
.Primitive, "f1 return type")
1016
attrs(0).VerifyValue(Of Object)(0,
TypedConstantKind
.Primitive, "p1 return type")
1021
attrs(0).VerifyValue(Of Object)(0,
TypedConstantKind
.Primitive, "p2 return type")
1025
attrs(0).VerifyValue(Of Object)(0,
TypedConstantKind
.Primitive, "f2 returns an integer")
1169
attrs(0).VerifyValue(Of Object)(0,
TypedConstantKind
.Primitive, 1)
1170
attrs(1).VerifyValue(Of Object)(0,
TypedConstantKind
.Array, New String() {"a", "b"})
1171
attrs(2).VerifyValue(Of Object)(0, "X",
TypedConstantKind
.Primitive, 1)
1172
attrs(3).VerifyValue(Of Object)(0, "X",
TypedConstantKind
.Array, New String() {"a", "b"})
1220
Assert.Equal(tc.Kind,
TypedConstantKind
.Enum)
1261
attrs(0).VerifyValue(0,
TypedConstantKind
.Type, bClass.ConstructUnboundGenericType())
2177
attrs.First().VerifyValue(Of Object)(0,
TypedConstantKind
.Type, typeArg)
2182
attrs.First().VerifyValue(Of Object)(0,
TypedConstantKind
.Type, typeArg)
2188
attrs.First().VerifyValue(Of Object)(0,
TypedConstantKind
.Type, typeArg)
2195
attrs.First().VerifyValue(Of Object)(0,
TypedConstantKind
.Type, typeArg)
2204
attrs.First().VerifyValue(Of Object)(0,
TypedConstantKind
.Type, typeArg)
2211
attrs.First().VerifyValue(Of Object)(0,
TypedConstantKind
.Type, typeArg)
4326
methods(0).GetAttributes().Single().VerifyValue(0,
TypedConstantKind
.Array, New Integer() {1, 2, 3})
4327
methods(1).GetAttributes().Single().VerifyValue(0,
TypedConstantKind
.Array, New Object() {1, 2, 3})
4328
methods(2).GetAttributes().Single().VerifyValue(0,
TypedConstantKind
.Array, New String() {"A", "B", "C"})
4329
methods(3).GetAttributes().Single().VerifyValue(0,
TypedConstantKind
.Array, New Object() {"A", "B", "C"})
4330
methods(4).GetAttributes().Single().VerifyValue(0,
TypedConstantKind
.Array, New Object() {}) ' Value was invalid.
4331
methods(5).GetAttributes().Single().VerifyValue(0,
TypedConstantKind
.Array, New Object() {DirectCast({1, 2, 3}, Object), DirectCast({"A", "B", "C"}, Object)})
4397
attrs(0).VerifyValue(0,
TypedConstantKind
.Array, nullArray)
4399
attrs(1).VerifyValue(0,
TypedConstantKind
.Array, emptyArray)
4401
attrs(2).VerifyValue(0,
TypedConstantKind
.Array, nullArray)
4402
attrs(2).VerifyNamedArgumentValue(0, fieldName,
TypedConstantKind
.Array, nullArray)
4404
attrs(3).VerifyValue(0,
TypedConstantKind
.Array, emptyArray)
4405
attrs(3).VerifyNamedArgumentValue(0, fieldName,
TypedConstantKind
.Array, nullArray)
4407
attrs(4).VerifyValue(0,
TypedConstantKind
.Array, nullArray)
4408
attrs(4).VerifyNamedArgumentValue(0, fieldName,
TypedConstantKind
.Array, emptyArray)
4410
attrs(5).VerifyValue(0,
TypedConstantKind
.Array, emptyArray)
4411
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)
365
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, 99UL)
373
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, "Ref")
383
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, 0.0F)
397
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, 123456)
403
attrSym.VerifyValue(2,
TypedConstantKind
.Primitive, 100)
417
attrSym.VerifyValue(0,
TypedConstantKind
.Enum, CInt(LayoutKind.Explicit))
419
attrSym.VerifyValue(0, "Size",
TypedConstantKind
.Primitive, 16)
420
attrSym.VerifyValue(1, "Pack",
TypedConstantKind
.Primitive, 8)
421
attrSym.VerifyValue(2, "CharSet",
TypedConstantKind
.Enum, CInt(CharSet.Unicode))
428
attrSym.VerifyValue(0,
TypedConstantKind
.Enum, CInt(UnmanagedType.I8))
430
attrSym.VerifyValue(0,
TypedConstantKind
.Primitive, 0)
966
Assert.Equal(
TypedConstantKind
.Enum, attrSym.CommonNamedArguments(0).Value.Kind)
977
Assert.Equal(
TypedConstantKind
.Enum, attrSym.CommonNamedArguments(0).Value.Kind)
980
Assert.Equal(
TypedConstantKind
.Primitive, attrSym.CommonNamedArguments(1).Value.Kind)
1203
Assert.Equal(
TypedConstantKind
.Enum, attrSym.CommonNamedArguments(0).Value.Kind)
3440
Assert.Equal(
TypedConstantKind
.Enum, attrSym.CommonConstructorArguments(0).Kind)
3449
Assert.Equal(
TypedConstantKind
.Enum, attrSym.CommonConstructorArguments(0).Kind)
3625
typeAttribute.VerifyNamedArgumentValue(0, "MayLeakOnAbort",
TypedConstantKind
.Primitive, True)
Emit\CompilationEmitTests.vb (12)
3290
typeAttribute.VerifyValue(0,
TypedConstantKind
.Enum, CInt(DeclarativeSecurityAction.RequestOptional))
3292
typeAttribute.VerifyNamedArgumentValue(0, "RemotingConfiguration",
TypedConstantKind
.Primitive, True)
3300
typeAttribute.VerifyValue(0,
TypedConstantKind
.Enum, CInt(DeclarativeSecurityAction.RequestMinimum))
3302
typeAttribute.VerifyNamedArgumentValue(0, "UnmanagedCode",
TypedConstantKind
.Primitive, True)
3320
typeAttribute.VerifyValue(0,
TypedConstantKind
.Enum, CInt(DeclarativeSecurityAction.Demand))
3322
typeAttribute.VerifyNamedArgumentValue(0, "Role",
TypedConstantKind
.Primitive, "User1")
3330
typeAttribute.VerifyValue(0,
TypedConstantKind
.Enum, CInt(DeclarativeSecurityAction.Assert))
3332
typeAttribute.VerifyNamedArgumentValue(0, "Role",
TypedConstantKind
.Primitive, "User2")
3345
methodAttribute.VerifyValue(0,
TypedConstantKind
.Enum, CInt(DeclarativeSecurityAction.Demand))
3347
methodAttribute.VerifyNamedArgumentValue(0, "Role",
TypedConstantKind
.Primitive, "User3")
3355
methodAttribute.VerifyValue(0,
TypedConstantKind
.Enum, CInt(DeclarativeSecurityAction.Assert))
3357
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)
143
attribute.VerifyValue(0,
TypedConstantKind
.Type, NewMsCorLib_systemType)
146
attribute.VerifyValue(0, "Target",
TypedConstantKind
.Type, GetType(Integer()))
147
attribute.VerifyValue(1, "TargetTypeName",
TypedConstantKind
.Primitive, "IntArrayType")
SymbolsTests\TypedConstantTests.vb (2)
34
Dim common As TypedConstant = New TypedConstant(_systemType,
TypedConstantKind
.Type, _namedType)
47
{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)
CodeGeneration\ExpressionGenerator.vb (4)
20
Case
TypedConstantKind
.Primitive,
TypedConstantKind
.Enum
23
Case
TypedConstantKind
.Array
30
Case
TypedConstantKind
.Type