Skip to content

Commit

Permalink
Fixed summaries for generated code (#55)
Browse files Browse the repository at this point in the history
* Fixed paramref to renamed "default" parameter to "_"
* Added summaries for IObservable-Ex/IEnumerable-Ex classes
* Added summaries to == and != operators
* Added inheritdoc summaries for IEquatable members
  • Loading branch information
jvbsl authored Sep 8, 2022
1 parent 77a1994 commit 86f0d68
Show file tree
Hide file tree
Showing 18 changed files with 348 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,30 @@ public override bool Equals(object other)
public bool Equals(Variant_class_nullable_disable other)
=> !(other is null) && _variant.Equals(other._variant);

/// <summary>Compare two Variant_class_nullable_disable objects for equality.</summary>
/// <param name="lhs">The first <see cref="Variant_class_nullable_disable" /> to compare.</param>
/// <param name="rhs">The second <see cref="Variant_class_nullable_disable" /> to compare.</param>
/// <returns><see langword="true" /> if <paramref name="lhs"/> and <paramref name="rhs"/> are considered equal; otherwise, <see langword="false" />.</returns>
/// <seealso cref="Equals(Variant_class_nullable_disable)" />
[global::System.Diagnostics.DebuggerNonUserCode]
public static bool operator ==(Variant_class_nullable_disable lhs, Variant_class_nullable_disable rhs)
=> lhs?.Equals(rhs) ?? (rhs is null);

/// <summary>Compare two Variant_class_nullable_disable objects for inequality.</summary>
/// <param name="lhs">The first <see cref="Variant_class_nullable_disable" /> to compare.</param>
/// <param name="rhs">The second <see cref="Variant_class_nullable_disable" /> to compare.</param>
/// <returns><see langword="true" /> if <paramref name="lhs"/> and <paramref name="rhs"/> are not considered equal; otherwise, <see langword="false" />.</returns>
/// <seealso cref="Equals(Variant_class_nullable_disable)" />
[global::System.Diagnostics.DebuggerNonUserCode]
public static bool operator !=(Variant_class_nullable_disable lhs, Variant_class_nullable_disable rhs)
=> !(lhs == rhs);

/// <inheritdoc/>
[global::System.Diagnostics.DebuggerNonUserCode]
public override int GetHashCode()
=> _variant.GetHashCode();

/// <inheritdoc/>
[global::System.Diagnostics.DebuggerNonUserCode]
public override string ToString()
=> _variant.ToString();
Expand Down Expand Up @@ -324,7 +336,7 @@ public Union(string value)

/// <summary>
/// The 1-based index of the currently stored type,
/// counted left-ro-right from the <see cref="global::Foo.Variant_class_nullable_disable.VariantOf()"/> parameter list.
/// counted left-ro-right from the <see cref="global::Foo.Variant_class_nullable_disable.VariantOf"/> parameter list.
/// <c>0</c> if the variant is empty.
/// </summary>
public readonly byte Index;
Expand Down Expand Up @@ -567,7 +579,7 @@ public TResult Match<TResult>(global::System.Func<int, TResult> i)
/// </summary>
/// <param name="i">The delegate to invoke with the stored value if it is of type <see cref="int"/>.</param>
/// <param name="_">The value to return if the stored value is of a different type.</param>
/// <returns>The value returned from invoking <paramref name="i"/>, or <paramref name="default"/>.</returns>
/// <returns>The value returned from invoking <paramref name="i"/>, or <paramref name="_"/>.</returns>
/// <exception cref="global::System.Exception">Any exception thrown from <paramref name="i"/> or <paramref name="_"/> is rethrown.</exception>
public TResult Match<TResult>(global::System.Func<int, TResult> i, TResult _)
{
Expand Down Expand Up @@ -697,7 +709,7 @@ public TResult Match<TResult>(global::System.Func<float, TResult> f)
/// </summary>
/// <param name="f">The delegate to invoke with the stored value if it is of type <see cref="float"/>.</param>
/// <param name="_">The value to return if the stored value is of a different type.</param>
/// <returns>The value returned from invoking <paramref name="f"/>, or <paramref name="default"/>.</returns>
/// <returns>The value returned from invoking <paramref name="f"/>, or <paramref name="_"/>.</returns>
/// <exception cref="global::System.Exception">Any exception thrown from <paramref name="f"/> or <paramref name="_"/> is rethrown.</exception>
public TResult Match<TResult>(global::System.Func<float, TResult> f, TResult _)
{
Expand Down Expand Up @@ -827,7 +839,7 @@ public TResult Match<TResult>(global::System.Func<string, TResult> s)
/// </summary>
/// <param name="s">The delegate to invoke with the stored value if it is of type <see cref="string"/>.</param>
/// <param name="_">The value to return if the stored value is of a different type.</param>
/// <returns>The value returned from invoking <paramref name="s"/>, or <paramref name="default"/>.</returns>
/// <returns>The value returned from invoking <paramref name="s"/>, or <paramref name="_"/>.</returns>
/// <exception cref="global::System.Exception">Any exception thrown from <paramref name="s"/> or <paramref name="_"/> is rethrown.</exception>
public TResult Match<TResult>(global::System.Func<string, TResult> s, TResult _)
{
Expand Down Expand Up @@ -967,6 +979,10 @@ public TResult Visit<TResult>(global::System.Func<int, TResult> i, global::Syste

namespace Foo
{
/// <summary>
/// Extensions which allow for easy and powerful integration into `System.Linq`-like queries
/// on <see cref="global::System.Collections.Generic.IEnumerable{T}" /> sequences, that let you manipulate a stream of variants based on the contained type.
/// </summary>
public static partial class Variant_class_nullable_disableEx
{
/// <summary>
Expand Down Expand Up @@ -1291,6 +1307,10 @@ public static partial class Variant_class_nullable_disableEx
}
namespace Foo
{
/// <summary>
/// Extensions which allow for easy and powerful integration into `System.Reactive.Linq`-like queries
/// on <see cref="global::System.IObservable{T}" /> sequences, that let you manipulate an asynchronous stream of variants based on the contained type.
/// </summary>
public static partial class Variant_class_nullable_disableEx
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,18 +123,30 @@ public override bool Equals(object? other)
public bool Equals(Variant_class_nullable_enable? other)
=> !(other is null) && _variant.Equals(other._variant);

/// <summary>Compare two Variant_class_nullable_enable objects for equality.</summary>
/// <param name="lhs">The first <see cref="Variant_class_nullable_enable" /> to compare.</param>
/// <param name="rhs">The second <see cref="Variant_class_nullable_enable" /> to compare.</param>
/// <returns><see langword="true" /> if <paramref name="lhs"/> and <paramref name="rhs"/> are considered equal; otherwise, <see langword="false" />.</returns>
/// <seealso cref="Equals(Variant_class_nullable_enable?)" />
[global::System.Diagnostics.DebuggerNonUserCode]
public static bool operator ==(Variant_class_nullable_enable? lhs, Variant_class_nullable_enable? rhs)
=> lhs?.Equals(rhs) ?? (rhs is null);

/// <summary>Compare two Variant_class_nullable_enable objects for inequality.</summary>
/// <param name="lhs">The first <see cref="Variant_class_nullable_enable" /> to compare.</param>
/// <param name="rhs">The second <see cref="Variant_class_nullable_enable" /> to compare.</param>
/// <returns><see langword="true" /> if <paramref name="lhs"/> and <paramref name="rhs"/> are not considered equal; otherwise, <see langword="false" />.</returns>
/// <seealso cref="Equals(Variant_class_nullable_enable?)" />
[global::System.Diagnostics.DebuggerNonUserCode]
public static bool operator !=(Variant_class_nullable_enable? lhs, Variant_class_nullable_enable? rhs)
=> !(lhs == rhs);

/// <inheritdoc/>
[global::System.Diagnostics.DebuggerNonUserCode]
public override int GetHashCode()
=> _variant.GetHashCode();

/// <inheritdoc/>
[global::System.Diagnostics.DebuggerNonUserCode]
public override string ToString()
=> _variant.ToString();
Expand Down Expand Up @@ -401,7 +413,7 @@ public Union(global::System.Array? value)

/// <summary>
/// The 1-based index of the currently stored type,
/// counted left-ro-right from the <see cref="global::Foo.Variant_class_nullable_enable.VariantOf()"/> parameter list.
/// counted left-ro-right from the <see cref="global::Foo.Variant_class_nullable_enable.VariantOf"/> parameter list.
/// <c>0</c> if the variant is empty.
/// </summary>
public readonly byte Index;
Expand Down Expand Up @@ -659,7 +671,7 @@ public TResult Match<TResult>(global::System.Func<int, TResult> i)
/// </summary>
/// <param name="i">The delegate to invoke with the stored value if it is of type <see cref="int"/>.</param>
/// <param name="_">The value to return if the stored value is of a different type.</param>
/// <returns>The value returned from invoking <paramref name="i"/>, or <paramref name="default"/>.</returns>
/// <returns>The value returned from invoking <paramref name="i"/>, or <paramref name="_"/>.</returns>
/// <exception cref="global::System.Exception">Any exception thrown from <paramref name="i"/> or <paramref name="_"/> is rethrown.</exception>
public TResult Match<TResult>(global::System.Func<int, TResult> i, TResult _)
{
Expand Down Expand Up @@ -789,7 +801,7 @@ public TResult Match<TResult>(global::System.Func<float, TResult> f)
/// </summary>
/// <param name="f">The delegate to invoke with the stored value if it is of type <see cref="float"/>.</param>
/// <param name="_">The value to return if the stored value is of a different type.</param>
/// <returns>The value returned from invoking <paramref name="f"/>, or <paramref name="default"/>.</returns>
/// <returns>The value returned from invoking <paramref name="f"/>, or <paramref name="_"/>.</returns>
/// <exception cref="global::System.Exception">Any exception thrown from <paramref name="f"/> or <paramref name="_"/> is rethrown.</exception>
public TResult Match<TResult>(global::System.Func<float, TResult> f, TResult _)
{
Expand Down Expand Up @@ -919,7 +931,7 @@ public TResult Match<TResult>(global::System.Func<string, TResult> s)
/// </summary>
/// <param name="s">The delegate to invoke with the stored value if it is of type <see cref="string"/>.</param>
/// <param name="_">The value to return if the stored value is of a different type.</param>
/// <returns>The value returned from invoking <paramref name="s"/>, or <paramref name="default"/>.</returns>
/// <returns>The value returned from invoking <paramref name="s"/>, or <paramref name="_"/>.</returns>
/// <exception cref="global::System.Exception">Any exception thrown from <paramref name="s"/> or <paramref name="_"/> is rethrown.</exception>
public TResult Match<TResult>(global::System.Func<string, TResult> s, TResult _)
{
Expand Down Expand Up @@ -1049,7 +1061,7 @@ public TResult Match<TResult>(global::System.Func<global::System.Array?, TResult
/// </summary>
/// <param name="a">The delegate to invoke with the stored value if it is of type <see cref="global::System.Array?"/>.</param>
/// <param name="_">The value to return if the stored value is of a different type.</param>
/// <returns>The value returned from invoking <paramref name="a"/>, or <paramref name="default"/>.</returns>
/// <returns>The value returned from invoking <paramref name="a"/>, or <paramref name="_"/>.</returns>
/// <exception cref="global::System.Exception">Any exception thrown from <paramref name="a"/> or <paramref name="_"/> is rethrown.</exception>
public TResult Match<TResult>(global::System.Func<global::System.Array?, TResult> a, TResult _)
{
Expand Down Expand Up @@ -1203,6 +1215,10 @@ public TResult Visit<TResult>(global::System.Func<int, TResult> i, global::Syste

namespace Foo
{
/// <summary>
/// Extensions which allow for easy and powerful integration into `System.Linq`-like queries
/// on <see cref="global::System.Collections.Generic.IEnumerable{T}" /> sequences, that let you manipulate a stream of variants based on the contained type.
/// </summary>
public static partial class Variant_class_nullable_enableEx
{
/// <summary>
Expand Down Expand Up @@ -1613,6 +1629,10 @@ public static partial class Variant_class_nullable_enableEx
}
namespace Foo
{
/// <summary>
/// Extensions which allow for easy and powerful integration into `System.Reactive.Linq`-like queries
/// on <see cref="global::System.IObservable{T}" /> sequences, that let you manipulate an asynchronous stream of variants based on the contained type.
/// </summary>
public static partial class Variant_class_nullable_enableEx
{
/// <summary>
Expand Down
26 changes: 23 additions & 3 deletions src/dotVariant.Generator.Test/samples/Variant-disposable.out.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,30 @@ public override bool Equals(object other)
public bool Equals(Variant_disposable other)
=> !(other is null) && _variant.Equals(other._variant);

/// <summary>Compare two Variant_disposable objects for equality.</summary>
/// <param name="lhs">The first <see cref="Variant_disposable" /> to compare.</param>
/// <param name="rhs">The second <see cref="Variant_disposable" /> to compare.</param>
/// <returns><see langword="true" /> if <paramref name="lhs"/> and <paramref name="rhs"/> are considered equal; otherwise, <see langword="false" />.</returns>
/// <seealso cref="Equals(Variant_disposable)" />
[global::System.Diagnostics.DebuggerNonUserCode]
public static bool operator ==(Variant_disposable lhs, Variant_disposable rhs)
=> lhs?.Equals(rhs) ?? (rhs is null);

/// <summary>Compare two Variant_disposable objects for inequality.</summary>
/// <param name="lhs">The first <see cref="Variant_disposable" /> to compare.</param>
/// <param name="rhs">The second <see cref="Variant_disposable" /> to compare.</param>
/// <returns><see langword="true" /> if <paramref name="lhs"/> and <paramref name="rhs"/> are not considered equal; otherwise, <see langword="false" />.</returns>
/// <seealso cref="Equals(Variant_disposable)" />
[global::System.Diagnostics.DebuggerNonUserCode]
public static bool operator !=(Variant_disposable lhs, Variant_disposable rhs)
=> !(lhs == rhs);

/// <inheritdoc/>
[global::System.Diagnostics.DebuggerNonUserCode]
public override int GetHashCode()
=> _variant.GetHashCode();

/// <inheritdoc/>
[global::System.Diagnostics.DebuggerNonUserCode]
public override string ToString()
=> _variant.ToString();
Expand Down Expand Up @@ -258,7 +270,7 @@ public Union(global::System.IO.Stream value)

/// <summary>
/// The 1-based index of the currently stored type,
/// counted left-ro-right from the <see cref="global::Foo.Variant_disposable.VariantOf()"/> parameter list.
/// counted left-ro-right from the <see cref="global::Foo.Variant_disposable.VariantOf"/> parameter list.
/// <c>0</c> if the variant is empty.
/// </summary>
public readonly byte Index;
Expand Down Expand Up @@ -506,7 +518,7 @@ public TResult Match<TResult>(global::System.Func<int, TResult> i)
/// </summary>
/// <param name="i">The delegate to invoke with the stored value if it is of type <see cref="int"/>.</param>
/// <param name="_">The value to return if the stored value is of a different type.</param>
/// <returns>The value returned from invoking <paramref name="i"/>, or <paramref name="default"/>.</returns>
/// <returns>The value returned from invoking <paramref name="i"/>, or <paramref name="_"/>.</returns>
/// <exception cref="global::System.Exception">Any exception thrown from <paramref name="i"/> or <paramref name="_"/> is rethrown.</exception>
public TResult Match<TResult>(global::System.Func<int, TResult> i, TResult _)
{
Expand Down Expand Up @@ -636,7 +648,7 @@ public TResult Match<TResult>(global::System.Func<global::System.IO.Stream, TRes
/// </summary>
/// <param name="stream">The delegate to invoke with the stored value if it is of type <see cref="global::System.IO.Stream"/>.</param>
/// <param name="_">The value to return if the stored value is of a different type.</param>
/// <returns>The value returned from invoking <paramref name="stream"/>, or <paramref name="default"/>.</returns>
/// <returns>The value returned from invoking <paramref name="stream"/>, or <paramref name="_"/>.</returns>
/// <exception cref="global::System.Exception">Any exception thrown from <paramref name="stream"/> or <paramref name="_"/> is rethrown.</exception>
public TResult Match<TResult>(global::System.Func<global::System.IO.Stream, TResult> stream, TResult _)
{
Expand Down Expand Up @@ -762,6 +774,10 @@ public TResult Visit<TResult>(global::System.Func<int, TResult> i, global::Syste

namespace Foo
{
/// <summary>
/// Extensions which allow for easy and powerful integration into `System.Linq`-like queries
/// on <see cref="global::System.Collections.Generic.IEnumerable{T}" /> sequences, that let you manipulate a stream of variants based on the contained type.
/// </summary>
public static partial class Variant_disposableEx
{
/// <summary>
Expand Down Expand Up @@ -1000,6 +1016,10 @@ public static partial class Variant_disposableEx
}
namespace Foo
{
/// <summary>
/// Extensions which allow for easy and powerful integration into `System.Reactive.Linq`-like queries
/// on <see cref="global::System.IObservable{T}" /> sequences, that let you manipulate an asynchronous stream of variants based on the contained type.
/// </summary>
public static partial class Variant_disposableEx
{
/// <summary>
Expand Down
Loading

0 comments on commit 86f0d68

Please sign in to comment.