-
Notifications
You must be signed in to change notification settings - Fork 1
Autonomous problem fix #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: upgrade
Are you sure you want to change the base?
Changes from all commits
c305858
0cb01fa
825f1be
c018d22
8ea0d75
6da3614
d0531c0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| using System; | ||
| using System; | ||
| using System.Text; | ||
| using System.Buffers; | ||
| using System.Runtime.CompilerServices; | ||
|
|
@@ -47,7 +47,7 @@ private static void FormatToRightJustify<TBufferWriter, T>(ref TBufferWriter sb, | |
| { | ||
| if (typeof(T) == typeof(string)) | ||
| { | ||
| var s = Unsafe.As<string>(arg); | ||
| var s = Unsafe.As<string>(arg)!; | ||
| int padding = width - s.Length; | ||
| if (padding > 0) | ||
| { | ||
|
|
@@ -82,7 +82,7 @@ private static void FormatToRightJustify<TBufferWriter, T>(ref TBufferWriter sb, | |
| } | ||
|
|
||
| var span = sb.GetSpan(charsWritten); | ||
| s.CopyTo(span); | ||
| s.Slice(0, charsWritten).CopyTo(span); | ||
| sb.Advance(charsWritten); | ||
| } | ||
| } | ||
|
|
@@ -130,7 +130,7 @@ private static void FormatToRightJustify<TBufferWriter, T>(ref TBufferWriter sb, | |
| { | ||
| if (typeof(T) == typeof(string)) | ||
| { | ||
| var s = Unsafe.As<string>(arg); | ||
| var s = Unsafe.As<string>(arg)!; | ||
| int padding = width - s.Length; | ||
| if (padding > 0) | ||
| { | ||
|
|
@@ -163,10 +163,10 @@ private static void FormatToRightJustify<TBufferWriter, T>(ref TBufferWriter sb, | |
| } | ||
|
|
||
| var span = sb.GetSpan(charsWritten); | ||
| s.CopyTo(span); | ||
| s.Slice(0, charsWritten).CopyTo(span); | ||
| sb.Advance(charsWritten); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| } | ||
| } | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Noise in the delta. Trailing newline must not be removed or added. |
||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are numerous changes in this file that change
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While true, the domain of the Structs are also zero-init by default. For example I argue that it should be a nullable type since it captures the true domain of the variable, and that explicitly adding the null forgiveness operator at use sites captures the intent of ignoring this nullability. Of course deciding whether |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| using System; | ||
| using System; | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is noise in the delta. BOM must not be added or removed. |
||
| using System.Buffers; | ||
| using System.IO; | ||
| using System.Runtime.CompilerServices; | ||
|
|
@@ -47,11 +47,11 @@ static Utf16ValueStringBuilder() | |
| /// <summary>Length of written buffer.</summary> | ||
| public int Length => index; | ||
| /// <summary>Get the written buffer data.</summary> | ||
| public ReadOnlySpan<char> AsSpan() => buffer.AsSpan(0, index); | ||
| public ReadOnlySpan<char> AsSpan() => buffer!.AsSpan(0, index); | ||
| /// <summary>Get the written buffer data.</summary> | ||
| public ReadOnlyMemory<char> AsMemory() => buffer.AsMemory(0, index); | ||
| public ReadOnlyMemory<char> AsMemory() => buffer!.AsMemory(0, index); | ||
| /// <summary>Get the written buffer data.</summary> | ||
| public ArraySegment<char> AsArraySegment() => new ArraySegment<char>(buffer, 0, index); | ||
| public ArraySegment<char> AsArraySegment() => new ArraySegment<char>(buffer!, 0, index); | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance | ||
|
|
@@ -263,7 +263,7 @@ public void AppendLine(ReadOnlySpan<char> value) | |
| /// <summary>Appends the string representation of a specified value to this instance.</summary> | ||
| public void Append<T>(T value) | ||
| { | ||
| if (!FormatterCache<T>.TryFormatDelegate(value, buffer.AsSpan(index), out var written, default)) | ||
| if (!FormatterCache<T>.TryFormatDelegate(value, buffer!.AsSpan(index), out var written, default)) | ||
| { | ||
| Grow(written); | ||
| if (!FormatterCache<T>.TryFormatDelegate(value, buffer.AsSpan(index), out written, default)) | ||
|
|
@@ -326,7 +326,7 @@ public void Insert(int index, ReadOnlySpan<char> value, int count) | |
| var newSize = index + value.Length * count; | ||
| var newBuffer = ArrayPool<char>.Shared.Rent(Math.Max(DefaultBufferSize, newSize)); | ||
|
|
||
| buffer.AsSpan(0, index).CopyTo(newBuffer); | ||
| buffer!.AsSpan(0, index).CopyTo(newBuffer); | ||
| int newBufferIndex = index; | ||
|
|
||
| for (int i = 0; i < count; i++) | ||
|
|
@@ -338,7 +338,7 @@ public void Insert(int index, ReadOnlySpan<char> value, int count) | |
| int remainLnegth = this.index - index; | ||
| buffer.AsSpan(index, remainLnegth).CopyTo(newBuffer.AsSpan(newBufferIndex)); | ||
|
|
||
| if (buffer!.Length != ThreadStaticBufferSize) | ||
| if (buffer.Length != ThreadStaticBufferSize) | ||
| { | ||
| if (buffer != null) | ||
| { | ||
|
|
@@ -462,7 +462,7 @@ public void Replace(ReadOnlySpan<char> oldValue, ReadOnlySpan<char> newValue, in | |
|
|
||
| var newBuffer = ArrayPool<char>.Shared.Rent(Math.Max(DefaultBufferSize, Length + (newValue.Length - oldValue.Length) * matchCount)); | ||
|
|
||
| buffer.AsSpan(0, startIndex).CopyTo(newBuffer); | ||
| buffer!.AsSpan(0, startIndex).CopyTo(newBuffer); | ||
| int newBufferIndex = startIndex; | ||
|
|
||
| for (int i = startIndex; i < endIndex; i += oldValue.Length) | ||
|
|
@@ -482,7 +482,7 @@ public void Replace(ReadOnlySpan<char> oldValue, ReadOnlySpan<char> newValue, in | |
| i += pos; | ||
| } | ||
|
|
||
| if (buffer!.Length != ThreadStaticBufferSize) | ||
| if (buffer.Length != ThreadStaticBufferSize) | ||
| { | ||
| ArrayPool<char>.Shared.Return(buffer); | ||
| } | ||
|
|
@@ -541,7 +541,7 @@ public void Remove(int startIndex, int length) | |
| } | ||
|
|
||
| int remain = startIndex + length; | ||
| buffer.AsSpan(remain, Length - remain).CopyTo(buffer.AsSpan(startIndex)); | ||
| buffer!.AsSpan(remain, Length - remain).CopyTo(buffer.AsSpan(startIndex)); | ||
| index -= length; | ||
| } | ||
|
|
||
|
|
@@ -558,7 +558,7 @@ public bool TryCopyTo(Span<char> destination, out int charsWritten) | |
| } | ||
|
|
||
| charsWritten = index; | ||
| buffer.AsSpan(0, index).CopyTo(destination); | ||
| buffer!.AsSpan(0, index).CopyTo(destination); | ||
| return true; | ||
| } | ||
|
|
||
|
|
@@ -568,7 +568,7 @@ public override string ToString() | |
| if (index == 0) | ||
| return string.Empty; | ||
|
|
||
| return new string(buffer, 0, index); | ||
| return new string(buffer!, 0, index); | ||
| } | ||
|
|
||
| // IBufferWriter | ||
|
|
@@ -621,7 +621,7 @@ void AppendFormatInternal<T>(T arg, int width, ReadOnlySpan<char> format, string | |
| { | ||
| width *= -1; | ||
|
|
||
| if (!FormatterCache<T>.TryFormatDelegate(arg, buffer.AsSpan(index), out var charsWritten, format)) | ||
| if (!FormatterCache<T>.TryFormatDelegate(arg, buffer!.AsSpan(index), out var charsWritten, format)) | ||
| { | ||
| Grow(charsWritten); | ||
| if (!FormatterCache<T>.TryFormatDelegate(arg, buffer.AsSpan(index), out charsWritten, format)) | ||
|
|
@@ -642,7 +642,7 @@ void AppendFormatInternal<T>(T arg, int width, ReadOnlySpan<char> format, string | |
| { | ||
| if (typeof(T) == typeof(string)) | ||
| { | ||
| var s = Unsafe.As<string>(arg); | ||
| var s = Unsafe.As<string>(arg)!; | ||
| int padding = width - s.Length; | ||
| if (padding > 0) | ||
| { | ||
|
|
@@ -731,7 +731,7 @@ static FormatterCache() | |
| } | ||
| } | ||
|
|
||
| TryFormatDelegate = formatter; | ||
| TryFormatDelegate = formatter!; | ||
| } | ||
|
|
||
| static bool TryFormatString(T value, Span<char> dest, out int written, ReadOnlySpan<char> format) | ||
|
|
@@ -762,7 +762,7 @@ static bool TryFormatDefault(T value, Span<char> dest, out int written, ReadOnly | |
| value.ToString(); | ||
|
|
||
| // also use this length when result is false. | ||
| written = s.Length; | ||
| written = s!.Length; | ||
| return s.AsSpan().TryCopyTo(dest); | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is noise in the delta. BOM must not be added or removed.