Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private static void FormatEnumDictionaryFactory(SourceWriter writer, string enum
""");

writer.Indentation += 2;
foreach (var member in enumTypeShape.Members.OrderBy(m => m.Key))
foreach (var member in enumTypeShape.Members.OrderBy(m => m.Key, StringComparer.Ordinal))
{
writer.WriteLine($"""["{member.Key}"] = {member.Value},""");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private static void FormatGetShapeProviderMethod(TypeShapeProviderModel provider
""");

writer.Indentation += 2;
foreach (TypeShapeModel typeModel in provider.ProvidedTypes.Values.OrderBy(t => t.SourceIdentifier))
foreach (TypeShapeModel typeModel in provider.ProvidedTypes.Values.OrderBy(t => t.SourceIdentifier, StringComparer.Ordinal))
{
writer.WriteLine($$"""
case {{FormatStringLiteral(typeModel.ReflectionName)}}:
Expand Down Expand Up @@ -123,7 +123,7 @@ private SourceText FormatGeneratedTypeMainFile(TypeDeclarationModel typeDeclarat
writer.WriteLine($"{typeDeclaration.TypeDeclarationHeader} :");
writer.WriteLine("#nullable disable annotations // Use nullable-oblivious interface implementation", disableIndentation: true);
writer.Indentation++;
foreach (TypeId typeToImplement in typeDeclaration.ShapeableImplementations.OrderBy(t => t.FullyQualifiedName))
foreach (TypeId typeToImplement in typeDeclaration.ShapeableImplementations.OrderBy(t => t.FullyQualifiedName, StringComparer.Ordinal))
{
string separator = --count == 0 ? "" : ",";
writer.WriteLine($"global::PolyType.IShapeable<{typeToImplement.FullyQualifiedName}>{separator}");
Expand All @@ -150,7 +150,7 @@ private SourceText FormatGeneratedTypeMainFile(TypeDeclarationModel typeDeclarat

if (provider.TargetSupportsIShapeableOfT)
{
foreach (TypeId typeToImplement in typeDeclaration.ShapeableImplementations.OrderBy(t => t.FullyQualifiedName))
foreach (TypeId typeToImplement in typeDeclaration.ShapeableImplementations.OrderBy(t => t.FullyQualifiedName, StringComparer.Ordinal))
{
if (emittedMembers++ > 0)
{
Expand Down Expand Up @@ -180,7 +180,7 @@ private sealed class {{LocalTypeShapeProviderName}} : global::PolyType.ITypeShap

writer.Indentation += 2;

foreach (TypeId typeToImplement in typeDeclaration.ShapeableImplementations.OrderBy(t => t.FullyQualifiedName))
foreach (TypeId typeToImplement in typeDeclaration.ShapeableImplementations.OrderBy(t => t.FullyQualifiedName, StringComparer.Ordinal))
{
writer.WriteLine($$"""
if (type == typeof({{typeToImplement.FullyQualifiedName}}))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ private void AddAllSourceFiles(SourceProductionContext context, TypeShapeProvide
context.CancellationToken.ThrowIfCancellationRequested();
context.AddSource($"{provider.ProviderDeclaration.SourceFilenamePrefix}.g.cs", FormatTypeShapeProviderMainFile(provider));

foreach (TypeShapeModel type in provider.ProvidedTypes.Values.OrderBy(t => t.SourceIdentifier))
foreach (TypeShapeModel type in provider.ProvidedTypes.Values.OrderBy(t => t.SourceIdentifier, StringComparer.Ordinal))
{
context.CancellationToken.ThrowIfCancellationRequested();
context.AddSource($"{provider.ProviderDeclaration.SourceFilenamePrefix}.{type.SourceIdentifier}.g.cs", FormatProvidedType(provider, type));
Expand Down Expand Up @@ -289,7 +289,7 @@ private void FormatAssociatedTypesFactory(SourceWriter writer, TypeShapeModel ob
""");

writer.Indentation += 2;
foreach (AssociatedTypeId associatedType in objectShapeModel.AssociatedTypes.OrderBy(t => t.ClosedTypeReflectionName))
foreach (AssociatedTypeId associatedType in objectShapeModel.AssociatedTypes.OrderBy(t => t.ClosedTypeReflectionName, StringComparer.Ordinal))
{
if (associatedType.OpenTypeInfo is { } openTypeInfo)
{
Expand Down
Loading