232 references to TypedConstantKind
Aspire.Hosting.Azure.Provisioning.Generators (2)
Aspire.Hosting.Integration.Analyzers (1)
ILLink.RoslynAnalyzer (1)
Microsoft.AspNetCore.App.Analyzers (1)
Microsoft.AspNetCore.Mvc.Analyzers (2)
Microsoft.CodeAnalysis (31)
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.CodeStyle (4)
Microsoft.CodeAnalysis.CSharp (122)
Binder\Binder_Attributes.cs (22)
731if (reorderedArgument.Kind == TypedConstantKind.Error)
735else if (reorderedArgument.Kind == TypedConstantKind.Array &&
749Debug.Assert(hasErrors || reorderedArguments.All(arg => arg.Kind != TypedConstantKind.Error));
848var typedConstantKind = node.Type.GetAttributeParameterTypedConstantKind(_binder.Compilation);
850return VisitExpression(node, typedConstantKind, diagnostics, ref attrHasErrors, curArgumentHasErrors || typedConstantKind == TypedConstantKind.Error);
853private TypedConstant VisitExpression(BoundExpression node, TypedConstantKind typedConstantKind, BindingDiagnosticBag diagnostics, ref bool attrHasErrors, bool curArgumentHasErrors)
862typedConstantKind = TypedConstantKind.Error;
879return CreateTypedConstant(node, TypedConstantKind.Error, diagnostics, ref attrHasErrors, curArgumentHasErrors);
885var typedConstantKind = type.GetAttributeParameterTypedConstantKind(_binder.Compilation);
901return new TypedConstant(spread.Expression.Type, TypedConstantKind.Error, value: null);
935var typedConstantKind = operandType.GetAttributeParameterTypedConstantKind(_binder.Compilation);
940return CreateTypedConstant(node, TypedConstantKind.Error, diagnostics, ref attrHasErrors, curArgumentHasErrors);
976return CreateTypedConstant(node, TypedConstantKind.Type, diagnostics, ref attrHasErrors, curArgumentHasErrors, simpleValue: node.SourceType.Type);
986return CreateTypedConstant(node, TypedConstantKind.Error, diagnostics, ref attrHasErrors, curArgumentHasErrors);
990var typedConstantKind = type.GetAttributeParameterTypedConstantKind(_binder.Compilation);
1008initializer = ImmutableArray.Create(CreateTypedConstant(node, TypedConstantKind.Error, diagnostics, ref attrHasErrors, curArgumentHasErrors));
1020private static TypedConstant CreateTypedConstant(BoundExpression node, TypedConstantKind typedConstantKind, BindingDiagnosticBag diagnostics, ref bool attrHasErrors, bool curArgumentHasErrors,
1026if (typedConstantKind != TypedConstantKind.Error && type.ContainsTypeParameter())
1047typedConstantKind = TypedConstantKind.Error;
1050if (typedConstantKind == TypedConstantKind.Error)
1058return new TypedConstant(type, TypedConstantKind.Error, null);
1060else if (typedConstantKind == TypedConstantKind.Array)
Emitter\Model\PEModuleBuilder.cs (5)
1743var value = flagsBuilder.SelectAsArray((flag, byteType) => new TypedConstant(byteType, TypedConstantKind.Primitive, flag), byteType);
1765ImmutableArray.Create(new TypedConstant(byteType, TypedConstantKind.Primitive, nullableValue)));
1785ImmutableArray.Create(new TypedConstant(Compilation.GetSpecialType(SpecialType.System_Byte), TypedConstantKind.Primitive, value)));
1827var transformFlags = builder.SelectAsArray((flag, constantType) => new TypedConstant(constantType, TypedConstantKind.Primitive, flag), booleanType);
1927[new TypedConstant(Compilation.GetSpecialType(SpecialType.System_String), TypedConstantKind.Primitive, markerName)]);
Symbols\Compilation_WellKnownMembers.cs (13)
477new TypedConstant(systemByte, TypedConstantKind.Primitive, scale),
478new TypedConstant(systemByte, TypedConstantKind.Primitive, (byte)(isNegative ? 128 : 0)),
479new TypedConstant(systemUnit32, TypedConstantKind.Primitive, high),
480new TypedConstant(systemUnit32, TypedConstantKind.Primitive, mid),
481new TypedConstant(systemUnit32, TypedConstantKind.Primitive, low)
487var ticks = new TypedConstant(GetSpecialType(SpecialType.System_Int64), TypedConstantKind.Primitive, value.Ticks);
504TypedConstantKind.Enum,
805var typedConstantDebugMode = new TypedConstant(debuggingModesType, TypedConstantKind.Enum, constantVal);
858new TypedConstant(attributeTargetsType, TypedConstantKind.Enum, targets));
860new KeyValuePair<WellKnownMember, TypedConstant>(WellKnownMember.System_AttributeUsageAttribute__AllowMultiple, new TypedConstant(boolType, TypedConstantKind.Primitive, allowMultiple)),
861new KeyValuePair<WellKnownMember, TypedConstant>(WellKnownMember.System_AttributeUsageAttribute__Inherited, new TypedConstant(boolType, TypedConstantKind.Primitive, inherited)));
891new TypedConstant(constantType, TypedConstantKind.Primitive, name), stringType);
938var result = flagsBuilder.SelectAsArray((flag, constantType) => new TypedConstant(constantType, TypedConstantKind.Primitive, flag), booleanType);
Symbols\Source\SourceAssemblySymbol.cs (6)
1829var typedConstantRequestMinimum = new TypedConstant(securityActionType, TypedConstantKind.Enum, constantValue);
1835var typedConstantTrue = new TypedConstant(boolType, TypedConstantKind.Primitive, value: true);
1975var typedConstantNoStringInterning = new TypedConstant(int32Type, TypedConstantKind.Primitive, Cci.Constants.CompilationRelaxations_NoStringInterning);
1994var typedConstantTrue = new TypedConstant(boolType, TypedConstantKind.Primitive, value: true);
2028var typedConstant = new TypedConstant(stringType, TypedConstantKind.Primitive, _compilation.Options.CryptoKeyContainer);
2038var typedConstant = new TypedConstant(stringType, TypedConstantKind.Primitive, _compilation.Options.CryptoKeyFile);
Symbols\Source\SourceNamedTypeSymbol.cs (8)
1040Debug.Assert(attributeData.CommonConstructorArguments[0].Kind == TypedConstantKind.Type);
1361Debug.Assert(argument.Kind == TypedConstantKind.Type);
1766new TypedConstant(compilation.GetSpecialType(SpecialType.System_String), TypedConstantKind.Primitive, PEModule.ByRefLikeMarker), // message
1767new TypedConstant(compilation.GetSpecialType(SpecialType.System_Boolean), TypedConstantKind.Primitive, true)), // error=true
1772ImmutableArray.Create(new TypedConstant(compilation.GetSpecialType(SpecialType.System_String), TypedConstantKind.Primitive, nameof(CompilerFeatureRequiredFeatures.RefStructs))),
1785var defaultMemberNameConstant = new TypedConstant(compilation.GetSpecialType(SpecialType.System_String), TypedConstantKind.Primitive, defaultMemberName);
1815static (subtype, elementType) => new TypedConstant(elementType, TypedConstantKind.Type, subtype.GetUnboundGenericTypeOrSelf()), propertyType.ElementType));
1847ImmutableArray.Create(new TypedConstant(compilation.GetWellKnownType(WellKnownType.System_Type), TypedConstantKind.Type, originalType)),
Microsoft.CodeAnalysis.CSharp.CodeStyle (2)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (5)
Microsoft.CodeAnalysis.CSharp.Features (2)
Microsoft.CodeAnalysis.CSharp.Workspaces (5)
Microsoft.CodeAnalysis.Features (7)
Microsoft.CodeAnalysis.NetAnalyzers (7)
Microsoft.CodeAnalysis.Razor.Compiler (1)
Microsoft.Diagnostics.DataContractReader.DataGenerator (1)
Microsoft.DotNet.ApiCompatibility (2)
Microsoft.DotNet.ApiSymbolExtensions (1)
Microsoft.Extensions.Logging.Generators (3)
Microsoft.Extensions.Options.SourceGeneration (2)
Microsoft.Extensions.Validation.ValidationsGenerator (2)
Microsoft.Gen.MetadataExtractor (6)
Microsoft.Gen.Metrics (6)
Microsoft.Gen.MetricsReports (6)
Roslyn.Diagnostics.CSharp.Analyzers (5)
System.Text.RegularExpressions.Generator (1)