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 #725: Introduce line breaks in GenerateNotNullWhenTrueAttribute and GenerateMaybeNullWhenFalse #727

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 2 additions & 0 deletions src/Vogen/Util.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public static string GenerateCallToValidationAndReturnFalseIfNeeded(VoWorkItem w

public static string GenerateNotNullWhenTrueAttribute() =>
"""

#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
Expand All @@ -111,6 +112,7 @@ public static string GenerateNotNullWhenTrueAttribute() =>

public static string GenerateMaybeNullWhenFalse() =>
"""

#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.MaybeNullWhen(false)]
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,11 @@ private readonly global::System.Diagnostics.StackTrace _stackTrace = null!;
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
System.String value,
System.String value,
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.MaybeNullWhen(false)]
#endif
out Name vo)
out Name vo)
#pragma warning restore CS8767 // Nullability of reference types in type of parameter doesn't match implicitly implemented member because of nullability attributes.

{
Expand Down Expand Up @@ -305,11 +305,11 @@ private readonly global::System.Diagnostics.StackTrace _stackTrace = null!;
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
global::System.String s, global::System.IFormatProvider provider,
global::System.String s, global::System.IFormatProvider provider,
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.MaybeNullWhen(false)]
#endif
out Name result)
out Name result)
{
if (s is null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,11 @@ private readonly global::System.Diagnostics.StackTrace _stackTrace = null!;
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
System.String value,
System.String value,
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.MaybeNullWhen(false)]
#endif
out Name vo)
out Name vo)
#pragma warning restore CS8767 // Nullability of reference types in type of parameter doesn't match implicitly implemented member because of nullability attributes.

{
Expand Down Expand Up @@ -301,11 +301,11 @@ private readonly global::System.Diagnostics.StackTrace _stackTrace = null!;
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
global::System.String s, global::System.IFormatProvider provider,
global::System.String s, global::System.IFormatProvider provider,
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.MaybeNullWhen(false)]
#endif
out Name result)
out Name result)
{
if (s is null)
{
Expand Down Expand Up @@ -510,11 +510,11 @@ private readonly global::System.Diagnostics.StackTrace _stackTrace = null!;
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
System.Int32 value,
System.Int32 value,
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.MaybeNullWhen(false)]
#endif
out Age vo)
out Age vo)
#pragma warning restore CS8767 // Nullability of reference types in type of parameter doesn't match implicitly implemented member because of nullability attributes.

{
Expand Down Expand Up @@ -598,11 +598,11 @@ private readonly global::System.Diagnostics.StackTrace _stackTrace = null!;
/// <returns>
/// True if the value could a) be parsed by the underlying type, and b) passes any validation (after running any optional normalization).
/// </returns>
public static global::System.Boolean TryParse(global::System.ReadOnlySpan<byte> utf8Text, global::System.Globalization.NumberStyles style, global::System.IFormatProvider provider,
public static global::System.Boolean TryParse(global::System.ReadOnlySpan<byte> utf8Text, global::System.Globalization.NumberStyles style, global::System.IFormatProvider provider,
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
out Age result)
out Age result)
{
if (System.Int32.TryParse(utf8Text, style, provider, out var __v))
{
Expand All @@ -620,11 +620,11 @@ private readonly global::System.Diagnostics.StackTrace _stackTrace = null!;
/// <returns>
/// True if the value could a) be parsed by the underlying type, and b) passes any validation (after running any optional normalization).
/// </returns>
public static global::System.Boolean TryParse(global::System.ReadOnlySpan<byte> utf8Text, global::System.IFormatProvider provider,
public static global::System.Boolean TryParse(global::System.ReadOnlySpan<byte> utf8Text, global::System.IFormatProvider provider,
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
out Age result)
out Age result)
{
if (System.Int32.TryParse(utf8Text, provider, out var __v))
{
Expand All @@ -642,11 +642,11 @@ private readonly global::System.Diagnostics.StackTrace _stackTrace = null!;
/// <returns>
/// True if the value could a) be parsed by the underlying type, and b) passes any validation (after running any optional normalization).
/// </returns>
public static global::System.Boolean TryParse(global::System.ReadOnlySpan<byte> utf8Text,
public static global::System.Boolean TryParse(global::System.ReadOnlySpan<byte> utf8Text,
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
out Age result)
out Age result)
{
if (System.Int32.TryParse(utf8Text, out var __v))
{
Expand All @@ -664,11 +664,11 @@ private readonly global::System.Diagnostics.StackTrace _stackTrace = null!;
/// <returns>
/// True if the value could a) be parsed by the underlying type, and b) passes any validation (after running any optional normalization).
/// </returns>
public static global::System.Boolean TryParse(global::System.ReadOnlySpan<char> s, global::System.Globalization.NumberStyles style, global::System.IFormatProvider provider,
public static global::System.Boolean TryParse(global::System.ReadOnlySpan<char> s, global::System.Globalization.NumberStyles style, global::System.IFormatProvider provider,
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
out Age result)
out Age result)
{
if (System.Int32.TryParse(s, style, provider, out var __v))
{
Expand All @@ -686,11 +686,11 @@ private readonly global::System.Diagnostics.StackTrace _stackTrace = null!;
/// <returns>
/// True if the value could a) be parsed by the underlying type, and b) passes any validation (after running any optional normalization).
/// </returns>
public static global::System.Boolean TryParse(global::System.ReadOnlySpan<char> s, global::System.IFormatProvider provider,
public static global::System.Boolean TryParse(global::System.ReadOnlySpan<char> s, global::System.IFormatProvider provider,
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
out Age result)
out Age result)
{
if (System.Int32.TryParse(s, provider, out var __v))
{
Expand All @@ -708,11 +708,11 @@ private readonly global::System.Diagnostics.StackTrace _stackTrace = null!;
/// <returns>
/// True if the value could a) be parsed by the underlying type, and b) passes any validation (after running any optional normalization).
/// </returns>
public static global::System.Boolean TryParse(global::System.ReadOnlySpan<char> s,
public static global::System.Boolean TryParse(global::System.ReadOnlySpan<char> s,
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
out Age result)
out Age result)
{
if (System.Int32.TryParse(s, out var __v))
{
Expand All @@ -730,11 +730,11 @@ private readonly global::System.Diagnostics.StackTrace _stackTrace = null!;
/// <returns>
/// True if the value could a) be parsed by the underlying type, and b) passes any validation (after running any optional normalization).
/// </returns>
public static global::System.Boolean TryParse(string s, global::System.Globalization.NumberStyles style, global::System.IFormatProvider provider,
public static global::System.Boolean TryParse(string s, global::System.Globalization.NumberStyles style, global::System.IFormatProvider provider,
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
out Age result)
out Age result)
{
if (System.Int32.TryParse(s, style, provider, out var __v))
{
Expand All @@ -752,11 +752,11 @@ private readonly global::System.Diagnostics.StackTrace _stackTrace = null!;
/// <returns>
/// True if the value could a) be parsed by the underlying type, and b) passes any validation (after running any optional normalization).
/// </returns>
public static global::System.Boolean TryParse(string s, global::System.IFormatProvider provider,
public static global::System.Boolean TryParse(string s, global::System.IFormatProvider provider,
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
out Age result)
out Age result)
{
if (System.Int32.TryParse(s, provider, out var __v))
{
Expand All @@ -774,11 +774,11 @@ private readonly global::System.Diagnostics.StackTrace _stackTrace = null!;
/// <returns>
/// True if the value could a) be parsed by the underlying type, and b) passes any validation (after running any optional normalization).
/// </returns>
public static global::System.Boolean TryParse(string s,
public static global::System.Boolean TryParse(string s,
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
out Age result)
out Age result)
{
if (System.Int32.TryParse(s, out var __v))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,11 @@ private readonly global::System.Diagnostics.StackTrace _stackTrace = null!;
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
System.Int32 value,
System.Int32 value,
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.MaybeNullWhen(false)]
#endif
out Age vo)
out Age vo)
#pragma warning restore CS8767 // Nullability of reference types in type of parameter doesn't match implicitly implemented member because of nullability attributes.

{
Expand Down Expand Up @@ -325,11 +325,11 @@ private readonly global::System.Diagnostics.StackTrace _stackTrace = null!;
/// <returns>
/// True if the value could a) be parsed by the underlying type, and b) passes any validation (after running any optional normalization).
/// </returns>
public static global::System.Boolean TryParse(global::System.ReadOnlySpan<byte> utf8Text, global::System.Globalization.NumberStyles style, global::System.IFormatProvider provider,
public static global::System.Boolean TryParse(global::System.ReadOnlySpan<byte> utf8Text, global::System.Globalization.NumberStyles style, global::System.IFormatProvider provider,
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
out Age result)
out Age result)
{
if (System.Int32.TryParse(utf8Text, style, provider, out var __v))
{
Expand All @@ -347,11 +347,11 @@ private readonly global::System.Diagnostics.StackTrace _stackTrace = null!;
/// <returns>
/// True if the value could a) be parsed by the underlying type, and b) passes any validation (after running any optional normalization).
/// </returns>
public static global::System.Boolean TryParse(global::System.ReadOnlySpan<byte> utf8Text, global::System.IFormatProvider provider,
public static global::System.Boolean TryParse(global::System.ReadOnlySpan<byte> utf8Text, global::System.IFormatProvider provider,
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
out Age result)
out Age result)
{
if (System.Int32.TryParse(utf8Text, provider, out var __v))
{
Expand All @@ -369,11 +369,11 @@ private readonly global::System.Diagnostics.StackTrace _stackTrace = null!;
/// <returns>
/// True if the value could a) be parsed by the underlying type, and b) passes any validation (after running any optional normalization).
/// </returns>
public static global::System.Boolean TryParse(global::System.ReadOnlySpan<byte> utf8Text,
public static global::System.Boolean TryParse(global::System.ReadOnlySpan<byte> utf8Text,
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
out Age result)
out Age result)
{
if (System.Int32.TryParse(utf8Text, out var __v))
{
Expand All @@ -391,11 +391,11 @@ private readonly global::System.Diagnostics.StackTrace _stackTrace = null!;
/// <returns>
/// True if the value could a) be parsed by the underlying type, and b) passes any validation (after running any optional normalization).
/// </returns>
public static global::System.Boolean TryParse(global::System.ReadOnlySpan<char> s, global::System.Globalization.NumberStyles style, global::System.IFormatProvider provider,
public static global::System.Boolean TryParse(global::System.ReadOnlySpan<char> s, global::System.Globalization.NumberStyles style, global::System.IFormatProvider provider,
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
out Age result)
out Age result)
{
if (System.Int32.TryParse(s, style, provider, out var __v))
{
Expand All @@ -413,11 +413,11 @@ private readonly global::System.Diagnostics.StackTrace _stackTrace = null!;
/// <returns>
/// True if the value could a) be parsed by the underlying type, and b) passes any validation (after running any optional normalization).
/// </returns>
public static global::System.Boolean TryParse(global::System.ReadOnlySpan<char> s, global::System.IFormatProvider provider,
public static global::System.Boolean TryParse(global::System.ReadOnlySpan<char> s, global::System.IFormatProvider provider,
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
out Age result)
out Age result)
{
if (System.Int32.TryParse(s, provider, out var __v))
{
Expand All @@ -435,11 +435,11 @@ private readonly global::System.Diagnostics.StackTrace _stackTrace = null!;
/// <returns>
/// True if the value could a) be parsed by the underlying type, and b) passes any validation (after running any optional normalization).
/// </returns>
public static global::System.Boolean TryParse(global::System.ReadOnlySpan<char> s,
public static global::System.Boolean TryParse(global::System.ReadOnlySpan<char> s,
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
out Age result)
out Age result)
{
if (System.Int32.TryParse(s, out var __v))
{
Expand All @@ -457,11 +457,11 @@ private readonly global::System.Diagnostics.StackTrace _stackTrace = null!;
/// <returns>
/// True if the value could a) be parsed by the underlying type, and b) passes any validation (after running any optional normalization).
/// </returns>
public static global::System.Boolean TryParse(string s, global::System.Globalization.NumberStyles style, global::System.IFormatProvider provider,
public static global::System.Boolean TryParse(string s, global::System.Globalization.NumberStyles style, global::System.IFormatProvider provider,
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
out Age result)
out Age result)
{
if (System.Int32.TryParse(s, style, provider, out var __v))
{
Expand All @@ -479,11 +479,11 @@ private readonly global::System.Diagnostics.StackTrace _stackTrace = null!;
/// <returns>
/// True if the value could a) be parsed by the underlying type, and b) passes any validation (after running any optional normalization).
/// </returns>
public static global::System.Boolean TryParse(string s, global::System.IFormatProvider provider,
public static global::System.Boolean TryParse(string s, global::System.IFormatProvider provider,
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
out Age result)
out Age result)
{
if (System.Int32.TryParse(s, provider, out var __v))
{
Expand All @@ -501,11 +501,11 @@ private readonly global::System.Diagnostics.StackTrace _stackTrace = null!;
/// <returns>
/// True if the value could a) be parsed by the underlying type, and b) passes any validation (after running any optional normalization).
/// </returns>
public static global::System.Boolean TryParse(string s,
public static global::System.Boolean TryParse(string s,
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
out Age result)
out Age result)
{
if (System.Int32.TryParse(s, out var __v))
{
Expand Down Expand Up @@ -825,11 +825,11 @@ private readonly global::System.Diagnostics.StackTrace _stackTrace = null!;
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
System.String value,
System.String value,
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.MaybeNullWhen(false)]
#endif
out Name vo)
out Name vo)
#pragma warning restore CS8767 // Nullability of reference types in type of parameter doesn't match implicitly implemented member because of nullability attributes.

{
Expand Down Expand Up @@ -932,11 +932,11 @@ private readonly global::System.Diagnostics.StackTrace _stackTrace = null!;
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
#endif
global::System.String s, global::System.IFormatProvider provider,
global::System.String s, global::System.IFormatProvider provider,
#if NETCOREAPP3_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.MaybeNullWhen(false)]
#endif
out Name result)
out Name result)
{
if (s is null)
{
Expand Down
Loading
Loading