767 references to TypedConstantKind
ILLink.RoslynAnalyzer (1)
Microsoft.AspNetCore.App.Analyzers (1)
Microsoft.AspNetCore.Mvc.Analyzers (2)
Microsoft.AspNetCore.Mvc.Api.Analyzers (9)
Microsoft.CodeAnalysis (29)
MetadataReader\MetadataDecoder.cs (11)
1528TypedConstantKind kind = PEModule.CrackStringInAttributeValue(out s, ref argReader) ?
1529TypedConstantKind.Primitive :
1530TypedConstantKind.Error;
1540return CreateTypedConstant(type, TypedConstantKind.Type, serializedType);
1547private static TypedConstantKind GetPrimitiveOrEnumTypedConstantKind(TypeSymbol type)
1549return (type.TypeKind == TypeKind.Enum) ? TypedConstantKind.Enum : TypedConstantKind.Primitive;
2146return new TypedConstant(type, TypedConstantKind.Error, null);
2153private static TypedConstant CreateTypedConstant(TypeSymbol type, TypedConstantKind kind, object value)
2157return new TypedConstant(type, TypedConstantKind.Error, null);
2163private static TypedConstant CreateTypedConstant(TypeSymbol type, TypedConstantKind kind, bool value)
Microsoft.CodeAnalysis.Analyzers (4)
Microsoft.CodeAnalysis.BannedApiAnalyzers (3)
Microsoft.CodeAnalysis.CodeStyle (3)
Microsoft.CodeAnalysis.CSharp (109)
Binder\Binder_Attributes.cs (22)
723if (reorderedArgument.Kind == TypedConstantKind.Error)
727else if (reorderedArgument.Kind == TypedConstantKind.Array &&
741Debug.Assert(hasErrors || reorderedArguments.All(arg => arg.Kind != TypedConstantKind.Error));
840var typedConstantKind = node.Type.GetAttributeParameterTypedConstantKind(_binder.Compilation);
842return VisitExpression(node, typedConstantKind, diagnostics, ref attrHasErrors, curArgumentHasErrors || typedConstantKind == TypedConstantKind.Error);
845private TypedConstant VisitExpression(BoundExpression node, TypedConstantKind typedConstantKind, BindingDiagnosticBag diagnostics, ref bool attrHasErrors, bool curArgumentHasErrors)
854typedConstantKind = TypedConstantKind.Error;
871return CreateTypedConstant(node, TypedConstantKind.Error, diagnostics, ref attrHasErrors, curArgumentHasErrors);
877var typedConstantKind = type.GetAttributeParameterTypedConstantKind(_binder.Compilation);
893return new TypedConstant(spread.Expression.Type, TypedConstantKind.Error, value: null);
927var typedConstantKind = operandType.GetAttributeParameterTypedConstantKind(_binder.Compilation);
932return CreateTypedConstant(node, TypedConstantKind.Error, diagnostics, ref attrHasErrors, curArgumentHasErrors);
968return CreateTypedConstant(node, TypedConstantKind.Type, diagnostics, ref attrHasErrors, curArgumentHasErrors, simpleValue: node.SourceType.Type);
978return CreateTypedConstant(node, TypedConstantKind.Error, diagnostics, ref attrHasErrors, curArgumentHasErrors);
982var typedConstantKind = type.GetAttributeParameterTypedConstantKind(_binder.Compilation);
1000initializer = ImmutableArray.Create(CreateTypedConstant(node, TypedConstantKind.Error, diagnostics, ref attrHasErrors, curArgumentHasErrors));
1012private static TypedConstant CreateTypedConstant(BoundExpression node, TypedConstantKind typedConstantKind, BindingDiagnosticBag diagnostics, ref bool attrHasErrors, bool curArgumentHasErrors,
1018if (typedConstantKind != TypedConstantKind.Error && type.ContainsTypeParameter())
1039typedConstantKind = TypedConstantKind.Error;
1042if (typedConstantKind == TypedConstantKind.Error)
1050return new TypedConstant(type, TypedConstantKind.Error, null);
1052else if (typedConstantKind == TypedConstantKind.Array)
Emitter\Model\PEModuleBuilder.cs (4)
1580var value = flagsBuilder.SelectAsArray((flag, byteType) => new TypedConstant(byteType, TypedConstantKind.Primitive, flag), byteType);
1602ImmutableArray.Create(new TypedConstant(byteType, TypedConstantKind.Primitive, nullableValue)));
1622ImmutableArray.Create(new TypedConstant(Compilation.GetSpecialType(SpecialType.System_Byte), TypedConstantKind.Primitive, value)));
1664var transformFlags = builder.SelectAsArray((flag, constantType) => new TypedConstant(constantType, TypedConstantKind.Primitive, flag), booleanType);
Symbols\Compilation_WellKnownMembers.cs (13)
471new TypedConstant(systemByte, TypedConstantKind.Primitive, scale),
472new TypedConstant(systemByte, TypedConstantKind.Primitive, (byte)(isNegative ? 128 : 0)),
473new TypedConstant(systemUnit32, TypedConstantKind.Primitive, high),
474new TypedConstant(systemUnit32, TypedConstantKind.Primitive, mid),
475new TypedConstant(systemUnit32, TypedConstantKind.Primitive, low)
481var ticks = new TypedConstant(GetSpecialType(SpecialType.System_Int64), TypedConstantKind.Primitive, value.Ticks);
498TypedConstantKind.Enum,
763var typedConstantDebugMode = new TypedConstant(debuggingModesType, TypedConstantKind.Enum, constantVal);
816new TypedConstant(attributeTargetsType, TypedConstantKind.Enum, targets));
818new KeyValuePair<WellKnownMember, TypedConstant>(WellKnownMember.System_AttributeUsageAttribute__AllowMultiple, new TypedConstant(boolType, TypedConstantKind.Primitive, allowMultiple)),
819new KeyValuePair<WellKnownMember, TypedConstant>(WellKnownMember.System_AttributeUsageAttribute__Inherited, new TypedConstant(boolType, TypedConstantKind.Primitive, inherited)));
849new TypedConstant(constantType, TypedConstantKind.Primitive, name), stringType);
896var result = flagsBuilder.SelectAsArray((flag, constantType) => new TypedConstant(constantType, TypedConstantKind.Primitive, flag), booleanType);
Symbols\Source\SourceAssemblySymbol.cs (6)
1828var typedConstantRequestMinimum = new TypedConstant(securityActionType, TypedConstantKind.Enum, constantValue);
1834var typedConstantTrue = new TypedConstant(boolType, TypedConstantKind.Primitive, value: true);
1972var typedConstantNoStringInterning = new TypedConstant(int32Type, TypedConstantKind.Primitive, Cci.Constants.CompilationRelaxations_NoStringInterning);
1991var typedConstantTrue = new TypedConstant(boolType, TypedConstantKind.Primitive, value: true);
2025var typedConstant = new TypedConstant(stringType, TypedConstantKind.Primitive, _compilation.Options.CryptoKeyContainer);
2035var typedConstant = new TypedConstant(stringType, TypedConstantKind.Primitive, _compilation.Options.CryptoKeyFile);
Symbols\Source\SourceNamedTypeSymbol.cs (7)
1034Debug.Assert(attributeData.CommonConstructorArguments[0].Kind == TypedConstantKind.Type);
1344Debug.Assert(argument.Kind == TypedConstantKind.Type);
1712new TypedConstant(compilation.GetSpecialType(SpecialType.System_String), TypedConstantKind.Primitive, PEModule.ByRefLikeMarker), // message
1713new TypedConstant(compilation.GetSpecialType(SpecialType.System_Boolean), TypedConstantKind.Primitive, true)), // error=true
1718ImmutableArray.Create(new TypedConstant(compilation.GetSpecialType(SpecialType.System_String), TypedConstantKind.Primitive, nameof(CompilerFeatureRequiredFeatures.RefStructs))),
1731var defaultMemberNameConstant = new TypedConstant(compilation.GetSpecialType(SpecialType.System_String), TypedConstantKind.Primitive, defaultMemberName);
1767ImmutableArray.Create(new TypedConstant(compilation.GetWellKnownType(WellKnownType.System_Type), TypedConstantKind.Type, originalType)),
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (5)
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (229)
Attributes\AttributeTests.cs (178)
491attrs[0].VerifyValue(0, TypedConstantKind.Primitive, "Roslyn.Compilers.UnitTests");
493attrs[1].VerifyValue(0, TypedConstantKind.Primitive, "Roslyn.Compilers.CSharp");
495attrs[2].VerifyValue(0, TypedConstantKind.Primitive, "Roslyn.Compilers.CSharp.UnitTests");
497attrs[3].VerifyValue(0, TypedConstantKind.Primitive, "Roslyn.Compilers.CSharp.Test.Utilities");
499attrs[4].VerifyValue(0, TypedConstantKind.Primitive, "Roslyn.Compilers.VisualBasic");
654Assert.Equal(TypedConstantKind.Array, attributeData.ConstructorArguments.Single().Kind);
684Assert.Equal(TypedConstantKind.Error, attrs[0].ConstructorArguments.Single().Kind);
1029Assert.Equal(TypedConstantKind.Array, arguments0[2].Kind);
1036Assert.Equal(TypedConstantKind.Array, arguments1[2].Kind);
1435a.VerifyValue(0, TypedConstantKind.Enum, (int)System.Configuration.Assemblies.AssemblyHashAlgorithm.MD5);
1439a.VerifyValue(0, TypedConstantKind.Primitive, "");
1443a.VerifyValue(0, TypedConstantKind.Primitive, true);
1447a.VerifyValue(0, TypedConstantKind.Enum, (int)AssemblyNameFlags.Retargetable);
1451a.VerifyValue(0, TypedConstantKind.Primitive, "MyKey.snk");
1455a.VerifyValue(0, TypedConstantKind.Primitive, "Key Name");
1459a.VerifyValue(0, TypedConstantKind.Primitive, "1.2.*");
1463a.VerifyValue(0, TypedConstantKind.Primitive, "4.3.2.100");
1520attrs.First().VerifyValue<object>(0, TypedConstantKind.Primitive, null);
1606attrs.First().VerifyValue(0, TypedConstantKind.Primitive, true);
1710attrs.First().VerifyValue<object>(0, TypedConstantKind.Type, typeof(object));
1711attrs.First().VerifyNamedArgumentValue<object>(0, "O", TypedConstantKind.Primitive, null);
1716attrs.First().VerifyValue(0, TypedConstantKind.Array, new object[] { typeof(string) });
1721attrs.First().VerifyValue(0, TypedConstantKind.Array, new object[] { 1, "two", typeof(string), 3.1415926 });
1724attrs.First().VerifyValue(0, TypedConstantKind.Array, new object[] { new object[] { typeof(string) } });
3106attrs[1].VerifyNamedArgumentValue<ushort>(0, "UShortField", TypedConstantKind.Primitive, 1234);
3115attrs[0].VerifyValue(0, TypedConstantKind.Enum, (int)FileMode.Open);
3116attrs[0].VerifyValue(1, TypedConstantKind.Enum, (int)(BindingFlags.DeclaredOnly | BindingFlags.Public));
3117attrs[0].VerifyNamedArgumentValue<uint>(0, "UIntField", TypedConstantKind.Primitive, 1230);
3122attrs[0].VerifyValue(0, TypedConstantKind.Array, new char[] { 'q', 'c' });
3131attrs[0].VerifyValue<object>(0, TypedConstantKind.Primitive, null);
3132attrs[0].VerifyValue<long>(1, TypedConstantKind.Primitive, 256);
3133attrs[0].VerifyValue<float>(2, TypedConstantKind.Primitive, 0);
3134attrs[0].VerifyValue<short>(3, TypedConstantKind.Primitive, -1);
3135attrs[0].VerifyNamedArgumentValue<ulong[]>(0, "AryField", TypedConstantKind.Array, new ulong[] { 0, 1, 12345657 });
3137attrs[1].VerifyValue<object>(0, TypedConstantKind.Type, typeof(Dictionary<string, int>));
3138attrs[1].VerifyValue<long>(1, TypedConstantKind.Primitive, 265);
3139attrs[1].VerifyValue<float>(2, TypedConstantKind.Primitive, -0.0001f);
3140attrs[1].VerifyValue<short>(3, TypedConstantKind.Primitive, 2);
3177attrs.First().VerifyValue<object>(0, TypedConstantKind.Array, new object[] { 0, "", null });
3178attrs.First().VerifyValue<byte>(1, TypedConstantKind.Primitive, 255);
3179attrs.First().VerifyValue<sbyte>(2, TypedConstantKind.Primitive, -128);
3180attrs.First().VerifyNamedArgumentValue<object[]>(0, "AryProp", TypedConstantKind.Array, new object[] { new object[] { "", typeof(IList<string>) } });
3186attrs[0].VerifyValue<object>(0, TypedConstantKind.Type, typeof(string[,,]));
3219attrs.First().VerifyValue<object>(0, TypedConstantKind.Array, new object[] { 1, null, "Hi" });
3220attrs.First().VerifyNamedArgumentValue<object>(0, "ObjectField", TypedConstantKind.Primitive, 2);
3451attrs.First().VerifyValue<char[]>(0, TypedConstantKind.Array, new char[] { ' ' });
3452attrs.First().VerifyValue<string[]>(1, TypedConstantKind.Array, new string[] { "" });
3464attrs.First().VerifyValue<char[]>(0, TypedConstantKind.Array, new char[] { ' ' });
3465attrs.First().VerifyValue<string[]>(1, TypedConstantKind.Array, new string[] { "" });
3533attr.VerifyValue<string>(0, TypedConstantKind.Primitive, "MultipleArgumentsToParamsParameter");
3534attr.VerifyValue<int[]>(1, TypedConstantKind.Array, new int[] { 4, 5, 6 });
3540attr.VerifyValue<string>(0, TypedConstantKind.Primitive, "NoArgumentsToParamsParameter");
3541attr.VerifyValue<int[]>(1, TypedConstantKind.Array, new int[] { });
3547attr.VerifyValue<string>(0, TypedConstantKind.Primitive, "NullArgumentToParamsParameter");
3548attr.VerifyValue<int[]>(1, TypedConstantKind.Array, null);
3590attrs.First().VerifyValue<char[]>(0, TypedConstantKind.Array, new char[] { ' ' });
3591attrs.First().VerifyValue<string[]>(1, TypedConstantKind.Array, new string[] { "whatever" });
3603attrs.First().VerifyValue<char[]>(0, TypedConstantKind.Array, new char[] { ' ' });
3604attrs.First().VerifyValue<string[]>(1, TypedConstantKind.Array, new string[] { "whatever" });
3639attrs.First().VerifyValue(0, TypedConstantKind.Type, typeof(Object));
3684attrs.First().VerifyValue(0, TypedConstantKind.Array, (object[])null);
4086attr.VerifyValue(0, TypedConstantKind.Enum, (int)(AttributeTargets.Field | AttributeTargets.Event));
4089attr.VerifyNamedArgumentValue(0, "Inherited", TypedConstantKind.Primitive, false);
4090attr.VerifyNamedArgumentValue(1, "AllowMultiple", TypedConstantKind.Primitive, true);
4140attrs.First().VerifyValue(0, TypedConstantKind.Primitive, 4);
4141attrs.First().VerifyValue(1, TypedConstantKind.Primitive, 5);
4143attrs.First().VerifyNamedArgumentValue(0, "X", TypedConstantKind.Primitive, 6);
4183attrs.First().VerifyValue(0, TypedConstantKind.Primitive, 3);
4184attrs.First().VerifyValue(1, TypedConstantKind.Primitive, 4);
4185attrs.First().VerifyValue(2, TypedConstantKind.Primitive, 5);
4187attrs.First().VerifyNamedArgumentValue(0, "X", TypedConstantKind.Primitive, 6);
4229attrs.First().VerifyValue(0, TypedConstantKind.Primitive, 2);
4230attrs.First().VerifyValue(1, TypedConstantKind.Primitive, 1);
4272attrs.First().VerifyValue(0, TypedConstantKind.Primitive, 3);
4273attrs.First().VerifyValue(1, TypedConstantKind.Primitive, 4);
4274attrs.First().VerifyValue(2, TypedConstantKind.Primitive, 5);
4276attrs.First().VerifyNamedArgumentValue(0, "X", TypedConstantKind.Primitive, 6);
4318attr.VerifyValue<int>(0, TypedConstantKind.Primitive, 2);
4521attrs.First().VerifyValue(0, TypedConstantKind.Primitive, 2);
4527attrs.First().VerifyValue(0, TypedConstantKind.Primitive, 2);
4576attrs.First().VerifyValue(0, TypedConstantKind.Type, cClass.AsUnboundGenericType());
4616attrs.First().VerifyValue(0, TypedConstantKind.Type, bClass.AsUnboundGenericType());
4968enumerator.Current.VerifyNamedArgumentValue(0, "X", TypedConstantKind.Enum, (int)new DayOfWeek());
4970enumerator.Current.VerifyNamedArgumentValue(0, "X", TypedConstantKind.Primitive, new bool());
4972enumerator.Current.VerifyNamedArgumentValue(0, "X", TypedConstantKind.Primitive, new sbyte());
4974enumerator.Current.VerifyNamedArgumentValue(0, "X", TypedConstantKind.Primitive, new byte());
4976enumerator.Current.VerifyNamedArgumentValue(0, "X", TypedConstantKind.Primitive, new short());
4978enumerator.Current.VerifyNamedArgumentValue(0, "X", TypedConstantKind.Primitive, new ushort());
4980enumerator.Current.VerifyNamedArgumentValue(0, "X", TypedConstantKind.Primitive, new int());
4982enumerator.Current.VerifyNamedArgumentValue(0, "X", TypedConstantKind.Primitive, new uint());
4984enumerator.Current.VerifyNamedArgumentValue(0, "X", TypedConstantKind.Primitive, new char());
4986enumerator.Current.VerifyNamedArgumentValue(0, "X", TypedConstantKind.Primitive, new float());
4988enumerator.Current.VerifyNamedArgumentValue(0, "X", TypedConstantKind.Primitive, new Single());
4990enumerator.Current.VerifyNamedArgumentValue(0, "X", TypedConstantKind.Primitive, new double());
5255attr.VerifyValue<object>(0, TypedConstantKind.Primitive, null);
5261attr.VerifyValue<int>(0, TypedConstantKind.Primitive, 1);
5316attr.VerifyValue<object>(0, TypedConstantKind.Primitive, null);
5320attr.VerifyValue<object>(0, TypedConstantKind.Primitive, null);
5328attr.VerifyValue<object>(0, TypedConstantKind.Primitive, null);
5332attr.VerifyValue<object>(0, TypedConstantKind.Primitive, null);
5495attrs.First().VerifyValue<object>(0, TypedConstantKind.Type, typeArg);
5500attrs.First().VerifyValue<object>(0, TypedConstantKind.Type, typeArg);
5506attrs.First().VerifyValue<object>(0, TypedConstantKind.Type, typeArg);
5513attrs.First().VerifyValue<object>(0, TypedConstantKind.Type, typeArg);
5522attrs.First().VerifyValue<object>(0, TypedConstantKind.Type, typeArg);
5529attrs.First().VerifyValue<object>(0, TypedConstantKind.Type, typeArg);
5618attributes[0].VerifyValue(0, TypedConstantKind.Primitive, value);
9415attrs1[0].VerifyValue(0, TypedConstantKind.Array, value1);
9416attrs1[1].VerifyValue(0, TypedConstantKind.Array, value1);
9417attrs1[2].VerifyValue(0, TypedConstantKind.Array, value1);
9420attrs2[0].VerifyValue(0, TypedConstantKind.Array, (object[])null);
9421attrs2[1].VerifyValue(0, TypedConstantKind.Primitive, (object)null);
9422attrs2[2].VerifyValue(0, TypedConstantKind.Array, (object[])null);
9426attrs3[0].VerifyValue(0, TypedConstantKind.Array, value3);
9427attrs3[1].VerifyValue(0, TypedConstantKind.Array, value3);
9428attrs3[2].VerifyValue(0, TypedConstantKind.Array, value3);
9496attrs1[0].VerifyValue(0, TypedConstantKind.Array, value1);
9497attrs1[1].VerifyValue(0, TypedConstantKind.Array, value1);
9498attrs1[2].VerifyValue(0, TypedConstantKind.Array, value1);
9502attrs2[0].VerifyValue(0, TypedConstantKind.Array, (object[])null);
9503attrs2[1].VerifyValue(0, TypedConstantKind.Primitive, (object)null);
9504attrs2[2].VerifyValue(0, TypedConstantKind.Array, (object[])null);
9509attrs3[0].VerifyValue(0, TypedConstantKind.Array, value3);
9510attrs3[1].VerifyValue(0, TypedConstantKind.Array, value3);
9511attrs3[2].VerifyValue(0, TypedConstantKind.Array, value3);
9514attrs4[0].VerifyValue(0, TypedConstantKind.Array, new object[] { "A" });
9515attrs4[1].VerifyValue(0, TypedConstantKind.Primitive, "A");
9516attrs4[2].VerifyValue(0, TypedConstantKind.Primitive, "A");
9580attrs1[0].VerifyValue(0, TypedConstantKind.Array, value1);
9581attrs1[1].VerifyValue(0, TypedConstantKind.Array, value1);
9582attrs1[2].VerifyValue(0, TypedConstantKind.Array, value1);
9585attrs2[0].VerifyValue(0, TypedConstantKind.Array, (object[])null);
9586attrs2[1].VerifyValue(0, TypedConstantKind.Array, (object[])null);
9587attrs2[2].VerifyValue(0, TypedConstantKind.Array, (string[])null);
9591attrs3[0].VerifyValue(0, TypedConstantKind.Array, value3);
9592attrs3[1].VerifyValue(0, TypedConstantKind.Array, value3);
9596attrs4[0].VerifyValue(0, TypedConstantKind.Array, value4);
9597attrs4[1].VerifyValue(0, TypedConstantKind.Array, value4);
9598attrs4[2].VerifyValue(0, TypedConstantKind.Array, value4);
9653attrs1[0].VerifyValue(0, TypedConstantKind.Array, value1);
9654attrs1[1].VerifyValue(0, TypedConstantKind.Array, value1);
9657attrs2[0].VerifyValue(0, TypedConstantKind.Array, (object[])null);
9658attrs2[1].VerifyValue(0, TypedConstantKind.Primitive, (object)null);
9659attrs2[2].VerifyValue(0, TypedConstantKind.Array, (object[])null);
9663attrs3[0].VerifyValue(0, TypedConstantKind.Array, value3);
9664attrs3[1].VerifyValue(0, TypedConstantKind.Array, value3);
9665attrs3[2].VerifyValue(0, TypedConstantKind.Array, value3);
9727attrs1[0].VerifyValue(0, TypedConstantKind.Array, value1);
9728attrs1[1].VerifyValue(0, TypedConstantKind.Array, value1);
9732attrs2[0].VerifyValue(0, TypedConstantKind.Array, (object[])null);
9733attrs2[1].VerifyValue(0, TypedConstantKind.Primitive, (object)null);
9734attrs2[2].VerifyValue(0, TypedConstantKind.Array, (object[])null);
9739attrs3[0].VerifyValue(0, TypedConstantKind.Array, value3);
9740attrs3[1].VerifyValue(0, TypedConstantKind.Array, value3);
9741attrs3[2].VerifyValue(0, TypedConstantKind.Array, value3);
9744attrs4[0].VerifyValue(0, TypedConstantKind.Array, new object[] { 1 });
9745attrs4[1].VerifyValue(0, TypedConstantKind.Primitive, 1);
9746attrs4[2].VerifyValue(0, TypedConstantKind.Primitive, 1);
9807attrs1[0].VerifyValue(0, TypedConstantKind.Array, value1);
9808attrs1[1].VerifyValue(0, TypedConstantKind.Array, new object[] { value1 });
9809attrs1[2].VerifyValue(0, TypedConstantKind.Array, value1);
9813attrs2[0].VerifyValue(0, TypedConstantKind.Array, value2);
9814attrs2[1].VerifyValue(0, TypedConstantKind.Array, value2);
9818attrs3[0].VerifyValue(0, TypedConstantKind.Array, value3);
9819attrs3[1].VerifyValue(0, TypedConstantKind.Array, value3);
9823attrs4[0].VerifyValue(0, TypedConstantKind.Array, value4);
9824attrs4[1].VerifyValue(0, TypedConstantKind.Array, value4);
9825attrs4[2].VerifyValue(0, TypedConstantKind.Array, value4);
9877attrs[0].VerifyValue(0, TypedConstantKind.Array, nullArray);
9879attrs[1].VerifyValue(0, TypedConstantKind.Array, emptyArray);
9881attrs[2].VerifyValue(0, TypedConstantKind.Array, nullArray);
9882attrs[2].VerifyNamedArgumentValue(0, fieldName, TypedConstantKind.Array, nullArray);
9884attrs[3].VerifyValue(0, TypedConstantKind.Array, emptyArray);
9885attrs[3].VerifyNamedArgumentValue(0, fieldName, TypedConstantKind.Array, nullArray);
9887attrs[4].VerifyValue(0, TypedConstantKind.Array, nullArray);
9888attrs[4].VerifyNamedArgumentValue(0, fieldName, TypedConstantKind.Array, emptyArray);
9890attrs[5].VerifyValue(0, TypedConstantKind.Array, emptyArray);
9891attrs[5].VerifyNamedArgumentValue(0, fieldName, TypedConstantKind.Array, emptyArray);
Attributes\AttributeTests_WellKnownAttributes.cs (43)
141attrSym.VerifyValue(0, TypedConstantKind.Primitive, 1);
165attrSym.VerifyValue(0, TypedConstantKind.Primitive, "ABCDEF5D-2448-447A-B786-64682CBEF123");
168attrSym.VerifyValue(0, TypedConstantKind.Enum, (int)ComInterfaceType.InterfaceIsIUnknown);
171attrSym.VerifyValue(0, TypedConstantKind.Type, typeof(object));
174attrSym.VerifyValue(0, TypedConstantKind.Enum, (int)TypeLibTypeFlags.FAggregatable);
177attrSym.VerifyValue(0, TypedConstantKind.Primitive, false);
178attrSym.VerifyNamedArgumentValue(0, "ThrowOnUnmappableChar", TypedConstantKind.Primitive, true);
267attrSym.VerifyValue(0, TypedConstantKind.Primitive, false);
270attrSym.VerifyValue(0, TypedConstantKind.Enum, (int)CallingConvention.StdCall);
273attrSym.VerifyNamedArgumentValue(0, "BestFitMapping", TypedConstantKind.Primitive, true);
274attrSym.VerifyNamedArgumentValue(1, "CharSet", TypedConstantKind.Enum, (int)CharSet.Ansi);
275attrSym.VerifyNamedArgumentValue(2, "SetLastError", TypedConstantKind.Primitive, true);
276attrSym.VerifyNamedArgumentValue(3, "ThrowOnUnmappableChar", TypedConstantKind.Primitive, true);
283attrSym.VerifyValue(0, TypedConstantKind.Type, typeof(object));
286attrSym.VerifyValue(0, TypedConstantKind.Primitive, "ProgId");
290attrSym.VerifyValue(0, TypedConstantKind.Primitive, 123);
293attrSym.VerifyValue(0, TypedConstantKind.Primitive, 1);
307attrSym.VerifyValue(0, TypedConstantKind.Primitive, true);
310attrSym.VerifyValue(1, TypedConstantKind.Primitive, "EGoo, InteropAttribute, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null");
318attrSym.VerifyValue(0, TypedConstantKind.Enum, (int)TypeLibVarFlags.FDisplayBind);
322attrSym.VerifyValue(0, TypedConstantKind.Primitive, "message");
323attrSym.VerifyValue(1, TypedConstantKind.Primitive, false);
417attrSym.VerifyValue(0, TypedConstantKind.Primitive, 99uL);
425attrSym.VerifyValue(0, TypedConstantKind.Primitive, "Ref");
436attrSym.VerifyValue(0, TypedConstantKind.Primitive, 0f);
456attrSym.VerifyValue(2, TypedConstantKind.Primitive, 100);
470attrSym.VerifyValue(0, TypedConstantKind.Enum, (int)LayoutKind.Explicit);
472attrSym.VerifyNamedArgumentValue(0, "Size", TypedConstantKind.Primitive, 16);
473attrSym.VerifyNamedArgumentValue(1, "Pack", TypedConstantKind.Primitive, 8);
474attrSym.VerifyNamedArgumentValue(2, "CharSet", TypedConstantKind.Enum, (int)CharSet.Unicode);
481attrSym.VerifyValue(0, TypedConstantKind.Enum, (int)UnmanagedType.I8);
483attrSym.VerifyValue(0, TypedConstantKind.Primitive, 0);
2480attrSym.VerifyValue(0, TypedConstantKind.Primitive, "unmanaged.dll");
2482attrSym.VerifyNamedArgumentValue(0, "CallingConvention", TypedConstantKind.Enum, (int)CallingConvention.FastCall);
2483attrSym.VerifyNamedArgumentValue(1, "SetLastError", TypedConstantKind.Primitive, true);
2488attrSym.VerifyValue(0, TypedConstantKind.Primitive, "user32.dll");
2490attrSym.VerifyNamedArgumentValue(0, "CharSet", TypedConstantKind.Enum, (int)CharSet.Unicode);
2491attrSym.VerifyNamedArgumentValue(1, "ExactSpelling", TypedConstantKind.Primitive, false);
2492attrSym.VerifyNamedArgumentValue(2, "EntryPoint", TypedConstantKind.Primitive, "MessageBox");
5156attrSym.VerifyValue(0, TypedConstantKind.Enum, (int)AttributeTargets.Class);
5158attrSym.VerifyNamedArgumentValue(0, "AllowMultiple", TypedConstantKind.Primitive, true);
5162attrSym.VerifyValue(0, TypedConstantKind.Enum, (int)AttributeTargets.Class);
5164attrSym.VerifyNamedArgumentValue(0, "AllowMultiple", TypedConstantKind.Primitive, false);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (111)
Symbols\Metadata\PE\LoadingAttributes.cs (94)
61aBoolInst.VerifyValue(0, TypedConstantKind.Primitive, true);
64aByteInst.VerifyValue(0, TypedConstantKind.Primitive, Convert.ToByte(1));
67aCharInst.VerifyValue(0, TypedConstantKind.Primitive, 'a');
70aSingleInst.VerifyValue(0, TypedConstantKind.Primitive, 3.14159f);
73aDoubleInst.VerifyValue(0, TypedConstantKind.Primitive, 3.1415926);
76aInt16Inst.VerifyValue(0, TypedConstantKind.Primitive, (Int16)16);
79aInt32Inst.VerifyValue(0, TypedConstantKind.Primitive, 32);
82aInt64Inst.VerifyValue(0, TypedConstantKind.Primitive, 64L);
85aObjectInst.VerifyValue(0, TypedConstantKind.Primitive, "object");
88aStringInst.VerifyValue(0, TypedConstantKind.Primitive, "assembly");
91aTypeInst.VerifyValue(0, TypedConstantKind.Type, typeof(string));
133aBoolInst.VerifyValue(0, TypedConstantKind.Primitive, true);
136aByteInst.VerifyValue(0, TypedConstantKind.Primitive, Convert.ToByte(1));
139aCharInst.VerifyValue(0, TypedConstantKind.Primitive, 'a');
142aSingleInst.VerifyValue(0, TypedConstantKind.Primitive, 3.14159f);
145aDoubleInst.VerifyValue(0, TypedConstantKind.Primitive, 3.1415926);
148aInt16Inst.VerifyValue(0, TypedConstantKind.Primitive, (Int16)16);
151aInt32Inst.VerifyValue(0, TypedConstantKind.Primitive, 32);
154aInt64Inst.VerifyValue(0, TypedConstantKind.Primitive, 64L);
157aObjectInst.VerifyValue(0, TypedConstantKind.Primitive, "object");
160aStringInst.VerifyValue(0, TypedConstantKind.Primitive, "module");
163aTypeInst.VerifyValue(0, TypedConstantKind.Type, typeof(string));
205c1.GetAttributes().First().VerifyValue(0, TypedConstantKind.Primitive, "C1");
208innerC1.GetAttributes().First().VerifyValue(0, TypedConstantKind.Primitive, "InnerC1");
215innerC2.GetAttributes().First().VerifyValue(0, TypedConstantKind.Primitive, "InnerC2");
218field1.GetAttributes().First().VerifyValue(0, TypedConstantKind.Primitive, "field1");
221property1.GetAttributes().First().VerifyValue(0, TypedConstantKind.Primitive, "Property1");
224sub1.GetAttributes().First().VerifyValue(0, TypedConstantKind.Primitive, "Sub1");
227sub1P1.GetAttributes().First().VerifyValue(0, TypedConstantKind.Primitive, "p1");
230function1.GetAttributes().First().VerifyValue(0, TypedConstantKind.Primitive, "Function1");
269a.VerifyNamedArgumentValue(0, "B", TypedConstantKind.Primitive, true);
272a.VerifyNamedArgumentValue(0, "B", TypedConstantKind.Primitive, Convert.ToByte(1));
275a.VerifyNamedArgumentValue(0, "C", TypedConstantKind.Primitive, 'b');
278a.VerifyNamedArgumentValue(0, "E", TypedConstantKind.Enum, 0);
281a.VerifyNamedArgumentValue(0, "S", TypedConstantKind.Primitive, 3.14159f);
284a.VerifyNamedArgumentValue(0, "D", TypedConstantKind.Primitive, 3.1415926);
287a.VerifyNamedArgumentValue(0, "I", TypedConstantKind.Primitive, (Int16)16);
290a.VerifyNamedArgumentValue(0, "I", TypedConstantKind.Primitive, 32);
293a.VerifyNamedArgumentValue(0, "I", TypedConstantKind.Primitive, 64L);
296a.VerifyNamedArgumentValue(0, "T", TypedConstantKind.Type, c3);
328a.VerifyNamedArgumentValue(0, "IA", TypedConstantKind.Array, new int[] { 1, 2 });
332a.VerifyNamedArgumentValue(0, "EA", TypedConstantKind.Array, new int[] { 0, 1 });
336a.VerifyNamedArgumentValue(0, "SA", TypedConstantKind.Array, new string[] { "Yes", "No" });
340a.VerifyNamedArgumentValue(0, "OA", TypedConstantKind.Array, new string[] { "Yes", "No" });
346a.VerifyNamedArgumentValue(0, "TA", TypedConstantKind.Array, new TypeSymbol[] { c1, c3 });
385c1.GetAttributes().First().VerifyValue(0, TypedConstantKind.Primitive, "C1");
432l.GetAttributes().First().VerifyValue(0, TypedConstantKind.Type, "System.Collections.Generic.List<>");
435l.GetAttributes().First().VerifyValue(0, TypedConstantKind.Type, "System.Collections.Generic.List<C1>");
438l.GetAttributes().First().VerifyValue(0, TypedConstantKind.Type, "System.Collections.Generic.List<System.String>");
441l.GetAttributes().First().VerifyValue(0, TypedConstantKind.Type, "System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<C1, System.String>>");
444l.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>>>");
477arg.VerifyValue(0, TypedConstantKind.Array, new int[] { 1, 2 });
481arg.VerifyValue(0, TypedConstantKind.Array, new object[] { stringType });
485arg.VerifyValue(0, TypedConstantKind.Array, new object[] { stringType });
489arg.VerifyValue(0, TypedConstantKind.Array, new object[] { stringType });
493arg.VerifyValue(0, TypedConstantKind.Array, new object[] { new object[] { stringType } });
499arg.VerifyValue(0, TypedConstantKind.Array, new object[] { 1, "two", stringType, 3.1415926 });
505arg.VerifyValue(0, TypedConstantKind.Array, new object[] { 1, new object[] { 2, 3, 4 }, 5 });
511arg.VerifyValue(0, TypedConstantKind.Array, new int[] { 1, 2, 3 });
606a.VerifyValue(0, TypedConstantKind.Primitive, "InteropAttributes");
609a.VerifyValue(1, TypedConstantKind.Primitive, 2);
612a.VerifyValue(0, TypedConstantKind.Primitive, "1234C65D-1234-447A-B786-64682CBEF136");
615a.VerifyValue(0, TypedConstantKind.Primitive, false);
616a.VerifyNamedArgumentValue(0, "ThrowOnUnmappableChar", TypedConstantKind.Primitive, true);
619a.VerifyValue(0, TypedConstantKind.Primitive, false);
630a.VerifyValue(2, TypedConstantKind.Primitive, 3);
637a.VerifyValue(0, TypedConstantKind.Primitive, true);
644a.VerifyValue(0, TypedConstantKind.Primitive, 8);
647a.VerifyNamedArgumentValue(0, "WrapNonExceptionThrows", TypedConstantKind.Primitive, true);
694attrSym.VerifyValue(0, TypedConstantKind.Primitive, "ABCDEF5D-2448-447A-B786-64682CBEF123");
747attrSym.VerifyValue(0, TypedConstantKind.Primitive, false);
757attrSym.VerifyNamedArgumentValue(0, "BestFitMapping", TypedConstantKind.Primitive, true);
758attrSym.VerifyNamedArgumentValue(1, "CharSet", TypedConstantKind.Enum, (int)CharSet.Ansi);
759attrSym.VerifyNamedArgumentValue(2, "SetLastError", TypedConstantKind.Primitive, true);
760attrSym.VerifyNamedArgumentValue(3, "ThrowOnUnmappableChar", TypedConstantKind.Primitive, true);
797attrSym.VerifyValue(0, TypedConstantKind.Primitive, "message");
798attrSym.VerifyValue(1, TypedConstantKind.Primitive, false);
854attrSym.VerifyValue(0, TypedConstantKind.Type, cbar);
858attrSym.VerifyValue(0, TypedConstantKind.Primitive, "MyIndex");
863mem.GetAttributes().First().VerifyValue(0, TypedConstantKind.Primitive, 10);
897attrSym.VerifyValue(0, TypedConstantKind.Primitive, 1);
927attrSym.VerifyNamedArgumentValue(0, "UShortField", TypedConstantKind.Primitive, Convert.ToUInt16(321));
931attrSym.VerifyNamedArgumentValue(0, "TypeField", TypedConstantKind.Type, typeof(Dictionary<string, int>));
968attrSym.VerifyValue(0, TypedConstantKind.Primitive, 3.1415926);
977attrSym.VerifyValue(0, TypedConstantKind.Primitive, 'q');
978attrSym.VerifyValue(1, TypedConstantKind.Primitive, Convert.ToByte(2));
990attrSym.VerifyValue(0, TypedConstantKind.Primitive, "555");
1005attrSym.VerifyValue(0, TypedConstantKind.Array, new sbyte[] { -1, 0, 1 });
1183attr1.VerifyValue(0, TypedConstantKind.Primitive, "4.6.1055.0");
1187attr1.VerifyValue(0, TypedConstantKind.Primitive, "4.6.1055.0");
1243attr.VerifyValue(0, TypedConstantKind.Primitive, "genericUriParserOptions");
1244attr.VerifyNamedArgumentValue(1, "IsRequired", TypedConstantKind.Primitive, true);
1276attr.VerifyValue(0, TypedConstantKind.Primitive, "DataCategory_Mapping");
1279attr.VerifyValue(0, TypedConstantKind.Primitive, "DataAdapter_MissingMappingAction");
Symbols\TypedConstantTests.cs (14)
44TypedConstant common = new TypedConstant(_systemType, TypedConstantKind.Type, _namedType);
57new[] { new TypedConstant(_systemType, TypedConstantKind.Type, _namedType) }.AsImmutableOrNull());
77new TypedConstant(_intType, TypedConstantKind.Primitive, 1),
78new TypedConstant(_intType, TypedConstantKind.Primitive, 1));
84new TypedConstant(_stringType, TypedConstantKind.Primitive, s1),
85new TypedConstant(_stringType, TypedConstantKind.Primitive, s2));
88new TypedConstant(_stringType, TypedConstantKind.Primitive, null),
89new TypedConstant(_stringType, TypedConstantKind.Primitive, null));
92new TypedConstant(_enumString1, TypedConstantKind.Primitive, null),
93new TypedConstant(_enumString2, TypedConstantKind.Primitive, null));
96new TypedConstant(_stringType, TypedConstantKind.Primitive, null),
97new TypedConstant(_stringType, TypedConstantKind.Error, null));
100new TypedConstant(_stringType, TypedConstantKind.Primitive, null),
101new TypedConstant(_systemType, TypedConstantKind.Primitive, null));
Microsoft.CodeAnalysis.CSharp.Test.Utilities (6)
Microsoft.CodeAnalysis.CSharp.WinRT.UnitTests (4)
Microsoft.CodeAnalysis.CSharp.Workspaces (5)
Microsoft.CodeAnalysis.Features (4)
Microsoft.CodeAnalysis.PublicApiAnalyzers (1)
Microsoft.CodeAnalysis.UnitTests (12)
CommonTypedConstantTests.cs (12)
42new TypedConstant(_intType, TypedConstantKind.Primitive, 1),
43new TypedConstant(_intType, TypedConstantKind.Primitive, 1));
49new TypedConstant(_stringType, TypedConstantKind.Primitive, s1),
50new TypedConstant(_stringType, TypedConstantKind.Primitive, s2));
53new TypedConstant(_stringType, TypedConstantKind.Primitive, null),
54new TypedConstant(_stringType, TypedConstantKind.Primitive, null));
57new TypedConstant(_enumString1, TypedConstantKind.Primitive, null),
58new TypedConstant(_enumString2, TypedConstantKind.Primitive, null));
61new TypedConstant(_stringType, TypedConstantKind.Primitive, null),
62new TypedConstant(_stringType, TypedConstantKind.Error, null));
65new TypedConstant(_stringType, TypedConstantKind.Primitive, null),
66new TypedConstant(_enumString1, TypedConstantKind.Primitive, null));
Microsoft.CodeAnalysis.VisualBasic (62)
Symbols\Source\SourceAssemblySymbol.vb (5)
1550Dim typedConstantNoStringInterning = New TypedConstant(int32Type, TypedConstantKind.Primitive, Cci.Constants.CompilationRelaxations_NoStringInterning)
1568Dim typedConstantTrue = New TypedConstant(boolType, TypedConstantKind.Primitive, True)
1606Dim typedConstantDebugMode = New TypedConstant(int32Type, TypedConstantKind.Enum, CInt(debuggingMode))
1623Dim typedConstant = New TypedConstant(stringType, TypedConstantKind.Primitive, _compilation.Options.CryptoKeyContainer)
1632Dim typedConstant = New TypedConstant(stringType, TypedConstantKind.Primitive, _compilation.Options.CryptoKeyFile)
Symbols\Source\SourceNamedTypeSymbol.vb (7)
2251If attrData.CommonConstructorArguments.Length = 1 AndAlso attrData.CommonConstructorArguments(0).Kind = TypedConstantKind.Primitive Then
2268Debug.Assert(argument.Kind = TypedConstantKind.Type)
2541New TypedConstant(stringType, TypedConstantKind.Primitive, DefaultPropertyName))))
2556New TypedConstant(GetSpecialType(SpecialType.System_String), TypedConstantKind.Primitive, _comClassData.ClassId))))
2562New TypedConstant(GetSpecialType(SpecialType.System_Int32), TypedConstantKind.Enum, CInt(ClassInterfaceType.None)))))
2583New TypedConstant(GetSpecialType(SpecialType.System_String), TypedConstantKind.Primitive, eventInterfaceName))))
2610ImmutableArray.Create(New TypedConstant(compilation.GetWellKnownType(WellKnownType.System_Type), TypedConstantKind.Type, originalType)),
Symbols\Source\SourceNamedTypeSymbol_ComClass.vb (11)
42Dim strVal As String = If(args(0).Kind <> TypedConstantKind.Array, TryCast(args(0).ValueInternal, String), Nothing)
49strVal = If(args(1).Kind <> TypedConstantKind.Array, TryCast(args(1).ValueInternal, String), Nothing)
55strVal = If(args(2).Kind <> TypedConstantKind.Array, TryCast(args(2).ValueInternal, String), Nothing)
312Dim value As Object = If(typedValue.Kind <> TypedConstantKind.Array, typedValue.ValueInternal, Nothing)
486Dim value As Object = If(typedValue.Kind <> TypedConstantKind.Array, typedValue.ValueInternal, Nothing)
1001New TypedConstant(_comClass.GetSpecialType(SpecialType.System_String), TypedConstantKind.Primitive, id))))
1009TypedConstantKind.Primitive,
1016TypedConstantKind.Primitive,
1023TypedConstantKind.Primitive,
1371TypedConstantKind.Primitive,
1877TypedConstantKind.Primitive,
Symbols\WellKnownMembers.vb (9)
221TypedConstantKind.Type,
245New TypedConstant(specialTypeByte, TypedConstantKind.Primitive, scale),
246New TypedConstant(specialTypeByte, TypedConstantKind.Primitive, CByte(If(isNegative, 128, 0))),
247New TypedConstant(specialTypeUInt32, TypedConstantKind.Primitive, high),
248New TypedConstant(specialTypeUInt32, TypedConstantKind.Primitive, mid),
249New TypedConstant(specialTypeUInt32, TypedConstantKind.Primitive, low)
261TypedConstantKind.Enum,
277TypedConstantKind.Enum,
737Return New TypedConstant(constantType, TypedConstantKind.Primitive, name)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (4)
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (113)
Attributes\AttributeTests.vb (78)
215attrs(0).VerifyValue(0, TypedConstantKind.Primitive, "Roslyn.Compilers.UnitTests")
216attrs(1).VerifyValue(0, TypedConstantKind.Primitive, "Roslyn.Compilers.CSharp")
217attrs(2).VerifyValue(0, TypedConstantKind.Primitive, "Roslyn.Compilers.CSharp.UnitTests")
218attrs(3).VerifyValue(0, TypedConstantKind.Primitive, "Roslyn.Compilers.CSharp.Test.Utilities")
219attrs(4).VerifyValue(0, TypedConstantKind.Primitive, "Roslyn.Compilers.VisualBasic")
267Assert.Equal(TypedConstantKind.Enum, a.CommonConstructorArguments(0).Kind)
272Assert.Equal(TypedConstantKind.Primitive, a.CommonConstructorArguments(0).Kind)
277Assert.Equal(TypedConstantKind.Primitive, a.CommonConstructorArguments(0).Kind)
282Assert.Equal(TypedConstantKind.Enum, a.CommonConstructorArguments(0).Kind)
287Assert.Equal(TypedConstantKind.Primitive, a.CommonConstructorArguments(0).Kind)
292Assert.Equal(TypedConstantKind.Primitive, a.CommonConstructorArguments(0).Kind)
297Assert.Equal(TypedConstantKind.Primitive, a.CommonConstructorArguments(0).Kind)
302Assert.Equal(TypedConstantKind.Primitive, a.CommonConstructorArguments(0).Kind)
358attrs(0).VerifyValue(0, TypedConstantKind.Primitive, 4)
652attrs(0).VerifyValue(Of Object)(0, TypedConstantKind.Type, GetType(Object))
653attrs(0).VerifyValue(Of Object)(0, "O", TypedConstantKind.Primitive, Nothing)
657attrs(0).VerifyValue(0, TypedConstantKind.Array, {GetType(String)})
661attrs(0).VerifyValue(Of Object())(0, TypedConstantKind.Array, {1, "two", GetType(String), 3.1415926})
663attrs(0).VerifyValue(0, TypedConstantKind.Array, {New Object() {GetType(String)}})
771attrs(0).VerifyValue(0, "TypeField", TypedConstantKind.Type, GetType(FileStream))
778attrs(1).VerifyValue(Of UShort)(0, "UShortField", TypedConstantKind.Primitive, 1234)
782attrs(4).VerifyValue(Of UShort)(0, "UShortField", TypedConstantKind.Primitive, 1234)
792attrs(0).VerifyValue(0, TypedConstantKind.Enum, CInt(FileMode.Open))
793attrs(0).VerifyValue(1, TypedConstantKind.Enum, CInt(BindingFlags.DeclaredOnly Or BindingFlags.Public))
794attrs(0).VerifyValue(0, "UIntField", TypedConstantKind.Primitive, 1230)
799attrs(0).VerifyValue(0, TypedConstantKind.Array, {"q"c, "c"c})
803attrs(0).VerifyValue(Of Object)(0, TypedConstantKind.Primitive, Nothing)
804attrs(0).VerifyValue(Of Long)(1, TypedConstantKind.Primitive, 256)
805attrs(0).VerifyValue(Of Single)(2, TypedConstantKind.Primitive, 0)
806attrs(0).VerifyValue(Of Short)(3, TypedConstantKind.Primitive, -1)
807attrs(0).VerifyValue(Of ULong())(0, "AryField", TypedConstantKind.Array, New ULong() {0, 1, 12345657})
809attrs(1).VerifyValue(Of Object)(0, TypedConstantKind.Type, GetType(Dictionary(Of String, Integer)))
810attrs(1).VerifyValue(Of Long)(1, TypedConstantKind.Primitive, 265)
811attrs(1).VerifyValue(Of Single)(2, TypedConstantKind.Primitive, -0.0001F)
812attrs(1).VerifyValue(Of Short)(3, TypedConstantKind.Primitive, 2)
853attrs(0).VerifyValue(Of Object)(0, TypedConstantKind.Array, New Object() {0, "", Nothing})
854attrs(0).VerifyValue(Of Byte)(1, TypedConstantKind.Primitive, 255)
855attrs(0).VerifyValue(Of SByte)(2, TypedConstantKind.Primitive, -128)
856attrs(0).VerifyValue(Of Object())(0, "AryProp", TypedConstantKind.Array, New Object() {New Object() {"", GetType(IList(Of String))}})
866attrs(1).VerifyValue(Of Object)(0, TypedConstantKind.Type, GetType(String(,,)))
906attrs(0).VerifyValue(Of Object)(0, TypedConstantKind.Array, New Object() {1, Nothing, "Hi"})
907attrs(0).VerifyValue(Of Object)(0, "ObjectField", TypedConstantKind.Primitive, 2)
941attrs(0).VerifyValue(Of Char())(0, TypedConstantKind.Array, New Char() {" "c, Nothing})
942attrs(0).VerifyValue(Of String())(1, TypedConstantKind.Array, New String() {""})
952attrs(0).VerifyValue(Of Char())(0, TypedConstantKind.Array, New Char() {" "c, Nothing})
953attrs(0).VerifyValue(Of String())(1, TypedConstantKind.Array, New String() {""})
1013attrs(0).VerifyValue(Of Object)(0, TypedConstantKind.Primitive, "f1 return type")
1017attrs(0).VerifyValue(Of Object)(0, TypedConstantKind.Primitive, "p1 return type")
1022attrs(0).VerifyValue(Of Object)(0, TypedConstantKind.Primitive, "p2 return type")
1026attrs(0).VerifyValue(Of Object)(0, TypedConstantKind.Primitive, "f2 returns an integer")
1170attrs(0).VerifyValue(Of Object)(0, TypedConstantKind.Primitive, 1)
1171attrs(1).VerifyValue(Of Object)(0, TypedConstantKind.Array, New String() {"a", "b"})
1172attrs(2).VerifyValue(Of Object)(0, "X", TypedConstantKind.Primitive, 1)
1173attrs(3).VerifyValue(Of Object)(0, "X", TypedConstantKind.Array, New String() {"a", "b"})
1221Assert.Equal(tc.Kind, TypedConstantKind.Enum)
1262attrs(0).VerifyValue(0, TypedConstantKind.Type, bClass.ConstructUnboundGenericType())
2180attrs.First().VerifyValue(Of Object)(0, TypedConstantKind.Type, typeArg)
2185attrs.First().VerifyValue(Of Object)(0, TypedConstantKind.Type, typeArg)
2191attrs.First().VerifyValue(Of Object)(0, TypedConstantKind.Type, typeArg)
2198attrs.First().VerifyValue(Of Object)(0, TypedConstantKind.Type, typeArg)
2207attrs.First().VerifyValue(Of Object)(0, TypedConstantKind.Type, typeArg)
2214attrs.First().VerifyValue(Of Object)(0, TypedConstantKind.Type, typeArg)
4329methods(0).GetAttributes().Single().VerifyValue(0, TypedConstantKind.Array, New Integer() {1, 2, 3})
4330methods(1).GetAttributes().Single().VerifyValue(0, TypedConstantKind.Array, New Object() {1, 2, 3})
4331methods(2).GetAttributes().Single().VerifyValue(0, TypedConstantKind.Array, New String() {"A", "B", "C"})
4332methods(3).GetAttributes().Single().VerifyValue(0, TypedConstantKind.Array, New Object() {"A", "B", "C"})
4333methods(4).GetAttributes().Single().VerifyValue(0, TypedConstantKind.Array, New Object() {}) ' Value was invalid.
4334methods(5).GetAttributes().Single().VerifyValue(0, TypedConstantKind.Array, New Object() {DirectCast({1, 2, 3}, Object), DirectCast({"A", "B", "C"}, Object)})
4400attrs(0).VerifyValue(0, TypedConstantKind.Array, nullArray)
4402attrs(1).VerifyValue(0, TypedConstantKind.Array, emptyArray)
4404attrs(2).VerifyValue(0, TypedConstantKind.Array, nullArray)
4405attrs(2).VerifyNamedArgumentValue(0, fieldName, TypedConstantKind.Array, nullArray)
4407attrs(3).VerifyValue(0, TypedConstantKind.Array, emptyArray)
4408attrs(3).VerifyNamedArgumentValue(0, fieldName, TypedConstantKind.Array, nullArray)
4410attrs(4).VerifyValue(0, TypedConstantKind.Array, nullArray)
4411attrs(4).VerifyNamedArgumentValue(0, fieldName, TypedConstantKind.Array, emptyArray)
4413attrs(5).VerifyValue(0, TypedConstantKind.Array, emptyArray)
4414attrs(5).VerifyNamedArgumentValue(0, fieldName, TypedConstantKind.Array, emptyArray)
Attributes\AttributeTests_WellKnownAttributes.vb (18)
368attrSym.VerifyValue(0, TypedConstantKind.Primitive, 99UL)
376attrSym.VerifyValue(0, TypedConstantKind.Primitive, "Ref")
386attrSym.VerifyValue(0, TypedConstantKind.Primitive, 0.0F)
400attrSym.VerifyValue(0, TypedConstantKind.Primitive, 123456)
406attrSym.VerifyValue(2, TypedConstantKind.Primitive, 100)
420attrSym.VerifyValue(0, TypedConstantKind.Enum, CInt(LayoutKind.Explicit))
422attrSym.VerifyValue(0, "Size", TypedConstantKind.Primitive, 16)
423attrSym.VerifyValue(1, "Pack", TypedConstantKind.Primitive, 8)
424attrSym.VerifyValue(2, "CharSet", TypedConstantKind.Enum, CInt(CharSet.Unicode))
431attrSym.VerifyValue(0, TypedConstantKind.Enum, CInt(UnmanagedType.I8))
433attrSym.VerifyValue(0, TypedConstantKind.Primitive, 0)
1233Assert.Equal(TypedConstantKind.Enum, attrSym.CommonNamedArguments(0).Value.Kind)
1244Assert.Equal(TypedConstantKind.Enum, attrSym.CommonNamedArguments(0).Value.Kind)
1247Assert.Equal(TypedConstantKind.Primitive, attrSym.CommonNamedArguments(1).Value.Kind)
1470Assert.Equal(TypedConstantKind.Enum, attrSym.CommonNamedArguments(0).Value.Kind)
3707Assert.Equal(TypedConstantKind.Enum, attrSym.CommonConstructorArguments(0).Kind)
3716Assert.Equal(TypedConstantKind.Enum, attrSym.CommonConstructorArguments(0).Kind)
3892typeAttribute.VerifyNamedArgumentValue(0, "MayLeakOnAbort", TypedConstantKind.Primitive, True)
Emit\CompilationEmitTests.vb (12)
3291typeAttribute.VerifyValue(0, TypedConstantKind.Enum, CInt(DeclarativeSecurityAction.RequestOptional))
3293typeAttribute.VerifyNamedArgumentValue(0, "RemotingConfiguration", TypedConstantKind.Primitive, True)
3301typeAttribute.VerifyValue(0, TypedConstantKind.Enum, CInt(DeclarativeSecurityAction.RequestMinimum))
3303typeAttribute.VerifyNamedArgumentValue(0, "UnmanagedCode", TypedConstantKind.Primitive, True)
3321typeAttribute.VerifyValue(0, TypedConstantKind.Enum, CInt(DeclarativeSecurityAction.Demand))
3323typeAttribute.VerifyNamedArgumentValue(0, "Role", TypedConstantKind.Primitive, "User1")
3331typeAttribute.VerifyValue(0, TypedConstantKind.Enum, CInt(DeclarativeSecurityAction.Assert))
3333typeAttribute.VerifyNamedArgumentValue(0, "Role", TypedConstantKind.Primitive, "User2")
3346methodAttribute.VerifyValue(0, TypedConstantKind.Enum, CInt(DeclarativeSecurityAction.Demand))
3348methodAttribute.VerifyNamedArgumentValue(0, "Role", TypedConstantKind.Primitive, "User3")
3356methodAttribute.VerifyValue(0, TypedConstantKind.Enum, CInt(DeclarativeSecurityAction.Assert))
3358methodAttribute.VerifyNamedArgumentValue(0, "Role", TypedConstantKind.Primitive, "User4")
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (19)
SymbolsTests\Metadata\PE\LoadingAttributes.vb (14)
393a.VerifyValue(0, "IA", TypedConstantKind.Array, {1, 2})
397a.VerifyValue(0, "EA", TypedConstantKind.Array, {0, 1})
401a.VerifyValue(0, "SA", TypedConstantKind.Array, {"Yes", "No"})
405a.VerifyValue(0, "OA", TypedConstantKind.Array, {"Yes", "No"})
411a.VerifyValue(0, "TA", TypedConstantKind.Array, {c1, c3})
540arg.VerifyValue(0, TypedConstantKind.Array, {1, 2})
544arg.VerifyValue(0, TypedConstantKind.Array, {stringType})
548arg.VerifyValue(0, TypedConstantKind.Array, New Object() {stringType})
552arg.VerifyValue(0, TypedConstantKind.Array, {stringType})
556arg.VerifyValue(0, TypedConstantKind.Array, New Object() {New Object() {stringType}})
562arg.VerifyValue(0, TypedConstantKind.Array, New Object() {1, "two", stringType, 3.1415926})
568VerifyValue(arg, 0, TypedConstantKind.Array, New Object() {1, New Object() {2, 3, 4}, 5})
574VerifyValue(arg, 0, TypedConstantKind.Array, New Integer() {1, 2, 3})
1101attrSym.VerifyValue(0, TypedConstantKind.Array, New SByte() {-1, 0, 1})
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (6)
Extensions.vb (6)
154Friend Sub VerifyValue(Of T)(ByVal attr As VisualBasicAttributeData, ByVal i As Integer, ByVal kind As TypedConstantKind, ByVal v As T)
161Friend Sub VerifyValue(Of T)(ByVal attr As VisualBasicAttributeData, ByVal i As Integer, ByVal name As String, ByVal kind As TypedConstantKind, ByVal v As T)
170Friend Sub VerifyNamedArgumentValue(Of T)(ByVal attr As VisualBasicAttributeData, i As Integer, name As String, kind As TypedConstantKind, v As T)
181Case TypedConstantKind.Array
183Case TypedConstantKind.Enum
185Case TypedConstantKind.Type
Microsoft.CodeAnalysis.VisualBasic.Workspaces (4)
Microsoft.Extensions.Logging.Generators (3)
Microsoft.Extensions.Options.SourceGeneration (2)
Microsoft.Gen.MetadataExtractor (5)
Microsoft.Gen.Metrics (5)
Microsoft.Gen.MetricsReports (5)
System.Text.RegularExpressions.Generator (1)