Skip to content
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

Fix a wrong t4 condition #4

Merged
merged 1 commit into from
Nov 16, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Utf8StringInterpolation/Utf8String.AppendFormatted.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1286,7 +1286,7 @@
}
#endif

#if !NET8_0_OR_GREATER
# if true

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void AppendFormatted(char? value, int alignment = 0, string? format = null)
Expand Down Expand Up @@ -1321,7 +1321,7 @@
if (alignment > 0)
{
Span<byte> buffer = stackalloc byte[32];
while (!value.TryFormat(buffer, out bytesWritten, format, formatProvider))

Check failure on line 1324 in src/Utf8StringInterpolation/Utf8String.AppendFormatted.cs

View workflow job for this annotation

GitHub Actions / build-dotnet

'char' does not contain a definition for 'TryFormat' and no accessible extension method 'TryFormat' accepting a first argument of type 'char' could be found (are you missing a using directive or an assembly reference?)
{
if (buffer.Length < 512)
{
Expand Down Expand Up @@ -1350,7 +1350,7 @@
else
{
// add right whitespace
while (!value.TryFormat(destination, out bytesWritten, format, formatProvider))

Check failure on line 1353 in src/Utf8StringInterpolation/Utf8String.AppendFormatted.cs

View workflow job for this annotation

GitHub Actions / build-dotnet

'char' does not contain a definition for 'TryFormat' and no accessible extension method 'TryFormat' accepting a first argument of type 'char' could be found (are you missing a using directive or an assembly reference?)
{
GrowCore(0);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Utf8StringInterpolation/Utf8String.AppendFormatted.tt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace Utf8StringInterpolation;
public ref partial struct Utf8StringWriter<TBufferWriter>
{
<# foreach(var x in generateTypes) { #>
<#= (x.type is not "bool" or "char") ? "#if !NET8_0_OR_GREATER" : "# if true" #>
<#= (x.type is not "bool" and not "char") ? "#if !NET8_0_OR_GREATER" : "# if true" #>

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void AppendFormatted(<#= x.type #>? value, int alignment = 0, string? format = null)
Expand Down