diff --git a/Projects/Server.Tests/Tests/PropertyList/ObjectPropertyListSpanAddTests.cs b/Projects/Server.Tests/Tests/PropertyList/ObjectPropertyListSpanAddTests.cs index 16d48ec9f..e7b2007d8 100644 --- a/Projects/Server.Tests/Tests/PropertyList/ObjectPropertyListSpanAddTests.cs +++ b/Projects/Server.Tests/Tests/PropertyList/ObjectPropertyListSpanAddTests.cs @@ -37,13 +37,15 @@ public class ObjectPropertyListSpanAddTests } [Fact] - public void SpanAdd_ProducesSameBytesAsStringAdd() + public void SpanAdd_ProducesSameBytesAsStringArgument() { + // Add(int, string) routes through the interpolation InternalAdd; Add(int, ReadOnlySpan) + // through the span InternalAdd. Both must produce identical bytes and hash. var fromString = new ObjectPropertyList(null); - fromString.Add("Hello World"); + fromString.Add(1070722, "Hello World"); var fromSpan = new ObjectPropertyList(null); - fromSpan.Add("Hello World".AsSpan()); + fromSpan.Add(1070722, "Hello World".AsSpan()); Assert.Equal(Decode(fromString), Decode(fromSpan)); Assert.Equal(fromString.Hash, fromSpan.Hash); diff --git a/Projects/Server/PropertyList/IPropertyList.cs b/Projects/Server/PropertyList/IPropertyList.cs index b0a39a0bb..f66c8cd61 100644 --- a/Projects/Server/PropertyList/IPropertyList.cs +++ b/Projects/Server/PropertyList/IPropertyList.cs @@ -29,9 +29,6 @@ public interface IPropertyList : ISelfInterpolatedStringHandler /** Convenience method for $"{argument}". */ public void Add(int number, string argument); - /** Convenience method for $"{text}". */ - public void Add(string text); - /** Convenience method for span-based text without allocating a string. */ public void Add(ReadOnlySpan argument); diff --git a/Projects/Server/PropertyList/ObjectPropertyList.cs b/Projects/Server/PropertyList/ObjectPropertyList.cs index 2ee1f35cc..ffe6a7315 100644 --- a/Projects/Server/PropertyList/ObjectPropertyList.cs +++ b/Projects/Server/PropertyList/ObjectPropertyList.cs @@ -148,7 +148,6 @@ public sealed class ObjectPropertyList : IPropertyList, IDisposable } public void Add(int number, string? arguments) => InternalAdd(number, $"{arguments}"); - public void Add(string argument) => InternalAdd(GetStringNumber(), $"{argument}"); public void Add(int number, int value) => InternalAdd(number, $"{value}"); public void AddLocalized(int value) => InternalAdd(GetStringNumber(), $"{value:#}"); public void AddLocalized(int number, int value) => InternalAdd(number, $"{value:#}"); diff --git a/Projects/Server/PropertyList/OplTextBlock.cs b/Projects/Server/PropertyList/OplTextBlock.cs index fdd157cad..e420c99fc 100644 --- a/Projects/Server/PropertyList/OplTextBlock.cs +++ b/Projects/Server/PropertyList/OplTextBlock.cs @@ -23,11 +23,11 @@ namespace Server; // Use with `using var block = list.TextBlock();`. ref struct: single-threaded OPL build only. public ref struct OplTextBlock { - private readonly ObjectPropertyList _list; + private readonly IPropertyList _list; internal ValueStringBuilder _builder; private bool _any; - internal OplTextBlock(ObjectPropertyList list) + internal OplTextBlock(IPropertyList list) { _list = list; _builder = ValueStringBuilder.Create();