Skip to content

Commit

Permalink
Merge pull request #18 from csillikd/fix-ienumerable-yourtype
Browse files Browse the repository at this point in the history
Fix summary
  • Loading branch information
FreeApophis authored Jan 16, 2025
2 parents 1303432 + bbe0348 commit d36b702
Show file tree
Hide file tree
Showing 31 changed files with 119 additions and 116 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
</PropertyGroup>
<PropertyGroup Label="NuGet Metadata">
<Version>1.2.0</Version>
<Version>1.2.1</Version>
<PackageId>Funcky.DiscriminatedUnion</PackageId>
<Authors>Polyadic</Authors>
<PackageLicenseExpression>MIT OR Apache-2.0</PackageLicenseExpression>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ internal sealed class DiscriminatedUnionAttribute : global::System.Attribute
/// <summary>Generates exhaustive <c>Match</c> and <c>Switch</c> methods for the entire type hierarchy.</summary>
public bool {{AttributeProperties.Flatten}} { get; set; }
/// <summary>If a specialized partition extension method for <c>IEnumerable<YourType></c> should be generated. Defaults to <see langword="false"/>.</summary>
/// <summary>If a specialized partition extension method for <c>IEnumerable&lt;YourType&gt;</c> should be generated. Defaults to <see langword="false"/>.</summary>
public bool {{AttributeProperties.GeneratePartitionExtension}} { get; set; }
/// <summary>Customized the generic type name used for the result in the generated <c>Match</c> methods. Defaults to <c>TResult</c>.</summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//HintName: DiscriminatedUnionAttribute.g.cs
//HintName: DiscriminatedUnionAttribute.g.cs
// <auto-generated/>
#nullable enable

Expand All @@ -14,7 +14,7 @@ internal sealed class DiscriminatedUnionAttribute : global::System.Attribute
/// <summary>Generates exhaustive <c>Match</c> and <c>Switch</c> methods for the entire type hierarchy.</summary>
public bool Flatten { get; set; }

/// <summary>If a specialized partition extension method for <c>IEnumerable<YourType></c> should be generated. Defaults to <see langword="false"/>.</summary>
/// <summary>If a specialized partition extension method for <c>IEnumerable&lt;YourType&gt;</c> should be generated. Defaults to <see langword="false"/>.</summary>
public bool GeneratePartitionExtension { get; set; }

/// <summary>Customized the generic type name used for the result in the generated <c>Match</c> methods. Defaults to <c>TResult</c>.</summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ partial class StaticClass
{
partial record NestedUnion
{
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.0.0")]
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.1.0")]
public abstract TResult Match<TResult>(global::System.Func<Variant, TResult> variant);

[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.0.0")]
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.1.0")]
public abstract void Switch(global::System.Action<Variant> variant);

partial record Variant
{
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.0.0")]
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.1.0")]
public override TResult Match<TResult>(global::System.Func<Variant, TResult> variant) => variant(this);

[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.0.0")]
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.1.0")]
public override void Switch(global::System.Action<Variant> variant) => variant(this);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ internal sealed class DiscriminatedUnionAttribute : global::System.Attribute
/// <summary>Generates exhaustive <c>Match</c> and <c>Switch</c> methods for the entire type hierarchy.</summary>
public bool Flatten { get; set; }

/// <summary>If a specialized partition extension method for <c>IEnumerable<YourType></c> should be generated. Defaults to <see langword="false"/>.</summary>
/// <summary>If a specialized partition extension method for <c>IEnumerable&lt;YourType&gt;</c> should be generated. Defaults to <see langword="false"/>.</summary>
public bool GeneratePartitionExtension { get; set; }

/// <summary>Customized the generic type name used for the result in the generated <c>Match</c> methods. Defaults to <c>TResult</c>.</summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

partial record EmptyUnion
{
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.0.0")]
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.1.0")]
public abstract TResult Match<TResult>();

[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.0.0")]
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.1.0")]
public abstract void Switch();
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ internal sealed class DiscriminatedUnionAttribute : global::System.Attribute
/// <summary>Generates exhaustive <c>Match</c> and <c>Switch</c> methods for the entire type hierarchy.</summary>
public bool Flatten { get; set; }

/// <summary>If a specialized partition extension method for <c>IEnumerable<YourType></c> should be generated. Defaults to <see langword="false"/>.</summary>
/// <summary>If a specialized partition extension method for <c>IEnumerable&lt;YourType&gt;</c> should be generated. Defaults to <see langword="false"/>.</summary>
public bool GeneratePartitionExtension { get; set; }

/// <summary>Customized the generic type name used for the result in the generated <c>Match</c> methods. Defaults to <c>TResult</c>.</summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ namespace Funcky.DiscriminatedUnion.Test
{
partial record FlattenedNestedUnionWithPartition
{
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.0.0")]
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.1.0")]
public abstract TResult Match<TResult>(global::System.Func<Keyword, TResult> keyword, global::System.Func<Literal.Number.Integer, TResult> integer);

[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.0.0")]
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.1.0")]
public abstract void Switch(global::System.Action<Keyword> keyword, global::System.Action<Literal.Number.Integer> integer);

partial record Keyword
{
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.0.0")]
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.1.0")]
public override TResult Match<TResult>(global::System.Func<Keyword, TResult> keyword, global::System.Func<Literal.Number.Integer, TResult> integer) => keyword(this);

[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.0.0")]
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.1.0")]
public override void Switch(global::System.Action<Keyword> keyword, global::System.Action<Literal.Number.Integer> integer) => keyword(this);
}

Expand All @@ -27,17 +27,17 @@ partial record Number
{
partial record Integer
{
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.0.0")]
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.1.0")]
public override TResult Match<TResult>(global::System.Func<Keyword, TResult> keyword, global::System.Func<Literal.Number.Integer, TResult> integer) => integer(this);

[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.0.0")]
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.1.0")]
public override void Switch(global::System.Action<Keyword> keyword, global::System.Action<Literal.Number.Integer> integer) => integer(this);
}
}
}
}

[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.0.0")]
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.1.0")]
public static partial class FlattenedNestedUnionWithPartitionEnumerableExtensions
{
public static (global::System.Collections.Generic.IReadOnlyList<FlattenedNestedUnionWithPartition.Keyword> Keyword, global::System.Collections.Generic.IReadOnlyList<FlattenedNestedUnionWithPartition.Literal.Number.Integer> Integer) Partition(this global::System.Collections.Generic.IEnumerable<FlattenedNestedUnionWithPartition> source)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ internal sealed class DiscriminatedUnionAttribute : global::System.Attribute
/// <summary>Generates exhaustive <c>Match</c> and <c>Switch</c> methods for the entire type hierarchy.</summary>
public bool Flatten { get; set; }

/// <summary>If a specialized partition extension method for <c>IEnumerable<YourType></c> should be generated. Defaults to <see langword="false"/>.</summary>
/// <summary>If a specialized partition extension method for <c>IEnumerable&lt;YourType&gt;</c> should be generated. Defaults to <see langword="false"/>.</summary>
public bool GeneratePartitionExtension { get; set; }

/// <summary>Customized the generic type name used for the result in the generated <c>Match</c> methods. Defaults to <c>TResult</c>.</summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,32 @@ namespace Funcky.DiscriminatedUnion.Test
{
partial record FlattenedUnionWithPartition
{
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.0.0")]
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.1.0")]
public abstract TResult Match<TResult>(global::System.Func<Keyword, TResult> keyword, global::System.Func<Integer, TResult> integer);

[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.0.0")]
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.1.0")]
public abstract void Switch(global::System.Action<Keyword> keyword, global::System.Action<Integer> integer);

partial record Keyword
{
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.0.0")]
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.1.0")]
public override TResult Match<TResult>(global::System.Func<Keyword, TResult> keyword, global::System.Func<Integer, TResult> integer) => keyword(this);

[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.0.0")]
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.1.0")]
public override void Switch(global::System.Action<Keyword> keyword, global::System.Action<Integer> integer) => keyword(this);
}

partial record Integer
{
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.0.0")]
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.1.0")]
public override TResult Match<TResult>(global::System.Func<Keyword, TResult> keyword, global::System.Func<Integer, TResult> integer) => integer(this);

[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.0.0")]
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.1.0")]
public override void Switch(global::System.Action<Keyword> keyword, global::System.Action<Integer> integer) => integer(this);
}
}

[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.0.0")]
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.1.0")]
public static partial class FlattenedUnionWithPartitionEnumerableExtensions
{
public static (global::System.Collections.Generic.IReadOnlyList<FlattenedUnionWithPartition.Keyword> Keyword, global::System.Collections.Generic.IReadOnlyList<FlattenedUnionWithPartition.Integer> Integer) Partition(this global::System.Collections.Generic.IEnumerable<FlattenedUnionWithPartition> source)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ internal sealed class DiscriminatedUnionAttribute : global::System.Attribute
/// <summary>Generates exhaustive <c>Match</c> and <c>Switch</c> methods for the entire type hierarchy.</summary>
public bool Flatten { get; set; }

/// <summary>If a specialized partition extension method for <c>IEnumerable<YourType></c> should be generated. Defaults to <see langword="false"/>.</summary>
/// <summary>If a specialized partition extension method for <c>IEnumerable&lt;YourType&gt;</c> should be generated. Defaults to <see langword="false"/>.</summary>
public bool GeneratePartitionExtension { get; set; }

/// <summary>Customized the generic type name used for the result in the generated <c>Match</c> methods. Defaults to <c>TResult</c>.</summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@ namespace Funcky.DiscriminatedUnion.Test
{
partial record Result<T> where T : notnull
{
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.0.0")]
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.1.0")]
internal abstract TResult Match<TResult>(global::System.Func<Ok, TResult> ok, global::System.Func<Error, TResult> error);

[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.0.0")]
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.1.0")]
internal abstract void Switch(global::System.Action<Ok> ok, global::System.Action<Error> error);

partial record Ok
{
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.0.0")]
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.1.0")]
internal override TResult Match<TResult>(global::System.Func<Ok, TResult> ok, global::System.Func<Error, TResult> error) => ok(this);

[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.0.0")]
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.1.0")]
internal override void Switch(global::System.Action<Ok> ok, global::System.Action<Error> error) => ok(this);
}

partial record Error
{
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.0.0")]
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.1.0")]
internal override TResult Match<TResult>(global::System.Func<Ok, TResult> ok, global::System.Func<Error, TResult> error) => error(this);

[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.0.0")]
[global::System.CodeDom.Compiler.GeneratedCode("Funcky.DiscriminatedUnion.SourceGeneration", "1.2.1.0")]
internal override void Switch(global::System.Action<Ok> ok, global::System.Action<Error> error) => error(this);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ internal sealed class DiscriminatedUnionAttribute : global::System.Attribute
/// <summary>Generates exhaustive <c>Match</c> and <c>Switch</c> methods for the entire type hierarchy.</summary>
public bool Flatten { get; set; }

/// <summary>If a specialized partition extension method for <c>IEnumerable<YourType></c> should be generated. Defaults to <see langword="false"/>.</summary>
/// <summary>If a specialized partition extension method for <c>IEnumerable&lt;YourType&gt;</c> should be generated. Defaults to <see langword="false"/>.</summary>
public bool GeneratePartitionExtension { get; set; }

/// <summary>Customized the generic type name used for the result in the generated <c>Match</c> methods. Defaults to <c>TResult</c>.</summary>
Expand Down
Loading

0 comments on commit d36b702

Please sign in to comment.