From 824464dcc8af85cbb0d6e7986d870c1433bbcf15 Mon Sep 17 00:00:00 2001 From: Alexander Wiedemann Date: Fri, 15 Mar 2024 08:53:08 +0100 Subject: [PATCH] - use global prefix for types used in generated code --- .../ResultType.cs | 162 +++---- .../ResultTypeWithMerge.cs | 76 ++-- .../EnumType/Generator.cs | 18 +- .../FunicularSwitch.Generators.csproj | 2 +- .../GeneratorHelper.cs | 1 - .../ResultType/Generator.cs | 18 +- .../UnionType/Generator.cs | 20 +- .../FunicularSwitch.Result.g.cs | 162 +++---- .../FunicularSwitch.ResultWithMerge.g.cs | 188 ++++---- ...monCSharpAccessModifierMatchExtension.g.cs | 24 +- ...eFormatterDetectionModeMatchExtension.g.cs | 24 +- ...ertionsDataRowMatchModeMatchExtension.g.cs | 24 +- ...CyclicReferenceHandlingMatchExtension.g.cs | 24 +- ...EnumEquivalencyHandlingMatchExtension.g.cs | 24 +- ...valencyEqualityStrategyMatchExtension.g.cs | 24 +- ...alencyEquivalencyResultMatchExtension.g.cs | 24 +- ...ivalencyOrderStrictnessMatchExtension.g.cs | 24 +- ...itivesTimeSpanConditionMatchExtension.g.cs | 24 +- ...SpecsPlatformIdentifierMatchExtension.g.cs | 24 +- ...ConsumerErrorUnionCasesMatchExtension.g.cs | 24 +- ...lEnumParentInternalEnumMatchExtension.g.cs | 24 +- ...orsConsumerSystemMyEnumMatchExtension.g.cs | 65 +++ .../SystemDateTimeKindMatchExtension.g.cs | 24 +- ...h.Generators.Consumer.OperationResult.g.cs | 162 +++---- ...ors.Consumer.OperationResultWithMerge.g.cs | 188 ++++---- ...ularSwitch.Generators.Consumer.Result.g.cs | 162 +++---- ...h.Generators.Consumer.ResultWithMerge.g.cs | 188 ++++---- ...tch.Generators.Consumer.System.Result.g.cs | 418 ++++++++++++++++++ ...nsumerArgumentExceptionMatchExtension.g.cs | 71 +++ ...GeneratorsConsumerErrorMatchExtension.g.cs | 24 +- ...SystemArgumentExceptionMatchExtension.g.cs | 71 +++ ...rWithPrimaryConstructorMatchExtension.g.cs | 24 +- .../TrickyNamespacesSpecs.cs | 32 ++ ...SwitchTesttestMatchExtension.g.verified.cs | 24 +- ...hTestOutertestMatchExtension.g.verified.cs | 24 +- ...SwitchTesttestMatchExtension.g.verified.cs | 24 +- ...rSwitch.Test.OperationResult.g.verified.cs | 162 +++---- ...est.OperationResultWithMerge.g.verified.cs | 188 ++++---- ...#FunicularSwitch.Test.Result.g.verified.cs | 162 +++---- ...rSwitch.Test.ResultWithMerge.g.verified.cs | 188 ++++---- ...rSwitch.Test.OperationResult.g.verified.cs | 162 +++---- ...est.OperationResultWithMerge.g.verified.cs | 188 ++++---- ...rSwitch.Test.OperationResult.g.verified.cs | 162 +++---- ...est.OperationResultWithMerge.g.verified.cs | 188 ++++---- ...rSwitch.Test.OperationResult.g.verified.cs | 162 +++---- ...pace#OuterBaseMatchExtension.g.verified.cs | 24 +- ...SwitchTestBaseMatchExtension.g.verified.cs | 24 +- ...SwitchTestBaseMatchExtension.g.verified.cs | 24 +- ...witchTestIBaseMatchExtension.g.verified.cs | 24 +- ...hTestOuterBaseMatchExtension.g.verified.cs | 24 +- ...SwitchTestBaseMatchExtension.g.verified.cs | 24 +- ...SwitchTestBaseMatchExtension.g.verified.cs | 24 +- ...SwitchTestBaseMatchExtension.g.verified.cs | 24 +- ...SwitchTestBaseMatchExtension.g.verified.cs | 24 +- ...SwitchTestBaseMatchExtension.g.verified.cs | 24 +- ...hTestFieldTypeMatchExtension.g.verified.cs | 24 +- ...witchTestIBaseMatchExtension.g.verified.cs | 24 +- 57 files changed, 2471 insertions(+), 1815 deletions(-) create mode 100644 Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FunicularSwitchGeneratorsConsumerSystemMyEnumMatchExtension.g.cs create mode 100644 Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.ResultTypeGenerator/FunicularSwitch.Generators.Consumer.System.Result.g.cs create mode 100644 Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.UnionTypeGenerator/FunicularSwitchGeneratorsConsumerArgumentExceptionMatchExtension.g.cs create mode 100644 Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.UnionTypeGenerator/FunicularSwitchGeneratorsConsumerSystemArgumentExceptionMatchExtension.g.cs create mode 100644 Source/Tests/FunicularSwitch.Generators.Consumer/TrickyNamespacesSpecs.cs diff --git a/Source/FunicularSwitch.Generators.Templates/ResultType.cs b/Source/FunicularSwitch.Generators.Templates/ResultType.cs index 2e08a2f..dd96fc4 100644 --- a/Source/FunicularSwitch.Generators.Templates/ResultType.cs +++ b/Source/FunicularSwitch.Generators.Templates/ResultType.cs @@ -1,5 +1,5 @@ #nullable enable -using System.Linq; +using global::System.Linq; //additional using directives namespace FunicularSwitch.Generators.Templates @@ -13,56 +13,56 @@ public abstract partial class MyResult public bool IsOk => !IsError; public abstract MyError? GetErrorOrDefault(); - public static MyResult Try(System.Func action, System.Func formatError) + public static MyResult Try(global::System.Func action, global::System.Func formatError) { try { return action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } - public static async System.Threading.Tasks.Task> Try(System.Func> action, System.Func formatError) + public static async global::System.Threading.Tasks.Task> Try(global::System.Func> action, global::System.Func formatError) { try { return await action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } - public static MyResult Try(System.Func> action, System.Func formatError) + public static MyResult Try(global::System.Func> action, global::System.Func formatError) { try { return action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } - public static async System.Threading.Tasks.Task> Try(System.Func>> action, System.Func formatError) + public static async global::System.Threading.Tasks.Task> Try(global::System.Func>> action, global::System.Func formatError) { try { return await action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } } - public abstract partial class MyResult : MyResult, System.Collections.Generic.IEnumerable + public abstract partial class MyResult : MyResult, global::System.Collections.Generic.IEnumerable { public static MyResult Error(MyError message) => Error(message); public static MyResult Ok(T value) => Ok(value); @@ -79,14 +79,14 @@ public abstract partial class MyResult : MyResult, System.Collections.Generic { Ok_ ok => ok.Equals((object)other), Error_ error => error.Equals((object)other), - _ => throw new System.InvalidOperationException($"Unexpected type derived from {nameof(MyResult)}") + _ => throw new global::System.InvalidOperationException($"Unexpected type derived from {nameof(MyResult)}") }; public override int GetHashCode() => this switch { Ok_ ok => ok.GetHashCode(), Error_ error => error.GetHashCode(), - _ => throw new System.InvalidOperationException($"Unexpected type derived from {nameof(MyResult)}") + _ => throw new global::System.InvalidOperationException($"Unexpected type derived from {nameof(MyResult)}") }; public override bool Equals(object? obj) @@ -101,7 +101,7 @@ public override bool Equals(object? obj) public static bool operator !=(MyResult? left, MyResult? right) => !Equals(left, right); - public void Match(System.Action ok, System.Action? error = null) => Match( + public void Match(global::System.Action ok, global::System.Action? error = null) => Match( v => { ok.Invoke(v); @@ -113,37 +113,37 @@ public void Match(System.Action ok, System.Action? error = null) => return 42; }); - public T1 Match(System.Func ok, System.Func error) + public T1 Match(global::System.Func ok, global::System.Func error) { return this switch { Ok_ okMyResult => ok(okMyResult.Value), Error_ errorMyResult => error(errorMyResult.Details), - _ => throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}") + _ => throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}") }; } - public async System.Threading.Tasks.Task Match(System.Func> ok, System.Func> error) + public async global::System.Threading.Tasks.Task Match(global::System.Func> ok, global::System.Func> error) { return this switch { Ok_ okMyResult => await ok(okMyResult.Value).ConfigureAwait(false), Error_ errorMyResult => await error(errorMyResult.Details).ConfigureAwait(false), - _ => throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}") + _ => throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}") }; } - public System.Threading.Tasks.Task Match(System.Func> ok, System.Func error) => - Match(ok, e => System.Threading.Tasks.Task.FromResult(error(e))); + public global::System.Threading.Tasks.Task Match(global::System.Func> ok, global::System.Func error) => + Match(ok, e => global::System.Threading.Tasks.Task.FromResult(error(e))); - public async System.Threading.Tasks.Task Match(System.Func ok) + public async global::System.Threading.Tasks.Task Match(global::System.Func ok) { if (this is Ok_ okMyResult) await ok(okMyResult.Value).ConfigureAwait(false); } - public T Match(System.Func error) => Match(v => v, error); + public T Match(global::System.Func error) => Match(v => v, error); - public MyResult Bind(System.Func> bind) + public MyResult Bind(global::System.Func> bind) { switch (this) { @@ -154,7 +154,7 @@ public MyResult Bind(System.Func> bind) } // ReSharper disable once RedundantCatchClause #pragma warning disable CS0168 // Variable is declared but never used - catch (System.Exception e) + catch (global::System.Exception e) #pragma warning restore CS0168 // Variable is declared but never used { throw; //createGenericErrorResult @@ -162,11 +162,11 @@ public MyResult Bind(System.Func> bind) case Error_ error: return error.Convert(); default: - throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); + throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); } } - public async System.Threading.Tasks.Task> Bind(System.Func>> bind) + public async global::System.Threading.Tasks.Task> Bind(global::System.Func>> bind) { switch (this) { @@ -177,7 +177,7 @@ public async System.Threading.Tasks.Task> Bind(System.Func> Bind(System.Func(); default: - throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); + throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); } } - public MyResult Map(System.Func map) + public MyResult Map(global::System.Func map) => Bind(value => Ok(map(value))); - public System.Threading.Tasks.Task> Map(System.Func> map) + public global::System.Threading.Tasks.Task> Map(global::System.Func> map) => Bind(async value => Ok(await map(value).ConfigureAwait(false))); public T? GetValueOrDefault() @@ -201,7 +201,7 @@ public System.Threading.Tasks.Task> Map(System.Func default ); - public T GetValueOrDefault(System.Func defaultValue) + public T GetValueOrDefault(global::System.Func defaultValue) => Match( v => v, _ => defaultValue() @@ -216,12 +216,12 @@ public T GetValueOrDefault(T defaultValue) public T GetValueOrThrow() => Match( v => v, - details => throw new System.InvalidOperationException($"Cannot access error result value. Error: {details}")); + details => throw new global::System.InvalidOperationException($"Cannot access error result value. Error: {details}")); - public System.Collections.Generic.IEnumerator GetEnumerator() => Match(ok => new[] { ok }, _ => Enumerable.Empty()).GetEnumerator(); + public global::System.Collections.Generic.IEnumerator GetEnumerator() => Match(ok => new[] { ok }, _ => Enumerable.Empty()).GetEnumerator(); public override string ToString() => Match(ok => $"Ok {ok?.ToString()}", error => $"Error {error}"); - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); + global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); public sealed partial class Ok_ : MyResult { @@ -235,7 +235,7 @@ public bool Equals(Ok_? other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; - return System.Collections.Generic.EqualityComparer.Default.Equals(Value, other.Value); + return global::System.Collections.Generic.EqualityComparer.Default.Equals(Value, other.Value); } public override bool Equals(object? obj) @@ -245,7 +245,7 @@ public override bool Equals(object? obj) return obj is Ok_ other && Equals(other); } - public override int GetHashCode() => Value == null ? 0 : System.Collections.Generic.EqualityComparer.Default.GetHashCode(Value); + public override int GetHashCode() => Value == null ? 0 : global::System.Collections.Generic.EqualityComparer.Default.GetHashCode(Value); public static bool operator ==(Ok_ left, Ok_ right) => Equals(left, right); @@ -289,66 +289,66 @@ public static partial class MyResultExtension { #region bind - public static async System.Threading.Tasks.Task> Bind( - this System.Threading.Tasks.Task> result, - System.Func> bind) + public static async global::System.Threading.Tasks.Task> Bind( + this global::System.Threading.Tasks.Task> result, + global::System.Func> bind) => (await result.ConfigureAwait(false)).Bind(bind); - public static async System.Threading.Tasks.Task> Bind( - this System.Threading.Tasks.Task> result, - System.Func>> bind) + public static async global::System.Threading.Tasks.Task> Bind( + this global::System.Threading.Tasks.Task> result, + global::System.Func>> bind) => await (await result.ConfigureAwait(false)).Bind(bind).ConfigureAwait(false); #endregion #region map - public static async System.Threading.Tasks.Task> Map( - this System.Threading.Tasks.Task> result, - System.Func map) + public static async global::System.Threading.Tasks.Task> Map( + this global::System.Threading.Tasks.Task> result, + global::System.Func map) => (await result.ConfigureAwait(false)).Map(map); - public static System.Threading.Tasks.Task> Map( - this System.Threading.Tasks.Task> result, - System.Func> bind) + public static global::System.Threading.Tasks.Task> Map( + this global::System.Threading.Tasks.Task> result, + global::System.Func> bind) => Bind(result, async v => MyResult.Ok(await bind(v).ConfigureAwait(false))); - public static MyResult MapError(this MyResult result, System.Func mapError) + public static MyResult MapError(this MyResult result, global::System.Func mapError) { if (result is MyResult.Error_ e) return MyResult.Error(mapError(e.Details)); return result; } - public static async System.Threading.Tasks.Task> MapError(this System.Threading.Tasks.Task> result, System.Func mapError) => (await result.ConfigureAwait(false)).MapError(mapError); + public static async global::System.Threading.Tasks.Task> MapError(this global::System.Threading.Tasks.Task> result, global::System.Func mapError) => (await result.ConfigureAwait(false)).MapError(mapError); #endregion #region match - public static async System.Threading.Tasks.Task Match( - this System.Threading.Tasks.Task> result, - System.Func> ok, - System.Func> error) + public static async global::System.Threading.Tasks.Task Match( + this global::System.Threading.Tasks.Task> result, + global::System.Func> ok, + global::System.Func> error) => await (await result.ConfigureAwait(false)).Match(ok, error).ConfigureAwait(false); - public static async System.Threading.Tasks.Task Match( - this System.Threading.Tasks.Task> result, - System.Func> ok, - System.Func error) + public static async global::System.Threading.Tasks.Task Match( + this global::System.Threading.Tasks.Task> result, + global::System.Func> ok, + global::System.Func error) => await (await result.ConfigureAwait(false)).Match(ok, error).ConfigureAwait(false); - public static async System.Threading.Tasks.Task Match( - this System.Threading.Tasks.Task> result, - System.Func ok, - System.Func error) + public static async global::System.Threading.Tasks.Task Match( + this global::System.Threading.Tasks.Task> result, + global::System.Func ok, + global::System.Func error) => (await result.ConfigureAwait(false)).Match(ok, error); #endregion public static MyResult Flatten(this MyResult> result) => result.Bind(r => r); - public static MyResult As(this MyResult result, System.Func errorTIsNotT1) => + public static MyResult As(this MyResult result, global::System.Func errorTIsNotT1) => result.Bind(r => { if (r is T1 converted) @@ -356,18 +356,18 @@ public static MyResult As(this MyResult result, System.Func(errorTIsNotT1()); }); - public static MyResult As(this MyResult result, System.Func errorIsNotT1) => + public static MyResult As(this MyResult result, global::System.Func errorIsNotT1) => result.As(errorIsNotT1); #region query-expression pattern - public static MyResult Select(this MyResult result, System.Func selector) => result.Map(selector); - public static System.Threading.Tasks.Task> Select(this System.Threading.Tasks.Task> result, System.Func selector) => result.Map(selector); + public static MyResult Select(this MyResult result, global::System.Func selector) => result.Map(selector); + public static global::System.Threading.Tasks.Task> Select(this global::System.Threading.Tasks.Task> result, global::System.Func selector) => result.Map(selector); - public static MyResult SelectMany(this MyResult result, System.Func> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); - public static System.Threading.Tasks.Task> SelectMany(this System.Threading.Tasks.Task> result, System.Func>> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); - public static System.Threading.Tasks.Task> SelectMany(this System.Threading.Tasks.Task> result, System.Func> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); - public static System.Threading.Tasks.Task> SelectMany(this MyResult result, System.Func>> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static MyResult SelectMany(this MyResult result, global::System.Func> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static global::System.Threading.Tasks.Task> SelectMany(this global::System.Threading.Tasks.Task> result, global::System.Func>> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static global::System.Threading.Tasks.Task> SelectMany(this global::System.Threading.Tasks.Task> result, global::System.Func> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static global::System.Threading.Tasks.Task> SelectMany(this MyResult result, global::System.Func>> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); #endregion } @@ -377,17 +377,17 @@ namespace FunicularSwitch.Generators.Templates.Extensions { public static partial class MyResultExtension { - public static System.Collections.Generic.IEnumerable Choose( - this System.Collections.Generic.IEnumerable items, - System.Func> choose, - System.Action onError) + public static global::System.Collections.Generic.IEnumerable Choose( + this global::System.Collections.Generic.IEnumerable items, + global::System.Func> choose, + global::System.Action onError) => items .Select(i => choose(i)) .Choose(onError); - public static System.Collections.Generic.IEnumerable Choose( - this System.Collections.Generic.IEnumerable> results, - System.Action onError) + public static global::System.Collections.Generic.IEnumerable Choose( + this global::System.Collections.Generic.IEnumerable> results, + global::System.Action onError) => results .Where(r => r.Match(_ => true, error => @@ -397,19 +397,19 @@ public static System.Collections.Generic.IEnumerable Choose( })) .Select(r => r.GetValueOrThrow()); - public static MyResult As(this object item, System.Func error) => + public static MyResult As(this object item, global::System.Func error) => !(item is T t) ? MyResult.Error(error()) : t; - public static MyResult NotNull(this T? item, System.Func error) => + public static MyResult NotNull(this T? item, global::System.Func error) => item ?? MyResult.Error(error()); - public static MyResult NotNullOrEmpty(this string? s, System.Func error) + public static MyResult NotNullOrEmpty(this string? s, global::System.Func error) => string.IsNullOrEmpty(s) ? MyResult.Error(error()) : s!; - public static MyResult NotNullOrWhiteSpace(this string? s, System.Func error) + public static MyResult NotNullOrWhiteSpace(this string? s, global::System.Func error) => string.IsNullOrWhiteSpace(s) ? MyResult.Error(error()) : s!; - public static MyResult First(this System.Collections.Generic.IEnumerable candidates, System.Func predicate, System.Func noMatch) => + public static MyResult First(this global::System.Collections.Generic.IEnumerable candidates, global::System.Func predicate, global::System.Func noMatch) => candidates .FirstOrDefault(i => predicate(i)) .NotNull(noMatch); diff --git a/Source/FunicularSwitch.Generators.Templates/ResultTypeWithMerge.cs b/Source/FunicularSwitch.Generators.Templates/ResultTypeWithMerge.cs index 8e70696..6c70c36 100644 --- a/Source/FunicularSwitch.Generators.Templates/ResultTypeWithMerge.cs +++ b/Source/FunicularSwitch.Generators.Templates/ResultTypeWithMerge.cs @@ -1,5 +1,5 @@ #nullable enable -using System.Linq; +using global::System.Linq; //additional using directives namespace FunicularSwitch.Generators.Templates @@ -12,27 +12,27 @@ public abstract partial class MyResult public static partial class MyResultExtension { - public static MyResult> Map(this System.Collections.Generic.IEnumerable> results, - System.Func map) => + public static MyResult> Map(this global::System.Collections.Generic.IEnumerable> results, + global::System.Func map) => results.Select(r => r.Map(map)).Aggregate(); - public static MyResult> Bind(this System.Collections.Generic.IEnumerable> results, - System.Func> bind) => + public static MyResult> Bind(this global::System.Collections.Generic.IEnumerable> results, + global::System.Func> bind) => results.Select(r => r.Bind(bind)).Aggregate(); - public static MyResult> Bind(this MyResult result, - System.Func>> bindMany) => + public static MyResult> Bind(this MyResult result, + global::System.Func>> bindMany) => result.Map(ok => bindMany(ok).Aggregate()).Flatten(); - public static MyResult Bind(this System.Collections.Generic.IEnumerable> results, - System.Func, MyResult> bind) => + public static MyResult Bind(this global::System.Collections.Generic.IEnumerable> results, + global::System.Func, MyResult> bind) => results.Aggregate().Bind(bind); - public static MyResult> Aggregate(this System.Collections.Generic.IEnumerable> results) + public static MyResult> Aggregate(this global::System.Collections.Generic.IEnumerable> results) { var isError = false; MyError aggregated = default!; - var oks = new System.Collections.Generic.List(); + var oks = new global::System.Collections.Generic.List(); foreach (var result in results) { result.Match( @@ -46,31 +46,31 @@ public static MyResult Bind(this System.Collections.Generic.IEnumerab } return isError - ? MyResult.Error>(aggregated) - : MyResult.Ok>(oks); + ? MyResult.Error>(aggregated) + : MyResult.Ok>(oks); } - public static async System.Threading.Tasks.Task>> Aggregate( - this System.Threading.Tasks.Task>> results) + public static async global::System.Threading.Tasks.Task>> Aggregate( + this global::System.Threading.Tasks.Task>> results) => (await results.ConfigureAwait(false)) .Aggregate(); - public static async System.Threading.Tasks.Task>> Aggregate( - this System.Collections.Generic.IEnumerable>> results) - => (await System.Threading.Tasks.Task.WhenAll(results.Select(e => e)).ConfigureAwait(false)) + public static async global::System.Threading.Tasks.Task>> Aggregate( + this global::System.Collections.Generic.IEnumerable>> results) + => (await global::System.Threading.Tasks.Task.WhenAll(results.Select(e => e)).ConfigureAwait(false)) .Aggregate(); - public static async System.Threading.Tasks.Task>> AggregateMany( - this System.Collections.Generic.IEnumerable>>> results) - => (await System.Threading.Tasks.Task.WhenAll(results.Select(e => e)).ConfigureAwait(false)) + public static async global::System.Threading.Tasks.Task>> AggregateMany( + this global::System.Collections.Generic.IEnumerable>>> results) + => (await global::System.Threading.Tasks.Task.WhenAll(results.Select(e => e)).ConfigureAwait(false)) .SelectMany(e => e) .Aggregate(); //generated aggregate extension methods - public static MyResult FirstOk(this System.Collections.Generic.IEnumerable> results, System.Func onEmpty) + public static MyResult FirstOk(this global::System.Collections.Generic.IEnumerable> results, global::System.Func onEmpty) { - var errors = new System.Collections.Generic.List(); + var errors = new global::System.Collections.Generic.List(); foreach (var result in results) { if (result is MyResult.Error_ e) @@ -85,24 +85,24 @@ public static MyResult FirstOk(this System.Collections.Generic.IEnumerable return MyResult.Error(MergeErrors(errors)); } - public static async System.Threading.Tasks.Task>> Aggregate( - this System.Collections.Generic.IEnumerable>> results, + public static async global::System.Threading.Tasks.Task>> Aggregate( + this global::System.Collections.Generic.IEnumerable>> results, int maxDegreeOfParallelism) => (await results.SelectAsync(e => e, maxDegreeOfParallelism).ConfigureAwait(false)) .Aggregate(); - public static async System.Threading.Tasks.Task>> AggregateMany( - this System.Collections.Generic.IEnumerable>>> results, + public static async global::System.Threading.Tasks.Task>> AggregateMany( + this global::System.Collections.Generic.IEnumerable>>> results, int maxDegreeOfParallelism) => (await results.SelectAsync(e => e, maxDegreeOfParallelism).ConfigureAwait(false)) .SelectMany(e => e) .Aggregate(); - static async System.Threading.Tasks.Task SelectAsync(this System.Collections.Generic.IEnumerable items, System.Func> selector, int maxDegreeOfParallelism) + static async global::System.Threading.Tasks.Task SelectAsync(this global::System.Collections.Generic.IEnumerable items, global::System.Func> selector, int maxDegreeOfParallelism) { - using (var throttler = new System.Threading.SemaphoreSlim(maxDegreeOfParallelism, maxDegreeOfParallelism)) + using (var throttler = new global::System.Threading.SemaphoreSlim(maxDegreeOfParallelism, maxDegreeOfParallelism)) { - return await System.Threading.Tasks.Task.WhenAll(items.Select(async item => + return await global::System.Threading.Tasks.Task.WhenAll(items.Select(async item => { // ReSharper disable once AccessToDisposedClosure await throttler.WaitAsync().ConfigureAwait(false); @@ -119,19 +119,19 @@ static async System.Threading.Tasks.Task SelectAsync(this Syste } } - public static MyResult> AllOk(this System.Collections.Generic.IEnumerable candidates, System.Func> validate) => + public static MyResult> AllOk(this global::System.Collections.Generic.IEnumerable candidates, global::System.Func> validate) => candidates .Select(c => c.Validate(validate)) .Aggregate(); - public static MyResult> AllOk(this System.Collections.Generic.IEnumerable> candidates, - System.Func> validate) => + public static MyResult> AllOk(this global::System.Collections.Generic.IEnumerable> candidates, + global::System.Func> validate) => candidates .Bind(items => items.AllOk(validate)); - public static MyResult Validate(this MyResult item, System.Func> validate) => item.Bind(i => i.Validate(validate)); + public static MyResult Validate(this MyResult item, global::System.Func> validate) => item.Bind(i => i.Validate(validate)); - public static MyResult Validate(this T item, System.Func> validate) + public static MyResult Validate(this T item, global::System.Func> validate) { try { @@ -140,21 +140,21 @@ public static MyResult Validate(this T item, System.Func FirstOk(this System.Collections.Generic.IEnumerable candidates, System.Func> validate, System.Func onEmpty) => + public static MyResult FirstOk(this global::System.Collections.Generic.IEnumerable candidates, global::System.Func> validate, global::System.Func onEmpty) => candidates .Select(r => r.Validate(validate)) .FirstOk(onEmpty); #region helpers - static MyError MergeErrors(System.Collections.Generic.IEnumerable errors) + static MyError MergeErrors(global::System.Collections.Generic.IEnumerable errors) { var first = true; MyError aggregated = default!; diff --git a/Source/FunicularSwitch.Generators/EnumType/Generator.cs b/Source/FunicularSwitch.Generators/EnumType/Generator.cs index 8078972..1ba1d79 100644 --- a/Source/FunicularSwitch.Generators/EnumType/Generator.cs +++ b/Source/FunicularSwitch.Generators/EnumType/Generator.cs @@ -24,20 +24,20 @@ void BlankLine() { using (builder.StaticPartialClass($"{enumTypeSchema.TypeName.Replace(".", "_")}MatchExtension", enumTypeSchema.IsInternal ? "internal" : "public")) { - var thisTaskParameter = ThisParameter(enumTypeSchema, $"System.Threading.Tasks.Task<{enumTypeSchema.FullTypeName}>"); + var thisTaskParameter = ThisParameter(enumTypeSchema, $"global::System.Threading.Tasks.Task<{enumTypeSchema.FullTypeName}>"); var caseParameters = enumTypeSchema.Cases.Select(c => c.ParameterName).ToSeparatedString(); void WriteBodyForTaskExtension(string matchMethodName) => builder.WriteLine($"(await {thisTaskParameter.Name}.ConfigureAwait(false)).{matchMethodName}({caseParameters});"); void WriteBodyForAsyncTaskExtension(string matchMethodName) => builder.WriteLine($"await (await {thisTaskParameter.Name}.ConfigureAwait(false)).{matchMethodName}({caseParameters}).ConfigureAwait(false);"); GenerateMatchMethod(builder, enumTypeSchema, "T"); BlankLine(); - GenerateMatchMethod(builder, enumTypeSchema, "System.Threading.Tasks.Task"); + GenerateMatchMethod(builder, enumTypeSchema, "global::System.Threading.Tasks.Task"); BlankLine(); - WriteMatchSignature(builder, enumTypeSchema, thisTaskParameter, "System.Threading.Tasks.Task", "T", "public static async"); + WriteMatchSignature(builder, enumTypeSchema, thisTaskParameter, "global::System.Threading.Tasks.Task", "T", "public static async"); WriteBodyForTaskExtension(MatchMethodName); BlankLine(); - WriteMatchSignature(builder, enumTypeSchema, thisTaskParameter, "System.Threading.Tasks.Task", handlerReturnType: "System.Threading.Tasks.Task", "public static async"); + WriteMatchSignature(builder, enumTypeSchema, thisTaskParameter, "global::System.Threading.Tasks.Task", handlerReturnType: "global::System.Threading.Tasks.Task", "public static async"); WriteBodyForAsyncTaskExtension(MatchMethodName); BlankLine(); @@ -72,7 +72,7 @@ static void GenerateMatchMethod(CSharpBuilder builder, EnumTypeSchema enumTypeSc } builder.WriteLine( - $"_ => throw new System.ArgumentException($\"Unknown enum value from {enumTypeSchema.FullTypeName}: {{{thisParameterName}.GetType().Name}}\")"); + $"_ => throw new global::System.ArgumentException($\"Unknown enum value from {enumTypeSchema.FullTypeName}: {{{thisParameterName}.GetType().Name}}\")"); } } @@ -103,7 +103,7 @@ static void GenerateSwitchMethod(CSharpBuilder builder, EnumTypeSchema enumTypeS builder.WriteLine("default:"); using (builder.Indent()) { - builder.WriteLine($"throw new System.ArgumentException($\"Unknown enum value from {enumTypeSchema.FullTypeName}: {{{thisParameterName}.GetType().Name}}\");"); + builder.WriteLine($"throw new global::System.ArgumentException($\"Unknown enum value from {enumTypeSchema.FullTypeName}: {{{thisParameterName}.GetType().Name}}\");"); } } } @@ -116,7 +116,7 @@ static void WriteMatchSignature(CSharpBuilder builder, EnumTypeSchema enumTypeSc { handlerReturnType ??= returnType; var handlerParameters = enumTypeSchema.Cases - .Select(c => new Parameter($"System.Func<{handlerReturnType}>", c.ParameterName)); + .Select(c => new Parameter($"global::System.Func<{handlerReturnType}>", c.ParameterName)); builder.WriteMethodSignature( modifiers: modifiers, @@ -128,9 +128,9 @@ static void WriteMatchSignature(CSharpBuilder builder, EnumTypeSchema enumTypeSc static void WriteSwitchSignature(CSharpBuilder builder, EnumTypeSchema enumTypeSchema, Parameter thisParameter, bool isAsync, bool? asyncReturn = null, bool lambda = false) { - var returnType = asyncReturn ?? isAsync ? "async System.Threading.Tasks.Task" : "void"; + var returnType = asyncReturn ?? isAsync ? "async global::System.Threading.Tasks.Task" : "void"; var handlerParameters = enumTypeSchema.Cases - .Select(c => new Parameter(isAsync ? "System.Func" : "System.Action", c.ParameterName)); + .Select(c => new Parameter(isAsync ? "global::System.Func" : "global::System.Action", c.ParameterName)); string modifiers = "public static"; diff --git a/Source/FunicularSwitch.Generators/FunicularSwitch.Generators.csproj b/Source/FunicularSwitch.Generators/FunicularSwitch.Generators.csproj index 257a2cf..4ce3411 100644 --- a/Source/FunicularSwitch.Generators/FunicularSwitch.Generators.csproj +++ b/Source/FunicularSwitch.Generators/FunicularSwitch.Generators.csproj @@ -23,7 +23,7 @@ 3 - 3.1 + 3.2 $(MajorVersion).0.0 diff --git a/Source/FunicularSwitch.Generators/GeneratorHelper.cs b/Source/FunicularSwitch.Generators/GeneratorHelper.cs index 10a5125..5396132 100644 --- a/Source/FunicularSwitch.Generators/GeneratorHelper.cs +++ b/Source/FunicularSwitch.Generators/GeneratorHelper.cs @@ -1,7 +1,6 @@ using FunicularSwitch.Generators.Common; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; -using FunicularSwitch.Generators.EnumType; namespace FunicularSwitch.Generators; diff --git a/Source/FunicularSwitch.Generators/ResultType/Generator.cs b/Source/FunicularSwitch.Generators/ResultType/Generator.cs index 6cef964..5470d3b 100644 --- a/Source/FunicularSwitch.Generators/ResultType/Generator.cs +++ b/Source/FunicularSwitch.Generators/ResultType/Generator.cs @@ -99,8 +99,8 @@ static string MakeAggregateExtensionMethod(int typeParameterCount, bool isValueT var typeArgumentsWithResult = $"{typeArguments}, TResult"; var parameterDeclarations = Expand(i => $"MyResult r{i}"); - var taskParameterDeclarations = Expand(i => $"System.Threading.Tasks.Task> r{i}"); - var parametersWithCombine = $"{parameterDeclarations}, System.Func<{typeArgumentsWithResult}> combine"; + var taskParameterDeclarations = Expand(i => $"global::System.Threading.Tasks.Task> r{i}"); + var parametersWithCombine = $"{parameterDeclarations}, global::System.Func<{typeArgumentsWithResult}> combine"; var okCheck = Expand(i => $"r{i} is MyResult.Ok_ ok{i}", " && "); var combineArguments = Expand(i => $"ok{i}.Value"); @@ -125,12 +125,12 @@ static string MakeAggregateExtensionMethod(int typeParameterCount, bool isValueT )!); }} - public static System.Threading.Tasks.Task> Aggregate<{typeArguments}>(this {taskParameterDeclarations}) + public static global::System.Threading.Tasks.Task> Aggregate<{typeArguments}>(this {taskParameterDeclarations}) => Aggregate({resultArrayElements}, ({tupleArguments}) => ({tupleArguments})); - public static async System.Threading.Tasks.Task> Aggregate<{typeArgumentsWithResult}>(this {taskParameterDeclarations}, System.Func<{typeArgumentsWithResult}> combine) + public static async global::System.Threading.Tasks.Task> Aggregate<{typeArgumentsWithResult}>(this {taskParameterDeclarations}, global::System.Func<{typeArgumentsWithResult}> combine) {{ - await System.Threading.Tasks.Task.WhenAll({resultArrayElements}); + await global::System.Threading.Tasks.Task.WhenAll({resultArrayElements}); return Aggregate({taskResultArrayElements}, combine); }}"; } @@ -142,16 +142,16 @@ public static string GenerateAggregateMethod(int typeParameterCount) var typeParameters = Expand(i => $"T{i}"); var parameterDeclarations = Expand(i => $"MyResult r{i}"); - var taskParameterDeclarations = Expand(i => $"System.Threading.Tasks.Task> r{i}"); + var taskParameterDeclarations = Expand(i => $"global::System.Threading.Tasks.Task> r{i}"); var parameters = Expand(i => $"r{i}"); return $@" public static MyResult<({typeParameters})> Aggregate<{typeParameters}>({parameterDeclarations}) => MyResultExtension.Aggregate({parameters}); - public static MyResult Aggregate<{typeParameters}, TResult>({parameterDeclarations}, System.Func<{typeParameters}, TResult> combine) => MyResultExtension.Aggregate({parameters}, combine); + public static MyResult Aggregate<{typeParameters}, TResult>({parameterDeclarations}, global::System.Func<{typeParameters}, TResult> combine) => MyResultExtension.Aggregate({parameters}, combine); - public static System.Threading.Tasks.Task> Aggregate<{typeParameters}>({taskParameterDeclarations}) => MyResultExtension.Aggregate({parameters}); + public static global::System.Threading.Tasks.Task> Aggregate<{typeParameters}>({taskParameterDeclarations}) => MyResultExtension.Aggregate({parameters}); - public static System.Threading.Tasks.Task> Aggregate<{typeParameters}, TResult>({taskParameterDeclarations}, System.Func<{typeParameters}, TResult> combine) => MyResultExtension.Aggregate({parameters}, combine);"; + public static global::System.Threading.Tasks.Task> Aggregate<{typeParameters}, TResult>({taskParameterDeclarations}, global::System.Func<{typeParameters}, TResult> combine) => MyResultExtension.Aggregate({parameters}, combine);"; } } \ No newline at end of file diff --git a/Source/FunicularSwitch.Generators/UnionType/Generator.cs b/Source/FunicularSwitch.Generators/UnionType/Generator.cs index 306c05a..e696cef 100644 --- a/Source/FunicularSwitch.Generators/UnionType/Generator.cs +++ b/Source/FunicularSwitch.Generators/UnionType/Generator.cs @@ -36,7 +36,7 @@ static void WriteMatchExtension(UnionTypeSchema unionTypeSchema, CSharpBuilder b using (builder.StaticPartialClass($"{unionTypeSchema.TypeName.Replace(".", "_")}MatchExtension", unionTypeSchema.IsInternal ? "internal" : "public")) { - var thisTaskParameter = ThisParameter(unionTypeSchema, $"System.Threading.Tasks.Task<{unionTypeSchema.FullTypeName}>"); + var thisTaskParameter = ThisParameter(unionTypeSchema, $"global::System.Threading.Tasks.Task<{unionTypeSchema.FullTypeName}>"); var caseParameters = unionTypeSchema.Cases.Select(c => c.ParameterName).ToSeparatedString(); void WriteBodyForTaskExtension(string matchMethodName) => builder.WriteLine( @@ -47,13 +47,13 @@ void WriteBodyForAsyncTaskExtension(string matchMethodName) => builder.WriteLine GenerateMatchMethod(builder, unionTypeSchema, "T"); BlankLine(); - GenerateMatchMethod(builder, unionTypeSchema, "System.Threading.Tasks.Task"); + GenerateMatchMethod(builder, unionTypeSchema, "global::System.Threading.Tasks.Task"); BlankLine(); - WriteMatchSignature(builder, unionTypeSchema, thisTaskParameter, "System.Threading.Tasks.Task", "T", "public static async"); + WriteMatchSignature(builder, unionTypeSchema, thisTaskParameter, "global::System.Threading.Tasks.Task", "T", "public static async"); WriteBodyForTaskExtension(MatchMethodName); BlankLine(); - WriteMatchSignature(builder, unionTypeSchema, thisTaskParameter, "System.Threading.Tasks.Task", handlerReturnType: "System.Threading.Tasks.Task", + WriteMatchSignature(builder, unionTypeSchema, thisTaskParameter, "global::System.Threading.Tasks.Task", handlerReturnType: "global::System.Threading.Tasks.Task", "public static async"); WriteBodyForAsyncTaskExtension(MatchMethodName); BlankLine(); @@ -144,7 +144,7 @@ static void GenerateMatchMethod(CSharpBuilder builder, UnionTypeSchema unionType } builder.WriteLine( - $"_ => throw new System.ArgumentException($\"Unknown type derived from {unionTypeSchema.FullTypeName}: {{{thisParameterName}.GetType().Name}}\")"); + $"_ => throw new global::System.ArgumentException($\"Unknown type derived from {unionTypeSchema.FullTypeName}: {{{thisParameterName}.GetType().Name}}\")"); } } @@ -177,7 +177,7 @@ static void GenerateSwitchMethod(CSharpBuilder builder, UnionTypeSchema unionTyp builder.WriteLine("default:"); using (builder.Indent()) { - builder.WriteLine($"throw new System.ArgumentException($\"Unknown type derived from {unionTypeSchema.FullTypeName}: {{{thisParameterName}.GetType().Name}}\");"); + builder.WriteLine($"throw new global::System.ArgumentException($\"Unknown type derived from {unionTypeSchema.FullTypeName}: {{{thisParameterName}.GetType().Name}}\");"); } } } @@ -190,7 +190,7 @@ static void WriteMatchSignature(CSharpBuilder builder, UnionTypeSchema unionType { handlerReturnType ??= returnType; var handlerParameters = unionTypeSchema.Cases - .Select(c => new Parameter($"System.Func<{c.FullTypeName}, {handlerReturnType}>", c.ParameterName)); + .Select(c => new Parameter($"global::System.Func<{c.FullTypeName}, {handlerReturnType}>", c.ParameterName)); builder.WriteMethodSignature( modifiers: modifiers, @@ -202,13 +202,13 @@ static void WriteMatchSignature(CSharpBuilder builder, UnionTypeSchema unionType static void WriteSwitchSignature(CSharpBuilder builder, UnionTypeSchema unionTypeSchema, Parameter thisParameter, bool isAsync, bool? asyncReturn = null, bool lambda = false) { - var returnType = asyncReturn ?? isAsync ? "async System.Threading.Tasks.Task" : "void"; + var returnType = asyncReturn ?? isAsync ? "async global::System.Threading.Tasks.Task" : "void"; var handlerParameters = unionTypeSchema.Cases .Select(c => { var parameterType = isAsync - ? $"System.Func<{c.FullTypeName}, System.Threading.Tasks.Task>" - : $"System.Action<{c.FullTypeName}>"; + ? $"global::System.Func<{c.FullTypeName}, global::System.Threading.Tasks.Task>" + : $"global::System.Action<{c.FullTypeName}>"; return new Parameter( parameterType, c.ParameterName); diff --git a/Source/FunicularSwitch/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.ResultTypeGenerator/FunicularSwitch.Result.g.cs b/Source/FunicularSwitch/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.ResultTypeGenerator/FunicularSwitch.Result.g.cs index 99c3ce1..989abe7 100644 --- a/Source/FunicularSwitch/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.ResultTypeGenerator/FunicularSwitch.Result.g.cs +++ b/Source/FunicularSwitch/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.ResultTypeGenerator/FunicularSwitch.Result.g.cs @@ -1,5 +1,5 @@ #nullable enable -using System.Linq; +using global::System.Linq; using FunicularSwitch; using System; @@ -14,56 +14,56 @@ public abstract partial class Result public bool IsOk => !IsError; public abstract String? GetErrorOrDefault(); - public static Result Try(System.Func action, System.Func formatError) + public static Result Try(global::System.Func action, global::System.Func formatError) { try { return action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } - public static async System.Threading.Tasks.Task> Try(System.Func> action, System.Func formatError) + public static async global::System.Threading.Tasks.Task> Try(global::System.Func> action, global::System.Func formatError) { try { return await action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } - public static Result Try(System.Func> action, System.Func formatError) + public static Result Try(global::System.Func> action, global::System.Func formatError) { try { return action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } - public static async System.Threading.Tasks.Task> Try(System.Func>> action, System.Func formatError) + public static async global::System.Threading.Tasks.Task> Try(global::System.Func>> action, global::System.Func formatError) { try { return await action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } } - public abstract partial class Result : Result, System.Collections.Generic.IEnumerable + public abstract partial class Result : Result, global::System.Collections.Generic.IEnumerable { public static Result Error(String message) => Error(message); public static Result Ok(T value) => Ok(value); @@ -80,14 +80,14 @@ public abstract partial class Result : Result, System.Collections.Generic.IEn { Ok_ ok => ok.Equals((object)other), Error_ error => error.Equals((object)other), - _ => throw new System.InvalidOperationException($"Unexpected type derived from {nameof(Result)}") + _ => throw new global::System.InvalidOperationException($"Unexpected type derived from {nameof(Result)}") }; public override int GetHashCode() => this switch { Ok_ ok => ok.GetHashCode(), Error_ error => error.GetHashCode(), - _ => throw new System.InvalidOperationException($"Unexpected type derived from {nameof(Result)}") + _ => throw new global::System.InvalidOperationException($"Unexpected type derived from {nameof(Result)}") }; public override bool Equals(object? obj) @@ -102,7 +102,7 @@ public override bool Equals(object? obj) public static bool operator !=(Result? left, Result? right) => !Equals(left, right); - public void Match(System.Action ok, System.Action? error = null) => Match( + public void Match(global::System.Action ok, global::System.Action? error = null) => Match( v => { ok.Invoke(v); @@ -114,37 +114,37 @@ public void Match(System.Action ok, System.Action? error = null) => M return 42; }); - public T1 Match(System.Func ok, System.Func error) + public T1 Match(global::System.Func ok, global::System.Func error) { return this switch { Ok_ okResult => ok(okResult.Value), Error_ errorResult => error(errorResult.Details), - _ => throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}") + _ => throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}") }; } - public async System.Threading.Tasks.Task Match(System.Func> ok, System.Func> error) + public async global::System.Threading.Tasks.Task Match(global::System.Func> ok, global::System.Func> error) { return this switch { Ok_ okResult => await ok(okResult.Value).ConfigureAwait(false), Error_ errorResult => await error(errorResult.Details).ConfigureAwait(false), - _ => throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}") + _ => throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}") }; } - public System.Threading.Tasks.Task Match(System.Func> ok, System.Func error) => - Match(ok, e => System.Threading.Tasks.Task.FromResult(error(e))); + public global::System.Threading.Tasks.Task Match(global::System.Func> ok, global::System.Func error) => + Match(ok, e => global::System.Threading.Tasks.Task.FromResult(error(e))); - public async System.Threading.Tasks.Task Match(System.Func ok) + public async global::System.Threading.Tasks.Task Match(global::System.Func ok) { if (this is Ok_ okResult) await ok(okResult.Value).ConfigureAwait(false); } - public T Match(System.Func error) => Match(v => v, error); + public T Match(global::System.Func error) => Match(v => v, error); - public Result Bind(System.Func> bind) + public Result Bind(global::System.Func> bind) { switch (this) { @@ -155,7 +155,7 @@ public Result Bind(System.Func> bind) } // ReSharper disable once RedundantCatchClause #pragma warning disable CS0168 // Variable is declared but never used - catch (System.Exception e) + catch (global::System.Exception e) #pragma warning restore CS0168 // Variable is declared but never used { throw; //createGenericErrorResult @@ -163,11 +163,11 @@ public Result Bind(System.Func> bind) case Error_ error: return error.Convert(); default: - throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); + throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); } } - public async System.Threading.Tasks.Task> Bind(System.Func>> bind) + public async global::System.Threading.Tasks.Task> Bind(global::System.Func>> bind) { switch (this) { @@ -178,7 +178,7 @@ public async System.Threading.Tasks.Task> Bind(System.Func> Bind(System.Func(); default: - throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); + throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); } } - public Result Map(System.Func map) + public Result Map(global::System.Func map) => Bind(value => Ok(map(value))); - public System.Threading.Tasks.Task> Map(System.Func> map) + public global::System.Threading.Tasks.Task> Map(global::System.Func> map) => Bind(async value => Ok(await map(value).ConfigureAwait(false))); public T? GetValueOrDefault() @@ -202,7 +202,7 @@ public System.Threading.Tasks.Task> Map(System.Func default ); - public T GetValueOrDefault(System.Func defaultValue) + public T GetValueOrDefault(global::System.Func defaultValue) => Match( v => v, _ => defaultValue() @@ -217,12 +217,12 @@ public T GetValueOrDefault(T defaultValue) public T GetValueOrThrow() => Match( v => v, - details => throw new System.InvalidOperationException($"Cannot access error result value. Error: {details}")); + details => throw new global::System.InvalidOperationException($"Cannot access error result value. Error: {details}")); - public System.Collections.Generic.IEnumerator GetEnumerator() => Match(ok => new[] { ok }, _ => Enumerable.Empty()).GetEnumerator(); + public global::System.Collections.Generic.IEnumerator GetEnumerator() => Match(ok => new[] { ok }, _ => Enumerable.Empty()).GetEnumerator(); public override string ToString() => Match(ok => $"Ok {ok?.ToString()}", error => $"Error {error}"); - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); + global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); public sealed partial class Ok_ : Result { @@ -236,7 +236,7 @@ public bool Equals(Ok_? other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; - return System.Collections.Generic.EqualityComparer.Default.Equals(Value, other.Value); + return global::System.Collections.Generic.EqualityComparer.Default.Equals(Value, other.Value); } public override bool Equals(object? obj) @@ -246,7 +246,7 @@ public override bool Equals(object? obj) return obj is Ok_ other && Equals(other); } - public override int GetHashCode() => Value == null ? 0 : System.Collections.Generic.EqualityComparer.Default.GetHashCode(Value); + public override int GetHashCode() => Value == null ? 0 : global::System.Collections.Generic.EqualityComparer.Default.GetHashCode(Value); public static bool operator ==(Ok_ left, Ok_ right) => Equals(left, right); @@ -290,66 +290,66 @@ public static partial class ResultExtension { #region bind - public static async System.Threading.Tasks.Task> Bind( - this System.Threading.Tasks.Task> result, - System.Func> bind) + public static async global::System.Threading.Tasks.Task> Bind( + this global::System.Threading.Tasks.Task> result, + global::System.Func> bind) => (await result.ConfigureAwait(false)).Bind(bind); - public static async System.Threading.Tasks.Task> Bind( - this System.Threading.Tasks.Task> result, - System.Func>> bind) + public static async global::System.Threading.Tasks.Task> Bind( + this global::System.Threading.Tasks.Task> result, + global::System.Func>> bind) => await (await result.ConfigureAwait(false)).Bind(bind).ConfigureAwait(false); #endregion #region map - public static async System.Threading.Tasks.Task> Map( - this System.Threading.Tasks.Task> result, - System.Func map) + public static async global::System.Threading.Tasks.Task> Map( + this global::System.Threading.Tasks.Task> result, + global::System.Func map) => (await result.ConfigureAwait(false)).Map(map); - public static System.Threading.Tasks.Task> Map( - this System.Threading.Tasks.Task> result, - System.Func> bind) + public static global::System.Threading.Tasks.Task> Map( + this global::System.Threading.Tasks.Task> result, + global::System.Func> bind) => Bind(result, async v => Result.Ok(await bind(v).ConfigureAwait(false))); - public static Result MapError(this Result result, System.Func mapError) + public static Result MapError(this Result result, global::System.Func mapError) { if (result is Result.Error_ e) return Result.Error(mapError(e.Details)); return result; } - public static async System.Threading.Tasks.Task> MapError(this System.Threading.Tasks.Task> result, System.Func mapError) => (await result.ConfigureAwait(false)).MapError(mapError); + public static async global::System.Threading.Tasks.Task> MapError(this global::System.Threading.Tasks.Task> result, global::System.Func mapError) => (await result.ConfigureAwait(false)).MapError(mapError); #endregion #region match - public static async System.Threading.Tasks.Task Match( - this System.Threading.Tasks.Task> result, - System.Func> ok, - System.Func> error) + public static async global::System.Threading.Tasks.Task Match( + this global::System.Threading.Tasks.Task> result, + global::System.Func> ok, + global::System.Func> error) => await (await result.ConfigureAwait(false)).Match(ok, error).ConfigureAwait(false); - public static async System.Threading.Tasks.Task Match( - this System.Threading.Tasks.Task> result, - System.Func> ok, - System.Func error) + public static async global::System.Threading.Tasks.Task Match( + this global::System.Threading.Tasks.Task> result, + global::System.Func> ok, + global::System.Func error) => await (await result.ConfigureAwait(false)).Match(ok, error).ConfigureAwait(false); - public static async System.Threading.Tasks.Task Match( - this System.Threading.Tasks.Task> result, - System.Func ok, - System.Func error) + public static async global::System.Threading.Tasks.Task Match( + this global::System.Threading.Tasks.Task> result, + global::System.Func ok, + global::System.Func error) => (await result.ConfigureAwait(false)).Match(ok, error); #endregion public static Result Flatten(this Result> result) => result.Bind(r => r); - public static Result As(this Result result, System.Func errorTIsNotT1) => + public static Result As(this Result result, global::System.Func errorTIsNotT1) => result.Bind(r => { if (r is T1 converted) @@ -357,18 +357,18 @@ public static Result As(this Result result, System.Func er return Result.Error(errorTIsNotT1()); }); - public static Result As(this Result result, System.Func errorIsNotT1) => + public static Result As(this Result result, global::System.Func errorIsNotT1) => result.As(errorIsNotT1); #region query-expression pattern - public static Result Select(this Result result, System.Func selector) => result.Map(selector); - public static System.Threading.Tasks.Task> Select(this System.Threading.Tasks.Task> result, System.Func selector) => result.Map(selector); + public static Result Select(this Result result, global::System.Func selector) => result.Map(selector); + public static global::System.Threading.Tasks.Task> Select(this global::System.Threading.Tasks.Task> result, global::System.Func selector) => result.Map(selector); - public static Result SelectMany(this Result result, System.Func> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); - public static System.Threading.Tasks.Task> SelectMany(this System.Threading.Tasks.Task> result, System.Func>> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); - public static System.Threading.Tasks.Task> SelectMany(this System.Threading.Tasks.Task> result, System.Func> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); - public static System.Threading.Tasks.Task> SelectMany(this Result result, System.Func>> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static Result SelectMany(this Result result, global::System.Func> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static global::System.Threading.Tasks.Task> SelectMany(this global::System.Threading.Tasks.Task> result, global::System.Func>> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static global::System.Threading.Tasks.Task> SelectMany(this global::System.Threading.Tasks.Task> result, global::System.Func> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static global::System.Threading.Tasks.Task> SelectMany(this Result result, global::System.Func>> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); #endregion } @@ -378,17 +378,17 @@ namespace FunicularSwitch.Extensions { public static partial class ResultExtension { - public static System.Collections.Generic.IEnumerable Choose( - this System.Collections.Generic.IEnumerable items, - System.Func> choose, - System.Action onError) + public static global::System.Collections.Generic.IEnumerable Choose( + this global::System.Collections.Generic.IEnumerable items, + global::System.Func> choose, + global::System.Action onError) => items .Select(i => choose(i)) .Choose(onError); - public static System.Collections.Generic.IEnumerable Choose( - this System.Collections.Generic.IEnumerable> results, - System.Action onError) + public static global::System.Collections.Generic.IEnumerable Choose( + this global::System.Collections.Generic.IEnumerable> results, + global::System.Action onError) => results .Where(r => r.Match(_ => true, error => @@ -398,19 +398,19 @@ public static System.Collections.Generic.IEnumerable Choose( })) .Select(r => r.GetValueOrThrow()); - public static Result As(this object item, System.Func error) => + public static Result As(this object item, global::System.Func error) => !(item is T t) ? Result.Error(error()) : t; - public static Result NotNull(this T? item, System.Func error) => + public static Result NotNull(this T? item, global::System.Func error) => item ?? Result.Error(error()); - public static Result NotNullOrEmpty(this string? s, System.Func error) + public static Result NotNullOrEmpty(this string? s, global::System.Func error) => string.IsNullOrEmpty(s) ? Result.Error(error()) : s!; - public static Result NotNullOrWhiteSpace(this string? s, System.Func error) + public static Result NotNullOrWhiteSpace(this string? s, global::System.Func error) => string.IsNullOrWhiteSpace(s) ? Result.Error(error()) : s!; - public static Result First(this System.Collections.Generic.IEnumerable candidates, System.Func predicate, System.Func noMatch) => + public static Result First(this global::System.Collections.Generic.IEnumerable candidates, global::System.Func predicate, global::System.Func noMatch) => candidates .FirstOrDefault(i => predicate(i)) .NotNull(noMatch); diff --git a/Source/FunicularSwitch/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.ResultTypeGenerator/FunicularSwitch.ResultWithMerge.g.cs b/Source/FunicularSwitch/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.ResultTypeGenerator/FunicularSwitch.ResultWithMerge.g.cs index faee461..eba145e 100644 --- a/Source/FunicularSwitch/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.ResultTypeGenerator/FunicularSwitch.ResultWithMerge.g.cs +++ b/Source/FunicularSwitch/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.ResultTypeGenerator/FunicularSwitch.ResultWithMerge.g.cs @@ -1,5 +1,5 @@ #nullable enable -using System.Linq; +using global::System.Linq; using FunicularSwitch; using System; @@ -11,92 +11,92 @@ public abstract partial class Result public static Result<(T1, T2)> Aggregate(Result r1, Result r2) => ResultExtension.Aggregate(r1, r2); - public static Result Aggregate(Result r1, Result r2, System.Func combine) => ResultExtension.Aggregate(r1, r2, combine); + public static Result Aggregate(Result r1, Result r2, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2) => ResultExtension.Aggregate(r1, r2); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2) => ResultExtension.Aggregate(r1, r2); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Func combine) => ResultExtension.Aggregate(r1, r2, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, combine); public static Result<(T1, T2, T3)> Aggregate(Result r1, Result r2, Result r3) => ResultExtension.Aggregate(r1, r2, r3); - public static Result Aggregate(Result r1, Result r2, Result r3, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, combine); + public static Result Aggregate(Result r1, Result r2, Result r3, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3) => ResultExtension.Aggregate(r1, r2, r3); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3) => ResultExtension.Aggregate(r1, r2, r3); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, combine); public static Result<(T1, T2, T3, T4)> Aggregate(Result r1, Result r2, Result r3, Result r4) => ResultExtension.Aggregate(r1, r2, r3, r4); - public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, combine); + public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4) => ResultExtension.Aggregate(r1, r2, r3, r4); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4) => ResultExtension.Aggregate(r1, r2, r3, r4); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, combine); public static Result<(T1, T2, T3, T4, T5)> Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5) => ResultExtension.Aggregate(r1, r2, r3, r4, r5); - public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, combine); + public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5) => ResultExtension.Aggregate(r1, r2, r3, r4, r5); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5) => ResultExtension.Aggregate(r1, r2, r3, r4, r5); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, combine); public static Result<(T1, T2, T3, T4, T5, T6)> Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6); - public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, combine); + public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, combine); public static Result<(T1, T2, T3, T4, T5, T6, T7)> Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7); - public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, combine); + public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, combine); public static Result<(T1, T2, T3, T4, T5, T6, T7, T8)> Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8); - public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, combine); + public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, combine); public static Result<(T1, T2, T3, T4, T5, T6, T7, T8, T9)> Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8, Result r9) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9); - public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8, Result r9, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, combine); + public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8, Result r9, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Threading.Tasks.Task> r9) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Threading.Tasks.Task> r9) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Threading.Tasks.Task> r9, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Threading.Tasks.Task> r9, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, combine); } public static partial class ResultExtension { - public static Result> Map(this System.Collections.Generic.IEnumerable> results, - System.Func map) => + public static Result> Map(this global::System.Collections.Generic.IEnumerable> results, + global::System.Func map) => results.Select(r => r.Map(map)).Aggregate(); - public static Result> Bind(this System.Collections.Generic.IEnumerable> results, - System.Func> bind) => + public static Result> Bind(this global::System.Collections.Generic.IEnumerable> results, + global::System.Func> bind) => results.Select(r => r.Bind(bind)).Aggregate(); - public static Result> Bind(this Result result, - System.Func>> bindMany) => + public static Result> Bind(this Result result, + global::System.Func>> bindMany) => result.Map(ok => bindMany(ok).Aggregate()).Flatten(); - public static Result Bind(this System.Collections.Generic.IEnumerable> results, - System.Func, Result> bind) => + public static Result Bind(this global::System.Collections.Generic.IEnumerable> results, + global::System.Func, Result> bind) => results.Aggregate().Bind(bind); - public static Result> Aggregate(this System.Collections.Generic.IEnumerable> results) + public static Result> Aggregate(this global::System.Collections.Generic.IEnumerable> results) { var isError = false; String aggregated = default!; - var oks = new System.Collections.Generic.List(); + var oks = new global::System.Collections.Generic.List(); foreach (var result in results) { result.Match( @@ -110,23 +110,23 @@ public static Result Bind(this System.Collections.Generic.IEnumerable } return isError - ? Result.Error>(aggregated) - : Result.Ok>(oks); + ? Result.Error>(aggregated) + : Result.Ok>(oks); } - public static async System.Threading.Tasks.Task>> Aggregate( - this System.Threading.Tasks.Task>> results) + public static async global::System.Threading.Tasks.Task>> Aggregate( + this global::System.Threading.Tasks.Task>> results) => (await results.ConfigureAwait(false)) .Aggregate(); - public static async System.Threading.Tasks.Task>> Aggregate( - this System.Collections.Generic.IEnumerable>> results) - => (await System.Threading.Tasks.Task.WhenAll(results.Select(e => e)).ConfigureAwait(false)) + public static async global::System.Threading.Tasks.Task>> Aggregate( + this global::System.Collections.Generic.IEnumerable>> results) + => (await global::System.Threading.Tasks.Task.WhenAll(results.Select(e => e)).ConfigureAwait(false)) .Aggregate(); - public static async System.Threading.Tasks.Task>> AggregateMany( - this System.Collections.Generic.IEnumerable>>> results) - => (await System.Threading.Tasks.Task.WhenAll(results.Select(e => e)).ConfigureAwait(false)) + public static async global::System.Threading.Tasks.Task>> AggregateMany( + this global::System.Collections.Generic.IEnumerable>>> results) + => (await global::System.Threading.Tasks.Task.WhenAll(results.Select(e => e)).ConfigureAwait(false)) .SelectMany(e => e) .Aggregate(); @@ -134,7 +134,7 @@ public static Result Bind(this System.Collections.Generic.IEnumerable public static Result<(T1, T2)> Aggregate(this Result r1, Result r2) => Aggregate(r1, r2, (v1, v2) => (v1, v2)); - public static Result Aggregate(this Result r1, Result r2, System.Func combine) + public static Result Aggregate(this Result r1, Result r2, global::System.Func combine) { if (r1 is Result.Ok_ ok1 && r2 is Result.Ok_ ok2) return combine(ok1.Value, ok2.Value); @@ -146,19 +146,19 @@ public static Result Aggregate(this Result r1, Res )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2) => Aggregate(r1, r2, (v1, v2) => (v1, v2)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2); return Aggregate(r1.Result, r2.Result, combine); } public static Result<(T1, T2, T3)> Aggregate(this Result r1, Result r2, Result r3) => Aggregate(r1, r2, r3, (v1, v2, v3) => (v1, v2, v3)); - public static Result Aggregate(this Result r1, Result r2, Result r3, System.Func combine) + public static Result Aggregate(this Result r1, Result r2, Result r3, global::System.Func combine) { if (r1 is Result.Ok_ ok1 && r2 is Result.Ok_ ok2 && r3 is Result.Ok_ ok3) return combine(ok1.Value, ok2.Value, ok3.Value); @@ -170,19 +170,19 @@ public static Result Aggregate(this Result r1, )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3) => Aggregate(r1, r2, r3, (v1, v2, v3) => (v1, v2, v3)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3); return Aggregate(r1.Result, r2.Result, r3.Result, combine); } public static Result<(T1, T2, T3, T4)> Aggregate(this Result r1, Result r2, Result r3, Result r4) => Aggregate(r1, r2, r3, r4, (v1, v2, v3, v4) => (v1, v2, v3, v4)); - public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, System.Func combine) + public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, global::System.Func combine) { if (r1 is Result.Ok_ ok1 && r2 is Result.Ok_ ok2 && r3 is Result.Ok_ ok3 && r4 is Result.Ok_ ok4) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value); @@ -194,19 +194,19 @@ public static Result Aggregate(this Result )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4) => Aggregate(r1, r2, r3, r4, (v1, v2, v3, v4) => (v1, v2, v3, v4)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, combine); } public static Result<(T1, T2, T3, T4, T5)> Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5) => Aggregate(r1, r2, r3, r4, r5, (v1, v2, v3, v4, v5) => (v1, v2, v3, v4, v5)); - public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, System.Func combine) + public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, global::System.Func combine) { if (r1 is Result.Ok_ ok1 && r2 is Result.Ok_ ok2 && r3 is Result.Ok_ ok3 && r4 is Result.Ok_ ok4 && r5 is Result.Ok_ ok5) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value); @@ -218,19 +218,19 @@ public static Result Aggregate(this Result )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5) => Aggregate(r1, r2, r3, r4, r5, (v1, v2, v3, v4, v5) => (v1, v2, v3, v4, v5)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, combine); } public static Result<(T1, T2, T3, T4, T5, T6)> Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6) => Aggregate(r1, r2, r3, r4, r5, r6, (v1, v2, v3, v4, v5, v6) => (v1, v2, v3, v4, v5, v6)); - public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, System.Func combine) + public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, global::System.Func combine) { if (r1 is Result.Ok_ ok1 && r2 is Result.Ok_ ok2 && r3 is Result.Ok_ ok3 && r4 is Result.Ok_ ok4 && r5 is Result.Ok_ ok5 && r6 is Result.Ok_ ok6) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value, ok6.Value); @@ -242,19 +242,19 @@ public static Result Aggregate(this Re )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6) => Aggregate(r1, r2, r3, r4, r5, r6, (v1, v2, v3, v4, v5, v6) => (v1, v2, v3, v4, v5, v6)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, r6.Result, combine); } public static Result<(T1, T2, T3, T4, T5, T6, T7)> Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7) => Aggregate(r1, r2, r3, r4, r5, r6, r7, (v1, v2, v3, v4, v5, v6, v7) => (v1, v2, v3, v4, v5, v6, v7)); - public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, System.Func combine) + public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, global::System.Func combine) { if (r1 is Result.Ok_ ok1 && r2 is Result.Ok_ ok2 && r3 is Result.Ok_ ok3 && r4 is Result.Ok_ ok4 && r5 is Result.Ok_ ok5 && r6 is Result.Ok_ ok6 && r7 is Result.Ok_ ok7) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value, ok6.Value, ok7.Value); @@ -266,19 +266,19 @@ public static Result Aggregate(thi )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7) => Aggregate(r1, r2, r3, r4, r5, r6, r7, (v1, v2, v3, v4, v5, v6, v7) => (v1, v2, v3, v4, v5, v6, v7)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, r6.Result, r7.Result, combine); } public static Result<(T1, T2, T3, T4, T5, T6, T7, T8)> Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8) => Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, (v1, v2, v3, v4, v5, v6, v7, v8) => (v1, v2, v3, v4, v5, v6, v7, v8)); - public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8, System.Func combine) + public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8, global::System.Func combine) { if (r1 is Result.Ok_ ok1 && r2 is Result.Ok_ ok2 && r3 is Result.Ok_ ok3 && r4 is Result.Ok_ ok4 && r5 is Result.Ok_ ok5 && r6 is Result.Ok_ ok6 && r7 is Result.Ok_ ok7 && r8 is Result.Ok_ ok8) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value, ok6.Value, ok7.Value, ok8.Value); @@ -290,19 +290,19 @@ public static Result Aggregate )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8) => Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, (v1, v2, v3, v4, v5, v6, v7, v8) => (v1, v2, v3, v4, v5, v6, v7, v8)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7, r8); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7, r8); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, r6.Result, r7.Result, r8.Result, combine); } public static Result<(T1, T2, T3, T4, T5, T6, T7, T8, T9)> Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8, Result r9) => Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, (v1, v2, v3, v4, v5, v6, v7, v8, v9) => (v1, v2, v3, v4, v5, v6, v7, v8, v9)); - public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8, Result r9, System.Func combine) + public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8, Result r9, global::System.Func combine) { if (r1 is Result.Ok_ ok1 && r2 is Result.Ok_ ok2 && r3 is Result.Ok_ ok3 && r4 is Result.Ok_ ok4 && r5 is Result.Ok_ ok5 && r6 is Result.Ok_ ok6 && r7 is Result.Ok_ ok7 && r8 is Result.Ok_ ok8 && r9 is Result.Ok_ ok9) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value, ok6.Value, ok7.Value, ok8.Value, ok9.Value); @@ -314,18 +314,18 @@ public static Result Aggregate> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Threading.Tasks.Task> r9) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Threading.Tasks.Task> r9) => Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, (v1, v2, v3, v4, v5, v6, v7, v8, v9) => (v1, v2, v3, v4, v5, v6, v7, v8, v9)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Threading.Tasks.Task> r9, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Threading.Tasks.Task> r9, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7, r8, r9); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7, r8, r9); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, r6.Result, r7.Result, r8.Result, r9.Result, combine); } - public static Result FirstOk(this System.Collections.Generic.IEnumerable> results, System.Func onEmpty) + public static Result FirstOk(this global::System.Collections.Generic.IEnumerable> results, global::System.Func onEmpty) { - var errors = new System.Collections.Generic.List(); + var errors = new global::System.Collections.Generic.List(); foreach (var result in results) { if (result is Result.Error_ e) @@ -340,24 +340,24 @@ public static Result FirstOk(this System.Collections.Generic.IEnumerable(MergeErrors(errors)); } - public static async System.Threading.Tasks.Task>> Aggregate( - this System.Collections.Generic.IEnumerable>> results, + public static async global::System.Threading.Tasks.Task>> Aggregate( + this global::System.Collections.Generic.IEnumerable>> results, int maxDegreeOfParallelism) => (await results.SelectAsync(e => e, maxDegreeOfParallelism).ConfigureAwait(false)) .Aggregate(); - public static async System.Threading.Tasks.Task>> AggregateMany( - this System.Collections.Generic.IEnumerable>>> results, + public static async global::System.Threading.Tasks.Task>> AggregateMany( + this global::System.Collections.Generic.IEnumerable>>> results, int maxDegreeOfParallelism) => (await results.SelectAsync(e => e, maxDegreeOfParallelism).ConfigureAwait(false)) .SelectMany(e => e) .Aggregate(); - static async System.Threading.Tasks.Task SelectAsync(this System.Collections.Generic.IEnumerable items, System.Func> selector, int maxDegreeOfParallelism) + static async global::System.Threading.Tasks.Task SelectAsync(this global::System.Collections.Generic.IEnumerable items, global::System.Func> selector, int maxDegreeOfParallelism) { - using (var throttler = new System.Threading.SemaphoreSlim(maxDegreeOfParallelism, maxDegreeOfParallelism)) + using (var throttler = new global::System.Threading.SemaphoreSlim(maxDegreeOfParallelism, maxDegreeOfParallelism)) { - return await System.Threading.Tasks.Task.WhenAll(items.Select(async item => + return await global::System.Threading.Tasks.Task.WhenAll(items.Select(async item => { // ReSharper disable once AccessToDisposedClosure await throttler.WaitAsync().ConfigureAwait(false); @@ -374,19 +374,19 @@ static async System.Threading.Tasks.Task SelectAsync(this Syste } } - public static Result> AllOk(this System.Collections.Generic.IEnumerable candidates, System.Func> validate) => + public static Result> AllOk(this global::System.Collections.Generic.IEnumerable candidates, global::System.Func> validate) => candidates .Select(c => c.Validate(validate)) .Aggregate(); - public static Result> AllOk(this System.Collections.Generic.IEnumerable> candidates, - System.Func> validate) => + public static Result> AllOk(this global::System.Collections.Generic.IEnumerable> candidates, + global::System.Func> validate) => candidates .Bind(items => items.AllOk(validate)); - public static Result Validate(this Result item, System.Func> validate) => item.Bind(i => i.Validate(validate)); + public static Result Validate(this Result item, global::System.Func> validate) => item.Bind(i => i.Validate(validate)); - public static Result Validate(this T item, System.Func> validate) + public static Result Validate(this T item, global::System.Func> validate) { try { @@ -395,21 +395,21 @@ public static Result Validate(this T item, System.Func FirstOk(this System.Collections.Generic.IEnumerable candidates, System.Func> validate, System.Func onEmpty) => + public static Result FirstOk(this global::System.Collections.Generic.IEnumerable candidates, global::System.Func> validate, global::System.Func onEmpty) => candidates .Select(r => r.Validate(validate)) .FirstOk(onEmpty); #region helpers - static String MergeErrors(System.Collections.Generic.IEnumerable errors) + static String MergeErrors(global::System.Collections.Generic.IEnumerable errors) { var first = true; String aggregated = default!; diff --git a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsCommonCSharpAccessModifierMatchExtension.g.cs b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsCommonCSharpAccessModifierMatchExtension.g.cs index 3fa39a9..f08e87a 100644 --- a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsCommonCSharpAccessModifierMatchExtension.g.cs +++ b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsCommonCSharpAccessModifierMatchExtension.g.cs @@ -3,7 +3,7 @@ namespace FluentAssertions.Common { public static partial class CSharpAccessModifierMatchExtension { - public static T Match(this FluentAssertions.Common.CSharpAccessModifier cSharpAccessModifier, System.Func @internal, System.Func invalidForCSharp, System.Func @private, System.Func privateProtected, System.Func @protected, System.Func protectedInternal, System.Func @public) => + public static T Match(this FluentAssertions.Common.CSharpAccessModifier cSharpAccessModifier, global::System.Func @internal, global::System.Func invalidForCSharp, global::System.Func @private, global::System.Func privateProtected, global::System.Func @protected, global::System.Func protectedInternal, global::System.Func @public) => cSharpAccessModifier switch { FluentAssertions.Common.CSharpAccessModifier.Internal => @internal(), @@ -13,10 +13,10 @@ public static T Match(this FluentAssertions.Common.CSharpAccessModifier cShar FluentAssertions.Common.CSharpAccessModifier.Protected => @protected(), FluentAssertions.Common.CSharpAccessModifier.ProtectedInternal => protectedInternal(), FluentAssertions.Common.CSharpAccessModifier.Public => @public(), - _ => throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Common.CSharpAccessModifier: {cSharpAccessModifier.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Common.CSharpAccessModifier: {cSharpAccessModifier.GetType().Name}") }; - public static System.Threading.Tasks.Task Match(this FluentAssertions.Common.CSharpAccessModifier cSharpAccessModifier, System.Func> @internal, System.Func> invalidForCSharp, System.Func> @private, System.Func> privateProtected, System.Func> @protected, System.Func> protectedInternal, System.Func> @public) => + public static global::System.Threading.Tasks.Task Match(this FluentAssertions.Common.CSharpAccessModifier cSharpAccessModifier, global::System.Func> @internal, global::System.Func> invalidForCSharp, global::System.Func> @private, global::System.Func> privateProtected, global::System.Func> @protected, global::System.Func> protectedInternal, global::System.Func> @public) => cSharpAccessModifier switch { FluentAssertions.Common.CSharpAccessModifier.Internal => @internal(), @@ -26,16 +26,16 @@ public static System.Threading.Tasks.Task Match(this FluentAssertions.Comm FluentAssertions.Common.CSharpAccessModifier.Protected => @protected(), FluentAssertions.Common.CSharpAccessModifier.ProtectedInternal => protectedInternal(), FluentAssertions.Common.CSharpAccessModifier.Public => @public(), - _ => throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Common.CSharpAccessModifier: {cSharpAccessModifier.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Common.CSharpAccessModifier: {cSharpAccessModifier.GetType().Name}") }; - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task cSharpAccessModifier, System.Func @internal, System.Func invalidForCSharp, System.Func @private, System.Func privateProtected, System.Func @protected, System.Func protectedInternal, System.Func @public) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task cSharpAccessModifier, global::System.Func @internal, global::System.Func invalidForCSharp, global::System.Func @private, global::System.Func privateProtected, global::System.Func @protected, global::System.Func protectedInternal, global::System.Func @public) => (await cSharpAccessModifier.ConfigureAwait(false)).Match(@internal, invalidForCSharp, @private, privateProtected, @protected, protectedInternal, @public); - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task cSharpAccessModifier, System.Func> @internal, System.Func> invalidForCSharp, System.Func> @private, System.Func> privateProtected, System.Func> @protected, System.Func> protectedInternal, System.Func> @public) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task cSharpAccessModifier, global::System.Func> @internal, global::System.Func> invalidForCSharp, global::System.Func> @private, global::System.Func> privateProtected, global::System.Func> @protected, global::System.Func> protectedInternal, global::System.Func> @public) => await (await cSharpAccessModifier.ConfigureAwait(false)).Match(@internal, invalidForCSharp, @private, privateProtected, @protected, protectedInternal, @public).ConfigureAwait(false); - public static void Switch(this FluentAssertions.Common.CSharpAccessModifier cSharpAccessModifier, System.Action @internal, System.Action invalidForCSharp, System.Action @private, System.Action privateProtected, System.Action @protected, System.Action protectedInternal, System.Action @public) + public static void Switch(this FluentAssertions.Common.CSharpAccessModifier cSharpAccessModifier, global::System.Action @internal, global::System.Action invalidForCSharp, global::System.Action @private, global::System.Action privateProtected, global::System.Action @protected, global::System.Action protectedInternal, global::System.Action @public) { switch (cSharpAccessModifier) { @@ -61,11 +61,11 @@ public static void Switch(this FluentAssertions.Common.CSharpAccessModifier cSha @public(); break; default: - throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Common.CSharpAccessModifier: {cSharpAccessModifier.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Common.CSharpAccessModifier: {cSharpAccessModifier.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this FluentAssertions.Common.CSharpAccessModifier cSharpAccessModifier, System.Func @internal, System.Func invalidForCSharp, System.Func @private, System.Func privateProtected, System.Func @protected, System.Func protectedInternal, System.Func @public) + public static async global::System.Threading.Tasks.Task Switch(this FluentAssertions.Common.CSharpAccessModifier cSharpAccessModifier, global::System.Func @internal, global::System.Func invalidForCSharp, global::System.Func @private, global::System.Func privateProtected, global::System.Func @protected, global::System.Func protectedInternal, global::System.Func @public) { switch (cSharpAccessModifier) { @@ -91,14 +91,14 @@ public static async System.Threading.Tasks.Task Switch(this FluentAssertions.Com await @public().ConfigureAwait(false); break; default: - throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Common.CSharpAccessModifier: {cSharpAccessModifier.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Common.CSharpAccessModifier: {cSharpAccessModifier.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task cSharpAccessModifier, System.Action @internal, System.Action invalidForCSharp, System.Action @private, System.Action privateProtected, System.Action @protected, System.Action protectedInternal, System.Action @public) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task cSharpAccessModifier, global::System.Action @internal, global::System.Action invalidForCSharp, global::System.Action @private, global::System.Action privateProtected, global::System.Action @protected, global::System.Action protectedInternal, global::System.Action @public) => (await cSharpAccessModifier.ConfigureAwait(false)).Switch(@internal, invalidForCSharp, @private, privateProtected, @protected, protectedInternal, @public); - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task cSharpAccessModifier, System.Func @internal, System.Func invalidForCSharp, System.Func @private, System.Func privateProtected, System.Func @protected, System.Func protectedInternal, System.Func @public) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task cSharpAccessModifier, global::System.Func @internal, global::System.Func invalidForCSharp, global::System.Func @private, global::System.Func privateProtected, global::System.Func @protected, global::System.Func protectedInternal, global::System.Func @public) => await (await cSharpAccessModifier.ConfigureAwait(false)).Switch(@internal, invalidForCSharp, @private, privateProtected, @protected, protectedInternal, @public).ConfigureAwait(false); } } diff --git a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsCommonValueFormatterDetectionModeMatchExtension.g.cs b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsCommonValueFormatterDetectionModeMatchExtension.g.cs index fa70425..c51a6d6 100644 --- a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsCommonValueFormatterDetectionModeMatchExtension.g.cs +++ b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsCommonValueFormatterDetectionModeMatchExtension.g.cs @@ -3,31 +3,31 @@ namespace FluentAssertions.Common { public static partial class ValueFormatterDetectionModeMatchExtension { - public static T Match(this FluentAssertions.Common.ValueFormatterDetectionMode valueFormatterDetectionMode, System.Func disabled, System.Func scan, System.Func specific) => + public static T Match(this FluentAssertions.Common.ValueFormatterDetectionMode valueFormatterDetectionMode, global::System.Func disabled, global::System.Func scan, global::System.Func specific) => valueFormatterDetectionMode switch { FluentAssertions.Common.ValueFormatterDetectionMode.Disabled => disabled(), FluentAssertions.Common.ValueFormatterDetectionMode.Scan => scan(), FluentAssertions.Common.ValueFormatterDetectionMode.Specific => specific(), - _ => throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Common.ValueFormatterDetectionMode: {valueFormatterDetectionMode.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Common.ValueFormatterDetectionMode: {valueFormatterDetectionMode.GetType().Name}") }; - public static System.Threading.Tasks.Task Match(this FluentAssertions.Common.ValueFormatterDetectionMode valueFormatterDetectionMode, System.Func> disabled, System.Func> scan, System.Func> specific) => + public static global::System.Threading.Tasks.Task Match(this FluentAssertions.Common.ValueFormatterDetectionMode valueFormatterDetectionMode, global::System.Func> disabled, global::System.Func> scan, global::System.Func> specific) => valueFormatterDetectionMode switch { FluentAssertions.Common.ValueFormatterDetectionMode.Disabled => disabled(), FluentAssertions.Common.ValueFormatterDetectionMode.Scan => scan(), FluentAssertions.Common.ValueFormatterDetectionMode.Specific => specific(), - _ => throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Common.ValueFormatterDetectionMode: {valueFormatterDetectionMode.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Common.ValueFormatterDetectionMode: {valueFormatterDetectionMode.GetType().Name}") }; - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task valueFormatterDetectionMode, System.Func disabled, System.Func scan, System.Func specific) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task valueFormatterDetectionMode, global::System.Func disabled, global::System.Func scan, global::System.Func specific) => (await valueFormatterDetectionMode.ConfigureAwait(false)).Match(disabled, scan, specific); - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task valueFormatterDetectionMode, System.Func> disabled, System.Func> scan, System.Func> specific) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task valueFormatterDetectionMode, global::System.Func> disabled, global::System.Func> scan, global::System.Func> specific) => await (await valueFormatterDetectionMode.ConfigureAwait(false)).Match(disabled, scan, specific).ConfigureAwait(false); - public static void Switch(this FluentAssertions.Common.ValueFormatterDetectionMode valueFormatterDetectionMode, System.Action disabled, System.Action scan, System.Action specific) + public static void Switch(this FluentAssertions.Common.ValueFormatterDetectionMode valueFormatterDetectionMode, global::System.Action disabled, global::System.Action scan, global::System.Action specific) { switch (valueFormatterDetectionMode) { @@ -41,11 +41,11 @@ public static void Switch(this FluentAssertions.Common.ValueFormatterDetectionMo specific(); break; default: - throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Common.ValueFormatterDetectionMode: {valueFormatterDetectionMode.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Common.ValueFormatterDetectionMode: {valueFormatterDetectionMode.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this FluentAssertions.Common.ValueFormatterDetectionMode valueFormatterDetectionMode, System.Func disabled, System.Func scan, System.Func specific) + public static async global::System.Threading.Tasks.Task Switch(this FluentAssertions.Common.ValueFormatterDetectionMode valueFormatterDetectionMode, global::System.Func disabled, global::System.Func scan, global::System.Func specific) { switch (valueFormatterDetectionMode) { @@ -59,14 +59,14 @@ public static async System.Threading.Tasks.Task Switch(this FluentAssertions.Com await specific().ConfigureAwait(false); break; default: - throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Common.ValueFormatterDetectionMode: {valueFormatterDetectionMode.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Common.ValueFormatterDetectionMode: {valueFormatterDetectionMode.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task valueFormatterDetectionMode, System.Action disabled, System.Action scan, System.Action specific) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task valueFormatterDetectionMode, global::System.Action disabled, global::System.Action scan, global::System.Action specific) => (await valueFormatterDetectionMode.ConfigureAwait(false)).Switch(disabled, scan, specific); - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task valueFormatterDetectionMode, System.Func disabled, System.Func scan, System.Func specific) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task valueFormatterDetectionMode, global::System.Func disabled, global::System.Func scan, global::System.Func specific) => await (await valueFormatterDetectionMode.ConfigureAwait(false)).Switch(disabled, scan, specific).ConfigureAwait(false); } } diff --git a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsDataRowMatchModeMatchExtension.g.cs b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsDataRowMatchModeMatchExtension.g.cs index 7d50c4f..3d7a189 100644 --- a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsDataRowMatchModeMatchExtension.g.cs +++ b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsDataRowMatchModeMatchExtension.g.cs @@ -3,29 +3,29 @@ namespace FluentAssertions.Data { public static partial class RowMatchModeMatchExtension { - public static T Match(this FluentAssertions.Data.RowMatchMode rowMatchMode, System.Func index, System.Func primaryKey) => + public static T Match(this FluentAssertions.Data.RowMatchMode rowMatchMode, global::System.Func index, global::System.Func primaryKey) => rowMatchMode switch { FluentAssertions.Data.RowMatchMode.Index => index(), FluentAssertions.Data.RowMatchMode.PrimaryKey => primaryKey(), - _ => throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Data.RowMatchMode: {rowMatchMode.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Data.RowMatchMode: {rowMatchMode.GetType().Name}") }; - public static System.Threading.Tasks.Task Match(this FluentAssertions.Data.RowMatchMode rowMatchMode, System.Func> index, System.Func> primaryKey) => + public static global::System.Threading.Tasks.Task Match(this FluentAssertions.Data.RowMatchMode rowMatchMode, global::System.Func> index, global::System.Func> primaryKey) => rowMatchMode switch { FluentAssertions.Data.RowMatchMode.Index => index(), FluentAssertions.Data.RowMatchMode.PrimaryKey => primaryKey(), - _ => throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Data.RowMatchMode: {rowMatchMode.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Data.RowMatchMode: {rowMatchMode.GetType().Name}") }; - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task rowMatchMode, System.Func index, System.Func primaryKey) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task rowMatchMode, global::System.Func index, global::System.Func primaryKey) => (await rowMatchMode.ConfigureAwait(false)).Match(index, primaryKey); - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task rowMatchMode, System.Func> index, System.Func> primaryKey) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task rowMatchMode, global::System.Func> index, global::System.Func> primaryKey) => await (await rowMatchMode.ConfigureAwait(false)).Match(index, primaryKey).ConfigureAwait(false); - public static void Switch(this FluentAssertions.Data.RowMatchMode rowMatchMode, System.Action index, System.Action primaryKey) + public static void Switch(this FluentAssertions.Data.RowMatchMode rowMatchMode, global::System.Action index, global::System.Action primaryKey) { switch (rowMatchMode) { @@ -36,11 +36,11 @@ public static void Switch(this FluentAssertions.Data.RowMatchMode rowMatchMode, primaryKey(); break; default: - throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Data.RowMatchMode: {rowMatchMode.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Data.RowMatchMode: {rowMatchMode.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this FluentAssertions.Data.RowMatchMode rowMatchMode, System.Func index, System.Func primaryKey) + public static async global::System.Threading.Tasks.Task Switch(this FluentAssertions.Data.RowMatchMode rowMatchMode, global::System.Func index, global::System.Func primaryKey) { switch (rowMatchMode) { @@ -51,14 +51,14 @@ public static async System.Threading.Tasks.Task Switch(this FluentAssertions.Dat await primaryKey().ConfigureAwait(false); break; default: - throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Data.RowMatchMode: {rowMatchMode.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Data.RowMatchMode: {rowMatchMode.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task rowMatchMode, System.Action index, System.Action primaryKey) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task rowMatchMode, global::System.Action index, global::System.Action primaryKey) => (await rowMatchMode.ConfigureAwait(false)).Switch(index, primaryKey); - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task rowMatchMode, System.Func index, System.Func primaryKey) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task rowMatchMode, global::System.Func index, global::System.Func primaryKey) => await (await rowMatchMode.ConfigureAwait(false)).Switch(index, primaryKey).ConfigureAwait(false); } } diff --git a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsEquivalencyCyclicReferenceHandlingMatchExtension.g.cs b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsEquivalencyCyclicReferenceHandlingMatchExtension.g.cs index 5692036..e53796a 100644 --- a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsEquivalencyCyclicReferenceHandlingMatchExtension.g.cs +++ b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsEquivalencyCyclicReferenceHandlingMatchExtension.g.cs @@ -3,29 +3,29 @@ namespace FluentAssertions.Equivalency { public static partial class CyclicReferenceHandlingMatchExtension { - public static T Match(this FluentAssertions.Equivalency.CyclicReferenceHandling cyclicReferenceHandling, System.Func ignore, System.Func throwException) => + public static T Match(this FluentAssertions.Equivalency.CyclicReferenceHandling cyclicReferenceHandling, global::System.Func ignore, global::System.Func throwException) => cyclicReferenceHandling switch { FluentAssertions.Equivalency.CyclicReferenceHandling.Ignore => ignore(), FluentAssertions.Equivalency.CyclicReferenceHandling.ThrowException => throwException(), - _ => throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.CyclicReferenceHandling: {cyclicReferenceHandling.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.CyclicReferenceHandling: {cyclicReferenceHandling.GetType().Name}") }; - public static System.Threading.Tasks.Task Match(this FluentAssertions.Equivalency.CyclicReferenceHandling cyclicReferenceHandling, System.Func> ignore, System.Func> throwException) => + public static global::System.Threading.Tasks.Task Match(this FluentAssertions.Equivalency.CyclicReferenceHandling cyclicReferenceHandling, global::System.Func> ignore, global::System.Func> throwException) => cyclicReferenceHandling switch { FluentAssertions.Equivalency.CyclicReferenceHandling.Ignore => ignore(), FluentAssertions.Equivalency.CyclicReferenceHandling.ThrowException => throwException(), - _ => throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.CyclicReferenceHandling: {cyclicReferenceHandling.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.CyclicReferenceHandling: {cyclicReferenceHandling.GetType().Name}") }; - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task cyclicReferenceHandling, System.Func ignore, System.Func throwException) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task cyclicReferenceHandling, global::System.Func ignore, global::System.Func throwException) => (await cyclicReferenceHandling.ConfigureAwait(false)).Match(ignore, throwException); - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task cyclicReferenceHandling, System.Func> ignore, System.Func> throwException) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task cyclicReferenceHandling, global::System.Func> ignore, global::System.Func> throwException) => await (await cyclicReferenceHandling.ConfigureAwait(false)).Match(ignore, throwException).ConfigureAwait(false); - public static void Switch(this FluentAssertions.Equivalency.CyclicReferenceHandling cyclicReferenceHandling, System.Action ignore, System.Action throwException) + public static void Switch(this FluentAssertions.Equivalency.CyclicReferenceHandling cyclicReferenceHandling, global::System.Action ignore, global::System.Action throwException) { switch (cyclicReferenceHandling) { @@ -36,11 +36,11 @@ public static void Switch(this FluentAssertions.Equivalency.CyclicReferenceHandl throwException(); break; default: - throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.CyclicReferenceHandling: {cyclicReferenceHandling.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.CyclicReferenceHandling: {cyclicReferenceHandling.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this FluentAssertions.Equivalency.CyclicReferenceHandling cyclicReferenceHandling, System.Func ignore, System.Func throwException) + public static async global::System.Threading.Tasks.Task Switch(this FluentAssertions.Equivalency.CyclicReferenceHandling cyclicReferenceHandling, global::System.Func ignore, global::System.Func throwException) { switch (cyclicReferenceHandling) { @@ -51,14 +51,14 @@ public static async System.Threading.Tasks.Task Switch(this FluentAssertions.Equ await throwException().ConfigureAwait(false); break; default: - throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.CyclicReferenceHandling: {cyclicReferenceHandling.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.CyclicReferenceHandling: {cyclicReferenceHandling.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task cyclicReferenceHandling, System.Action ignore, System.Action throwException) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task cyclicReferenceHandling, global::System.Action ignore, global::System.Action throwException) => (await cyclicReferenceHandling.ConfigureAwait(false)).Switch(ignore, throwException); - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task cyclicReferenceHandling, System.Func ignore, System.Func throwException) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task cyclicReferenceHandling, global::System.Func ignore, global::System.Func throwException) => await (await cyclicReferenceHandling.ConfigureAwait(false)).Switch(ignore, throwException).ConfigureAwait(false); } } diff --git a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsEquivalencyEnumEquivalencyHandlingMatchExtension.g.cs b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsEquivalencyEnumEquivalencyHandlingMatchExtension.g.cs index 04e26e4..8ec2ddc 100644 --- a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsEquivalencyEnumEquivalencyHandlingMatchExtension.g.cs +++ b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsEquivalencyEnumEquivalencyHandlingMatchExtension.g.cs @@ -3,29 +3,29 @@ namespace FluentAssertions.Equivalency { public static partial class EnumEquivalencyHandlingMatchExtension { - public static T Match(this FluentAssertions.Equivalency.EnumEquivalencyHandling enumEquivalencyHandling, System.Func byName, System.Func byValue) => + public static T Match(this FluentAssertions.Equivalency.EnumEquivalencyHandling enumEquivalencyHandling, global::System.Func byName, global::System.Func byValue) => enumEquivalencyHandling switch { FluentAssertions.Equivalency.EnumEquivalencyHandling.ByName => byName(), FluentAssertions.Equivalency.EnumEquivalencyHandling.ByValue => byValue(), - _ => throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.EnumEquivalencyHandling: {enumEquivalencyHandling.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.EnumEquivalencyHandling: {enumEquivalencyHandling.GetType().Name}") }; - public static System.Threading.Tasks.Task Match(this FluentAssertions.Equivalency.EnumEquivalencyHandling enumEquivalencyHandling, System.Func> byName, System.Func> byValue) => + public static global::System.Threading.Tasks.Task Match(this FluentAssertions.Equivalency.EnumEquivalencyHandling enumEquivalencyHandling, global::System.Func> byName, global::System.Func> byValue) => enumEquivalencyHandling switch { FluentAssertions.Equivalency.EnumEquivalencyHandling.ByName => byName(), FluentAssertions.Equivalency.EnumEquivalencyHandling.ByValue => byValue(), - _ => throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.EnumEquivalencyHandling: {enumEquivalencyHandling.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.EnumEquivalencyHandling: {enumEquivalencyHandling.GetType().Name}") }; - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task enumEquivalencyHandling, System.Func byName, System.Func byValue) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task enumEquivalencyHandling, global::System.Func byName, global::System.Func byValue) => (await enumEquivalencyHandling.ConfigureAwait(false)).Match(byName, byValue); - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task enumEquivalencyHandling, System.Func> byName, System.Func> byValue) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task enumEquivalencyHandling, global::System.Func> byName, global::System.Func> byValue) => await (await enumEquivalencyHandling.ConfigureAwait(false)).Match(byName, byValue).ConfigureAwait(false); - public static void Switch(this FluentAssertions.Equivalency.EnumEquivalencyHandling enumEquivalencyHandling, System.Action byName, System.Action byValue) + public static void Switch(this FluentAssertions.Equivalency.EnumEquivalencyHandling enumEquivalencyHandling, global::System.Action byName, global::System.Action byValue) { switch (enumEquivalencyHandling) { @@ -36,11 +36,11 @@ public static void Switch(this FluentAssertions.Equivalency.EnumEquivalencyHandl byValue(); break; default: - throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.EnumEquivalencyHandling: {enumEquivalencyHandling.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.EnumEquivalencyHandling: {enumEquivalencyHandling.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this FluentAssertions.Equivalency.EnumEquivalencyHandling enumEquivalencyHandling, System.Func byName, System.Func byValue) + public static async global::System.Threading.Tasks.Task Switch(this FluentAssertions.Equivalency.EnumEquivalencyHandling enumEquivalencyHandling, global::System.Func byName, global::System.Func byValue) { switch (enumEquivalencyHandling) { @@ -51,14 +51,14 @@ public static async System.Threading.Tasks.Task Switch(this FluentAssertions.Equ await byValue().ConfigureAwait(false); break; default: - throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.EnumEquivalencyHandling: {enumEquivalencyHandling.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.EnumEquivalencyHandling: {enumEquivalencyHandling.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task enumEquivalencyHandling, System.Action byName, System.Action byValue) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task enumEquivalencyHandling, global::System.Action byName, global::System.Action byValue) => (await enumEquivalencyHandling.ConfigureAwait(false)).Switch(byName, byValue); - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task enumEquivalencyHandling, System.Func byName, System.Func byValue) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task enumEquivalencyHandling, global::System.Func byName, global::System.Func byValue) => await (await enumEquivalencyHandling.ConfigureAwait(false)).Switch(byName, byValue).ConfigureAwait(false); } } diff --git a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsEquivalencyEqualityStrategyMatchExtension.g.cs b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsEquivalencyEqualityStrategyMatchExtension.g.cs index c8c01fc..b5bea66 100644 --- a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsEquivalencyEqualityStrategyMatchExtension.g.cs +++ b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsEquivalencyEqualityStrategyMatchExtension.g.cs @@ -3,33 +3,33 @@ namespace FluentAssertions.Equivalency { public static partial class EqualityStrategyMatchExtension { - public static T Match(this FluentAssertions.Equivalency.EqualityStrategy equalityStrategy, System.Func @equals, System.Func forceEquals, System.Func forceMembers, System.Func members) => + public static T Match(this FluentAssertions.Equivalency.EqualityStrategy equalityStrategy, global::System.Func @equals, global::System.Func forceEquals, global::System.Func forceMembers, global::System.Func members) => equalityStrategy switch { FluentAssertions.Equivalency.EqualityStrategy.Equals => @equals(), FluentAssertions.Equivalency.EqualityStrategy.ForceEquals => forceEquals(), FluentAssertions.Equivalency.EqualityStrategy.ForceMembers => forceMembers(), FluentAssertions.Equivalency.EqualityStrategy.Members => members(), - _ => throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.EqualityStrategy: {equalityStrategy.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.EqualityStrategy: {equalityStrategy.GetType().Name}") }; - public static System.Threading.Tasks.Task Match(this FluentAssertions.Equivalency.EqualityStrategy equalityStrategy, System.Func> @equals, System.Func> forceEquals, System.Func> forceMembers, System.Func> members) => + public static global::System.Threading.Tasks.Task Match(this FluentAssertions.Equivalency.EqualityStrategy equalityStrategy, global::System.Func> @equals, global::System.Func> forceEquals, global::System.Func> forceMembers, global::System.Func> members) => equalityStrategy switch { FluentAssertions.Equivalency.EqualityStrategy.Equals => @equals(), FluentAssertions.Equivalency.EqualityStrategy.ForceEquals => forceEquals(), FluentAssertions.Equivalency.EqualityStrategy.ForceMembers => forceMembers(), FluentAssertions.Equivalency.EqualityStrategy.Members => members(), - _ => throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.EqualityStrategy: {equalityStrategy.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.EqualityStrategy: {equalityStrategy.GetType().Name}") }; - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task equalityStrategy, System.Func @equals, System.Func forceEquals, System.Func forceMembers, System.Func members) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task equalityStrategy, global::System.Func @equals, global::System.Func forceEquals, global::System.Func forceMembers, global::System.Func members) => (await equalityStrategy.ConfigureAwait(false)).Match(@equals, forceEquals, forceMembers, members); - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task equalityStrategy, System.Func> @equals, System.Func> forceEquals, System.Func> forceMembers, System.Func> members) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task equalityStrategy, global::System.Func> @equals, global::System.Func> forceEquals, global::System.Func> forceMembers, global::System.Func> members) => await (await equalityStrategy.ConfigureAwait(false)).Match(@equals, forceEquals, forceMembers, members).ConfigureAwait(false); - public static void Switch(this FluentAssertions.Equivalency.EqualityStrategy equalityStrategy, System.Action @equals, System.Action forceEquals, System.Action forceMembers, System.Action members) + public static void Switch(this FluentAssertions.Equivalency.EqualityStrategy equalityStrategy, global::System.Action @equals, global::System.Action forceEquals, global::System.Action forceMembers, global::System.Action members) { switch (equalityStrategy) { @@ -46,11 +46,11 @@ public static void Switch(this FluentAssertions.Equivalency.EqualityStrategy equ members(); break; default: - throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.EqualityStrategy: {equalityStrategy.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.EqualityStrategy: {equalityStrategy.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this FluentAssertions.Equivalency.EqualityStrategy equalityStrategy, System.Func @equals, System.Func forceEquals, System.Func forceMembers, System.Func members) + public static async global::System.Threading.Tasks.Task Switch(this FluentAssertions.Equivalency.EqualityStrategy equalityStrategy, global::System.Func @equals, global::System.Func forceEquals, global::System.Func forceMembers, global::System.Func members) { switch (equalityStrategy) { @@ -67,14 +67,14 @@ public static async System.Threading.Tasks.Task Switch(this FluentAssertions.Equ await members().ConfigureAwait(false); break; default: - throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.EqualityStrategy: {equalityStrategy.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.EqualityStrategy: {equalityStrategy.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task equalityStrategy, System.Action @equals, System.Action forceEquals, System.Action forceMembers, System.Action members) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task equalityStrategy, global::System.Action @equals, global::System.Action forceEquals, global::System.Action forceMembers, global::System.Action members) => (await equalityStrategy.ConfigureAwait(false)).Switch(@equals, forceEquals, forceMembers, members); - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task equalityStrategy, System.Func @equals, System.Func forceEquals, System.Func forceMembers, System.Func members) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task equalityStrategy, global::System.Func @equals, global::System.Func forceEquals, global::System.Func forceMembers, global::System.Func members) => await (await equalityStrategy.ConfigureAwait(false)).Switch(@equals, forceEquals, forceMembers, members).ConfigureAwait(false); } } diff --git a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsEquivalencyEquivalencyResultMatchExtension.g.cs b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsEquivalencyEquivalencyResultMatchExtension.g.cs index 13a88fb..2d6c7b9 100644 --- a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsEquivalencyEquivalencyResultMatchExtension.g.cs +++ b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsEquivalencyEquivalencyResultMatchExtension.g.cs @@ -3,29 +3,29 @@ namespace FluentAssertions.Equivalency { public static partial class EquivalencyResultMatchExtension { - public static T Match(this FluentAssertions.Equivalency.EquivalencyResult equivalencyResult, System.Func assertionCompleted, System.Func continueWithNext) => + public static T Match(this FluentAssertions.Equivalency.EquivalencyResult equivalencyResult, global::System.Func assertionCompleted, global::System.Func continueWithNext) => equivalencyResult switch { FluentAssertions.Equivalency.EquivalencyResult.AssertionCompleted => assertionCompleted(), FluentAssertions.Equivalency.EquivalencyResult.ContinueWithNext => continueWithNext(), - _ => throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.EquivalencyResult: {equivalencyResult.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.EquivalencyResult: {equivalencyResult.GetType().Name}") }; - public static System.Threading.Tasks.Task Match(this FluentAssertions.Equivalency.EquivalencyResult equivalencyResult, System.Func> assertionCompleted, System.Func> continueWithNext) => + public static global::System.Threading.Tasks.Task Match(this FluentAssertions.Equivalency.EquivalencyResult equivalencyResult, global::System.Func> assertionCompleted, global::System.Func> continueWithNext) => equivalencyResult switch { FluentAssertions.Equivalency.EquivalencyResult.AssertionCompleted => assertionCompleted(), FluentAssertions.Equivalency.EquivalencyResult.ContinueWithNext => continueWithNext(), - _ => throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.EquivalencyResult: {equivalencyResult.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.EquivalencyResult: {equivalencyResult.GetType().Name}") }; - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task equivalencyResult, System.Func assertionCompleted, System.Func continueWithNext) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task equivalencyResult, global::System.Func assertionCompleted, global::System.Func continueWithNext) => (await equivalencyResult.ConfigureAwait(false)).Match(assertionCompleted, continueWithNext); - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task equivalencyResult, System.Func> assertionCompleted, System.Func> continueWithNext) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task equivalencyResult, global::System.Func> assertionCompleted, global::System.Func> continueWithNext) => await (await equivalencyResult.ConfigureAwait(false)).Match(assertionCompleted, continueWithNext).ConfigureAwait(false); - public static void Switch(this FluentAssertions.Equivalency.EquivalencyResult equivalencyResult, System.Action assertionCompleted, System.Action continueWithNext) + public static void Switch(this FluentAssertions.Equivalency.EquivalencyResult equivalencyResult, global::System.Action assertionCompleted, global::System.Action continueWithNext) { switch (equivalencyResult) { @@ -36,11 +36,11 @@ public static void Switch(this FluentAssertions.Equivalency.EquivalencyResult eq continueWithNext(); break; default: - throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.EquivalencyResult: {equivalencyResult.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.EquivalencyResult: {equivalencyResult.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this FluentAssertions.Equivalency.EquivalencyResult equivalencyResult, System.Func assertionCompleted, System.Func continueWithNext) + public static async global::System.Threading.Tasks.Task Switch(this FluentAssertions.Equivalency.EquivalencyResult equivalencyResult, global::System.Func assertionCompleted, global::System.Func continueWithNext) { switch (equivalencyResult) { @@ -51,14 +51,14 @@ public static async System.Threading.Tasks.Task Switch(this FluentAssertions.Equ await continueWithNext().ConfigureAwait(false); break; default: - throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.EquivalencyResult: {equivalencyResult.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.EquivalencyResult: {equivalencyResult.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task equivalencyResult, System.Action assertionCompleted, System.Action continueWithNext) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task equivalencyResult, global::System.Action assertionCompleted, global::System.Action continueWithNext) => (await equivalencyResult.ConfigureAwait(false)).Switch(assertionCompleted, continueWithNext); - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task equivalencyResult, System.Func assertionCompleted, System.Func continueWithNext) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task equivalencyResult, global::System.Func assertionCompleted, global::System.Func continueWithNext) => await (await equivalencyResult.ConfigureAwait(false)).Switch(assertionCompleted, continueWithNext).ConfigureAwait(false); } } diff --git a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsEquivalencyOrderStrictnessMatchExtension.g.cs b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsEquivalencyOrderStrictnessMatchExtension.g.cs index 9abe0c6..29f379a 100644 --- a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsEquivalencyOrderStrictnessMatchExtension.g.cs +++ b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsEquivalencyOrderStrictnessMatchExtension.g.cs @@ -3,31 +3,31 @@ namespace FluentAssertions.Equivalency { public static partial class OrderStrictnessMatchExtension { - public static T Match(this FluentAssertions.Equivalency.OrderStrictness orderStrictness, System.Func irrelevant, System.Func notStrict, System.Func strict) => + public static T Match(this FluentAssertions.Equivalency.OrderStrictness orderStrictness, global::System.Func irrelevant, global::System.Func notStrict, global::System.Func strict) => orderStrictness switch { FluentAssertions.Equivalency.OrderStrictness.Irrelevant => irrelevant(), FluentAssertions.Equivalency.OrderStrictness.NotStrict => notStrict(), FluentAssertions.Equivalency.OrderStrictness.Strict => strict(), - _ => throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.OrderStrictness: {orderStrictness.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.OrderStrictness: {orderStrictness.GetType().Name}") }; - public static System.Threading.Tasks.Task Match(this FluentAssertions.Equivalency.OrderStrictness orderStrictness, System.Func> irrelevant, System.Func> notStrict, System.Func> strict) => + public static global::System.Threading.Tasks.Task Match(this FluentAssertions.Equivalency.OrderStrictness orderStrictness, global::System.Func> irrelevant, global::System.Func> notStrict, global::System.Func> strict) => orderStrictness switch { FluentAssertions.Equivalency.OrderStrictness.Irrelevant => irrelevant(), FluentAssertions.Equivalency.OrderStrictness.NotStrict => notStrict(), FluentAssertions.Equivalency.OrderStrictness.Strict => strict(), - _ => throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.OrderStrictness: {orderStrictness.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.OrderStrictness: {orderStrictness.GetType().Name}") }; - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task orderStrictness, System.Func irrelevant, System.Func notStrict, System.Func strict) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task orderStrictness, global::System.Func irrelevant, global::System.Func notStrict, global::System.Func strict) => (await orderStrictness.ConfigureAwait(false)).Match(irrelevant, notStrict, strict); - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task orderStrictness, System.Func> irrelevant, System.Func> notStrict, System.Func> strict) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task orderStrictness, global::System.Func> irrelevant, global::System.Func> notStrict, global::System.Func> strict) => await (await orderStrictness.ConfigureAwait(false)).Match(irrelevant, notStrict, strict).ConfigureAwait(false); - public static void Switch(this FluentAssertions.Equivalency.OrderStrictness orderStrictness, System.Action irrelevant, System.Action notStrict, System.Action strict) + public static void Switch(this FluentAssertions.Equivalency.OrderStrictness orderStrictness, global::System.Action irrelevant, global::System.Action notStrict, global::System.Action strict) { switch (orderStrictness) { @@ -41,11 +41,11 @@ public static void Switch(this FluentAssertions.Equivalency.OrderStrictness orde strict(); break; default: - throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.OrderStrictness: {orderStrictness.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.OrderStrictness: {orderStrictness.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this FluentAssertions.Equivalency.OrderStrictness orderStrictness, System.Func irrelevant, System.Func notStrict, System.Func strict) + public static async global::System.Threading.Tasks.Task Switch(this FluentAssertions.Equivalency.OrderStrictness orderStrictness, global::System.Func irrelevant, global::System.Func notStrict, global::System.Func strict) { switch (orderStrictness) { @@ -59,14 +59,14 @@ public static async System.Threading.Tasks.Task Switch(this FluentAssertions.Equ await strict().ConfigureAwait(false); break; default: - throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.OrderStrictness: {orderStrictness.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Equivalency.OrderStrictness: {orderStrictness.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task orderStrictness, System.Action irrelevant, System.Action notStrict, System.Action strict) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task orderStrictness, global::System.Action irrelevant, global::System.Action notStrict, global::System.Action strict) => (await orderStrictness.ConfigureAwait(false)).Switch(irrelevant, notStrict, strict); - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task orderStrictness, System.Func irrelevant, System.Func notStrict, System.Func strict) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task orderStrictness, global::System.Func irrelevant, global::System.Func notStrict, global::System.Func strict) => await (await orderStrictness.ConfigureAwait(false)).Switch(irrelevant, notStrict, strict).ConfigureAwait(false); } } diff --git a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsPrimitivesTimeSpanConditionMatchExtension.g.cs b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsPrimitivesTimeSpanConditionMatchExtension.g.cs index 14fcfbd..dcd5f95 100644 --- a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsPrimitivesTimeSpanConditionMatchExtension.g.cs +++ b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FluentAssertionsPrimitivesTimeSpanConditionMatchExtension.g.cs @@ -3,7 +3,7 @@ namespace FluentAssertions.Primitives { public static partial class TimeSpanConditionMatchExtension { - public static T Match(this FluentAssertions.Primitives.TimeSpanCondition timeSpanCondition, System.Func atLeast, System.Func exactly, System.Func lessThan, System.Func moreThan, System.Func within) => + public static T Match(this FluentAssertions.Primitives.TimeSpanCondition timeSpanCondition, global::System.Func atLeast, global::System.Func exactly, global::System.Func lessThan, global::System.Func moreThan, global::System.Func within) => timeSpanCondition switch { FluentAssertions.Primitives.TimeSpanCondition.AtLeast => atLeast(), @@ -11,10 +11,10 @@ public static T Match(this FluentAssertions.Primitives.TimeSpanCondition time FluentAssertions.Primitives.TimeSpanCondition.LessThan => lessThan(), FluentAssertions.Primitives.TimeSpanCondition.MoreThan => moreThan(), FluentAssertions.Primitives.TimeSpanCondition.Within => within(), - _ => throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Primitives.TimeSpanCondition: {timeSpanCondition.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Primitives.TimeSpanCondition: {timeSpanCondition.GetType().Name}") }; - public static System.Threading.Tasks.Task Match(this FluentAssertions.Primitives.TimeSpanCondition timeSpanCondition, System.Func> atLeast, System.Func> exactly, System.Func> lessThan, System.Func> moreThan, System.Func> within) => + public static global::System.Threading.Tasks.Task Match(this FluentAssertions.Primitives.TimeSpanCondition timeSpanCondition, global::System.Func> atLeast, global::System.Func> exactly, global::System.Func> lessThan, global::System.Func> moreThan, global::System.Func> within) => timeSpanCondition switch { FluentAssertions.Primitives.TimeSpanCondition.AtLeast => atLeast(), @@ -22,16 +22,16 @@ public static System.Threading.Tasks.Task Match(this FluentAssertions.Prim FluentAssertions.Primitives.TimeSpanCondition.LessThan => lessThan(), FluentAssertions.Primitives.TimeSpanCondition.MoreThan => moreThan(), FluentAssertions.Primitives.TimeSpanCondition.Within => within(), - _ => throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Primitives.TimeSpanCondition: {timeSpanCondition.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Primitives.TimeSpanCondition: {timeSpanCondition.GetType().Name}") }; - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task timeSpanCondition, System.Func atLeast, System.Func exactly, System.Func lessThan, System.Func moreThan, System.Func within) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task timeSpanCondition, global::System.Func atLeast, global::System.Func exactly, global::System.Func lessThan, global::System.Func moreThan, global::System.Func within) => (await timeSpanCondition.ConfigureAwait(false)).Match(atLeast, exactly, lessThan, moreThan, within); - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task timeSpanCondition, System.Func> atLeast, System.Func> exactly, System.Func> lessThan, System.Func> moreThan, System.Func> within) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task timeSpanCondition, global::System.Func> atLeast, global::System.Func> exactly, global::System.Func> lessThan, global::System.Func> moreThan, global::System.Func> within) => await (await timeSpanCondition.ConfigureAwait(false)).Match(atLeast, exactly, lessThan, moreThan, within).ConfigureAwait(false); - public static void Switch(this FluentAssertions.Primitives.TimeSpanCondition timeSpanCondition, System.Action atLeast, System.Action exactly, System.Action lessThan, System.Action moreThan, System.Action within) + public static void Switch(this FluentAssertions.Primitives.TimeSpanCondition timeSpanCondition, global::System.Action atLeast, global::System.Action exactly, global::System.Action lessThan, global::System.Action moreThan, global::System.Action within) { switch (timeSpanCondition) { @@ -51,11 +51,11 @@ public static void Switch(this FluentAssertions.Primitives.TimeSpanCondition tim within(); break; default: - throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Primitives.TimeSpanCondition: {timeSpanCondition.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Primitives.TimeSpanCondition: {timeSpanCondition.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this FluentAssertions.Primitives.TimeSpanCondition timeSpanCondition, System.Func atLeast, System.Func exactly, System.Func lessThan, System.Func moreThan, System.Func within) + public static async global::System.Threading.Tasks.Task Switch(this FluentAssertions.Primitives.TimeSpanCondition timeSpanCondition, global::System.Func atLeast, global::System.Func exactly, global::System.Func lessThan, global::System.Func moreThan, global::System.Func within) { switch (timeSpanCondition) { @@ -75,14 +75,14 @@ public static async System.Threading.Tasks.Task Switch(this FluentAssertions.Pri await within().ConfigureAwait(false); break; default: - throw new System.ArgumentException($"Unknown enum value from FluentAssertions.Primitives.TimeSpanCondition: {timeSpanCondition.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown enum value from FluentAssertions.Primitives.TimeSpanCondition: {timeSpanCondition.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task timeSpanCondition, System.Action atLeast, System.Action exactly, System.Action lessThan, System.Action moreThan, System.Action within) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task timeSpanCondition, global::System.Action atLeast, global::System.Action exactly, global::System.Action lessThan, global::System.Action moreThan, global::System.Action within) => (await timeSpanCondition.ConfigureAwait(false)).Switch(atLeast, exactly, lessThan, moreThan, within); - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task timeSpanCondition, System.Func atLeast, System.Func exactly, System.Func lessThan, System.Func moreThan, System.Func within) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task timeSpanCondition, global::System.Func atLeast, global::System.Func exactly, global::System.Func lessThan, global::System.Func moreThan, global::System.Func within) => await (await timeSpanCondition.ConfigureAwait(false)).Switch(atLeast, exactly, lessThan, moreThan, within).ConfigureAwait(false); } } diff --git a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FunicularSwitchGeneratorsConsumerEnumSpecsPlatformIdentifierMatchExtension.g.cs b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FunicularSwitchGeneratorsConsumerEnumSpecsPlatformIdentifierMatchExtension.g.cs index 0d19d3d..7d3dc95 100644 --- a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FunicularSwitchGeneratorsConsumerEnumSpecsPlatformIdentifierMatchExtension.g.cs +++ b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FunicularSwitchGeneratorsConsumerEnumSpecsPlatformIdentifierMatchExtension.g.cs @@ -3,31 +3,31 @@ namespace FunicularSwitch.Generators.Consumer { public static partial class EnumSpecs_PlatformIdentifierMatchExtension { - public static T Match(this FunicularSwitch.Generators.Consumer.EnumSpecs.PlatformIdentifier platformIdentifier, System.Func developerMachine, System.Func linuxDevice, System.Func windowsDevice) => + public static T Match(this FunicularSwitch.Generators.Consumer.EnumSpecs.PlatformIdentifier platformIdentifier, global::System.Func developerMachine, global::System.Func linuxDevice, global::System.Func windowsDevice) => platformIdentifier switch { FunicularSwitch.Generators.Consumer.EnumSpecs.PlatformIdentifier.DeveloperMachine => developerMachine(), FunicularSwitch.Generators.Consumer.EnumSpecs.PlatformIdentifier.LinuxDevice => linuxDevice(), FunicularSwitch.Generators.Consumer.EnumSpecs.PlatformIdentifier.WindowsDevice => windowsDevice(), - _ => throw new System.ArgumentException($"Unknown enum value from FunicularSwitch.Generators.Consumer.EnumSpecs.PlatformIdentifier: {platformIdentifier.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown enum value from FunicularSwitch.Generators.Consumer.EnumSpecs.PlatformIdentifier: {platformIdentifier.GetType().Name}") }; - public static System.Threading.Tasks.Task Match(this FunicularSwitch.Generators.Consumer.EnumSpecs.PlatformIdentifier platformIdentifier, System.Func> developerMachine, System.Func> linuxDevice, System.Func> windowsDevice) => + public static global::System.Threading.Tasks.Task Match(this FunicularSwitch.Generators.Consumer.EnumSpecs.PlatformIdentifier platformIdentifier, global::System.Func> developerMachine, global::System.Func> linuxDevice, global::System.Func> windowsDevice) => platformIdentifier switch { FunicularSwitch.Generators.Consumer.EnumSpecs.PlatformIdentifier.DeveloperMachine => developerMachine(), FunicularSwitch.Generators.Consumer.EnumSpecs.PlatformIdentifier.LinuxDevice => linuxDevice(), FunicularSwitch.Generators.Consumer.EnumSpecs.PlatformIdentifier.WindowsDevice => windowsDevice(), - _ => throw new System.ArgumentException($"Unknown enum value from FunicularSwitch.Generators.Consumer.EnumSpecs.PlatformIdentifier: {platformIdentifier.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown enum value from FunicularSwitch.Generators.Consumer.EnumSpecs.PlatformIdentifier: {platformIdentifier.GetType().Name}") }; - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task platformIdentifier, System.Func developerMachine, System.Func linuxDevice, System.Func windowsDevice) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task platformIdentifier, global::System.Func developerMachine, global::System.Func linuxDevice, global::System.Func windowsDevice) => (await platformIdentifier.ConfigureAwait(false)).Match(developerMachine, linuxDevice, windowsDevice); - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task platformIdentifier, System.Func> developerMachine, System.Func> linuxDevice, System.Func> windowsDevice) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task platformIdentifier, global::System.Func> developerMachine, global::System.Func> linuxDevice, global::System.Func> windowsDevice) => await (await platformIdentifier.ConfigureAwait(false)).Match(developerMachine, linuxDevice, windowsDevice).ConfigureAwait(false); - public static void Switch(this FunicularSwitch.Generators.Consumer.EnumSpecs.PlatformIdentifier platformIdentifier, System.Action developerMachine, System.Action linuxDevice, System.Action windowsDevice) + public static void Switch(this FunicularSwitch.Generators.Consumer.EnumSpecs.PlatformIdentifier platformIdentifier, global::System.Action developerMachine, global::System.Action linuxDevice, global::System.Action windowsDevice) { switch (platformIdentifier) { @@ -41,11 +41,11 @@ public static void Switch(this FunicularSwitch.Generators.Consumer.EnumSpecs.Pla windowsDevice(); break; default: - throw new System.ArgumentException($"Unknown enum value from FunicularSwitch.Generators.Consumer.EnumSpecs.PlatformIdentifier: {platformIdentifier.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown enum value from FunicularSwitch.Generators.Consumer.EnumSpecs.PlatformIdentifier: {platformIdentifier.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this FunicularSwitch.Generators.Consumer.EnumSpecs.PlatformIdentifier platformIdentifier, System.Func developerMachine, System.Func linuxDevice, System.Func windowsDevice) + public static async global::System.Threading.Tasks.Task Switch(this FunicularSwitch.Generators.Consumer.EnumSpecs.PlatformIdentifier platformIdentifier, global::System.Func developerMachine, global::System.Func linuxDevice, global::System.Func windowsDevice) { switch (platformIdentifier) { @@ -59,14 +59,14 @@ public static async System.Threading.Tasks.Task Switch(this FunicularSwitch.Gene await windowsDevice().ConfigureAwait(false); break; default: - throw new System.ArgumentException($"Unknown enum value from FunicularSwitch.Generators.Consumer.EnumSpecs.PlatformIdentifier: {platformIdentifier.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown enum value from FunicularSwitch.Generators.Consumer.EnumSpecs.PlatformIdentifier: {platformIdentifier.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task platformIdentifier, System.Action developerMachine, System.Action linuxDevice, System.Action windowsDevice) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task platformIdentifier, global::System.Action developerMachine, global::System.Action linuxDevice, global::System.Action windowsDevice) => (await platformIdentifier.ConfigureAwait(false)).Switch(developerMachine, linuxDevice, windowsDevice); - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task platformIdentifier, System.Func developerMachine, System.Func linuxDevice, System.Func windowsDevice) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task platformIdentifier, global::System.Func developerMachine, global::System.Func linuxDevice, global::System.Func windowsDevice) => await (await platformIdentifier.ConfigureAwait(false)).Switch(developerMachine, linuxDevice, windowsDevice).ConfigureAwait(false); } } diff --git a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FunicularSwitchGeneratorsConsumerErrorUnionCasesMatchExtension.g.cs b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FunicularSwitchGeneratorsConsumerErrorUnionCasesMatchExtension.g.cs index 49ee67d..1afd09c 100644 --- a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FunicularSwitchGeneratorsConsumerErrorUnionCasesMatchExtension.g.cs +++ b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FunicularSwitchGeneratorsConsumerErrorUnionCasesMatchExtension.g.cs @@ -3,33 +3,33 @@ namespace FunicularSwitch.Generators.Consumer { internal static partial class Error_UnionCasesMatchExtension { - public static T Match(this FunicularSwitch.Generators.Consumer.Error.UnionCases unionCases, System.Func generic, System.Func notFound, System.Func notAuthorized, System.Func aggregated) => + public static T Match(this FunicularSwitch.Generators.Consumer.Error.UnionCases unionCases, global::System.Func generic, global::System.Func notFound, global::System.Func notAuthorized, global::System.Func aggregated) => unionCases switch { FunicularSwitch.Generators.Consumer.Error.UnionCases.Generic => generic(), FunicularSwitch.Generators.Consumer.Error.UnionCases.NotFound => notFound(), FunicularSwitch.Generators.Consumer.Error.UnionCases.NotAuthorized => notAuthorized(), FunicularSwitch.Generators.Consumer.Error.UnionCases.Aggregated => aggregated(), - _ => throw new System.ArgumentException($"Unknown enum value from FunicularSwitch.Generators.Consumer.Error.UnionCases: {unionCases.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown enum value from FunicularSwitch.Generators.Consumer.Error.UnionCases: {unionCases.GetType().Name}") }; - public static System.Threading.Tasks.Task Match(this FunicularSwitch.Generators.Consumer.Error.UnionCases unionCases, System.Func> generic, System.Func> notFound, System.Func> notAuthorized, System.Func> aggregated) => + public static global::System.Threading.Tasks.Task Match(this FunicularSwitch.Generators.Consumer.Error.UnionCases unionCases, global::System.Func> generic, global::System.Func> notFound, global::System.Func> notAuthorized, global::System.Func> aggregated) => unionCases switch { FunicularSwitch.Generators.Consumer.Error.UnionCases.Generic => generic(), FunicularSwitch.Generators.Consumer.Error.UnionCases.NotFound => notFound(), FunicularSwitch.Generators.Consumer.Error.UnionCases.NotAuthorized => notAuthorized(), FunicularSwitch.Generators.Consumer.Error.UnionCases.Aggregated => aggregated(), - _ => throw new System.ArgumentException($"Unknown enum value from FunicularSwitch.Generators.Consumer.Error.UnionCases: {unionCases.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown enum value from FunicularSwitch.Generators.Consumer.Error.UnionCases: {unionCases.GetType().Name}") }; - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task unionCases, System.Func generic, System.Func notFound, System.Func notAuthorized, System.Func aggregated) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task unionCases, global::System.Func generic, global::System.Func notFound, global::System.Func notAuthorized, global::System.Func aggregated) => (await unionCases.ConfigureAwait(false)).Match(generic, notFound, notAuthorized, aggregated); - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task unionCases, System.Func> generic, System.Func> notFound, System.Func> notAuthorized, System.Func> aggregated) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task unionCases, global::System.Func> generic, global::System.Func> notFound, global::System.Func> notAuthorized, global::System.Func> aggregated) => await (await unionCases.ConfigureAwait(false)).Match(generic, notFound, notAuthorized, aggregated).ConfigureAwait(false); - public static void Switch(this FunicularSwitch.Generators.Consumer.Error.UnionCases unionCases, System.Action generic, System.Action notFound, System.Action notAuthorized, System.Action aggregated) + public static void Switch(this FunicularSwitch.Generators.Consumer.Error.UnionCases unionCases, global::System.Action generic, global::System.Action notFound, global::System.Action notAuthorized, global::System.Action aggregated) { switch (unionCases) { @@ -46,11 +46,11 @@ public static void Switch(this FunicularSwitch.Generators.Consumer.Error.UnionCa aggregated(); break; default: - throw new System.ArgumentException($"Unknown enum value from FunicularSwitch.Generators.Consumer.Error.UnionCases: {unionCases.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown enum value from FunicularSwitch.Generators.Consumer.Error.UnionCases: {unionCases.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this FunicularSwitch.Generators.Consumer.Error.UnionCases unionCases, System.Func generic, System.Func notFound, System.Func notAuthorized, System.Func aggregated) + public static async global::System.Threading.Tasks.Task Switch(this FunicularSwitch.Generators.Consumer.Error.UnionCases unionCases, global::System.Func generic, global::System.Func notFound, global::System.Func notAuthorized, global::System.Func aggregated) { switch (unionCases) { @@ -67,14 +67,14 @@ public static async System.Threading.Tasks.Task Switch(this FunicularSwitch.Gene await aggregated().ConfigureAwait(false); break; default: - throw new System.ArgumentException($"Unknown enum value from FunicularSwitch.Generators.Consumer.Error.UnionCases: {unionCases.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown enum value from FunicularSwitch.Generators.Consumer.Error.UnionCases: {unionCases.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task unionCases, System.Action generic, System.Action notFound, System.Action notAuthorized, System.Action aggregated) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task unionCases, global::System.Action generic, global::System.Action notFound, global::System.Action notAuthorized, global::System.Action aggregated) => (await unionCases.ConfigureAwait(false)).Switch(generic, notFound, notAuthorized, aggregated); - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task unionCases, System.Func generic, System.Func notFound, System.Func notAuthorized, System.Func aggregated) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task unionCases, global::System.Func generic, global::System.Func notFound, global::System.Func notAuthorized, global::System.Func aggregated) => await (await unionCases.ConfigureAwait(false)).Switch(generic, notFound, notAuthorized, aggregated).ConfigureAwait(false); } } diff --git a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FunicularSwitchGeneratorsConsumerInternalEnumParentInternalEnumMatchExtension.g.cs b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FunicularSwitchGeneratorsConsumerInternalEnumParentInternalEnumMatchExtension.g.cs index 370741b..789046e 100644 --- a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FunicularSwitchGeneratorsConsumerInternalEnumParentInternalEnumMatchExtension.g.cs +++ b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FunicularSwitchGeneratorsConsumerInternalEnumParentInternalEnumMatchExtension.g.cs @@ -3,29 +3,29 @@ namespace FunicularSwitch.Generators.Consumer { internal static partial class InternalEnumParent_InternalEnumMatchExtension { - public static T Match(this FunicularSwitch.Generators.Consumer.InternalEnumParent.InternalEnum internalEnum, System.Func one, System.Func two) => + public static T Match(this FunicularSwitch.Generators.Consumer.InternalEnumParent.InternalEnum internalEnum, global::System.Func one, global::System.Func two) => internalEnum switch { FunicularSwitch.Generators.Consumer.InternalEnumParent.InternalEnum.One => one(), FunicularSwitch.Generators.Consumer.InternalEnumParent.InternalEnum.Two => two(), - _ => throw new System.ArgumentException($"Unknown enum value from FunicularSwitch.Generators.Consumer.InternalEnumParent.InternalEnum: {internalEnum.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown enum value from FunicularSwitch.Generators.Consumer.InternalEnumParent.InternalEnum: {internalEnum.GetType().Name}") }; - public static System.Threading.Tasks.Task Match(this FunicularSwitch.Generators.Consumer.InternalEnumParent.InternalEnum internalEnum, System.Func> one, System.Func> two) => + public static global::System.Threading.Tasks.Task Match(this FunicularSwitch.Generators.Consumer.InternalEnumParent.InternalEnum internalEnum, global::System.Func> one, global::System.Func> two) => internalEnum switch { FunicularSwitch.Generators.Consumer.InternalEnumParent.InternalEnum.One => one(), FunicularSwitch.Generators.Consumer.InternalEnumParent.InternalEnum.Two => two(), - _ => throw new System.ArgumentException($"Unknown enum value from FunicularSwitch.Generators.Consumer.InternalEnumParent.InternalEnum: {internalEnum.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown enum value from FunicularSwitch.Generators.Consumer.InternalEnumParent.InternalEnum: {internalEnum.GetType().Name}") }; - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task internalEnum, System.Func one, System.Func two) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task internalEnum, global::System.Func one, global::System.Func two) => (await internalEnum.ConfigureAwait(false)).Match(one, two); - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task internalEnum, System.Func> one, System.Func> two) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task internalEnum, global::System.Func> one, global::System.Func> two) => await (await internalEnum.ConfigureAwait(false)).Match(one, two).ConfigureAwait(false); - public static void Switch(this FunicularSwitch.Generators.Consumer.InternalEnumParent.InternalEnum internalEnum, System.Action one, System.Action two) + public static void Switch(this FunicularSwitch.Generators.Consumer.InternalEnumParent.InternalEnum internalEnum, global::System.Action one, global::System.Action two) { switch (internalEnum) { @@ -36,11 +36,11 @@ public static void Switch(this FunicularSwitch.Generators.Consumer.InternalEnumP two(); break; default: - throw new System.ArgumentException($"Unknown enum value from FunicularSwitch.Generators.Consumer.InternalEnumParent.InternalEnum: {internalEnum.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown enum value from FunicularSwitch.Generators.Consumer.InternalEnumParent.InternalEnum: {internalEnum.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this FunicularSwitch.Generators.Consumer.InternalEnumParent.InternalEnum internalEnum, System.Func one, System.Func two) + public static async global::System.Threading.Tasks.Task Switch(this FunicularSwitch.Generators.Consumer.InternalEnumParent.InternalEnum internalEnum, global::System.Func one, global::System.Func two) { switch (internalEnum) { @@ -51,14 +51,14 @@ public static async System.Threading.Tasks.Task Switch(this FunicularSwitch.Gene await two().ConfigureAwait(false); break; default: - throw new System.ArgumentException($"Unknown enum value from FunicularSwitch.Generators.Consumer.InternalEnumParent.InternalEnum: {internalEnum.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown enum value from FunicularSwitch.Generators.Consumer.InternalEnumParent.InternalEnum: {internalEnum.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task internalEnum, System.Action one, System.Action two) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task internalEnum, global::System.Action one, global::System.Action two) => (await internalEnum.ConfigureAwait(false)).Switch(one, two); - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task internalEnum, System.Func one, System.Func two) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task internalEnum, global::System.Func one, global::System.Func two) => await (await internalEnum.ConfigureAwait(false)).Switch(one, two).ConfigureAwait(false); } } diff --git a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FunicularSwitchGeneratorsConsumerSystemMyEnumMatchExtension.g.cs b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FunicularSwitchGeneratorsConsumerSystemMyEnumMatchExtension.g.cs new file mode 100644 index 0000000..7359603 --- /dev/null +++ b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/FunicularSwitchGeneratorsConsumerSystemMyEnumMatchExtension.g.cs @@ -0,0 +1,65 @@ +#pragma warning disable 1591 +namespace FunicularSwitch.Generators.Consumer.System +{ + public static partial class MyEnumMatchExtension + { + public static T Match(this FunicularSwitch.Generators.Consumer.System.MyEnum myEnum, global::System.Func one, global::System.Func two) => + myEnum switch + { + FunicularSwitch.Generators.Consumer.System.MyEnum.One => one(), + FunicularSwitch.Generators.Consumer.System.MyEnum.Two => two(), + _ => throw new global::System.ArgumentException($"Unknown enum value from FunicularSwitch.Generators.Consumer.System.MyEnum: {myEnum.GetType().Name}") + }; + + public static global::System.Threading.Tasks.Task Match(this FunicularSwitch.Generators.Consumer.System.MyEnum myEnum, global::System.Func> one, global::System.Func> two) => + myEnum switch + { + FunicularSwitch.Generators.Consumer.System.MyEnum.One => one(), + FunicularSwitch.Generators.Consumer.System.MyEnum.Two => two(), + _ => throw new global::System.ArgumentException($"Unknown enum value from FunicularSwitch.Generators.Consumer.System.MyEnum: {myEnum.GetType().Name}") + }; + + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task myEnum, global::System.Func one, global::System.Func two) => + (await myEnum.ConfigureAwait(false)).Match(one, two); + + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task myEnum, global::System.Func> one, global::System.Func> two) => + await (await myEnum.ConfigureAwait(false)).Match(one, two).ConfigureAwait(false); + + public static void Switch(this FunicularSwitch.Generators.Consumer.System.MyEnum myEnum, global::System.Action one, global::System.Action two) + { + switch (myEnum) + { + case FunicularSwitch.Generators.Consumer.System.MyEnum.One: + one(); + break; + case FunicularSwitch.Generators.Consumer.System.MyEnum.Two: + two(); + break; + default: + throw new global::System.ArgumentException($"Unknown enum value from FunicularSwitch.Generators.Consumer.System.MyEnum: {myEnum.GetType().Name}"); + } + } + + public static async global::System.Threading.Tasks.Task Switch(this FunicularSwitch.Generators.Consumer.System.MyEnum myEnum, global::System.Func one, global::System.Func two) + { + switch (myEnum) + { + case FunicularSwitch.Generators.Consumer.System.MyEnum.One: + await one().ConfigureAwait(false); + break; + case FunicularSwitch.Generators.Consumer.System.MyEnum.Two: + await two().ConfigureAwait(false); + break; + default: + throw new global::System.ArgumentException($"Unknown enum value from FunicularSwitch.Generators.Consumer.System.MyEnum: {myEnum.GetType().Name}"); + } + } + + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task myEnum, global::System.Action one, global::System.Action two) => + (await myEnum.ConfigureAwait(false)).Switch(one, two); + + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task myEnum, global::System.Func one, global::System.Func two) => + await (await myEnum.ConfigureAwait(false)).Switch(one, two).ConfigureAwait(false); + } +} +#pragma warning restore 1591 diff --git a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/SystemDateTimeKindMatchExtension.g.cs b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/SystemDateTimeKindMatchExtension.g.cs index 146e8f1..bfd8879 100644 --- a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/SystemDateTimeKindMatchExtension.g.cs +++ b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.EnumTypeGenerator/SystemDateTimeKindMatchExtension.g.cs @@ -3,31 +3,31 @@ namespace System { public static partial class DateTimeKindMatchExtension { - public static T Match(this System.DateTimeKind dateTimeKind, System.Func local, System.Func unspecified, System.Func utc) => + public static T Match(this System.DateTimeKind dateTimeKind, global::System.Func local, global::System.Func unspecified, global::System.Func utc) => dateTimeKind switch { System.DateTimeKind.Local => local(), System.DateTimeKind.Unspecified => unspecified(), System.DateTimeKind.Utc => utc(), - _ => throw new System.ArgumentException($"Unknown enum value from System.DateTimeKind: {dateTimeKind.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown enum value from System.DateTimeKind: {dateTimeKind.GetType().Name}") }; - public static System.Threading.Tasks.Task Match(this System.DateTimeKind dateTimeKind, System.Func> local, System.Func> unspecified, System.Func> utc) => + public static global::System.Threading.Tasks.Task Match(this System.DateTimeKind dateTimeKind, global::System.Func> local, global::System.Func> unspecified, global::System.Func> utc) => dateTimeKind switch { System.DateTimeKind.Local => local(), System.DateTimeKind.Unspecified => unspecified(), System.DateTimeKind.Utc => utc(), - _ => throw new System.ArgumentException($"Unknown enum value from System.DateTimeKind: {dateTimeKind.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown enum value from System.DateTimeKind: {dateTimeKind.GetType().Name}") }; - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task dateTimeKind, System.Func local, System.Func unspecified, System.Func utc) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task dateTimeKind, global::System.Func local, global::System.Func unspecified, global::System.Func utc) => (await dateTimeKind.ConfigureAwait(false)).Match(local, unspecified, utc); - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task dateTimeKind, System.Func> local, System.Func> unspecified, System.Func> utc) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task dateTimeKind, global::System.Func> local, global::System.Func> unspecified, global::System.Func> utc) => await (await dateTimeKind.ConfigureAwait(false)).Match(local, unspecified, utc).ConfigureAwait(false); - public static void Switch(this System.DateTimeKind dateTimeKind, System.Action local, System.Action unspecified, System.Action utc) + public static void Switch(this System.DateTimeKind dateTimeKind, global::System.Action local, global::System.Action unspecified, global::System.Action utc) { switch (dateTimeKind) { @@ -41,11 +41,11 @@ public static void Switch(this System.DateTimeKind dateTimeKind, System.Action l utc(); break; default: - throw new System.ArgumentException($"Unknown enum value from System.DateTimeKind: {dateTimeKind.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown enum value from System.DateTimeKind: {dateTimeKind.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this System.DateTimeKind dateTimeKind, System.Func local, System.Func unspecified, System.Func utc) + public static async global::System.Threading.Tasks.Task Switch(this System.DateTimeKind dateTimeKind, global::System.Func local, global::System.Func unspecified, global::System.Func utc) { switch (dateTimeKind) { @@ -59,14 +59,14 @@ public static async System.Threading.Tasks.Task Switch(this System.DateTimeKind await utc().ConfigureAwait(false); break; default: - throw new System.ArgumentException($"Unknown enum value from System.DateTimeKind: {dateTimeKind.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown enum value from System.DateTimeKind: {dateTimeKind.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task dateTimeKind, System.Action local, System.Action unspecified, System.Action utc) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task dateTimeKind, global::System.Action local, global::System.Action unspecified, global::System.Action utc) => (await dateTimeKind.ConfigureAwait(false)).Switch(local, unspecified, utc); - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task dateTimeKind, System.Func local, System.Func unspecified, System.Func utc) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task dateTimeKind, global::System.Func local, global::System.Func unspecified, global::System.Func utc) => await (await dateTimeKind.ConfigureAwait(false)).Switch(local, unspecified, utc).ConfigureAwait(false); } } diff --git a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.ResultTypeGenerator/FunicularSwitch.Generators.Consumer.OperationResult.g.cs b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.ResultTypeGenerator/FunicularSwitch.Generators.Consumer.OperationResult.g.cs index 77e03f7..f785673 100644 --- a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.ResultTypeGenerator/FunicularSwitch.Generators.Consumer.OperationResult.g.cs +++ b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.ResultTypeGenerator/FunicularSwitch.Generators.Consumer.OperationResult.g.cs @@ -1,5 +1,5 @@ #nullable enable -using System.Linq; +using global::System.Linq; using FunicularSwitch; namespace FunicularSwitch.Generators.Consumer @@ -13,56 +13,56 @@ abstract partial class OperationResult public bool IsOk => !IsError; public abstract Error? GetErrorOrDefault(); - public static OperationResult Try(System.Func action, System.Func formatError) + public static OperationResult Try(global::System.Func action, global::System.Func formatError) { try { return action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } - public static async System.Threading.Tasks.Task> Try(System.Func> action, System.Func formatError) + public static async global::System.Threading.Tasks.Task> Try(global::System.Func> action, global::System.Func formatError) { try { return await action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } - public static OperationResult Try(System.Func> action, System.Func formatError) + public static OperationResult Try(global::System.Func> action, global::System.Func formatError) { try { return action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } - public static async System.Threading.Tasks.Task> Try(System.Func>> action, System.Func formatError) + public static async global::System.Threading.Tasks.Task> Try(global::System.Func>> action, global::System.Func formatError) { try { return await action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } } - abstract partial class OperationResult : OperationResult, System.Collections.Generic.IEnumerable + abstract partial class OperationResult : OperationResult, global::System.Collections.Generic.IEnumerable { public static OperationResult Error(Error message) => Error(message); public static OperationResult Ok(T value) => Ok(value); @@ -79,14 +79,14 @@ abstract partial class OperationResult : OperationResult, System.Collections. { Ok_ ok => ok.Equals((object)other), Error_ error => error.Equals((object)other), - _ => throw new System.InvalidOperationException($"Unexpected type derived from {nameof(OperationResult)}") + _ => throw new global::System.InvalidOperationException($"Unexpected type derived from {nameof(OperationResult)}") }; public override int GetHashCode() => this switch { Ok_ ok => ok.GetHashCode(), Error_ error => error.GetHashCode(), - _ => throw new System.InvalidOperationException($"Unexpected type derived from {nameof(OperationResult)}") + _ => throw new global::System.InvalidOperationException($"Unexpected type derived from {nameof(OperationResult)}") }; public override bool Equals(object? obj) @@ -101,7 +101,7 @@ public override bool Equals(object? obj) public static bool operator !=(OperationResult? left, OperationResult? right) => !Equals(left, right); - public void Match(System.Action ok, System.Action? error = null) => Match( + public void Match(global::System.Action ok, global::System.Action? error = null) => Match( v => { ok.Invoke(v); @@ -113,37 +113,37 @@ public void Match(System.Action ok, System.Action? error = null) => Ma return 42; }); - public T1 Match(System.Func ok, System.Func error) + public T1 Match(global::System.Func ok, global::System.Func error) { return this switch { Ok_ okOperationResult => ok(okOperationResult.Value), Error_ errorOperationResult => error(errorOperationResult.Details), - _ => throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}") + _ => throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}") }; } - public async System.Threading.Tasks.Task Match(System.Func> ok, System.Func> error) + public async global::System.Threading.Tasks.Task Match(global::System.Func> ok, global::System.Func> error) { return this switch { Ok_ okOperationResult => await ok(okOperationResult.Value).ConfigureAwait(false), Error_ errorOperationResult => await error(errorOperationResult.Details).ConfigureAwait(false), - _ => throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}") + _ => throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}") }; } - public System.Threading.Tasks.Task Match(System.Func> ok, System.Func error) => - Match(ok, e => System.Threading.Tasks.Task.FromResult(error(e))); + public global::System.Threading.Tasks.Task Match(global::System.Func> ok, global::System.Func error) => + Match(ok, e => global::System.Threading.Tasks.Task.FromResult(error(e))); - public async System.Threading.Tasks.Task Match(System.Func ok) + public async global::System.Threading.Tasks.Task Match(global::System.Func ok) { if (this is Ok_ okOperationResult) await ok(okOperationResult.Value).ConfigureAwait(false); } - public T Match(System.Func error) => Match(v => v, error); + public T Match(global::System.Func error) => Match(v => v, error); - public OperationResult Bind(System.Func> bind) + public OperationResult Bind(global::System.Func> bind) { switch (this) { @@ -154,7 +154,7 @@ public OperationResult Bind(System.Func> bind) } // ReSharper disable once RedundantCatchClause #pragma warning disable CS0168 // Variable is declared but never used - catch (System.Exception e) + catch (global::System.Exception e) #pragma warning restore CS0168 // Variable is declared but never used { return OperationResult.Error(FunicularSwitch.Generators.Consumer.Error.Generic(e)); @@ -162,11 +162,11 @@ public OperationResult Bind(System.Func> bind) case Error_ error: return error.Convert(); default: - throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); + throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); } } - public async System.Threading.Tasks.Task> Bind(System.Func>> bind) + public async global::System.Threading.Tasks.Task> Bind(global::System.Func>> bind) { switch (this) { @@ -177,7 +177,7 @@ public async System.Threading.Tasks.Task> Bind(System.Fu } // ReSharper disable once RedundantCatchClause #pragma warning disable CS0168 // Variable is declared but never used - catch (System.Exception e) + catch (global::System.Exception e) #pragma warning restore CS0168 // Variable is declared but never used { return OperationResult.Error(FunicularSwitch.Generators.Consumer.Error.Generic(e)); @@ -185,14 +185,14 @@ public async System.Threading.Tasks.Task> Bind(System.Fu case Error_ error: return error.Convert(); default: - throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); + throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); } } - public OperationResult Map(System.Func map) + public OperationResult Map(global::System.Func map) => Bind(value => Ok(map(value))); - public System.Threading.Tasks.Task> Map(System.Func> map) + public global::System.Threading.Tasks.Task> Map(global::System.Func> map) => Bind(async value => Ok(await map(value).ConfigureAwait(false))); public T? GetValueOrDefault() @@ -201,7 +201,7 @@ public System.Threading.Tasks.Task> Map(System.Func default ); - public T GetValueOrDefault(System.Func defaultValue) + public T GetValueOrDefault(global::System.Func defaultValue) => Match( v => v, _ => defaultValue() @@ -216,12 +216,12 @@ public T GetValueOrDefault(T defaultValue) public T GetValueOrThrow() => Match( v => v, - details => throw new System.InvalidOperationException($"Cannot access error result value. Error: {details}")); + details => throw new global::System.InvalidOperationException($"Cannot access error result value. Error: {details}")); - public System.Collections.Generic.IEnumerator GetEnumerator() => Match(ok => new[] { ok }, _ => Enumerable.Empty()).GetEnumerator(); + public global::System.Collections.Generic.IEnumerator GetEnumerator() => Match(ok => new[] { ok }, _ => Enumerable.Empty()).GetEnumerator(); public override string ToString() => Match(ok => $"Ok {ok?.ToString()}", error => $"Error {error}"); - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); + global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); public sealed partial class Ok_ : OperationResult { @@ -235,7 +235,7 @@ public bool Equals(Ok_? other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; - return System.Collections.Generic.EqualityComparer.Default.Equals(Value, other.Value); + return global::System.Collections.Generic.EqualityComparer.Default.Equals(Value, other.Value); } public override bool Equals(object? obj) @@ -245,7 +245,7 @@ public override bool Equals(object? obj) return obj is Ok_ other && Equals(other); } - public override int GetHashCode() => Value == null ? 0 : System.Collections.Generic.EqualityComparer.Default.GetHashCode(Value); + public override int GetHashCode() => Value == null ? 0 : global::System.Collections.Generic.EqualityComparer.Default.GetHashCode(Value); public static bool operator ==(Ok_ left, Ok_ right) => Equals(left, right); @@ -289,66 +289,66 @@ static partial class OperationResultExtension { #region bind - public static async System.Threading.Tasks.Task> Bind( - this System.Threading.Tasks.Task> result, - System.Func> bind) + public static async global::System.Threading.Tasks.Task> Bind( + this global::System.Threading.Tasks.Task> result, + global::System.Func> bind) => (await result.ConfigureAwait(false)).Bind(bind); - public static async System.Threading.Tasks.Task> Bind( - this System.Threading.Tasks.Task> result, - System.Func>> bind) + public static async global::System.Threading.Tasks.Task> Bind( + this global::System.Threading.Tasks.Task> result, + global::System.Func>> bind) => await (await result.ConfigureAwait(false)).Bind(bind).ConfigureAwait(false); #endregion #region map - public static async System.Threading.Tasks.Task> Map( - this System.Threading.Tasks.Task> result, - System.Func map) + public static async global::System.Threading.Tasks.Task> Map( + this global::System.Threading.Tasks.Task> result, + global::System.Func map) => (await result.ConfigureAwait(false)).Map(map); - public static System.Threading.Tasks.Task> Map( - this System.Threading.Tasks.Task> result, - System.Func> bind) + public static global::System.Threading.Tasks.Task> Map( + this global::System.Threading.Tasks.Task> result, + global::System.Func> bind) => Bind(result, async v => OperationResult.Ok(await bind(v).ConfigureAwait(false))); - public static OperationResult MapError(this OperationResult result, System.Func mapError) + public static OperationResult MapError(this OperationResult result, global::System.Func mapError) { if (result is OperationResult.Error_ e) return OperationResult.Error(mapError(e.Details)); return result; } - public static async System.Threading.Tasks.Task> MapError(this System.Threading.Tasks.Task> result, System.Func mapError) => (await result.ConfigureAwait(false)).MapError(mapError); + public static async global::System.Threading.Tasks.Task> MapError(this global::System.Threading.Tasks.Task> result, global::System.Func mapError) => (await result.ConfigureAwait(false)).MapError(mapError); #endregion #region match - public static async System.Threading.Tasks.Task Match( - this System.Threading.Tasks.Task> result, - System.Func> ok, - System.Func> error) + public static async global::System.Threading.Tasks.Task Match( + this global::System.Threading.Tasks.Task> result, + global::System.Func> ok, + global::System.Func> error) => await (await result.ConfigureAwait(false)).Match(ok, error).ConfigureAwait(false); - public static async System.Threading.Tasks.Task Match( - this System.Threading.Tasks.Task> result, - System.Func> ok, - System.Func error) + public static async global::System.Threading.Tasks.Task Match( + this global::System.Threading.Tasks.Task> result, + global::System.Func> ok, + global::System.Func error) => await (await result.ConfigureAwait(false)).Match(ok, error).ConfigureAwait(false); - public static async System.Threading.Tasks.Task Match( - this System.Threading.Tasks.Task> result, - System.Func ok, - System.Func error) + public static async global::System.Threading.Tasks.Task Match( + this global::System.Threading.Tasks.Task> result, + global::System.Func ok, + global::System.Func error) => (await result.ConfigureAwait(false)).Match(ok, error); #endregion public static OperationResult Flatten(this OperationResult> result) => result.Bind(r => r); - public static OperationResult As(this OperationResult result, System.Func errorTIsNotT1) => + public static OperationResult As(this OperationResult result, global::System.Func errorTIsNotT1) => result.Bind(r => { if (r is T1 converted) @@ -356,18 +356,18 @@ public static OperationResult As(this OperationResult result, Syst return OperationResult.Error(errorTIsNotT1()); }); - public static OperationResult As(this OperationResult result, System.Func errorIsNotT1) => + public static OperationResult As(this OperationResult result, global::System.Func errorIsNotT1) => result.As(errorIsNotT1); #region query-expression pattern - public static OperationResult Select(this OperationResult result, System.Func selector) => result.Map(selector); - public static System.Threading.Tasks.Task> Select(this System.Threading.Tasks.Task> result, System.Func selector) => result.Map(selector); + public static OperationResult Select(this OperationResult result, global::System.Func selector) => result.Map(selector); + public static global::System.Threading.Tasks.Task> Select(this global::System.Threading.Tasks.Task> result, global::System.Func selector) => result.Map(selector); - public static OperationResult SelectMany(this OperationResult result, System.Func> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); - public static System.Threading.Tasks.Task> SelectMany(this System.Threading.Tasks.Task> result, System.Func>> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); - public static System.Threading.Tasks.Task> SelectMany(this System.Threading.Tasks.Task> result, System.Func> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); - public static System.Threading.Tasks.Task> SelectMany(this OperationResult result, System.Func>> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static OperationResult SelectMany(this OperationResult result, global::System.Func> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static global::System.Threading.Tasks.Task> SelectMany(this global::System.Threading.Tasks.Task> result, global::System.Func>> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static global::System.Threading.Tasks.Task> SelectMany(this global::System.Threading.Tasks.Task> result, global::System.Func> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static global::System.Threading.Tasks.Task> SelectMany(this OperationResult result, global::System.Func>> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); #endregion } @@ -377,17 +377,17 @@ namespace FunicularSwitch.Generators.Consumer.Extensions { static partial class OperationResultExtension { - public static System.Collections.Generic.IEnumerable Choose( - this System.Collections.Generic.IEnumerable items, - System.Func> choose, - System.Action onError) + public static global::System.Collections.Generic.IEnumerable Choose( + this global::System.Collections.Generic.IEnumerable items, + global::System.Func> choose, + global::System.Action onError) => items .Select(i => choose(i)) .Choose(onError); - public static System.Collections.Generic.IEnumerable Choose( - this System.Collections.Generic.IEnumerable> results, - System.Action onError) + public static global::System.Collections.Generic.IEnumerable Choose( + this global::System.Collections.Generic.IEnumerable> results, + global::System.Action onError) => results .Where(r => r.Match(_ => true, error => @@ -397,19 +397,19 @@ public static System.Collections.Generic.IEnumerable Choose( })) .Select(r => r.GetValueOrThrow()); - public static OperationResult As(this object item, System.Func error) => + public static OperationResult As(this object item, global::System.Func error) => !(item is T t) ? OperationResult.Error(error()) : t; - public static OperationResult NotNull(this T? item, System.Func error) => + public static OperationResult NotNull(this T? item, global::System.Func error) => item ?? OperationResult.Error(error()); - public static OperationResult NotNullOrEmpty(this string? s, System.Func error) + public static OperationResult NotNullOrEmpty(this string? s, global::System.Func error) => string.IsNullOrEmpty(s) ? OperationResult.Error(error()) : s!; - public static OperationResult NotNullOrWhiteSpace(this string? s, System.Func error) + public static OperationResult NotNullOrWhiteSpace(this string? s, global::System.Func error) => string.IsNullOrWhiteSpace(s) ? OperationResult.Error(error()) : s!; - public static OperationResult First(this System.Collections.Generic.IEnumerable candidates, System.Func predicate, System.Func noMatch) => + public static OperationResult First(this global::System.Collections.Generic.IEnumerable candidates, global::System.Func predicate, global::System.Func noMatch) => candidates .FirstOrDefault(i => predicate(i)) .NotNull(noMatch); diff --git a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.ResultTypeGenerator/FunicularSwitch.Generators.Consumer.OperationResultWithMerge.g.cs b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.ResultTypeGenerator/FunicularSwitch.Generators.Consumer.OperationResultWithMerge.g.cs index 1ea9e52..2ef2f82 100644 --- a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.ResultTypeGenerator/FunicularSwitch.Generators.Consumer.OperationResultWithMerge.g.cs +++ b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.ResultTypeGenerator/FunicularSwitch.Generators.Consumer.OperationResultWithMerge.g.cs @@ -1,5 +1,5 @@ #nullable enable -using System.Linq; +using global::System.Linq; using FunicularSwitch; namespace FunicularSwitch.Generators.Consumer @@ -10,92 +10,92 @@ abstract partial class OperationResult public static OperationResult<(T1, T2)> Aggregate(OperationResult r1, OperationResult r2) => OperationResultExtension.Aggregate(r1, r2); - public static OperationResult Aggregate(OperationResult r1, OperationResult r2, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, combine); + public static OperationResult Aggregate(OperationResult r1, OperationResult r2, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2) => OperationResultExtension.Aggregate(r1, r2); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2) => OperationResultExtension.Aggregate(r1, r2); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, combine); public static OperationResult<(T1, T2, T3)> Aggregate(OperationResult r1, OperationResult r2, OperationResult r3) => OperationResultExtension.Aggregate(r1, r2, r3); - public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, combine); + public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3) => OperationResultExtension.Aggregate(r1, r2, r3); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3) => OperationResultExtension.Aggregate(r1, r2, r3); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, combine); public static OperationResult<(T1, T2, T3, T4)> Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4) => OperationResultExtension.Aggregate(r1, r2, r3, r4); - public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, combine); + public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4) => OperationResultExtension.Aggregate(r1, r2, r3, r4); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4) => OperationResultExtension.Aggregate(r1, r2, r3, r4); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, combine); public static OperationResult<(T1, T2, T3, T4, T5)> Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5); - public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, combine); + public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, combine); public static OperationResult<(T1, T2, T3, T4, T5, T6)> Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6); - public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, combine); + public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, combine); public static OperationResult<(T1, T2, T3, T4, T5, T6, T7)> Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7); - public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, combine); + public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, combine); public static OperationResult<(T1, T2, T3, T4, T5, T6, T7, T8)> Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8); - public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, combine); + public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, combine); public static OperationResult<(T1, T2, T3, T4, T5, T6, T7, T8, T9)> Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, OperationResult r9) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9); - public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, OperationResult r9, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, combine); + public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, OperationResult r9, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Threading.Tasks.Task> r9) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Threading.Tasks.Task> r9) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Threading.Tasks.Task> r9, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Threading.Tasks.Task> r9, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, combine); } static partial class OperationResultExtension { - public static OperationResult> Map(this System.Collections.Generic.IEnumerable> results, - System.Func map) => + public static OperationResult> Map(this global::System.Collections.Generic.IEnumerable> results, + global::System.Func map) => results.Select(r => r.Map(map)).Aggregate(); - public static OperationResult> Bind(this System.Collections.Generic.IEnumerable> results, - System.Func> bind) => + public static OperationResult> Bind(this global::System.Collections.Generic.IEnumerable> results, + global::System.Func> bind) => results.Select(r => r.Bind(bind)).Aggregate(); - public static OperationResult> Bind(this OperationResult result, - System.Func>> bindMany) => + public static OperationResult> Bind(this OperationResult result, + global::System.Func>> bindMany) => result.Map(ok => bindMany(ok).Aggregate()).Flatten(); - public static OperationResult Bind(this System.Collections.Generic.IEnumerable> results, - System.Func, OperationResult> bind) => + public static OperationResult Bind(this global::System.Collections.Generic.IEnumerable> results, + global::System.Func, OperationResult> bind) => results.Aggregate().Bind(bind); - public static OperationResult> Aggregate(this System.Collections.Generic.IEnumerable> results) + public static OperationResult> Aggregate(this global::System.Collections.Generic.IEnumerable> results) { var isError = false; Error aggregated = default!; - var oks = new System.Collections.Generic.List(); + var oks = new global::System.Collections.Generic.List(); foreach (var result in results) { result.Match( @@ -109,23 +109,23 @@ public static OperationResult Bind(this System.Collections.Generic.IE } return isError - ? OperationResult.Error>(aggregated) - : OperationResult.Ok>(oks); + ? OperationResult.Error>(aggregated) + : OperationResult.Ok>(oks); } - public static async System.Threading.Tasks.Task>> Aggregate( - this System.Threading.Tasks.Task>> results) + public static async global::System.Threading.Tasks.Task>> Aggregate( + this global::System.Threading.Tasks.Task>> results) => (await results.ConfigureAwait(false)) .Aggregate(); - public static async System.Threading.Tasks.Task>> Aggregate( - this System.Collections.Generic.IEnumerable>> results) - => (await System.Threading.Tasks.Task.WhenAll(results.Select(e => e)).ConfigureAwait(false)) + public static async global::System.Threading.Tasks.Task>> Aggregate( + this global::System.Collections.Generic.IEnumerable>> results) + => (await global::System.Threading.Tasks.Task.WhenAll(results.Select(e => e)).ConfigureAwait(false)) .Aggregate(); - public static async System.Threading.Tasks.Task>> AggregateMany( - this System.Collections.Generic.IEnumerable>>> results) - => (await System.Threading.Tasks.Task.WhenAll(results.Select(e => e)).ConfigureAwait(false)) + public static async global::System.Threading.Tasks.Task>> AggregateMany( + this global::System.Collections.Generic.IEnumerable>>> results) + => (await global::System.Threading.Tasks.Task.WhenAll(results.Select(e => e)).ConfigureAwait(false)) .SelectMany(e => e) .Aggregate(); @@ -133,7 +133,7 @@ public static OperationResult Bind(this System.Collections.Generic.IE public static OperationResult<(T1, T2)> Aggregate(this OperationResult r1, OperationResult r2) => Aggregate(r1, r2, (v1, v2) => (v1, v2)); - public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, System.Func combine) + public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, global::System.Func combine) { if (r1 is OperationResult.Ok_ ok1 && r2 is OperationResult.Ok_ ok2) return combine(ok1.Value, ok2.Value); @@ -145,19 +145,19 @@ public static OperationResult Aggregate(this Operation )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2) => Aggregate(r1, r2, (v1, v2) => (v1, v2)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2); return Aggregate(r1.Result, r2.Result, combine); } public static OperationResult<(T1, T2, T3)> Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3) => Aggregate(r1, r2, r3, (v1, v2, v3) => (v1, v2, v3)); - public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, System.Func combine) + public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, global::System.Func combine) { if (r1 is OperationResult.Ok_ ok1 && r2 is OperationResult.Ok_ ok2 && r3 is OperationResult.Ok_ ok3) return combine(ok1.Value, ok2.Value, ok3.Value); @@ -169,19 +169,19 @@ public static OperationResult Aggregate(this Opera )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3) => Aggregate(r1, r2, r3, (v1, v2, v3) => (v1, v2, v3)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3); return Aggregate(r1.Result, r2.Result, r3.Result, combine); } public static OperationResult<(T1, T2, T3, T4)> Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4) => Aggregate(r1, r2, r3, r4, (v1, v2, v3, v4) => (v1, v2, v3, v4)); - public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, System.Func combine) + public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, global::System.Func combine) { if (r1 is OperationResult.Ok_ ok1 && r2 is OperationResult.Ok_ ok2 && r3 is OperationResult.Ok_ ok3 && r4 is OperationResult.Ok_ ok4) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value); @@ -193,19 +193,19 @@ public static OperationResult Aggregate(this O )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4) => Aggregate(r1, r2, r3, r4, (v1, v2, v3, v4) => (v1, v2, v3, v4)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, combine); } public static OperationResult<(T1, T2, T3, T4, T5)> Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5) => Aggregate(r1, r2, r3, r4, r5, (v1, v2, v3, v4, v5) => (v1, v2, v3, v4, v5)); - public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, System.Func combine) + public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, global::System.Func combine) { if (r1 is OperationResult.Ok_ ok1 && r2 is OperationResult.Ok_ ok2 && r3 is OperationResult.Ok_ ok3 && r4 is OperationResult.Ok_ ok4 && r5 is OperationResult.Ok_ ok5) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value); @@ -217,19 +217,19 @@ public static OperationResult Aggregate(th )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5) => Aggregate(r1, r2, r3, r4, r5, (v1, v2, v3, v4, v5) => (v1, v2, v3, v4, v5)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, combine); } public static OperationResult<(T1, T2, T3, T4, T5, T6)> Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6) => Aggregate(r1, r2, r3, r4, r5, r6, (v1, v2, v3, v4, v5, v6) => (v1, v2, v3, v4, v5, v6)); - public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, System.Func combine) + public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, global::System.Func combine) { if (r1 is OperationResult.Ok_ ok1 && r2 is OperationResult.Ok_ ok2 && r3 is OperationResult.Ok_ ok3 && r4 is OperationResult.Ok_ ok4 && r5 is OperationResult.Ok_ ok5 && r6 is OperationResult.Ok_ ok6) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value, ok6.Value); @@ -241,19 +241,19 @@ public static OperationResult Aggregate> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6) => Aggregate(r1, r2, r3, r4, r5, r6, (v1, v2, v3, v4, v5, v6) => (v1, v2, v3, v4, v5, v6)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, r6.Result, combine); } public static OperationResult<(T1, T2, T3, T4, T5, T6, T7)> Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7) => Aggregate(r1, r2, r3, r4, r5, r6, r7, (v1, v2, v3, v4, v5, v6, v7) => (v1, v2, v3, v4, v5, v6, v7)); - public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, System.Func combine) + public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, global::System.Func combine) { if (r1 is OperationResult.Ok_ ok1 && r2 is OperationResult.Ok_ ok2 && r3 is OperationResult.Ok_ ok3 && r4 is OperationResult.Ok_ ok4 && r5 is OperationResult.Ok_ ok5 && r6 is OperationResult.Ok_ ok6 && r7 is OperationResult.Ok_ ok7) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value, ok6.Value, ok7.Value); @@ -265,19 +265,19 @@ public static OperationResult Aggregate> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7) => Aggregate(r1, r2, r3, r4, r5, r6, r7, (v1, v2, v3, v4, v5, v6, v7) => (v1, v2, v3, v4, v5, v6, v7)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, r6.Result, r7.Result, combine); } public static OperationResult<(T1, T2, T3, T4, T5, T6, T7, T8)> Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8) => Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, (v1, v2, v3, v4, v5, v6, v7, v8) => (v1, v2, v3, v4, v5, v6, v7, v8)); - public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, System.Func combine) + public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, global::System.Func combine) { if (r1 is OperationResult.Ok_ ok1 && r2 is OperationResult.Ok_ ok2 && r3 is OperationResult.Ok_ ok3 && r4 is OperationResult.Ok_ ok4 && r5 is OperationResult.Ok_ ok5 && r6 is OperationResult.Ok_ ok6 && r7 is OperationResult.Ok_ ok7 && r8 is OperationResult.Ok_ ok8) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value, ok6.Value, ok7.Value, ok8.Value); @@ -289,19 +289,19 @@ public static OperationResult Aggregate> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8) => Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, (v1, v2, v3, v4, v5, v6, v7, v8) => (v1, v2, v3, v4, v5, v6, v7, v8)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7, r8); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7, r8); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, r6.Result, r7.Result, r8.Result, combine); } public static OperationResult<(T1, T2, T3, T4, T5, T6, T7, T8, T9)> Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, OperationResult r9) => Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, (v1, v2, v3, v4, v5, v6, v7, v8, v9) => (v1, v2, v3, v4, v5, v6, v7, v8, v9)); - public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, OperationResult r9, System.Func combine) + public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, OperationResult r9, global::System.Func combine) { if (r1 is OperationResult.Ok_ ok1 && r2 is OperationResult.Ok_ ok2 && r3 is OperationResult.Ok_ ok3 && r4 is OperationResult.Ok_ ok4 && r5 is OperationResult.Ok_ ok5 && r6 is OperationResult.Ok_ ok6 && r7 is OperationResult.Ok_ ok7 && r8 is OperationResult.Ok_ ok8 && r9 is OperationResult.Ok_ ok9) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value, ok6.Value, ok7.Value, ok8.Value, ok9.Value); @@ -313,18 +313,18 @@ public static OperationResult Aggregate> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Threading.Tasks.Task> r9) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Threading.Tasks.Task> r9) => Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, (v1, v2, v3, v4, v5, v6, v7, v8, v9) => (v1, v2, v3, v4, v5, v6, v7, v8, v9)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Threading.Tasks.Task> r9, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Threading.Tasks.Task> r9, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7, r8, r9); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7, r8, r9); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, r6.Result, r7.Result, r8.Result, r9.Result, combine); } - public static OperationResult FirstOk(this System.Collections.Generic.IEnumerable> results, System.Func onEmpty) + public static OperationResult FirstOk(this global::System.Collections.Generic.IEnumerable> results, global::System.Func onEmpty) { - var errors = new System.Collections.Generic.List(); + var errors = new global::System.Collections.Generic.List(); foreach (var result in results) { if (result is OperationResult.Error_ e) @@ -339,24 +339,24 @@ public static OperationResult FirstOk(this System.Collections.Generic.IEnu return OperationResult.Error(MergeErrors(errors)); } - public static async System.Threading.Tasks.Task>> Aggregate( - this System.Collections.Generic.IEnumerable>> results, + public static async global::System.Threading.Tasks.Task>> Aggregate( + this global::System.Collections.Generic.IEnumerable>> results, int maxDegreeOfParallelism) => (await results.SelectAsync(e => e, maxDegreeOfParallelism).ConfigureAwait(false)) .Aggregate(); - public static async System.Threading.Tasks.Task>> AggregateMany( - this System.Collections.Generic.IEnumerable>>> results, + public static async global::System.Threading.Tasks.Task>> AggregateMany( + this global::System.Collections.Generic.IEnumerable>>> results, int maxDegreeOfParallelism) => (await results.SelectAsync(e => e, maxDegreeOfParallelism).ConfigureAwait(false)) .SelectMany(e => e) .Aggregate(); - static async System.Threading.Tasks.Task SelectAsync(this System.Collections.Generic.IEnumerable items, System.Func> selector, int maxDegreeOfParallelism) + static async global::System.Threading.Tasks.Task SelectAsync(this global::System.Collections.Generic.IEnumerable items, global::System.Func> selector, int maxDegreeOfParallelism) { - using (var throttler = new System.Threading.SemaphoreSlim(maxDegreeOfParallelism, maxDegreeOfParallelism)) + using (var throttler = new global::System.Threading.SemaphoreSlim(maxDegreeOfParallelism, maxDegreeOfParallelism)) { - return await System.Threading.Tasks.Task.WhenAll(items.Select(async item => + return await global::System.Threading.Tasks.Task.WhenAll(items.Select(async item => { // ReSharper disable once AccessToDisposedClosure await throttler.WaitAsync().ConfigureAwait(false); @@ -373,19 +373,19 @@ static async System.Threading.Tasks.Task SelectAsync(this Syste } } - public static OperationResult> AllOk(this System.Collections.Generic.IEnumerable candidates, System.Func> validate) => + public static OperationResult> AllOk(this global::System.Collections.Generic.IEnumerable candidates, global::System.Func> validate) => candidates .Select(c => c.Validate(validate)) .Aggregate(); - public static OperationResult> AllOk(this System.Collections.Generic.IEnumerable> candidates, - System.Func> validate) => + public static OperationResult> AllOk(this global::System.Collections.Generic.IEnumerable> candidates, + global::System.Func> validate) => candidates .Bind(items => items.AllOk(validate)); - public static OperationResult Validate(this OperationResult item, System.Func> validate) => item.Bind(i => i.Validate(validate)); + public static OperationResult Validate(this OperationResult item, global::System.Func> validate) => item.Bind(i => i.Validate(validate)); - public static OperationResult Validate(this T item, System.Func> validate) + public static OperationResult Validate(this T item, global::System.Func> validate) { try { @@ -394,21 +394,21 @@ public static OperationResult Validate(this T item, System.Func(FunicularSwitch.Generators.Consumer.Error.Generic(e)); } } - public static OperationResult FirstOk(this System.Collections.Generic.IEnumerable candidates, System.Func> validate, System.Func onEmpty) => + public static OperationResult FirstOk(this global::System.Collections.Generic.IEnumerable candidates, global::System.Func> validate, global::System.Func onEmpty) => candidates .Select(r => r.Validate(validate)) .FirstOk(onEmpty); #region helpers - static Error MergeErrors(System.Collections.Generic.IEnumerable errors) + static Error MergeErrors(global::System.Collections.Generic.IEnumerable errors) { var first = true; Error aggregated = default!; diff --git a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.ResultTypeGenerator/FunicularSwitch.Generators.Consumer.Result.g.cs b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.ResultTypeGenerator/FunicularSwitch.Generators.Consumer.Result.g.cs index def173d..7b2ba7e 100644 --- a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.ResultTypeGenerator/FunicularSwitch.Generators.Consumer.Result.g.cs +++ b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.ResultTypeGenerator/FunicularSwitch.Generators.Consumer.Result.g.cs @@ -1,5 +1,5 @@ #nullable enable -using System.Linq; +using global::System.Linq; using FunicularSwitch; using System; @@ -14,56 +14,56 @@ public abstract partial class Result public bool IsOk => !IsError; public abstract String? GetErrorOrDefault(); - public static Result Try(System.Func action, System.Func formatError) + public static Result Try(global::System.Func action, global::System.Func formatError) { try { return action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } - public static async System.Threading.Tasks.Task> Try(System.Func> action, System.Func formatError) + public static async global::System.Threading.Tasks.Task> Try(global::System.Func> action, global::System.Func formatError) { try { return await action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } - public static Result Try(System.Func> action, System.Func formatError) + public static Result Try(global::System.Func> action, global::System.Func formatError) { try { return action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } - public static async System.Threading.Tasks.Task> Try(System.Func>> action, System.Func formatError) + public static async global::System.Threading.Tasks.Task> Try(global::System.Func>> action, global::System.Func formatError) { try { return await action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } } - public abstract partial class Result : Result, System.Collections.Generic.IEnumerable + public abstract partial class Result : Result, global::System.Collections.Generic.IEnumerable { public static Result Error(String message) => Error(message); public static Result Ok(T value) => Ok(value); @@ -80,14 +80,14 @@ public abstract partial class Result : Result, System.Collections.Generic.IEn { Ok_ ok => ok.Equals((object)other), Error_ error => error.Equals((object)other), - _ => throw new System.InvalidOperationException($"Unexpected type derived from {nameof(Result)}") + _ => throw new global::System.InvalidOperationException($"Unexpected type derived from {nameof(Result)}") }; public override int GetHashCode() => this switch { Ok_ ok => ok.GetHashCode(), Error_ error => error.GetHashCode(), - _ => throw new System.InvalidOperationException($"Unexpected type derived from {nameof(Result)}") + _ => throw new global::System.InvalidOperationException($"Unexpected type derived from {nameof(Result)}") }; public override bool Equals(object? obj) @@ -102,7 +102,7 @@ public override bool Equals(object? obj) public static bool operator !=(Result? left, Result? right) => !Equals(left, right); - public void Match(System.Action ok, System.Action? error = null) => Match( + public void Match(global::System.Action ok, global::System.Action? error = null) => Match( v => { ok.Invoke(v); @@ -114,37 +114,37 @@ public void Match(System.Action ok, System.Action? error = null) => M return 42; }); - public T1 Match(System.Func ok, System.Func error) + public T1 Match(global::System.Func ok, global::System.Func error) { return this switch { Ok_ okResult => ok(okResult.Value), Error_ errorResult => error(errorResult.Details), - _ => throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}") + _ => throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}") }; } - public async System.Threading.Tasks.Task Match(System.Func> ok, System.Func> error) + public async global::System.Threading.Tasks.Task Match(global::System.Func> ok, global::System.Func> error) { return this switch { Ok_ okResult => await ok(okResult.Value).ConfigureAwait(false), Error_ errorResult => await error(errorResult.Details).ConfigureAwait(false), - _ => throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}") + _ => throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}") }; } - public System.Threading.Tasks.Task Match(System.Func> ok, System.Func error) => - Match(ok, e => System.Threading.Tasks.Task.FromResult(error(e))); + public global::System.Threading.Tasks.Task Match(global::System.Func> ok, global::System.Func error) => + Match(ok, e => global::System.Threading.Tasks.Task.FromResult(error(e))); - public async System.Threading.Tasks.Task Match(System.Func ok) + public async global::System.Threading.Tasks.Task Match(global::System.Func ok) { if (this is Ok_ okResult) await ok(okResult.Value).ConfigureAwait(false); } - public T Match(System.Func error) => Match(v => v, error); + public T Match(global::System.Func error) => Match(v => v, error); - public Result Bind(System.Func> bind) + public Result Bind(global::System.Func> bind) { switch (this) { @@ -155,7 +155,7 @@ public Result Bind(System.Func> bind) } // ReSharper disable once RedundantCatchClause #pragma warning disable CS0168 // Variable is declared but never used - catch (System.Exception e) + catch (global::System.Exception e) #pragma warning restore CS0168 // Variable is declared but never used { return Result.Error(FunicularSwitch.Generators.Consumer.ErrorExtension.UnexpectedToStringError(e)); @@ -163,11 +163,11 @@ public Result Bind(System.Func> bind) case Error_ error: return error.Convert(); default: - throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); + throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); } } - public async System.Threading.Tasks.Task> Bind(System.Func>> bind) + public async global::System.Threading.Tasks.Task> Bind(global::System.Func>> bind) { switch (this) { @@ -178,7 +178,7 @@ public async System.Threading.Tasks.Task> Bind(System.Func(FunicularSwitch.Generators.Consumer.ErrorExtension.UnexpectedToStringError(e)); @@ -186,14 +186,14 @@ public async System.Threading.Tasks.Task> Bind(System.Func(); default: - throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); + throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); } } - public Result Map(System.Func map) + public Result Map(global::System.Func map) => Bind(value => Ok(map(value))); - public System.Threading.Tasks.Task> Map(System.Func> map) + public global::System.Threading.Tasks.Task> Map(global::System.Func> map) => Bind(async value => Ok(await map(value).ConfigureAwait(false))); public T? GetValueOrDefault() @@ -202,7 +202,7 @@ public System.Threading.Tasks.Task> Map(System.Func default ); - public T GetValueOrDefault(System.Func defaultValue) + public T GetValueOrDefault(global::System.Func defaultValue) => Match( v => v, _ => defaultValue() @@ -217,12 +217,12 @@ public T GetValueOrDefault(T defaultValue) public T GetValueOrThrow() => Match( v => v, - details => throw new System.InvalidOperationException($"Cannot access error result value. Error: {details}")); + details => throw new global::System.InvalidOperationException($"Cannot access error result value. Error: {details}")); - public System.Collections.Generic.IEnumerator GetEnumerator() => Match(ok => new[] { ok }, _ => Enumerable.Empty()).GetEnumerator(); + public global::System.Collections.Generic.IEnumerator GetEnumerator() => Match(ok => new[] { ok }, _ => Enumerable.Empty()).GetEnumerator(); public override string ToString() => Match(ok => $"Ok {ok?.ToString()}", error => $"Error {error}"); - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); + global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); public sealed partial class Ok_ : Result { @@ -236,7 +236,7 @@ public bool Equals(Ok_? other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; - return System.Collections.Generic.EqualityComparer.Default.Equals(Value, other.Value); + return global::System.Collections.Generic.EqualityComparer.Default.Equals(Value, other.Value); } public override bool Equals(object? obj) @@ -246,7 +246,7 @@ public override bool Equals(object? obj) return obj is Ok_ other && Equals(other); } - public override int GetHashCode() => Value == null ? 0 : System.Collections.Generic.EqualityComparer.Default.GetHashCode(Value); + public override int GetHashCode() => Value == null ? 0 : global::System.Collections.Generic.EqualityComparer.Default.GetHashCode(Value); public static bool operator ==(Ok_ left, Ok_ right) => Equals(left, right); @@ -290,66 +290,66 @@ public static partial class ResultExtension { #region bind - public static async System.Threading.Tasks.Task> Bind( - this System.Threading.Tasks.Task> result, - System.Func> bind) + public static async global::System.Threading.Tasks.Task> Bind( + this global::System.Threading.Tasks.Task> result, + global::System.Func> bind) => (await result.ConfigureAwait(false)).Bind(bind); - public static async System.Threading.Tasks.Task> Bind( - this System.Threading.Tasks.Task> result, - System.Func>> bind) + public static async global::System.Threading.Tasks.Task> Bind( + this global::System.Threading.Tasks.Task> result, + global::System.Func>> bind) => await (await result.ConfigureAwait(false)).Bind(bind).ConfigureAwait(false); #endregion #region map - public static async System.Threading.Tasks.Task> Map( - this System.Threading.Tasks.Task> result, - System.Func map) + public static async global::System.Threading.Tasks.Task> Map( + this global::System.Threading.Tasks.Task> result, + global::System.Func map) => (await result.ConfigureAwait(false)).Map(map); - public static System.Threading.Tasks.Task> Map( - this System.Threading.Tasks.Task> result, - System.Func> bind) + public static global::System.Threading.Tasks.Task> Map( + this global::System.Threading.Tasks.Task> result, + global::System.Func> bind) => Bind(result, async v => Result.Ok(await bind(v).ConfigureAwait(false))); - public static Result MapError(this Result result, System.Func mapError) + public static Result MapError(this Result result, global::System.Func mapError) { if (result is Result.Error_ e) return Result.Error(mapError(e.Details)); return result; } - public static async System.Threading.Tasks.Task> MapError(this System.Threading.Tasks.Task> result, System.Func mapError) => (await result.ConfigureAwait(false)).MapError(mapError); + public static async global::System.Threading.Tasks.Task> MapError(this global::System.Threading.Tasks.Task> result, global::System.Func mapError) => (await result.ConfigureAwait(false)).MapError(mapError); #endregion #region match - public static async System.Threading.Tasks.Task Match( - this System.Threading.Tasks.Task> result, - System.Func> ok, - System.Func> error) + public static async global::System.Threading.Tasks.Task Match( + this global::System.Threading.Tasks.Task> result, + global::System.Func> ok, + global::System.Func> error) => await (await result.ConfigureAwait(false)).Match(ok, error).ConfigureAwait(false); - public static async System.Threading.Tasks.Task Match( - this System.Threading.Tasks.Task> result, - System.Func> ok, - System.Func error) + public static async global::System.Threading.Tasks.Task Match( + this global::System.Threading.Tasks.Task> result, + global::System.Func> ok, + global::System.Func error) => await (await result.ConfigureAwait(false)).Match(ok, error).ConfigureAwait(false); - public static async System.Threading.Tasks.Task Match( - this System.Threading.Tasks.Task> result, - System.Func ok, - System.Func error) + public static async global::System.Threading.Tasks.Task Match( + this global::System.Threading.Tasks.Task> result, + global::System.Func ok, + global::System.Func error) => (await result.ConfigureAwait(false)).Match(ok, error); #endregion public static Result Flatten(this Result> result) => result.Bind(r => r); - public static Result As(this Result result, System.Func errorTIsNotT1) => + public static Result As(this Result result, global::System.Func errorTIsNotT1) => result.Bind(r => { if (r is T1 converted) @@ -357,18 +357,18 @@ public static Result As(this Result result, System.Func er return Result.Error(errorTIsNotT1()); }); - public static Result As(this Result result, System.Func errorIsNotT1) => + public static Result As(this Result result, global::System.Func errorIsNotT1) => result.As(errorIsNotT1); #region query-expression pattern - public static Result Select(this Result result, System.Func selector) => result.Map(selector); - public static System.Threading.Tasks.Task> Select(this System.Threading.Tasks.Task> result, System.Func selector) => result.Map(selector); + public static Result Select(this Result result, global::System.Func selector) => result.Map(selector); + public static global::System.Threading.Tasks.Task> Select(this global::System.Threading.Tasks.Task> result, global::System.Func selector) => result.Map(selector); - public static Result SelectMany(this Result result, System.Func> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); - public static System.Threading.Tasks.Task> SelectMany(this System.Threading.Tasks.Task> result, System.Func>> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); - public static System.Threading.Tasks.Task> SelectMany(this System.Threading.Tasks.Task> result, System.Func> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); - public static System.Threading.Tasks.Task> SelectMany(this Result result, System.Func>> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static Result SelectMany(this Result result, global::System.Func> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static global::System.Threading.Tasks.Task> SelectMany(this global::System.Threading.Tasks.Task> result, global::System.Func>> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static global::System.Threading.Tasks.Task> SelectMany(this global::System.Threading.Tasks.Task> result, global::System.Func> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static global::System.Threading.Tasks.Task> SelectMany(this Result result, global::System.Func>> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); #endregion } @@ -378,17 +378,17 @@ namespace FunicularSwitch.Generators.Consumer.Extensions { public static partial class ResultExtension { - public static System.Collections.Generic.IEnumerable Choose( - this System.Collections.Generic.IEnumerable items, - System.Func> choose, - System.Action onError) + public static global::System.Collections.Generic.IEnumerable Choose( + this global::System.Collections.Generic.IEnumerable items, + global::System.Func> choose, + global::System.Action onError) => items .Select(i => choose(i)) .Choose(onError); - public static System.Collections.Generic.IEnumerable Choose( - this System.Collections.Generic.IEnumerable> results, - System.Action onError) + public static global::System.Collections.Generic.IEnumerable Choose( + this global::System.Collections.Generic.IEnumerable> results, + global::System.Action onError) => results .Where(r => r.Match(_ => true, error => @@ -398,19 +398,19 @@ public static System.Collections.Generic.IEnumerable Choose( })) .Select(r => r.GetValueOrThrow()); - public static Result As(this object item, System.Func error) => + public static Result As(this object item, global::System.Func error) => !(item is T t) ? Result.Error(error()) : t; - public static Result NotNull(this T? item, System.Func error) => + public static Result NotNull(this T? item, global::System.Func error) => item ?? Result.Error(error()); - public static Result NotNullOrEmpty(this string? s, System.Func error) + public static Result NotNullOrEmpty(this string? s, global::System.Func error) => string.IsNullOrEmpty(s) ? Result.Error(error()) : s!; - public static Result NotNullOrWhiteSpace(this string? s, System.Func error) + public static Result NotNullOrWhiteSpace(this string? s, global::System.Func error) => string.IsNullOrWhiteSpace(s) ? Result.Error(error()) : s!; - public static Result First(this System.Collections.Generic.IEnumerable candidates, System.Func predicate, System.Func noMatch) => + public static Result First(this global::System.Collections.Generic.IEnumerable candidates, global::System.Func predicate, global::System.Func noMatch) => candidates .FirstOrDefault(i => predicate(i)) .NotNull(noMatch); diff --git a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.ResultTypeGenerator/FunicularSwitch.Generators.Consumer.ResultWithMerge.g.cs b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.ResultTypeGenerator/FunicularSwitch.Generators.Consumer.ResultWithMerge.g.cs index dda67ed..8561a80 100644 --- a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.ResultTypeGenerator/FunicularSwitch.Generators.Consumer.ResultWithMerge.g.cs +++ b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.ResultTypeGenerator/FunicularSwitch.Generators.Consumer.ResultWithMerge.g.cs @@ -1,5 +1,5 @@ #nullable enable -using System.Linq; +using global::System.Linq; using FunicularSwitch; using System; @@ -11,92 +11,92 @@ public abstract partial class Result public static Result<(T1, T2)> Aggregate(Result r1, Result r2) => ResultExtension.Aggregate(r1, r2); - public static Result Aggregate(Result r1, Result r2, System.Func combine) => ResultExtension.Aggregate(r1, r2, combine); + public static Result Aggregate(Result r1, Result r2, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2) => ResultExtension.Aggregate(r1, r2); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2) => ResultExtension.Aggregate(r1, r2); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Func combine) => ResultExtension.Aggregate(r1, r2, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, combine); public static Result<(T1, T2, T3)> Aggregate(Result r1, Result r2, Result r3) => ResultExtension.Aggregate(r1, r2, r3); - public static Result Aggregate(Result r1, Result r2, Result r3, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, combine); + public static Result Aggregate(Result r1, Result r2, Result r3, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3) => ResultExtension.Aggregate(r1, r2, r3); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3) => ResultExtension.Aggregate(r1, r2, r3); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, combine); public static Result<(T1, T2, T3, T4)> Aggregate(Result r1, Result r2, Result r3, Result r4) => ResultExtension.Aggregate(r1, r2, r3, r4); - public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, combine); + public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4) => ResultExtension.Aggregate(r1, r2, r3, r4); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4) => ResultExtension.Aggregate(r1, r2, r3, r4); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, combine); public static Result<(T1, T2, T3, T4, T5)> Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5) => ResultExtension.Aggregate(r1, r2, r3, r4, r5); - public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, combine); + public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5) => ResultExtension.Aggregate(r1, r2, r3, r4, r5); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5) => ResultExtension.Aggregate(r1, r2, r3, r4, r5); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, combine); public static Result<(T1, T2, T3, T4, T5, T6)> Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6); - public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, combine); + public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, combine); public static Result<(T1, T2, T3, T4, T5, T6, T7)> Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7); - public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, combine); + public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, combine); public static Result<(T1, T2, T3, T4, T5, T6, T7, T8)> Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8); - public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, combine); + public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, combine); public static Result<(T1, T2, T3, T4, T5, T6, T7, T8, T9)> Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8, Result r9) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9); - public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8, Result r9, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, combine); + public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8, Result r9, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Threading.Tasks.Task> r9) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Threading.Tasks.Task> r9) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Threading.Tasks.Task> r9, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Threading.Tasks.Task> r9, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, combine); } public static partial class ResultExtension { - public static Result> Map(this System.Collections.Generic.IEnumerable> results, - System.Func map) => + public static Result> Map(this global::System.Collections.Generic.IEnumerable> results, + global::System.Func map) => results.Select(r => r.Map(map)).Aggregate(); - public static Result> Bind(this System.Collections.Generic.IEnumerable> results, - System.Func> bind) => + public static Result> Bind(this global::System.Collections.Generic.IEnumerable> results, + global::System.Func> bind) => results.Select(r => r.Bind(bind)).Aggregate(); - public static Result> Bind(this Result result, - System.Func>> bindMany) => + public static Result> Bind(this Result result, + global::System.Func>> bindMany) => result.Map(ok => bindMany(ok).Aggregate()).Flatten(); - public static Result Bind(this System.Collections.Generic.IEnumerable> results, - System.Func, Result> bind) => + public static Result Bind(this global::System.Collections.Generic.IEnumerable> results, + global::System.Func, Result> bind) => results.Aggregate().Bind(bind); - public static Result> Aggregate(this System.Collections.Generic.IEnumerable> results) + public static Result> Aggregate(this global::System.Collections.Generic.IEnumerable> results) { var isError = false; String aggregated = default!; - var oks = new System.Collections.Generic.List(); + var oks = new global::System.Collections.Generic.List(); foreach (var result in results) { result.Match( @@ -110,23 +110,23 @@ public static Result Bind(this System.Collections.Generic.IEnumerable } return isError - ? Result.Error>(aggregated) - : Result.Ok>(oks); + ? Result.Error>(aggregated) + : Result.Ok>(oks); } - public static async System.Threading.Tasks.Task>> Aggregate( - this System.Threading.Tasks.Task>> results) + public static async global::System.Threading.Tasks.Task>> Aggregate( + this global::System.Threading.Tasks.Task>> results) => (await results.ConfigureAwait(false)) .Aggregate(); - public static async System.Threading.Tasks.Task>> Aggregate( - this System.Collections.Generic.IEnumerable>> results) - => (await System.Threading.Tasks.Task.WhenAll(results.Select(e => e)).ConfigureAwait(false)) + public static async global::System.Threading.Tasks.Task>> Aggregate( + this global::System.Collections.Generic.IEnumerable>> results) + => (await global::System.Threading.Tasks.Task.WhenAll(results.Select(e => e)).ConfigureAwait(false)) .Aggregate(); - public static async System.Threading.Tasks.Task>> AggregateMany( - this System.Collections.Generic.IEnumerable>>> results) - => (await System.Threading.Tasks.Task.WhenAll(results.Select(e => e)).ConfigureAwait(false)) + public static async global::System.Threading.Tasks.Task>> AggregateMany( + this global::System.Collections.Generic.IEnumerable>>> results) + => (await global::System.Threading.Tasks.Task.WhenAll(results.Select(e => e)).ConfigureAwait(false)) .SelectMany(e => e) .Aggregate(); @@ -134,7 +134,7 @@ public static Result Bind(this System.Collections.Generic.IEnumerable public static Result<(T1, T2)> Aggregate(this Result r1, Result r2) => Aggregate(r1, r2, (v1, v2) => (v1, v2)); - public static Result Aggregate(this Result r1, Result r2, System.Func combine) + public static Result Aggregate(this Result r1, Result r2, global::System.Func combine) { if (r1 is Result.Ok_ ok1 && r2 is Result.Ok_ ok2) return combine(ok1.Value, ok2.Value); @@ -146,19 +146,19 @@ public static Result Aggregate(this Result r1, Res )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2) => Aggregate(r1, r2, (v1, v2) => (v1, v2)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2); return Aggregate(r1.Result, r2.Result, combine); } public static Result<(T1, T2, T3)> Aggregate(this Result r1, Result r2, Result r3) => Aggregate(r1, r2, r3, (v1, v2, v3) => (v1, v2, v3)); - public static Result Aggregate(this Result r1, Result r2, Result r3, System.Func combine) + public static Result Aggregate(this Result r1, Result r2, Result r3, global::System.Func combine) { if (r1 is Result.Ok_ ok1 && r2 is Result.Ok_ ok2 && r3 is Result.Ok_ ok3) return combine(ok1.Value, ok2.Value, ok3.Value); @@ -170,19 +170,19 @@ public static Result Aggregate(this Result r1, )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3) => Aggregate(r1, r2, r3, (v1, v2, v3) => (v1, v2, v3)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3); return Aggregate(r1.Result, r2.Result, r3.Result, combine); } public static Result<(T1, T2, T3, T4)> Aggregate(this Result r1, Result r2, Result r3, Result r4) => Aggregate(r1, r2, r3, r4, (v1, v2, v3, v4) => (v1, v2, v3, v4)); - public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, System.Func combine) + public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, global::System.Func combine) { if (r1 is Result.Ok_ ok1 && r2 is Result.Ok_ ok2 && r3 is Result.Ok_ ok3 && r4 is Result.Ok_ ok4) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value); @@ -194,19 +194,19 @@ public static Result Aggregate(this Result )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4) => Aggregate(r1, r2, r3, r4, (v1, v2, v3, v4) => (v1, v2, v3, v4)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, combine); } public static Result<(T1, T2, T3, T4, T5)> Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5) => Aggregate(r1, r2, r3, r4, r5, (v1, v2, v3, v4, v5) => (v1, v2, v3, v4, v5)); - public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, System.Func combine) + public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, global::System.Func combine) { if (r1 is Result.Ok_ ok1 && r2 is Result.Ok_ ok2 && r3 is Result.Ok_ ok3 && r4 is Result.Ok_ ok4 && r5 is Result.Ok_ ok5) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value); @@ -218,19 +218,19 @@ public static Result Aggregate(this Result )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5) => Aggregate(r1, r2, r3, r4, r5, (v1, v2, v3, v4, v5) => (v1, v2, v3, v4, v5)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, combine); } public static Result<(T1, T2, T3, T4, T5, T6)> Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6) => Aggregate(r1, r2, r3, r4, r5, r6, (v1, v2, v3, v4, v5, v6) => (v1, v2, v3, v4, v5, v6)); - public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, System.Func combine) + public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, global::System.Func combine) { if (r1 is Result.Ok_ ok1 && r2 is Result.Ok_ ok2 && r3 is Result.Ok_ ok3 && r4 is Result.Ok_ ok4 && r5 is Result.Ok_ ok5 && r6 is Result.Ok_ ok6) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value, ok6.Value); @@ -242,19 +242,19 @@ public static Result Aggregate(this Re )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6) => Aggregate(r1, r2, r3, r4, r5, r6, (v1, v2, v3, v4, v5, v6) => (v1, v2, v3, v4, v5, v6)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, r6.Result, combine); } public static Result<(T1, T2, T3, T4, T5, T6, T7)> Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7) => Aggregate(r1, r2, r3, r4, r5, r6, r7, (v1, v2, v3, v4, v5, v6, v7) => (v1, v2, v3, v4, v5, v6, v7)); - public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, System.Func combine) + public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, global::System.Func combine) { if (r1 is Result.Ok_ ok1 && r2 is Result.Ok_ ok2 && r3 is Result.Ok_ ok3 && r4 is Result.Ok_ ok4 && r5 is Result.Ok_ ok5 && r6 is Result.Ok_ ok6 && r7 is Result.Ok_ ok7) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value, ok6.Value, ok7.Value); @@ -266,19 +266,19 @@ public static Result Aggregate(thi )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7) => Aggregate(r1, r2, r3, r4, r5, r6, r7, (v1, v2, v3, v4, v5, v6, v7) => (v1, v2, v3, v4, v5, v6, v7)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, r6.Result, r7.Result, combine); } public static Result<(T1, T2, T3, T4, T5, T6, T7, T8)> Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8) => Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, (v1, v2, v3, v4, v5, v6, v7, v8) => (v1, v2, v3, v4, v5, v6, v7, v8)); - public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8, System.Func combine) + public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8, global::System.Func combine) { if (r1 is Result.Ok_ ok1 && r2 is Result.Ok_ ok2 && r3 is Result.Ok_ ok3 && r4 is Result.Ok_ ok4 && r5 is Result.Ok_ ok5 && r6 is Result.Ok_ ok6 && r7 is Result.Ok_ ok7 && r8 is Result.Ok_ ok8) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value, ok6.Value, ok7.Value, ok8.Value); @@ -290,19 +290,19 @@ public static Result Aggregate )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8) => Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, (v1, v2, v3, v4, v5, v6, v7, v8) => (v1, v2, v3, v4, v5, v6, v7, v8)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7, r8); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7, r8); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, r6.Result, r7.Result, r8.Result, combine); } public static Result<(T1, T2, T3, T4, T5, T6, T7, T8, T9)> Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8, Result r9) => Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, (v1, v2, v3, v4, v5, v6, v7, v8, v9) => (v1, v2, v3, v4, v5, v6, v7, v8, v9)); - public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8, Result r9, System.Func combine) + public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8, Result r9, global::System.Func combine) { if (r1 is Result.Ok_ ok1 && r2 is Result.Ok_ ok2 && r3 is Result.Ok_ ok3 && r4 is Result.Ok_ ok4 && r5 is Result.Ok_ ok5 && r6 is Result.Ok_ ok6 && r7 is Result.Ok_ ok7 && r8 is Result.Ok_ ok8 && r9 is Result.Ok_ ok9) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value, ok6.Value, ok7.Value, ok8.Value, ok9.Value); @@ -314,18 +314,18 @@ public static Result Aggregate> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Threading.Tasks.Task> r9) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Threading.Tasks.Task> r9) => Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, (v1, v2, v3, v4, v5, v6, v7, v8, v9) => (v1, v2, v3, v4, v5, v6, v7, v8, v9)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Threading.Tasks.Task> r9, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Threading.Tasks.Task> r9, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7, r8, r9); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7, r8, r9); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, r6.Result, r7.Result, r8.Result, r9.Result, combine); } - public static Result FirstOk(this System.Collections.Generic.IEnumerable> results, System.Func onEmpty) + public static Result FirstOk(this global::System.Collections.Generic.IEnumerable> results, global::System.Func onEmpty) { - var errors = new System.Collections.Generic.List(); + var errors = new global::System.Collections.Generic.List(); foreach (var result in results) { if (result is Result.Error_ e) @@ -340,24 +340,24 @@ public static Result FirstOk(this System.Collections.Generic.IEnumerable(MergeErrors(errors)); } - public static async System.Threading.Tasks.Task>> Aggregate( - this System.Collections.Generic.IEnumerable>> results, + public static async global::System.Threading.Tasks.Task>> Aggregate( + this global::System.Collections.Generic.IEnumerable>> results, int maxDegreeOfParallelism) => (await results.SelectAsync(e => e, maxDegreeOfParallelism).ConfigureAwait(false)) .Aggregate(); - public static async System.Threading.Tasks.Task>> AggregateMany( - this System.Collections.Generic.IEnumerable>>> results, + public static async global::System.Threading.Tasks.Task>> AggregateMany( + this global::System.Collections.Generic.IEnumerable>>> results, int maxDegreeOfParallelism) => (await results.SelectAsync(e => e, maxDegreeOfParallelism).ConfigureAwait(false)) .SelectMany(e => e) .Aggregate(); - static async System.Threading.Tasks.Task SelectAsync(this System.Collections.Generic.IEnumerable items, System.Func> selector, int maxDegreeOfParallelism) + static async global::System.Threading.Tasks.Task SelectAsync(this global::System.Collections.Generic.IEnumerable items, global::System.Func> selector, int maxDegreeOfParallelism) { - using (var throttler = new System.Threading.SemaphoreSlim(maxDegreeOfParallelism, maxDegreeOfParallelism)) + using (var throttler = new global::System.Threading.SemaphoreSlim(maxDegreeOfParallelism, maxDegreeOfParallelism)) { - return await System.Threading.Tasks.Task.WhenAll(items.Select(async item => + return await global::System.Threading.Tasks.Task.WhenAll(items.Select(async item => { // ReSharper disable once AccessToDisposedClosure await throttler.WaitAsync().ConfigureAwait(false); @@ -374,19 +374,19 @@ static async System.Threading.Tasks.Task SelectAsync(this Syste } } - public static Result> AllOk(this System.Collections.Generic.IEnumerable candidates, System.Func> validate) => + public static Result> AllOk(this global::System.Collections.Generic.IEnumerable candidates, global::System.Func> validate) => candidates .Select(c => c.Validate(validate)) .Aggregate(); - public static Result> AllOk(this System.Collections.Generic.IEnumerable> candidates, - System.Func> validate) => + public static Result> AllOk(this global::System.Collections.Generic.IEnumerable> candidates, + global::System.Func> validate) => candidates .Bind(items => items.AllOk(validate)); - public static Result Validate(this Result item, System.Func> validate) => item.Bind(i => i.Validate(validate)); + public static Result Validate(this Result item, global::System.Func> validate) => item.Bind(i => i.Validate(validate)); - public static Result Validate(this T item, System.Func> validate) + public static Result Validate(this T item, global::System.Func> validate) { try { @@ -395,21 +395,21 @@ public static Result Validate(this T item, System.Func(FunicularSwitch.Generators.Consumer.ErrorExtension.UnexpectedToStringError(e)); } } - public static Result FirstOk(this System.Collections.Generic.IEnumerable candidates, System.Func> validate, System.Func onEmpty) => + public static Result FirstOk(this global::System.Collections.Generic.IEnumerable candidates, global::System.Func> validate, global::System.Func onEmpty) => candidates .Select(r => r.Validate(validate)) .FirstOk(onEmpty); #region helpers - static String MergeErrors(System.Collections.Generic.IEnumerable errors) + static String MergeErrors(global::System.Collections.Generic.IEnumerable errors) { var first = true; String aggregated = default!; diff --git a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.ResultTypeGenerator/FunicularSwitch.Generators.Consumer.System.Result.g.cs b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.ResultTypeGenerator/FunicularSwitch.Generators.Consumer.System.Result.g.cs new file mode 100644 index 0000000..b79f14b --- /dev/null +++ b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.ResultTypeGenerator/FunicularSwitch.Generators.Consumer.System.Result.g.cs @@ -0,0 +1,418 @@ +#nullable enable +using global::System.Linq; +using FunicularSwitch; + +namespace FunicularSwitch.Generators.Consumer.System +{ +#pragma warning disable 1591 + public abstract partial class Result + { + public static Result Error(Action details) => new Result.Error_(details); + public static Result Ok(T value) => new Result.Ok_(value); + public bool IsError => GetType().GetGenericTypeDefinition() == typeof(Result<>.Error_); + public bool IsOk => !IsError; + public abstract Action? GetErrorOrDefault(); + + public static Result Try(global::System.Func action, global::System.Func formatError) + { + try + { + return action(); + } + catch (global::System.Exception e) + { + return Error(formatError(e)); + } + } + + public static async global::System.Threading.Tasks.Task> Try(global::System.Func> action, global::System.Func formatError) + { + try + { + return await action(); + } + catch (global::System.Exception e) + { + return Error(formatError(e)); + } + } + + public static Result Try(global::System.Func> action, global::System.Func formatError) + { + try + { + return action(); + } + catch (global::System.Exception e) + { + return Error(formatError(e)); + } + } + + public static async global::System.Threading.Tasks.Task> Try(global::System.Func>> action, global::System.Func formatError) + { + try + { + return await action(); + } + catch (global::System.Exception e) + { + return Error(formatError(e)); + } + } + } + + public abstract partial class Result : Result, global::System.Collections.Generic.IEnumerable + { + public static Result Error(Action message) => Error(message); + public static Result Ok(T value) => Ok(value); + + public static implicit operator Result(T value) => Result.Ok(value); + + public static bool operator true(Result result) => result.IsOk; + public static bool operator false(Result result) => result.IsError; + + public static bool operator !(Result result) => result.IsError; + + //just here to suppress warning, never called because all subtypes (Ok_, Error_) implement Equals and GetHashCode + bool Equals(Result other) => this switch + { + Ok_ ok => ok.Equals((object)other), + Error_ error => error.Equals((object)other), + _ => throw new global::System.InvalidOperationException($"Unexpected type derived from {nameof(Result)}") + }; + + public override int GetHashCode() => this switch + { + Ok_ ok => ok.GetHashCode(), + Error_ error => error.GetHashCode(), + _ => throw new global::System.InvalidOperationException($"Unexpected type derived from {nameof(Result)}") + }; + + public override bool Equals(object? obj) + { + if (ReferenceEquals(null, obj)) return false; + if (ReferenceEquals(this, obj)) return true; + if (obj.GetType() != this.GetType()) return false; + return Equals((Result)obj); + } + + public static bool operator ==(Result? left, Result? right) => Equals(left, right); + + public static bool operator !=(Result? left, Result? right) => !Equals(left, right); + + public void Match(global::System.Action ok, global::System.Action? error = null) => Match( + v => + { + ok.Invoke(v); + return 42; + }, + err => + { + error?.Invoke(err); + return 42; + }); + + public T1 Match(global::System.Func ok, global::System.Func error) + { + return this switch + { + Ok_ okResult => ok(okResult.Value), + Error_ errorResult => error(errorResult.Details), + _ => throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}") + }; + } + + public async global::System.Threading.Tasks.Task Match(global::System.Func> ok, global::System.Func> error) + { + return this switch + { + Ok_ okResult => await ok(okResult.Value).ConfigureAwait(false), + Error_ errorResult => await error(errorResult.Details).ConfigureAwait(false), + _ => throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}") + }; + } + + public global::System.Threading.Tasks.Task Match(global::System.Func> ok, global::System.Func error) => + Match(ok, e => global::System.Threading.Tasks.Task.FromResult(error(e))); + + public async global::System.Threading.Tasks.Task Match(global::System.Func ok) + { + if (this is Ok_ okResult) await ok(okResult.Value).ConfigureAwait(false); + } + + public T Match(global::System.Func error) => Match(v => v, error); + + public Result Bind(global::System.Func> bind) + { + switch (this) + { + case Ok_ ok: + try + { + return bind(ok.Value); + } + // ReSharper disable once RedundantCatchClause +#pragma warning disable CS0168 // Variable is declared but never used + catch (global::System.Exception e) +#pragma warning restore CS0168 // Variable is declared but never used + { + throw; //createGenericErrorResult + } + case Error_ error: + return error.Convert(); + default: + throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); + } + } + + public async global::System.Threading.Tasks.Task> Bind(global::System.Func>> bind) + { + switch (this) + { + case Ok_ ok: + try + { + return await bind(ok.Value).ConfigureAwait(false); + } + // ReSharper disable once RedundantCatchClause +#pragma warning disable CS0168 // Variable is declared but never used + catch (global::System.Exception e) +#pragma warning restore CS0168 // Variable is declared but never used + { + throw; //createGenericErrorResult + } + case Error_ error: + return error.Convert(); + default: + throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); + } + } + + public Result Map(global::System.Func map) + => Bind(value => Ok(map(value))); + + public global::System.Threading.Tasks.Task> Map(global::System.Func> map) + => Bind(async value => Ok(await map(value).ConfigureAwait(false))); + + public T? GetValueOrDefault() + => Match( + v => (T?)v, + _ => default + ); + + public T GetValueOrDefault(global::System.Func defaultValue) + => Match( + v => v, + _ => defaultValue() + ); + + public T GetValueOrDefault(T defaultValue) + => Match( + v => v, + _ => defaultValue + ); + + public T GetValueOrThrow() + => Match( + v => v, + details => throw new global::System.InvalidOperationException($"Cannot access error result value. Error: {details}")); + + public global::System.Collections.Generic.IEnumerator GetEnumerator() => Match(ok => new[] { ok }, _ => Enumerable.Empty()).GetEnumerator(); + + public override string ToString() => Match(ok => $"Ok {ok?.ToString()}", error => $"Error {error}"); + global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); + + public sealed partial class Ok_ : Result + { + public T Value { get; } + + public Ok_(T value) => Value = value; + + public override Action? GetErrorOrDefault() => null; + + public bool Equals(Ok_? other) + { + if (ReferenceEquals(null, other)) return false; + if (ReferenceEquals(this, other)) return true; + return global::System.Collections.Generic.EqualityComparer.Default.Equals(Value, other.Value); + } + + public override bool Equals(object? obj) + { + if (ReferenceEquals(null, obj)) return false; + if (ReferenceEquals(this, obj)) return true; + return obj is Ok_ other && Equals(other); + } + + public override int GetHashCode() => Value == null ? 0 : global::System.Collections.Generic.EqualityComparer.Default.GetHashCode(Value); + + public static bool operator ==(Ok_ left, Ok_ right) => Equals(left, right); + + public static bool operator !=(Ok_ left, Ok_ right) => !Equals(left, right); + } + + public sealed partial class Error_ : Result + { + public Action Details { get; } + + public Error_(Action details) => Details = details; + + public Result.Error_ Convert() => new Result.Error_(Details); + + public override Action? GetErrorOrDefault() => Details; + + public bool Equals(Error_? other) + { + if (ReferenceEquals(null, other)) return false; + if (ReferenceEquals(this, other)) return true; + return Equals(Details, other.Details); + } + + public override bool Equals(object? obj) + { + if (ReferenceEquals(null, obj)) return false; + if (ReferenceEquals(this, obj)) return true; + return obj is Error_ other && Equals(other); + } + + public override int GetHashCode() => Details.GetHashCode(); + + public static bool operator ==(Error_ left, Error_ right) => Equals(left, right); + + public static bool operator !=(Error_ left, Error_ right) => !Equals(left, right); + } + + } + + public static partial class ResultExtension + { + #region bind + + public static async global::System.Threading.Tasks.Task> Bind( + this global::System.Threading.Tasks.Task> result, + global::System.Func> bind) + => (await result.ConfigureAwait(false)).Bind(bind); + + public static async global::System.Threading.Tasks.Task> Bind( + this global::System.Threading.Tasks.Task> result, + global::System.Func>> bind) + => await (await result.ConfigureAwait(false)).Bind(bind).ConfigureAwait(false); + + #endregion + + #region map + + public static async global::System.Threading.Tasks.Task> Map( + this global::System.Threading.Tasks.Task> result, + global::System.Func map) + => (await result.ConfigureAwait(false)).Map(map); + + public static global::System.Threading.Tasks.Task> Map( + this global::System.Threading.Tasks.Task> result, + global::System.Func> bind) + => Bind(result, async v => Result.Ok(await bind(v).ConfigureAwait(false))); + + public static Result MapError(this Result result, global::System.Func mapError) + { + if (result is Result.Error_ e) + return Result.Error(mapError(e.Details)); + return result; + } + + public static async global::System.Threading.Tasks.Task> MapError(this global::System.Threading.Tasks.Task> result, global::System.Func mapError) => (await result.ConfigureAwait(false)).MapError(mapError); + + #endregion + + #region match + + public static async global::System.Threading.Tasks.Task Match( + this global::System.Threading.Tasks.Task> result, + global::System.Func> ok, + global::System.Func> error) + => await (await result.ConfigureAwait(false)).Match(ok, error).ConfigureAwait(false); + + public static async global::System.Threading.Tasks.Task Match( + this global::System.Threading.Tasks.Task> result, + global::System.Func> ok, + global::System.Func error) + => await (await result.ConfigureAwait(false)).Match(ok, error).ConfigureAwait(false); + + public static async global::System.Threading.Tasks.Task Match( + this global::System.Threading.Tasks.Task> result, + global::System.Func ok, + global::System.Func error) + => (await result.ConfigureAwait(false)).Match(ok, error); + + #endregion + + public static Result Flatten(this Result> result) => result.Bind(r => r); + + public static Result As(this Result result, global::System.Func errorTIsNotT1) => + result.Bind(r => + { + if (r is T1 converted) + return converted; + return Result.Error(errorTIsNotT1()); + }); + + public static Result As(this Result result, global::System.Func errorIsNotT1) => + result.As(errorIsNotT1); + + #region query-expression pattern + + public static Result Select(this Result result, global::System.Func selector) => result.Map(selector); + public static global::System.Threading.Tasks.Task> Select(this global::System.Threading.Tasks.Task> result, global::System.Func selector) => result.Map(selector); + + public static Result SelectMany(this Result result, global::System.Func> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static global::System.Threading.Tasks.Task> SelectMany(this global::System.Threading.Tasks.Task> result, global::System.Func>> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static global::System.Threading.Tasks.Task> SelectMany(this global::System.Threading.Tasks.Task> result, global::System.Func> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static global::System.Threading.Tasks.Task> SelectMany(this Result result, global::System.Func>> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + + #endregion + } +} + +namespace FunicularSwitch.Generators.Consumer.System.Extensions +{ + public static partial class ResultExtension + { + public static global::System.Collections.Generic.IEnumerable Choose( + this global::System.Collections.Generic.IEnumerable items, + global::System.Func> choose, + global::System.Action onError) + => items + .Select(i => choose(i)) + .Choose(onError); + + public static global::System.Collections.Generic.IEnumerable Choose( + this global::System.Collections.Generic.IEnumerable> results, + global::System.Action onError) + => results + .Where(r => + r.Match(_ => true, error => + { + onError(error); + return false; + })) + .Select(r => r.GetValueOrThrow()); + + public static Result As(this object item, global::System.Func error) => + !(item is T t) ? Result.Error(error()) : t; + + public static Result NotNull(this T? item, global::System.Func error) => + item ?? Result.Error(error()); + + public static Result NotNullOrEmpty(this string? s, global::System.Func error) + => string.IsNullOrEmpty(s) ? Result.Error(error()) : s!; + + public static Result NotNullOrWhiteSpace(this string? s, global::System.Func error) + => string.IsNullOrWhiteSpace(s) ? Result.Error(error()) : s!; + + public static Result First(this global::System.Collections.Generic.IEnumerable candidates, global::System.Func predicate, global::System.Func noMatch) => + candidates + .FirstOrDefault(i => predicate(i)) + .NotNull(noMatch); + } +#pragma warning restore 1591 +} diff --git a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.UnionTypeGenerator/FunicularSwitchGeneratorsConsumerArgumentExceptionMatchExtension.g.cs b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.UnionTypeGenerator/FunicularSwitchGeneratorsConsumerArgumentExceptionMatchExtension.g.cs new file mode 100644 index 0000000..be07cdf --- /dev/null +++ b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.UnionTypeGenerator/FunicularSwitchGeneratorsConsumerArgumentExceptionMatchExtension.g.cs @@ -0,0 +1,71 @@ +#pragma warning disable 1591 +namespace FunicularSwitch.Generators.Consumer +{ + public static partial class ArgumentExceptionMatchExtension + { + public static T Match(this FunicularSwitch.Generators.Consumer.ArgumentException argumentException, global::System.Func action, global::System.Func func) => + argumentException switch + { + FunicularSwitch.Generators.Consumer.ArgumentException.Action_ case1 => action(case1), + FunicularSwitch.Generators.Consumer.ArgumentException.Func_ case2 => func(case2), + _ => throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Generators.Consumer.ArgumentException: {argumentException.GetType().Name}") + }; + + public static global::System.Threading.Tasks.Task Match(this FunicularSwitch.Generators.Consumer.ArgumentException argumentException, global::System.Func> action, global::System.Func> func) => + argumentException switch + { + FunicularSwitch.Generators.Consumer.ArgumentException.Action_ case1 => action(case1), + FunicularSwitch.Generators.Consumer.ArgumentException.Func_ case2 => func(case2), + _ => throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Generators.Consumer.ArgumentException: {argumentException.GetType().Name}") + }; + + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task argumentException, global::System.Func action, global::System.Func func) => + (await argumentException.ConfigureAwait(false)).Match(action, func); + + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task argumentException, global::System.Func> action, global::System.Func> func) => + await (await argumentException.ConfigureAwait(false)).Match(action, func).ConfigureAwait(false); + + public static void Switch(this FunicularSwitch.Generators.Consumer.ArgumentException argumentException, global::System.Action action, global::System.Action func) + { + switch (argumentException) + { + case FunicularSwitch.Generators.Consumer.ArgumentException.Action_ case1: + action(case1); + break; + case FunicularSwitch.Generators.Consumer.ArgumentException.Func_ case2: + func(case2); + break; + default: + throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Generators.Consumer.ArgumentException: {argumentException.GetType().Name}"); + } + } + + public static async global::System.Threading.Tasks.Task Switch(this FunicularSwitch.Generators.Consumer.ArgumentException argumentException, global::System.Func action, global::System.Func func) + { + switch (argumentException) + { + case FunicularSwitch.Generators.Consumer.ArgumentException.Action_ case1: + await action(case1).ConfigureAwait(false); + break; + case FunicularSwitch.Generators.Consumer.ArgumentException.Func_ case2: + await func(case2).ConfigureAwait(false); + break; + default: + throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Generators.Consumer.ArgumentException: {argumentException.GetType().Name}"); + } + } + + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task argumentException, global::System.Action action, global::System.Action func) => + (await argumentException.ConfigureAwait(false)).Switch(action, func); + + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task argumentException, global::System.Func action, global::System.Func func) => + await (await argumentException.ConfigureAwait(false)).Switch(action, func).ConfigureAwait(false); + } + + public abstract partial record ArgumentException + { + public static FunicularSwitch.Generators.Consumer.ArgumentException Action() => new FunicularSwitch.Generators.Consumer.ArgumentException.Action_(); + public static FunicularSwitch.Generators.Consumer.ArgumentException Func() => new FunicularSwitch.Generators.Consumer.ArgumentException.Func_(); + } +} +#pragma warning restore 1591 diff --git a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.UnionTypeGenerator/FunicularSwitchGeneratorsConsumerErrorMatchExtension.g.cs b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.UnionTypeGenerator/FunicularSwitchGeneratorsConsumerErrorMatchExtension.g.cs index 120bbf0..43b3e14 100644 --- a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.UnionTypeGenerator/FunicularSwitchGeneratorsConsumerErrorMatchExtension.g.cs +++ b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.UnionTypeGenerator/FunicularSwitchGeneratorsConsumerErrorMatchExtension.g.cs @@ -3,33 +3,33 @@ namespace FunicularSwitch.Generators.Consumer { public static partial class ErrorMatchExtension { - public static T Match(this FunicularSwitch.Generators.Consumer.Error error, System.Func generic, System.Func notFound, System.Func notAuthorized, System.Func aggregated) => + public static T Match(this FunicularSwitch.Generators.Consumer.Error error, global::System.Func generic, global::System.Func notFound, global::System.Func notAuthorized, global::System.Func aggregated) => error switch { FunicularSwitch.Generators.Consumer.Error.Generic_ case1 => generic(case1), FunicularSwitch.Generators.Consumer.Error.NotFound_ case2 => notFound(case2), FunicularSwitch.Generators.Consumer.Error.NotAuthorized_ case3 => notAuthorized(case3), FunicularSwitch.Generators.Consumer.Error.Aggregated_ case4 => aggregated(case4), - _ => throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Generators.Consumer.Error: {error.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Generators.Consumer.Error: {error.GetType().Name}") }; - public static System.Threading.Tasks.Task Match(this FunicularSwitch.Generators.Consumer.Error error, System.Func> generic, System.Func> notFound, System.Func> notAuthorized, System.Func> aggregated) => + public static global::System.Threading.Tasks.Task Match(this FunicularSwitch.Generators.Consumer.Error error, global::System.Func> generic, global::System.Func> notFound, global::System.Func> notAuthorized, global::System.Func> aggregated) => error switch { FunicularSwitch.Generators.Consumer.Error.Generic_ case1 => generic(case1), FunicularSwitch.Generators.Consumer.Error.NotFound_ case2 => notFound(case2), FunicularSwitch.Generators.Consumer.Error.NotAuthorized_ case3 => notAuthorized(case3), FunicularSwitch.Generators.Consumer.Error.Aggregated_ case4 => aggregated(case4), - _ => throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Generators.Consumer.Error: {error.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Generators.Consumer.Error: {error.GetType().Name}") }; - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task error, System.Func generic, System.Func notFound, System.Func notAuthorized, System.Func aggregated) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task error, global::System.Func generic, global::System.Func notFound, global::System.Func notAuthorized, global::System.Func aggregated) => (await error.ConfigureAwait(false)).Match(generic, notFound, notAuthorized, aggregated); - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task error, System.Func> generic, System.Func> notFound, System.Func> notAuthorized, System.Func> aggregated) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task error, global::System.Func> generic, global::System.Func> notFound, global::System.Func> notAuthorized, global::System.Func> aggregated) => await (await error.ConfigureAwait(false)).Match(generic, notFound, notAuthorized, aggregated).ConfigureAwait(false); - public static void Switch(this FunicularSwitch.Generators.Consumer.Error error, System.Action generic, System.Action notFound, System.Action notAuthorized, System.Action aggregated) + public static void Switch(this FunicularSwitch.Generators.Consumer.Error error, global::System.Action generic, global::System.Action notFound, global::System.Action notAuthorized, global::System.Action aggregated) { switch (error) { @@ -46,11 +46,11 @@ public static void Switch(this FunicularSwitch.Generators.Consumer.Error error, aggregated(case4); break; default: - throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Generators.Consumer.Error: {error.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Generators.Consumer.Error: {error.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this FunicularSwitch.Generators.Consumer.Error error, System.Func generic, System.Func notFound, System.Func notAuthorized, System.Func aggregated) + public static async global::System.Threading.Tasks.Task Switch(this FunicularSwitch.Generators.Consumer.Error error, global::System.Func generic, global::System.Func notFound, global::System.Func notAuthorized, global::System.Func aggregated) { switch (error) { @@ -67,14 +67,14 @@ public static async System.Threading.Tasks.Task Switch(this FunicularSwitch.Gene await aggregated(case4).ConfigureAwait(false); break; default: - throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Generators.Consumer.Error: {error.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Generators.Consumer.Error: {error.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task error, System.Action generic, System.Action notFound, System.Action notAuthorized, System.Action aggregated) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task error, global::System.Action generic, global::System.Action notFound, global::System.Action notAuthorized, global::System.Action aggregated) => (await error.ConfigureAwait(false)).Switch(generic, notFound, notAuthorized, aggregated); - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task error, System.Func generic, System.Func notFound, System.Func notAuthorized, System.Func aggregated) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task error, global::System.Func generic, global::System.Func notFound, global::System.Func notAuthorized, global::System.Func aggregated) => await (await error.ConfigureAwait(false)).Switch(generic, notFound, notAuthorized, aggregated).ConfigureAwait(false); } diff --git a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.UnionTypeGenerator/FunicularSwitchGeneratorsConsumerSystemArgumentExceptionMatchExtension.g.cs b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.UnionTypeGenerator/FunicularSwitchGeneratorsConsumerSystemArgumentExceptionMatchExtension.g.cs new file mode 100644 index 0000000..4455b38 --- /dev/null +++ b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.UnionTypeGenerator/FunicularSwitchGeneratorsConsumerSystemArgumentExceptionMatchExtension.g.cs @@ -0,0 +1,71 @@ +#pragma warning disable 1591 +namespace FunicularSwitch.Generators.Consumer.System +{ + public static partial class ArgumentExceptionMatchExtension + { + public static T Match(this FunicularSwitch.Generators.Consumer.System.ArgumentException argumentException, global::System.Func action, global::System.Func func) => + argumentException switch + { + FunicularSwitch.Generators.Consumer.System.ArgumentException.Action_ case1 => action(case1), + FunicularSwitch.Generators.Consumer.System.ArgumentException.Func_ case2 => func(case2), + _ => throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Generators.Consumer.System.ArgumentException: {argumentException.GetType().Name}") + }; + + public static global::System.Threading.Tasks.Task Match(this FunicularSwitch.Generators.Consumer.System.ArgumentException argumentException, global::System.Func> action, global::System.Func> func) => + argumentException switch + { + FunicularSwitch.Generators.Consumer.System.ArgumentException.Action_ case1 => action(case1), + FunicularSwitch.Generators.Consumer.System.ArgumentException.Func_ case2 => func(case2), + _ => throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Generators.Consumer.System.ArgumentException: {argumentException.GetType().Name}") + }; + + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task argumentException, global::System.Func action, global::System.Func func) => + (await argumentException.ConfigureAwait(false)).Match(action, func); + + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task argumentException, global::System.Func> action, global::System.Func> func) => + await (await argumentException.ConfigureAwait(false)).Match(action, func).ConfigureAwait(false); + + public static void Switch(this FunicularSwitch.Generators.Consumer.System.ArgumentException argumentException, global::System.Action action, global::System.Action func) + { + switch (argumentException) + { + case FunicularSwitch.Generators.Consumer.System.ArgumentException.Action_ case1: + action(case1); + break; + case FunicularSwitch.Generators.Consumer.System.ArgumentException.Func_ case2: + func(case2); + break; + default: + throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Generators.Consumer.System.ArgumentException: {argumentException.GetType().Name}"); + } + } + + public static async global::System.Threading.Tasks.Task Switch(this FunicularSwitch.Generators.Consumer.System.ArgumentException argumentException, global::System.Func action, global::System.Func func) + { + switch (argumentException) + { + case FunicularSwitch.Generators.Consumer.System.ArgumentException.Action_ case1: + await action(case1).ConfigureAwait(false); + break; + case FunicularSwitch.Generators.Consumer.System.ArgumentException.Func_ case2: + await func(case2).ConfigureAwait(false); + break; + default: + throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Generators.Consumer.System.ArgumentException: {argumentException.GetType().Name}"); + } + } + + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task argumentException, global::System.Action action, global::System.Action func) => + (await argumentException.ConfigureAwait(false)).Switch(action, func); + + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task argumentException, global::System.Func action, global::System.Func func) => + await (await argumentException.ConfigureAwait(false)).Switch(action, func).ConfigureAwait(false); + } + + public abstract partial record ArgumentException + { + public static FunicularSwitch.Generators.Consumer.System.ArgumentException Action() => new FunicularSwitch.Generators.Consumer.System.ArgumentException.Action_(); + public static FunicularSwitch.Generators.Consumer.System.ArgumentException Func() => new FunicularSwitch.Generators.Consumer.System.ArgumentException.Func_(); + } +} +#pragma warning restore 1591 diff --git a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.UnionTypeGenerator/FunicularSwitchGeneratorsConsumerWithPrimaryConstructorMatchExtension.g.cs b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.UnionTypeGenerator/FunicularSwitchGeneratorsConsumerWithPrimaryConstructorMatchExtension.g.cs index 6f98551..54ba831 100644 --- a/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.UnionTypeGenerator/FunicularSwitchGeneratorsConsumerWithPrimaryConstructorMatchExtension.g.cs +++ b/Source/Tests/FunicularSwitch.Generators.Consumer/Generated/FunicularSwitch.Generators/FunicularSwitch.Generators.UnionTypeGenerator/FunicularSwitchGeneratorsConsumerWithPrimaryConstructorMatchExtension.g.cs @@ -3,27 +3,27 @@ namespace FunicularSwitch.Generators.Consumer { public static partial class WithPrimaryConstructorMatchExtension { - public static T Match(this FunicularSwitch.Generators.Consumer.WithPrimaryConstructor withPrimaryConstructor, System.Func derivedWithPrimaryConstructor) => + public static T Match(this FunicularSwitch.Generators.Consumer.WithPrimaryConstructor withPrimaryConstructor, global::System.Func derivedWithPrimaryConstructor) => withPrimaryConstructor switch { FunicularSwitch.Generators.Consumer.DerivedWithPrimaryConstructor case1 => derivedWithPrimaryConstructor(case1), - _ => throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Generators.Consumer.WithPrimaryConstructor: {withPrimaryConstructor.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Generators.Consumer.WithPrimaryConstructor: {withPrimaryConstructor.GetType().Name}") }; - public static System.Threading.Tasks.Task Match(this FunicularSwitch.Generators.Consumer.WithPrimaryConstructor withPrimaryConstructor, System.Func> derivedWithPrimaryConstructor) => + public static global::System.Threading.Tasks.Task Match(this FunicularSwitch.Generators.Consumer.WithPrimaryConstructor withPrimaryConstructor, global::System.Func> derivedWithPrimaryConstructor) => withPrimaryConstructor switch { FunicularSwitch.Generators.Consumer.DerivedWithPrimaryConstructor case1 => derivedWithPrimaryConstructor(case1), - _ => throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Generators.Consumer.WithPrimaryConstructor: {withPrimaryConstructor.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Generators.Consumer.WithPrimaryConstructor: {withPrimaryConstructor.GetType().Name}") }; - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task withPrimaryConstructor, System.Func derivedWithPrimaryConstructor) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task withPrimaryConstructor, global::System.Func derivedWithPrimaryConstructor) => (await withPrimaryConstructor.ConfigureAwait(false)).Match(derivedWithPrimaryConstructor); - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task withPrimaryConstructor, System.Func> derivedWithPrimaryConstructor) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task withPrimaryConstructor, global::System.Func> derivedWithPrimaryConstructor) => await (await withPrimaryConstructor.ConfigureAwait(false)).Match(derivedWithPrimaryConstructor).ConfigureAwait(false); - public static void Switch(this FunicularSwitch.Generators.Consumer.WithPrimaryConstructor withPrimaryConstructor, System.Action derivedWithPrimaryConstructor) + public static void Switch(this FunicularSwitch.Generators.Consumer.WithPrimaryConstructor withPrimaryConstructor, global::System.Action derivedWithPrimaryConstructor) { switch (withPrimaryConstructor) { @@ -31,11 +31,11 @@ public static void Switch(this FunicularSwitch.Generators.Consumer.WithPrimaryCo derivedWithPrimaryConstructor(case1); break; default: - throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Generators.Consumer.WithPrimaryConstructor: {withPrimaryConstructor.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Generators.Consumer.WithPrimaryConstructor: {withPrimaryConstructor.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this FunicularSwitch.Generators.Consumer.WithPrimaryConstructor withPrimaryConstructor, System.Func derivedWithPrimaryConstructor) + public static async global::System.Threading.Tasks.Task Switch(this FunicularSwitch.Generators.Consumer.WithPrimaryConstructor withPrimaryConstructor, global::System.Func derivedWithPrimaryConstructor) { switch (withPrimaryConstructor) { @@ -43,14 +43,14 @@ public static async System.Threading.Tasks.Task Switch(this FunicularSwitch.Gene await derivedWithPrimaryConstructor(case1).ConfigureAwait(false); break; default: - throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Generators.Consumer.WithPrimaryConstructor: {withPrimaryConstructor.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Generators.Consumer.WithPrimaryConstructor: {withPrimaryConstructor.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task withPrimaryConstructor, System.Action derivedWithPrimaryConstructor) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task withPrimaryConstructor, global::System.Action derivedWithPrimaryConstructor) => (await withPrimaryConstructor.ConfigureAwait(false)).Switch(derivedWithPrimaryConstructor); - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task withPrimaryConstructor, System.Func derivedWithPrimaryConstructor) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task withPrimaryConstructor, global::System.Func derivedWithPrimaryConstructor) => await (await withPrimaryConstructor.ConfigureAwait(false)).Switch(derivedWithPrimaryConstructor).ConfigureAwait(false); } diff --git a/Source/Tests/FunicularSwitch.Generators.Consumer/TrickyNamespacesSpecs.cs b/Source/Tests/FunicularSwitch.Generators.Consumer/TrickyNamespacesSpecs.cs new file mode 100644 index 0000000..8d207bb --- /dev/null +++ b/Source/Tests/FunicularSwitch.Generators.Consumer/TrickyNamespacesSpecs.cs @@ -0,0 +1,32 @@ +// ReSharper disable once CheckNamespace +namespace FunicularSwitch.Generators.Consumer.System +{ + [ExtendedEnum] + public enum MyEnum + { + One, + Two + } + + public class Action; + + [UnionType] + public abstract partial record ArgumentException() + { + public record Func_() : ArgumentException; + public record Action_() : ArgumentException; + } + + [ResultType(typeof(Action))] + public abstract partial class Result; +} + +namespace FunicularSwitch.Generators.Consumer +{ + [UnionType] + public abstract partial record ArgumentException() + { + public record Func_() : ArgumentException; + public record Action_() : ArgumentException; + } +} \ No newline at end of file diff --git a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_enum_match_method_generator.For_enum_type#FunicularSwitchTesttestMatchExtension.g.verified.cs b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_enum_match_method_generator.For_enum_type#FunicularSwitchTesttestMatchExtension.g.verified.cs index d340194..2cd87b1 100644 --- a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_enum_match_method_generator.For_enum_type#FunicularSwitchTesttestMatchExtension.g.verified.cs +++ b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_enum_match_method_generator.For_enum_type#FunicularSwitchTesttestMatchExtension.g.verified.cs @@ -4,29 +4,29 @@ namespace FunicularSwitch.Test { public static partial class testMatchExtension { - public static T Match(this FunicularSwitch.Test.test test, System.Func one, System.Func two) => + public static T Match(this FunicularSwitch.Test.test test, global::System.Func one, global::System.Func two) => test switch { FunicularSwitch.Test.test.one => one(), FunicularSwitch.Test.test.two => two(), - _ => throw new System.ArgumentException($"Unknown enum value from FunicularSwitch.Test.test: {test.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown enum value from FunicularSwitch.Test.test: {test.GetType().Name}") }; - public static System.Threading.Tasks.Task Match(this FunicularSwitch.Test.test test, System.Func> one, System.Func> two) => + public static global::System.Threading.Tasks.Task Match(this FunicularSwitch.Test.test test, global::System.Func> one, global::System.Func> two) => test switch { FunicularSwitch.Test.test.one => one(), FunicularSwitch.Test.test.two => two(), - _ => throw new System.ArgumentException($"Unknown enum value from FunicularSwitch.Test.test: {test.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown enum value from FunicularSwitch.Test.test: {test.GetType().Name}") }; - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task test, System.Func one, System.Func two) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task test, global::System.Func one, global::System.Func two) => (await test.ConfigureAwait(false)).Match(one, two); - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task test, System.Func> one, System.Func> two) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task test, global::System.Func> one, global::System.Func> two) => await (await test.ConfigureAwait(false)).Match(one, two).ConfigureAwait(false); - public static void Switch(this FunicularSwitch.Test.test test, System.Action one, System.Action two) + public static void Switch(this FunicularSwitch.Test.test test, global::System.Action one, global::System.Action two) { switch (test) { @@ -37,11 +37,11 @@ public static void Switch(this FunicularSwitch.Test.test test, System.Action one two(); break; default: - throw new System.ArgumentException($"Unknown enum value from FunicularSwitch.Test.test: {test.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown enum value from FunicularSwitch.Test.test: {test.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this FunicularSwitch.Test.test test, System.Func one, System.Func two) + public static async global::System.Threading.Tasks.Task Switch(this FunicularSwitch.Test.test test, global::System.Func one, global::System.Func two) { switch (test) { @@ -52,14 +52,14 @@ public static async System.Threading.Tasks.Task Switch(this FunicularSwitch.Test await two().ConfigureAwait(false); break; default: - throw new System.ArgumentException($"Unknown enum value from FunicularSwitch.Test.test: {test.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown enum value from FunicularSwitch.Test.test: {test.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task test, System.Action one, System.Action two) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task test, global::System.Action one, global::System.Action two) => (await test.ConfigureAwait(false)).Switch(one, two); - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task test, System.Func one, System.Func two) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task test, global::System.Func one, global::System.Func two) => await (await test.ConfigureAwait(false)).Switch(one, two).ConfigureAwait(false); } } diff --git a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_enum_match_method_generator.For_enum_type_embedded#FunicularSwitchTestOutertestMatchExtension.g.verified.cs b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_enum_match_method_generator.For_enum_type_embedded#FunicularSwitchTestOutertestMatchExtension.g.verified.cs index cbceffc..27e8769 100644 --- a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_enum_match_method_generator.For_enum_type_embedded#FunicularSwitchTestOutertestMatchExtension.g.verified.cs +++ b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_enum_match_method_generator.For_enum_type_embedded#FunicularSwitchTestOutertestMatchExtension.g.verified.cs @@ -4,29 +4,29 @@ namespace FunicularSwitch.Test { public static partial class Outer_testMatchExtension { - public static T Match(this FunicularSwitch.Test.Outer.test test, System.Func one, System.Func two) => + public static T Match(this FunicularSwitch.Test.Outer.test test, global::System.Func one, global::System.Func two) => test switch { FunicularSwitch.Test.Outer.test.one => one(), FunicularSwitch.Test.Outer.test.two => two(), - _ => throw new System.ArgumentException($"Unknown enum value from FunicularSwitch.Test.Outer.test: {test.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown enum value from FunicularSwitch.Test.Outer.test: {test.GetType().Name}") }; - public static System.Threading.Tasks.Task Match(this FunicularSwitch.Test.Outer.test test, System.Func> one, System.Func> two) => + public static global::System.Threading.Tasks.Task Match(this FunicularSwitch.Test.Outer.test test, global::System.Func> one, global::System.Func> two) => test switch { FunicularSwitch.Test.Outer.test.one => one(), FunicularSwitch.Test.Outer.test.two => two(), - _ => throw new System.ArgumentException($"Unknown enum value from FunicularSwitch.Test.Outer.test: {test.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown enum value from FunicularSwitch.Test.Outer.test: {test.GetType().Name}") }; - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task test, System.Func one, System.Func two) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task test, global::System.Func one, global::System.Func two) => (await test.ConfigureAwait(false)).Match(one, two); - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task test, System.Func> one, System.Func> two) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task test, global::System.Func> one, global::System.Func> two) => await (await test.ConfigureAwait(false)).Match(one, two).ConfigureAwait(false); - public static void Switch(this FunicularSwitch.Test.Outer.test test, System.Action one, System.Action two) + public static void Switch(this FunicularSwitch.Test.Outer.test test, global::System.Action one, global::System.Action two) { switch (test) { @@ -37,11 +37,11 @@ public static void Switch(this FunicularSwitch.Test.Outer.test test, System.Acti two(); break; default: - throw new System.ArgumentException($"Unknown enum value from FunicularSwitch.Test.Outer.test: {test.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown enum value from FunicularSwitch.Test.Outer.test: {test.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this FunicularSwitch.Test.Outer.test test, System.Func one, System.Func two) + public static async global::System.Threading.Tasks.Task Switch(this FunicularSwitch.Test.Outer.test test, global::System.Func one, global::System.Func two) { switch (test) { @@ -52,14 +52,14 @@ public static async System.Threading.Tasks.Task Switch(this FunicularSwitch.Test await two().ConfigureAwait(false); break; default: - throw new System.ArgumentException($"Unknown enum value from FunicularSwitch.Test.Outer.test: {test.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown enum value from FunicularSwitch.Test.Outer.test: {test.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task test, System.Action one, System.Action two) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task test, global::System.Action one, global::System.Action two) => (await test.ConfigureAwait(false)).Switch(one, two); - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task test, System.Func one, System.Func two) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task test, global::System.Func one, global::System.Func two) => await (await test.ConfigureAwait(false)).Switch(one, two).ConfigureAwait(false); } } diff --git a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_enum_match_method_generator.For_enum_type_with_order#FunicularSwitchTesttestMatchExtension.g.verified.cs b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_enum_match_method_generator.For_enum_type_with_order#FunicularSwitchTesttestMatchExtension.g.verified.cs index d340194..2cd87b1 100644 --- a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_enum_match_method_generator.For_enum_type_with_order#FunicularSwitchTesttestMatchExtension.g.verified.cs +++ b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_enum_match_method_generator.For_enum_type_with_order#FunicularSwitchTesttestMatchExtension.g.verified.cs @@ -4,29 +4,29 @@ namespace FunicularSwitch.Test { public static partial class testMatchExtension { - public static T Match(this FunicularSwitch.Test.test test, System.Func one, System.Func two) => + public static T Match(this FunicularSwitch.Test.test test, global::System.Func one, global::System.Func two) => test switch { FunicularSwitch.Test.test.one => one(), FunicularSwitch.Test.test.two => two(), - _ => throw new System.ArgumentException($"Unknown enum value from FunicularSwitch.Test.test: {test.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown enum value from FunicularSwitch.Test.test: {test.GetType().Name}") }; - public static System.Threading.Tasks.Task Match(this FunicularSwitch.Test.test test, System.Func> one, System.Func> two) => + public static global::System.Threading.Tasks.Task Match(this FunicularSwitch.Test.test test, global::System.Func> one, global::System.Func> two) => test switch { FunicularSwitch.Test.test.one => one(), FunicularSwitch.Test.test.two => two(), - _ => throw new System.ArgumentException($"Unknown enum value from FunicularSwitch.Test.test: {test.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown enum value from FunicularSwitch.Test.test: {test.GetType().Name}") }; - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task test, System.Func one, System.Func two) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task test, global::System.Func one, global::System.Func two) => (await test.ConfigureAwait(false)).Match(one, two); - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task test, System.Func> one, System.Func> two) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task test, global::System.Func> one, global::System.Func> two) => await (await test.ConfigureAwait(false)).Match(one, two).ConfigureAwait(false); - public static void Switch(this FunicularSwitch.Test.test test, System.Action one, System.Action two) + public static void Switch(this FunicularSwitch.Test.test test, global::System.Action one, global::System.Action two) { switch (test) { @@ -37,11 +37,11 @@ public static void Switch(this FunicularSwitch.Test.test test, System.Action one two(); break; default: - throw new System.ArgumentException($"Unknown enum value from FunicularSwitch.Test.test: {test.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown enum value from FunicularSwitch.Test.test: {test.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this FunicularSwitch.Test.test test, System.Func one, System.Func two) + public static async global::System.Threading.Tasks.Task Switch(this FunicularSwitch.Test.test test, global::System.Func one, global::System.Func two) { switch (test) { @@ -52,14 +52,14 @@ public static async System.Threading.Tasks.Task Switch(this FunicularSwitch.Test await two().ConfigureAwait(false); break; default: - throw new System.ArgumentException($"Unknown enum value from FunicularSwitch.Test.test: {test.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown enum value from FunicularSwitch.Test.test: {test.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task test, System.Action one, System.Action two) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task test, global::System.Action one, global::System.Action two) => (await test.ConfigureAwait(false)).Switch(one, two); - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task test, System.Func one, System.Func two) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task test, global::System.Func one, global::System.Func two) => await (await test.ConfigureAwait(false)).Switch(one, two).ConfigureAwait(false); } } diff --git a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_enum_error_type#FunicularSwitch.Test.OperationResult.g.verified.cs b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_enum_error_type#FunicularSwitch.Test.OperationResult.g.verified.cs index 82c1d63..ff31b66 100644 --- a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_enum_error_type#FunicularSwitch.Test.OperationResult.g.verified.cs +++ b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_enum_error_type#FunicularSwitch.Test.OperationResult.g.verified.cs @@ -1,6 +1,6 @@ //HintName: FunicularSwitch.Test.OperationResult.g.cs #nullable enable -using System.Linq; +using global::System.Linq; using FunicularSwitch; namespace FunicularSwitch.Test @@ -14,56 +14,56 @@ public abstract partial class OperationResult public bool IsOk => !IsError; public abstract MyError? GetErrorOrDefault(); - public static OperationResult Try(System.Func action, System.Func formatError) + public static OperationResult Try(global::System.Func action, global::System.Func formatError) { try { return action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } - public static async System.Threading.Tasks.Task> Try(System.Func> action, System.Func formatError) + public static async global::System.Threading.Tasks.Task> Try(global::System.Func> action, global::System.Func formatError) { try { return await action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } - public static OperationResult Try(System.Func> action, System.Func formatError) + public static OperationResult Try(global::System.Func> action, global::System.Func formatError) { try { return action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } - public static async System.Threading.Tasks.Task> Try(System.Func>> action, System.Func formatError) + public static async global::System.Threading.Tasks.Task> Try(global::System.Func>> action, global::System.Func formatError) { try { return await action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } } - public abstract partial class OperationResult : OperationResult, System.Collections.Generic.IEnumerable + public abstract partial class OperationResult : OperationResult, global::System.Collections.Generic.IEnumerable { public static OperationResult Error(MyError message) => Error(message); public static OperationResult Ok(T value) => Ok(value); @@ -80,14 +80,14 @@ public abstract partial class OperationResult : OperationResult, System.Colle { Ok_ ok => ok.Equals((object)other), Error_ error => error.Equals((object)other), - _ => throw new System.InvalidOperationException($"Unexpected type derived from {nameof(OperationResult)}") + _ => throw new global::System.InvalidOperationException($"Unexpected type derived from {nameof(OperationResult)}") }; public override int GetHashCode() => this switch { Ok_ ok => ok.GetHashCode(), Error_ error => error.GetHashCode(), - _ => throw new System.InvalidOperationException($"Unexpected type derived from {nameof(OperationResult)}") + _ => throw new global::System.InvalidOperationException($"Unexpected type derived from {nameof(OperationResult)}") }; public override bool Equals(object? obj) @@ -102,7 +102,7 @@ public override bool Equals(object? obj) public static bool operator !=(OperationResult? left, OperationResult? right) => !Equals(left, right); - public void Match(System.Action ok, System.Action? error = null) => Match( + public void Match(global::System.Action ok, global::System.Action? error = null) => Match( v => { ok.Invoke(v); @@ -114,37 +114,37 @@ public void Match(System.Action ok, System.Action? error = null) => return 42; }); - public T1 Match(System.Func ok, System.Func error) + public T1 Match(global::System.Func ok, global::System.Func error) { return this switch { Ok_ okOperationResult => ok(okOperationResult.Value), Error_ errorOperationResult => error(errorOperationResult.Details), - _ => throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}") + _ => throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}") }; } - public async System.Threading.Tasks.Task Match(System.Func> ok, System.Func> error) + public async global::System.Threading.Tasks.Task Match(global::System.Func> ok, global::System.Func> error) { return this switch { Ok_ okOperationResult => await ok(okOperationResult.Value).ConfigureAwait(false), Error_ errorOperationResult => await error(errorOperationResult.Details).ConfigureAwait(false), - _ => throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}") + _ => throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}") }; } - public System.Threading.Tasks.Task Match(System.Func> ok, System.Func error) => - Match(ok, e => System.Threading.Tasks.Task.FromResult(error(e))); + public global::System.Threading.Tasks.Task Match(global::System.Func> ok, global::System.Func error) => + Match(ok, e => global::System.Threading.Tasks.Task.FromResult(error(e))); - public async System.Threading.Tasks.Task Match(System.Func ok) + public async global::System.Threading.Tasks.Task Match(global::System.Func ok) { if (this is Ok_ okOperationResult) await ok(okOperationResult.Value).ConfigureAwait(false); } - public T Match(System.Func error) => Match(v => v, error); + public T Match(global::System.Func error) => Match(v => v, error); - public OperationResult Bind(System.Func> bind) + public OperationResult Bind(global::System.Func> bind) { switch (this) { @@ -155,7 +155,7 @@ public OperationResult Bind(System.Func> bind) } // ReSharper disable once RedundantCatchClause #pragma warning disable CS0168 // Variable is declared but never used - catch (System.Exception e) + catch (global::System.Exception e) #pragma warning restore CS0168 // Variable is declared but never used { throw; //createGenericErrorResult @@ -163,11 +163,11 @@ public OperationResult Bind(System.Func> bind) case Error_ error: return error.Convert(); default: - throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); + throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); } } - public async System.Threading.Tasks.Task> Bind(System.Func>> bind) + public async global::System.Threading.Tasks.Task> Bind(global::System.Func>> bind) { switch (this) { @@ -178,7 +178,7 @@ public async System.Threading.Tasks.Task> Bind(System.Fu } // ReSharper disable once RedundantCatchClause #pragma warning disable CS0168 // Variable is declared but never used - catch (System.Exception e) + catch (global::System.Exception e) #pragma warning restore CS0168 // Variable is declared but never used { throw; //createGenericErrorResult @@ -186,14 +186,14 @@ public async System.Threading.Tasks.Task> Bind(System.Fu case Error_ error: return error.Convert(); default: - throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); + throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); } } - public OperationResult Map(System.Func map) + public OperationResult Map(global::System.Func map) => Bind(value => Ok(map(value))); - public System.Threading.Tasks.Task> Map(System.Func> map) + public global::System.Threading.Tasks.Task> Map(global::System.Func> map) => Bind(async value => Ok(await map(value).ConfigureAwait(false))); public T? GetValueOrDefault() @@ -202,7 +202,7 @@ public System.Threading.Tasks.Task> Map(System.Func default ); - public T GetValueOrDefault(System.Func defaultValue) + public T GetValueOrDefault(global::System.Func defaultValue) => Match( v => v, _ => defaultValue() @@ -217,12 +217,12 @@ public T GetValueOrDefault(T defaultValue) public T GetValueOrThrow() => Match( v => v, - details => throw new System.InvalidOperationException($"Cannot access error result value. Error: {details}")); + details => throw new global::System.InvalidOperationException($"Cannot access error result value. Error: {details}")); - public System.Collections.Generic.IEnumerator GetEnumerator() => Match(ok => new[] { ok }, _ => Enumerable.Empty()).GetEnumerator(); + public global::System.Collections.Generic.IEnumerator GetEnumerator() => Match(ok => new[] { ok }, _ => Enumerable.Empty()).GetEnumerator(); public override string ToString() => Match(ok => $"Ok {ok?.ToString()}", error => $"Error {error}"); - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); + global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); public sealed partial class Ok_ : OperationResult { @@ -236,7 +236,7 @@ public bool Equals(Ok_? other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; - return System.Collections.Generic.EqualityComparer.Default.Equals(Value, other.Value); + return global::System.Collections.Generic.EqualityComparer.Default.Equals(Value, other.Value); } public override bool Equals(object? obj) @@ -246,7 +246,7 @@ public override bool Equals(object? obj) return obj is Ok_ other && Equals(other); } - public override int GetHashCode() => Value == null ? 0 : System.Collections.Generic.EqualityComparer.Default.GetHashCode(Value); + public override int GetHashCode() => Value == null ? 0 : global::System.Collections.Generic.EqualityComparer.Default.GetHashCode(Value); public static bool operator ==(Ok_ left, Ok_ right) => Equals(left, right); @@ -290,66 +290,66 @@ public static partial class OperationResultExtension { #region bind - public static async System.Threading.Tasks.Task> Bind( - this System.Threading.Tasks.Task> result, - System.Func> bind) + public static async global::System.Threading.Tasks.Task> Bind( + this global::System.Threading.Tasks.Task> result, + global::System.Func> bind) => (await result.ConfigureAwait(false)).Bind(bind); - public static async System.Threading.Tasks.Task> Bind( - this System.Threading.Tasks.Task> result, - System.Func>> bind) + public static async global::System.Threading.Tasks.Task> Bind( + this global::System.Threading.Tasks.Task> result, + global::System.Func>> bind) => await (await result.ConfigureAwait(false)).Bind(bind).ConfigureAwait(false); #endregion #region map - public static async System.Threading.Tasks.Task> Map( - this System.Threading.Tasks.Task> result, - System.Func map) + public static async global::System.Threading.Tasks.Task> Map( + this global::System.Threading.Tasks.Task> result, + global::System.Func map) => (await result.ConfigureAwait(false)).Map(map); - public static System.Threading.Tasks.Task> Map( - this System.Threading.Tasks.Task> result, - System.Func> bind) + public static global::System.Threading.Tasks.Task> Map( + this global::System.Threading.Tasks.Task> result, + global::System.Func> bind) => Bind(result, async v => OperationResult.Ok(await bind(v).ConfigureAwait(false))); - public static OperationResult MapError(this OperationResult result, System.Func mapError) + public static OperationResult MapError(this OperationResult result, global::System.Func mapError) { if (result is OperationResult.Error_ e) return OperationResult.Error(mapError(e.Details)); return result; } - public static async System.Threading.Tasks.Task> MapError(this System.Threading.Tasks.Task> result, System.Func mapError) => (await result.ConfigureAwait(false)).MapError(mapError); + public static async global::System.Threading.Tasks.Task> MapError(this global::System.Threading.Tasks.Task> result, global::System.Func mapError) => (await result.ConfigureAwait(false)).MapError(mapError); #endregion #region match - public static async System.Threading.Tasks.Task Match( - this System.Threading.Tasks.Task> result, - System.Func> ok, - System.Func> error) + public static async global::System.Threading.Tasks.Task Match( + this global::System.Threading.Tasks.Task> result, + global::System.Func> ok, + global::System.Func> error) => await (await result.ConfigureAwait(false)).Match(ok, error).ConfigureAwait(false); - public static async System.Threading.Tasks.Task Match( - this System.Threading.Tasks.Task> result, - System.Func> ok, - System.Func error) + public static async global::System.Threading.Tasks.Task Match( + this global::System.Threading.Tasks.Task> result, + global::System.Func> ok, + global::System.Func error) => await (await result.ConfigureAwait(false)).Match(ok, error).ConfigureAwait(false); - public static async System.Threading.Tasks.Task Match( - this System.Threading.Tasks.Task> result, - System.Func ok, - System.Func error) + public static async global::System.Threading.Tasks.Task Match( + this global::System.Threading.Tasks.Task> result, + global::System.Func ok, + global::System.Func error) => (await result.ConfigureAwait(false)).Match(ok, error); #endregion public static OperationResult Flatten(this OperationResult> result) => result.Bind(r => r); - public static OperationResult As(this OperationResult result, System.Func errorTIsNotT1) => + public static OperationResult As(this OperationResult result, global::System.Func errorTIsNotT1) => result.Bind(r => { if (r is T1 converted) @@ -357,18 +357,18 @@ public static OperationResult As(this OperationResult result, Syst return OperationResult.Error(errorTIsNotT1()); }); - public static OperationResult As(this OperationResult result, System.Func errorIsNotT1) => + public static OperationResult As(this OperationResult result, global::System.Func errorIsNotT1) => result.As(errorIsNotT1); #region query-expression pattern - public static OperationResult Select(this OperationResult result, System.Func selector) => result.Map(selector); - public static System.Threading.Tasks.Task> Select(this System.Threading.Tasks.Task> result, System.Func selector) => result.Map(selector); + public static OperationResult Select(this OperationResult result, global::System.Func selector) => result.Map(selector); + public static global::System.Threading.Tasks.Task> Select(this global::System.Threading.Tasks.Task> result, global::System.Func selector) => result.Map(selector); - public static OperationResult SelectMany(this OperationResult result, System.Func> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); - public static System.Threading.Tasks.Task> SelectMany(this System.Threading.Tasks.Task> result, System.Func>> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); - public static System.Threading.Tasks.Task> SelectMany(this System.Threading.Tasks.Task> result, System.Func> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); - public static System.Threading.Tasks.Task> SelectMany(this OperationResult result, System.Func>> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static OperationResult SelectMany(this OperationResult result, global::System.Func> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static global::System.Threading.Tasks.Task> SelectMany(this global::System.Threading.Tasks.Task> result, global::System.Func>> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static global::System.Threading.Tasks.Task> SelectMany(this global::System.Threading.Tasks.Task> result, global::System.Func> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static global::System.Threading.Tasks.Task> SelectMany(this OperationResult result, global::System.Func>> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); #endregion } @@ -378,17 +378,17 @@ namespace FunicularSwitch.Test.Extensions { public static partial class OperationResultExtension { - public static System.Collections.Generic.IEnumerable Choose( - this System.Collections.Generic.IEnumerable items, - System.Func> choose, - System.Action onError) + public static global::System.Collections.Generic.IEnumerable Choose( + this global::System.Collections.Generic.IEnumerable items, + global::System.Func> choose, + global::System.Action onError) => items .Select(i => choose(i)) .Choose(onError); - public static System.Collections.Generic.IEnumerable Choose( - this System.Collections.Generic.IEnumerable> results, - System.Action onError) + public static global::System.Collections.Generic.IEnumerable Choose( + this global::System.Collections.Generic.IEnumerable> results, + global::System.Action onError) => results .Where(r => r.Match(_ => true, error => @@ -398,19 +398,19 @@ public static System.Collections.Generic.IEnumerable Choose( })) .Select(r => r.GetValueOrThrow()); - public static OperationResult As(this object item, System.Func error) => + public static OperationResult As(this object item, global::System.Func error) => !(item is T t) ? OperationResult.Error(error()) : t; - public static OperationResult NotNull(this T? item, System.Func error) => + public static OperationResult NotNull(this T? item, global::System.Func error) => item ?? OperationResult.Error(error()); - public static OperationResult NotNullOrEmpty(this string? s, System.Func error) + public static OperationResult NotNullOrEmpty(this string? s, global::System.Func error) => string.IsNullOrEmpty(s) ? OperationResult.Error(error()) : s!; - public static OperationResult NotNullOrWhiteSpace(this string? s, System.Func error) + public static OperationResult NotNullOrWhiteSpace(this string? s, global::System.Func error) => string.IsNullOrWhiteSpace(s) ? OperationResult.Error(error()) : s!; - public static OperationResult First(this System.Collections.Generic.IEnumerable candidates, System.Func predicate, System.Func noMatch) => + public static OperationResult First(this global::System.Collections.Generic.IEnumerable candidates, global::System.Func predicate, global::System.Func noMatch) => candidates .FirstOrDefault(i => predicate(i)) .NotNull(noMatch); diff --git a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_enum_error_type#FunicularSwitch.Test.OperationResultWithMerge.g.verified.cs b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_enum_error_type#FunicularSwitch.Test.OperationResultWithMerge.g.verified.cs index e2899ef..4999d4d 100644 --- a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_enum_error_type#FunicularSwitch.Test.OperationResultWithMerge.g.verified.cs +++ b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_enum_error_type#FunicularSwitch.Test.OperationResultWithMerge.g.verified.cs @@ -1,6 +1,6 @@ //HintName: FunicularSwitch.Test.OperationResultWithMerge.g.cs #nullable enable -using System.Linq; +using global::System.Linq; using FunicularSwitch; namespace FunicularSwitch.Test @@ -11,92 +11,92 @@ public abstract partial class OperationResult public static OperationResult<(T1, T2)> Aggregate(OperationResult r1, OperationResult r2) => OperationResultExtension.Aggregate(r1, r2); - public static OperationResult Aggregate(OperationResult r1, OperationResult r2, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, combine); + public static OperationResult Aggregate(OperationResult r1, OperationResult r2, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2) => OperationResultExtension.Aggregate(r1, r2); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2) => OperationResultExtension.Aggregate(r1, r2); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, combine); public static OperationResult<(T1, T2, T3)> Aggregate(OperationResult r1, OperationResult r2, OperationResult r3) => OperationResultExtension.Aggregate(r1, r2, r3); - public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, combine); + public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3) => OperationResultExtension.Aggregate(r1, r2, r3); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3) => OperationResultExtension.Aggregate(r1, r2, r3); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, combine); public static OperationResult<(T1, T2, T3, T4)> Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4) => OperationResultExtension.Aggregate(r1, r2, r3, r4); - public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, combine); + public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4) => OperationResultExtension.Aggregate(r1, r2, r3, r4); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4) => OperationResultExtension.Aggregate(r1, r2, r3, r4); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, combine); public static OperationResult<(T1, T2, T3, T4, T5)> Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5); - public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, combine); + public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, combine); public static OperationResult<(T1, T2, T3, T4, T5, T6)> Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6); - public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, combine); + public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, combine); public static OperationResult<(T1, T2, T3, T4, T5, T6, T7)> Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7); - public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, combine); + public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, combine); public static OperationResult<(T1, T2, T3, T4, T5, T6, T7, T8)> Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8); - public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, combine); + public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, combine); public static OperationResult<(T1, T2, T3, T4, T5, T6, T7, T8, T9)> Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, OperationResult r9) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9); - public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, OperationResult r9, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, combine); + public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, OperationResult r9, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Threading.Tasks.Task> r9) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Threading.Tasks.Task> r9) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Threading.Tasks.Task> r9, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Threading.Tasks.Task> r9, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, combine); } public static partial class OperationResultExtension { - public static OperationResult> Map(this System.Collections.Generic.IEnumerable> results, - System.Func map) => + public static OperationResult> Map(this global::System.Collections.Generic.IEnumerable> results, + global::System.Func map) => results.Select(r => r.Map(map)).Aggregate(); - public static OperationResult> Bind(this System.Collections.Generic.IEnumerable> results, - System.Func> bind) => + public static OperationResult> Bind(this global::System.Collections.Generic.IEnumerable> results, + global::System.Func> bind) => results.Select(r => r.Bind(bind)).Aggregate(); - public static OperationResult> Bind(this OperationResult result, - System.Func>> bindMany) => + public static OperationResult> Bind(this OperationResult result, + global::System.Func>> bindMany) => result.Map(ok => bindMany(ok).Aggregate()).Flatten(); - public static OperationResult Bind(this System.Collections.Generic.IEnumerable> results, - System.Func, OperationResult> bind) => + public static OperationResult Bind(this global::System.Collections.Generic.IEnumerable> results, + global::System.Func, OperationResult> bind) => results.Aggregate().Bind(bind); - public static OperationResult> Aggregate(this System.Collections.Generic.IEnumerable> results) + public static OperationResult> Aggregate(this global::System.Collections.Generic.IEnumerable> results) { var isError = false; MyError aggregated = default!; - var oks = new System.Collections.Generic.List(); + var oks = new global::System.Collections.Generic.List(); foreach (var result in results) { result.Match( @@ -110,23 +110,23 @@ public static OperationResult Bind(this System.Collections.Generic.IE } return isError - ? OperationResult.Error>(aggregated) - : OperationResult.Ok>(oks); + ? OperationResult.Error>(aggregated) + : OperationResult.Ok>(oks); } - public static async System.Threading.Tasks.Task>> Aggregate( - this System.Threading.Tasks.Task>> results) + public static async global::System.Threading.Tasks.Task>> Aggregate( + this global::System.Threading.Tasks.Task>> results) => (await results.ConfigureAwait(false)) .Aggregate(); - public static async System.Threading.Tasks.Task>> Aggregate( - this System.Collections.Generic.IEnumerable>> results) - => (await System.Threading.Tasks.Task.WhenAll(results.Select(e => e)).ConfigureAwait(false)) + public static async global::System.Threading.Tasks.Task>> Aggregate( + this global::System.Collections.Generic.IEnumerable>> results) + => (await global::System.Threading.Tasks.Task.WhenAll(results.Select(e => e)).ConfigureAwait(false)) .Aggregate(); - public static async System.Threading.Tasks.Task>> AggregateMany( - this System.Collections.Generic.IEnumerable>>> results) - => (await System.Threading.Tasks.Task.WhenAll(results.Select(e => e)).ConfigureAwait(false)) + public static async global::System.Threading.Tasks.Task>> AggregateMany( + this global::System.Collections.Generic.IEnumerable>>> results) + => (await global::System.Threading.Tasks.Task.WhenAll(results.Select(e => e)).ConfigureAwait(false)) .SelectMany(e => e) .Aggregate(); @@ -134,7 +134,7 @@ public static OperationResult Bind(this System.Collections.Generic.IE public static OperationResult<(T1, T2)> Aggregate(this OperationResult r1, OperationResult r2) => Aggregate(r1, r2, (v1, v2) => (v1, v2)); - public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, System.Func combine) + public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, global::System.Func combine) { if (r1 is OperationResult.Ok_ ok1 && r2 is OperationResult.Ok_ ok2) return combine(ok1.Value, ok2.Value); @@ -146,19 +146,19 @@ public static OperationResult Aggregate(this Operation )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2) => Aggregate(r1, r2, (v1, v2) => (v1, v2)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2); return Aggregate(r1.Result, r2.Result, combine); } public static OperationResult<(T1, T2, T3)> Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3) => Aggregate(r1, r2, r3, (v1, v2, v3) => (v1, v2, v3)); - public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, System.Func combine) + public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, global::System.Func combine) { if (r1 is OperationResult.Ok_ ok1 && r2 is OperationResult.Ok_ ok2 && r3 is OperationResult.Ok_ ok3) return combine(ok1.Value, ok2.Value, ok3.Value); @@ -170,19 +170,19 @@ public static OperationResult Aggregate(this Opera )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3) => Aggregate(r1, r2, r3, (v1, v2, v3) => (v1, v2, v3)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3); return Aggregate(r1.Result, r2.Result, r3.Result, combine); } public static OperationResult<(T1, T2, T3, T4)> Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4) => Aggregate(r1, r2, r3, r4, (v1, v2, v3, v4) => (v1, v2, v3, v4)); - public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, System.Func combine) + public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, global::System.Func combine) { if (r1 is OperationResult.Ok_ ok1 && r2 is OperationResult.Ok_ ok2 && r3 is OperationResult.Ok_ ok3 && r4 is OperationResult.Ok_ ok4) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value); @@ -194,19 +194,19 @@ public static OperationResult Aggregate(this O )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4) => Aggregate(r1, r2, r3, r4, (v1, v2, v3, v4) => (v1, v2, v3, v4)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, combine); } public static OperationResult<(T1, T2, T3, T4, T5)> Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5) => Aggregate(r1, r2, r3, r4, r5, (v1, v2, v3, v4, v5) => (v1, v2, v3, v4, v5)); - public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, System.Func combine) + public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, global::System.Func combine) { if (r1 is OperationResult.Ok_ ok1 && r2 is OperationResult.Ok_ ok2 && r3 is OperationResult.Ok_ ok3 && r4 is OperationResult.Ok_ ok4 && r5 is OperationResult.Ok_ ok5) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value); @@ -218,19 +218,19 @@ public static OperationResult Aggregate(th )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5) => Aggregate(r1, r2, r3, r4, r5, (v1, v2, v3, v4, v5) => (v1, v2, v3, v4, v5)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, combine); } public static OperationResult<(T1, T2, T3, T4, T5, T6)> Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6) => Aggregate(r1, r2, r3, r4, r5, r6, (v1, v2, v3, v4, v5, v6) => (v1, v2, v3, v4, v5, v6)); - public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, System.Func combine) + public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, global::System.Func combine) { if (r1 is OperationResult.Ok_ ok1 && r2 is OperationResult.Ok_ ok2 && r3 is OperationResult.Ok_ ok3 && r4 is OperationResult.Ok_ ok4 && r5 is OperationResult.Ok_ ok5 && r6 is OperationResult.Ok_ ok6) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value, ok6.Value); @@ -242,19 +242,19 @@ public static OperationResult Aggregate> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6) => Aggregate(r1, r2, r3, r4, r5, r6, (v1, v2, v3, v4, v5, v6) => (v1, v2, v3, v4, v5, v6)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, r6.Result, combine); } public static OperationResult<(T1, T2, T3, T4, T5, T6, T7)> Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7) => Aggregate(r1, r2, r3, r4, r5, r6, r7, (v1, v2, v3, v4, v5, v6, v7) => (v1, v2, v3, v4, v5, v6, v7)); - public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, System.Func combine) + public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, global::System.Func combine) { if (r1 is OperationResult.Ok_ ok1 && r2 is OperationResult.Ok_ ok2 && r3 is OperationResult.Ok_ ok3 && r4 is OperationResult.Ok_ ok4 && r5 is OperationResult.Ok_ ok5 && r6 is OperationResult.Ok_ ok6 && r7 is OperationResult.Ok_ ok7) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value, ok6.Value, ok7.Value); @@ -266,19 +266,19 @@ public static OperationResult Aggregate> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7) => Aggregate(r1, r2, r3, r4, r5, r6, r7, (v1, v2, v3, v4, v5, v6, v7) => (v1, v2, v3, v4, v5, v6, v7)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, r6.Result, r7.Result, combine); } public static OperationResult<(T1, T2, T3, T4, T5, T6, T7, T8)> Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8) => Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, (v1, v2, v3, v4, v5, v6, v7, v8) => (v1, v2, v3, v4, v5, v6, v7, v8)); - public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, System.Func combine) + public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, global::System.Func combine) { if (r1 is OperationResult.Ok_ ok1 && r2 is OperationResult.Ok_ ok2 && r3 is OperationResult.Ok_ ok3 && r4 is OperationResult.Ok_ ok4 && r5 is OperationResult.Ok_ ok5 && r6 is OperationResult.Ok_ ok6 && r7 is OperationResult.Ok_ ok7 && r8 is OperationResult.Ok_ ok8) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value, ok6.Value, ok7.Value, ok8.Value); @@ -290,19 +290,19 @@ public static OperationResult Aggregate> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8) => Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, (v1, v2, v3, v4, v5, v6, v7, v8) => (v1, v2, v3, v4, v5, v6, v7, v8)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7, r8); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7, r8); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, r6.Result, r7.Result, r8.Result, combine); } public static OperationResult<(T1, T2, T3, T4, T5, T6, T7, T8, T9)> Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, OperationResult r9) => Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, (v1, v2, v3, v4, v5, v6, v7, v8, v9) => (v1, v2, v3, v4, v5, v6, v7, v8, v9)); - public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, OperationResult r9, System.Func combine) + public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, OperationResult r9, global::System.Func combine) { if (r1 is OperationResult.Ok_ ok1 && r2 is OperationResult.Ok_ ok2 && r3 is OperationResult.Ok_ ok3 && r4 is OperationResult.Ok_ ok4 && r5 is OperationResult.Ok_ ok5 && r6 is OperationResult.Ok_ ok6 && r7 is OperationResult.Ok_ ok7 && r8 is OperationResult.Ok_ ok8 && r9 is OperationResult.Ok_ ok9) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value, ok6.Value, ok7.Value, ok8.Value, ok9.Value); @@ -314,18 +314,18 @@ public static OperationResult Aggregate> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Threading.Tasks.Task> r9) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Threading.Tasks.Task> r9) => Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, (v1, v2, v3, v4, v5, v6, v7, v8, v9) => (v1, v2, v3, v4, v5, v6, v7, v8, v9)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Threading.Tasks.Task> r9, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Threading.Tasks.Task> r9, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7, r8, r9); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7, r8, r9); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, r6.Result, r7.Result, r8.Result, r9.Result, combine); } - public static OperationResult FirstOk(this System.Collections.Generic.IEnumerable> results, System.Func onEmpty) + public static OperationResult FirstOk(this global::System.Collections.Generic.IEnumerable> results, global::System.Func onEmpty) { - var errors = new System.Collections.Generic.List(); + var errors = new global::System.Collections.Generic.List(); foreach (var result in results) { if (result is OperationResult.Error_ e) @@ -340,24 +340,24 @@ public static OperationResult FirstOk(this System.Collections.Generic.IEnu return OperationResult.Error(MergeErrors(errors)); } - public static async System.Threading.Tasks.Task>> Aggregate( - this System.Collections.Generic.IEnumerable>> results, + public static async global::System.Threading.Tasks.Task>> Aggregate( + this global::System.Collections.Generic.IEnumerable>> results, int maxDegreeOfParallelism) => (await results.SelectAsync(e => e, maxDegreeOfParallelism).ConfigureAwait(false)) .Aggregate(); - public static async System.Threading.Tasks.Task>> AggregateMany( - this System.Collections.Generic.IEnumerable>>> results, + public static async global::System.Threading.Tasks.Task>> AggregateMany( + this global::System.Collections.Generic.IEnumerable>>> results, int maxDegreeOfParallelism) => (await results.SelectAsync(e => e, maxDegreeOfParallelism).ConfigureAwait(false)) .SelectMany(e => e) .Aggregate(); - static async System.Threading.Tasks.Task SelectAsync(this System.Collections.Generic.IEnumerable items, System.Func> selector, int maxDegreeOfParallelism) + static async global::System.Threading.Tasks.Task SelectAsync(this global::System.Collections.Generic.IEnumerable items, global::System.Func> selector, int maxDegreeOfParallelism) { - using (var throttler = new System.Threading.SemaphoreSlim(maxDegreeOfParallelism, maxDegreeOfParallelism)) + using (var throttler = new global::System.Threading.SemaphoreSlim(maxDegreeOfParallelism, maxDegreeOfParallelism)) { - return await System.Threading.Tasks.Task.WhenAll(items.Select(async item => + return await global::System.Threading.Tasks.Task.WhenAll(items.Select(async item => { // ReSharper disable once AccessToDisposedClosure await throttler.WaitAsync().ConfigureAwait(false); @@ -374,19 +374,19 @@ static async System.Threading.Tasks.Task SelectAsync(this Syste } } - public static OperationResult> AllOk(this System.Collections.Generic.IEnumerable candidates, System.Func> validate) => + public static OperationResult> AllOk(this global::System.Collections.Generic.IEnumerable candidates, global::System.Func> validate) => candidates .Select(c => c.Validate(validate)) .Aggregate(); - public static OperationResult> AllOk(this System.Collections.Generic.IEnumerable> candidates, - System.Func> validate) => + public static OperationResult> AllOk(this global::System.Collections.Generic.IEnumerable> candidates, + global::System.Func> validate) => candidates .Bind(items => items.AllOk(validate)); - public static OperationResult Validate(this OperationResult item, System.Func> validate) => item.Bind(i => i.Validate(validate)); + public static OperationResult Validate(this OperationResult item, global::System.Func> validate) => item.Bind(i => i.Validate(validate)); - public static OperationResult Validate(this T item, System.Func> validate) + public static OperationResult Validate(this T item, global::System.Func> validate) { try { @@ -395,21 +395,21 @@ public static OperationResult Validate(this T item, System.Func FirstOk(this System.Collections.Generic.IEnumerable candidates, System.Func> validate, System.Func onEmpty) => + public static OperationResult FirstOk(this global::System.Collections.Generic.IEnumerable candidates, global::System.Func> validate, global::System.Func onEmpty) => candidates .Select(r => r.Validate(validate)) .FirstOk(onEmpty); #region helpers - static MyError MergeErrors(System.Collections.Generic.IEnumerable errors) + static MyError MergeErrors(global::System.Collections.Generic.IEnumerable errors) { var first = true; MyError aggregated = default!; diff --git a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_enum_error_type#FunicularSwitch.Test.Result.g.verified.cs b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_enum_error_type#FunicularSwitch.Test.Result.g.verified.cs index bb4f560..cc5e6eb 100644 --- a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_enum_error_type#FunicularSwitch.Test.Result.g.verified.cs +++ b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_enum_error_type#FunicularSwitch.Test.Result.g.verified.cs @@ -1,6 +1,6 @@ //HintName: FunicularSwitch.Test.Result.g.cs #nullable enable -using System.Linq; +using global::System.Linq; using FunicularSwitch; using System; @@ -15,56 +15,56 @@ public abstract partial class Result public bool IsOk => !IsError; public abstract String? GetErrorOrDefault(); - public static Result Try(System.Func action, System.Func formatError) + public static Result Try(global::System.Func action, global::System.Func formatError) { try { return action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } - public static async System.Threading.Tasks.Task> Try(System.Func> action, System.Func formatError) + public static async global::System.Threading.Tasks.Task> Try(global::System.Func> action, global::System.Func formatError) { try { return await action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } - public static Result Try(System.Func> action, System.Func formatError) + public static Result Try(global::System.Func> action, global::System.Func formatError) { try { return action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } - public static async System.Threading.Tasks.Task> Try(System.Func>> action, System.Func formatError) + public static async global::System.Threading.Tasks.Task> Try(global::System.Func>> action, global::System.Func formatError) { try { return await action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } } - public abstract partial class Result : Result, System.Collections.Generic.IEnumerable + public abstract partial class Result : Result, global::System.Collections.Generic.IEnumerable { public static Result Error(String message) => Error(message); public static Result Ok(T value) => Ok(value); @@ -81,14 +81,14 @@ public abstract partial class Result : Result, System.Collections.Generic.IEn { Ok_ ok => ok.Equals((object)other), Error_ error => error.Equals((object)other), - _ => throw new System.InvalidOperationException($"Unexpected type derived from {nameof(Result)}") + _ => throw new global::System.InvalidOperationException($"Unexpected type derived from {nameof(Result)}") }; public override int GetHashCode() => this switch { Ok_ ok => ok.GetHashCode(), Error_ error => error.GetHashCode(), - _ => throw new System.InvalidOperationException($"Unexpected type derived from {nameof(Result)}") + _ => throw new global::System.InvalidOperationException($"Unexpected type derived from {nameof(Result)}") }; public override bool Equals(object? obj) @@ -103,7 +103,7 @@ public override bool Equals(object? obj) public static bool operator !=(Result? left, Result? right) => !Equals(left, right); - public void Match(System.Action ok, System.Action? error = null) => Match( + public void Match(global::System.Action ok, global::System.Action? error = null) => Match( v => { ok.Invoke(v); @@ -115,37 +115,37 @@ public void Match(System.Action ok, System.Action? error = null) => M return 42; }); - public T1 Match(System.Func ok, System.Func error) + public T1 Match(global::System.Func ok, global::System.Func error) { return this switch { Ok_ okResult => ok(okResult.Value), Error_ errorResult => error(errorResult.Details), - _ => throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}") + _ => throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}") }; } - public async System.Threading.Tasks.Task Match(System.Func> ok, System.Func> error) + public async global::System.Threading.Tasks.Task Match(global::System.Func> ok, global::System.Func> error) { return this switch { Ok_ okResult => await ok(okResult.Value).ConfigureAwait(false), Error_ errorResult => await error(errorResult.Details).ConfigureAwait(false), - _ => throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}") + _ => throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}") }; } - public System.Threading.Tasks.Task Match(System.Func> ok, System.Func error) => - Match(ok, e => System.Threading.Tasks.Task.FromResult(error(e))); + public global::System.Threading.Tasks.Task Match(global::System.Func> ok, global::System.Func error) => + Match(ok, e => global::System.Threading.Tasks.Task.FromResult(error(e))); - public async System.Threading.Tasks.Task Match(System.Func ok) + public async global::System.Threading.Tasks.Task Match(global::System.Func ok) { if (this is Ok_ okResult) await ok(okResult.Value).ConfigureAwait(false); } - public T Match(System.Func error) => Match(v => v, error); + public T Match(global::System.Func error) => Match(v => v, error); - public Result Bind(System.Func> bind) + public Result Bind(global::System.Func> bind) { switch (this) { @@ -156,7 +156,7 @@ public Result Bind(System.Func> bind) } // ReSharper disable once RedundantCatchClause #pragma warning disable CS0168 // Variable is declared but never used - catch (System.Exception e) + catch (global::System.Exception e) #pragma warning restore CS0168 // Variable is declared but never used { throw; //createGenericErrorResult @@ -164,11 +164,11 @@ public Result Bind(System.Func> bind) case Error_ error: return error.Convert(); default: - throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); + throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); } } - public async System.Threading.Tasks.Task> Bind(System.Func>> bind) + public async global::System.Threading.Tasks.Task> Bind(global::System.Func>> bind) { switch (this) { @@ -179,7 +179,7 @@ public async System.Threading.Tasks.Task> Bind(System.Func> Bind(System.Func(); default: - throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); + throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); } } - public Result Map(System.Func map) + public Result Map(global::System.Func map) => Bind(value => Ok(map(value))); - public System.Threading.Tasks.Task> Map(System.Func> map) + public global::System.Threading.Tasks.Task> Map(global::System.Func> map) => Bind(async value => Ok(await map(value).ConfigureAwait(false))); public T? GetValueOrDefault() @@ -203,7 +203,7 @@ public System.Threading.Tasks.Task> Map(System.Func default ); - public T GetValueOrDefault(System.Func defaultValue) + public T GetValueOrDefault(global::System.Func defaultValue) => Match( v => v, _ => defaultValue() @@ -218,12 +218,12 @@ public T GetValueOrDefault(T defaultValue) public T GetValueOrThrow() => Match( v => v, - details => throw new System.InvalidOperationException($"Cannot access error result value. Error: {details}")); + details => throw new global::System.InvalidOperationException($"Cannot access error result value. Error: {details}")); - public System.Collections.Generic.IEnumerator GetEnumerator() => Match(ok => new[] { ok }, _ => Enumerable.Empty()).GetEnumerator(); + public global::System.Collections.Generic.IEnumerator GetEnumerator() => Match(ok => new[] { ok }, _ => Enumerable.Empty()).GetEnumerator(); public override string ToString() => Match(ok => $"Ok {ok?.ToString()}", error => $"Error {error}"); - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); + global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); public sealed partial class Ok_ : Result { @@ -237,7 +237,7 @@ public bool Equals(Ok_? other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; - return System.Collections.Generic.EqualityComparer.Default.Equals(Value, other.Value); + return global::System.Collections.Generic.EqualityComparer.Default.Equals(Value, other.Value); } public override bool Equals(object? obj) @@ -247,7 +247,7 @@ public override bool Equals(object? obj) return obj is Ok_ other && Equals(other); } - public override int GetHashCode() => Value == null ? 0 : System.Collections.Generic.EqualityComparer.Default.GetHashCode(Value); + public override int GetHashCode() => Value == null ? 0 : global::System.Collections.Generic.EqualityComparer.Default.GetHashCode(Value); public static bool operator ==(Ok_ left, Ok_ right) => Equals(left, right); @@ -291,66 +291,66 @@ public static partial class ResultExtension { #region bind - public static async System.Threading.Tasks.Task> Bind( - this System.Threading.Tasks.Task> result, - System.Func> bind) + public static async global::System.Threading.Tasks.Task> Bind( + this global::System.Threading.Tasks.Task> result, + global::System.Func> bind) => (await result.ConfigureAwait(false)).Bind(bind); - public static async System.Threading.Tasks.Task> Bind( - this System.Threading.Tasks.Task> result, - System.Func>> bind) + public static async global::System.Threading.Tasks.Task> Bind( + this global::System.Threading.Tasks.Task> result, + global::System.Func>> bind) => await (await result.ConfigureAwait(false)).Bind(bind).ConfigureAwait(false); #endregion #region map - public static async System.Threading.Tasks.Task> Map( - this System.Threading.Tasks.Task> result, - System.Func map) + public static async global::System.Threading.Tasks.Task> Map( + this global::System.Threading.Tasks.Task> result, + global::System.Func map) => (await result.ConfigureAwait(false)).Map(map); - public static System.Threading.Tasks.Task> Map( - this System.Threading.Tasks.Task> result, - System.Func> bind) + public static global::System.Threading.Tasks.Task> Map( + this global::System.Threading.Tasks.Task> result, + global::System.Func> bind) => Bind(result, async v => Result.Ok(await bind(v).ConfigureAwait(false))); - public static Result MapError(this Result result, System.Func mapError) + public static Result MapError(this Result result, global::System.Func mapError) { if (result is Result.Error_ e) return Result.Error(mapError(e.Details)); return result; } - public static async System.Threading.Tasks.Task> MapError(this System.Threading.Tasks.Task> result, System.Func mapError) => (await result.ConfigureAwait(false)).MapError(mapError); + public static async global::System.Threading.Tasks.Task> MapError(this global::System.Threading.Tasks.Task> result, global::System.Func mapError) => (await result.ConfigureAwait(false)).MapError(mapError); #endregion #region match - public static async System.Threading.Tasks.Task Match( - this System.Threading.Tasks.Task> result, - System.Func> ok, - System.Func> error) + public static async global::System.Threading.Tasks.Task Match( + this global::System.Threading.Tasks.Task> result, + global::System.Func> ok, + global::System.Func> error) => await (await result.ConfigureAwait(false)).Match(ok, error).ConfigureAwait(false); - public static async System.Threading.Tasks.Task Match( - this System.Threading.Tasks.Task> result, - System.Func> ok, - System.Func error) + public static async global::System.Threading.Tasks.Task Match( + this global::System.Threading.Tasks.Task> result, + global::System.Func> ok, + global::System.Func error) => await (await result.ConfigureAwait(false)).Match(ok, error).ConfigureAwait(false); - public static async System.Threading.Tasks.Task Match( - this System.Threading.Tasks.Task> result, - System.Func ok, - System.Func error) + public static async global::System.Threading.Tasks.Task Match( + this global::System.Threading.Tasks.Task> result, + global::System.Func ok, + global::System.Func error) => (await result.ConfigureAwait(false)).Match(ok, error); #endregion public static Result Flatten(this Result> result) => result.Bind(r => r); - public static Result As(this Result result, System.Func errorTIsNotT1) => + public static Result As(this Result result, global::System.Func errorTIsNotT1) => result.Bind(r => { if (r is T1 converted) @@ -358,18 +358,18 @@ public static Result As(this Result result, System.Func er return Result.Error(errorTIsNotT1()); }); - public static Result As(this Result result, System.Func errorIsNotT1) => + public static Result As(this Result result, global::System.Func errorIsNotT1) => result.As(errorIsNotT1); #region query-expression pattern - public static Result Select(this Result result, System.Func selector) => result.Map(selector); - public static System.Threading.Tasks.Task> Select(this System.Threading.Tasks.Task> result, System.Func selector) => result.Map(selector); + public static Result Select(this Result result, global::System.Func selector) => result.Map(selector); + public static global::System.Threading.Tasks.Task> Select(this global::System.Threading.Tasks.Task> result, global::System.Func selector) => result.Map(selector); - public static Result SelectMany(this Result result, System.Func> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); - public static System.Threading.Tasks.Task> SelectMany(this System.Threading.Tasks.Task> result, System.Func>> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); - public static System.Threading.Tasks.Task> SelectMany(this System.Threading.Tasks.Task> result, System.Func> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); - public static System.Threading.Tasks.Task> SelectMany(this Result result, System.Func>> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static Result SelectMany(this Result result, global::System.Func> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static global::System.Threading.Tasks.Task> SelectMany(this global::System.Threading.Tasks.Task> result, global::System.Func>> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static global::System.Threading.Tasks.Task> SelectMany(this global::System.Threading.Tasks.Task> result, global::System.Func> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static global::System.Threading.Tasks.Task> SelectMany(this Result result, global::System.Func>> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); #endregion } @@ -379,17 +379,17 @@ namespace FunicularSwitch.Test.Extensions { public static partial class ResultExtension { - public static System.Collections.Generic.IEnumerable Choose( - this System.Collections.Generic.IEnumerable items, - System.Func> choose, - System.Action onError) + public static global::System.Collections.Generic.IEnumerable Choose( + this global::System.Collections.Generic.IEnumerable items, + global::System.Func> choose, + global::System.Action onError) => items .Select(i => choose(i)) .Choose(onError); - public static System.Collections.Generic.IEnumerable Choose( - this System.Collections.Generic.IEnumerable> results, - System.Action onError) + public static global::System.Collections.Generic.IEnumerable Choose( + this global::System.Collections.Generic.IEnumerable> results, + global::System.Action onError) => results .Where(r => r.Match(_ => true, error => @@ -399,19 +399,19 @@ public static System.Collections.Generic.IEnumerable Choose( })) .Select(r => r.GetValueOrThrow()); - public static Result As(this object item, System.Func error) => + public static Result As(this object item, global::System.Func error) => !(item is T t) ? Result.Error(error()) : t; - public static Result NotNull(this T? item, System.Func error) => + public static Result NotNull(this T? item, global::System.Func error) => item ?? Result.Error(error()); - public static Result NotNullOrEmpty(this string? s, System.Func error) + public static Result NotNullOrEmpty(this string? s, global::System.Func error) => string.IsNullOrEmpty(s) ? Result.Error(error()) : s!; - public static Result NotNullOrWhiteSpace(this string? s, System.Func error) + public static Result NotNullOrWhiteSpace(this string? s, global::System.Func error) => string.IsNullOrWhiteSpace(s) ? Result.Error(error()) : s!; - public static Result First(this System.Collections.Generic.IEnumerable candidates, System.Func predicate, System.Func noMatch) => + public static Result First(this global::System.Collections.Generic.IEnumerable candidates, global::System.Func predicate, global::System.Func noMatch) => candidates .FirstOrDefault(i => predicate(i)) .NotNull(noMatch); diff --git a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_enum_error_type#FunicularSwitch.Test.ResultWithMerge.g.verified.cs b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_enum_error_type#FunicularSwitch.Test.ResultWithMerge.g.verified.cs index 5e637c5..978efd0 100644 --- a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_enum_error_type#FunicularSwitch.Test.ResultWithMerge.g.verified.cs +++ b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_enum_error_type#FunicularSwitch.Test.ResultWithMerge.g.verified.cs @@ -1,6 +1,6 @@ //HintName: FunicularSwitch.Test.ResultWithMerge.g.cs #nullable enable -using System.Linq; +using global::System.Linq; using FunicularSwitch; using System; @@ -12,92 +12,92 @@ public abstract partial class Result public static Result<(T1, T2)> Aggregate(Result r1, Result r2) => ResultExtension.Aggregate(r1, r2); - public static Result Aggregate(Result r1, Result r2, System.Func combine) => ResultExtension.Aggregate(r1, r2, combine); + public static Result Aggregate(Result r1, Result r2, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2) => ResultExtension.Aggregate(r1, r2); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2) => ResultExtension.Aggregate(r1, r2); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Func combine) => ResultExtension.Aggregate(r1, r2, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, combine); public static Result<(T1, T2, T3)> Aggregate(Result r1, Result r2, Result r3) => ResultExtension.Aggregate(r1, r2, r3); - public static Result Aggregate(Result r1, Result r2, Result r3, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, combine); + public static Result Aggregate(Result r1, Result r2, Result r3, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3) => ResultExtension.Aggregate(r1, r2, r3); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3) => ResultExtension.Aggregate(r1, r2, r3); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, combine); public static Result<(T1, T2, T3, T4)> Aggregate(Result r1, Result r2, Result r3, Result r4) => ResultExtension.Aggregate(r1, r2, r3, r4); - public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, combine); + public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4) => ResultExtension.Aggregate(r1, r2, r3, r4); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4) => ResultExtension.Aggregate(r1, r2, r3, r4); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, combine); public static Result<(T1, T2, T3, T4, T5)> Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5) => ResultExtension.Aggregate(r1, r2, r3, r4, r5); - public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, combine); + public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5) => ResultExtension.Aggregate(r1, r2, r3, r4, r5); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5) => ResultExtension.Aggregate(r1, r2, r3, r4, r5); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, combine); public static Result<(T1, T2, T3, T4, T5, T6)> Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6); - public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, combine); + public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, combine); public static Result<(T1, T2, T3, T4, T5, T6, T7)> Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7); - public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, combine); + public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, combine); public static Result<(T1, T2, T3, T4, T5, T6, T7, T8)> Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8); - public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, combine); + public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, combine); public static Result<(T1, T2, T3, T4, T5, T6, T7, T8, T9)> Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8, Result r9) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9); - public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8, Result r9, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, combine); + public static Result Aggregate(Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8, Result r9, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Threading.Tasks.Task> r9) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Threading.Tasks.Task> r9) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Threading.Tasks.Task> r9, System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Threading.Tasks.Task> r9, global::System.Func combine) => ResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, combine); } public static partial class ResultExtension { - public static Result> Map(this System.Collections.Generic.IEnumerable> results, - System.Func map) => + public static Result> Map(this global::System.Collections.Generic.IEnumerable> results, + global::System.Func map) => results.Select(r => r.Map(map)).Aggregate(); - public static Result> Bind(this System.Collections.Generic.IEnumerable> results, - System.Func> bind) => + public static Result> Bind(this global::System.Collections.Generic.IEnumerable> results, + global::System.Func> bind) => results.Select(r => r.Bind(bind)).Aggregate(); - public static Result> Bind(this Result result, - System.Func>> bindMany) => + public static Result> Bind(this Result result, + global::System.Func>> bindMany) => result.Map(ok => bindMany(ok).Aggregate()).Flatten(); - public static Result Bind(this System.Collections.Generic.IEnumerable> results, - System.Func, Result> bind) => + public static Result Bind(this global::System.Collections.Generic.IEnumerable> results, + global::System.Func, Result> bind) => results.Aggregate().Bind(bind); - public static Result> Aggregate(this System.Collections.Generic.IEnumerable> results) + public static Result> Aggregate(this global::System.Collections.Generic.IEnumerable> results) { var isError = false; String aggregated = default!; - var oks = new System.Collections.Generic.List(); + var oks = new global::System.Collections.Generic.List(); foreach (var result in results) { result.Match( @@ -111,23 +111,23 @@ public static Result Bind(this System.Collections.Generic.IEnumerable } return isError - ? Result.Error>(aggregated) - : Result.Ok>(oks); + ? Result.Error>(aggregated) + : Result.Ok>(oks); } - public static async System.Threading.Tasks.Task>> Aggregate( - this System.Threading.Tasks.Task>> results) + public static async global::System.Threading.Tasks.Task>> Aggregate( + this global::System.Threading.Tasks.Task>> results) => (await results.ConfigureAwait(false)) .Aggregate(); - public static async System.Threading.Tasks.Task>> Aggregate( - this System.Collections.Generic.IEnumerable>> results) - => (await System.Threading.Tasks.Task.WhenAll(results.Select(e => e)).ConfigureAwait(false)) + public static async global::System.Threading.Tasks.Task>> Aggregate( + this global::System.Collections.Generic.IEnumerable>> results) + => (await global::System.Threading.Tasks.Task.WhenAll(results.Select(e => e)).ConfigureAwait(false)) .Aggregate(); - public static async System.Threading.Tasks.Task>> AggregateMany( - this System.Collections.Generic.IEnumerable>>> results) - => (await System.Threading.Tasks.Task.WhenAll(results.Select(e => e)).ConfigureAwait(false)) + public static async global::System.Threading.Tasks.Task>> AggregateMany( + this global::System.Collections.Generic.IEnumerable>>> results) + => (await global::System.Threading.Tasks.Task.WhenAll(results.Select(e => e)).ConfigureAwait(false)) .SelectMany(e => e) .Aggregate(); @@ -135,7 +135,7 @@ public static Result Bind(this System.Collections.Generic.IEnumerable public static Result<(T1, T2)> Aggregate(this Result r1, Result r2) => Aggregate(r1, r2, (v1, v2) => (v1, v2)); - public static Result Aggregate(this Result r1, Result r2, System.Func combine) + public static Result Aggregate(this Result r1, Result r2, global::System.Func combine) { if (r1 is Result.Ok_ ok1 && r2 is Result.Ok_ ok2) return combine(ok1.Value, ok2.Value); @@ -147,19 +147,19 @@ public static Result Aggregate(this Result r1, Res )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2) => Aggregate(r1, r2, (v1, v2) => (v1, v2)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2); return Aggregate(r1.Result, r2.Result, combine); } public static Result<(T1, T2, T3)> Aggregate(this Result r1, Result r2, Result r3) => Aggregate(r1, r2, r3, (v1, v2, v3) => (v1, v2, v3)); - public static Result Aggregate(this Result r1, Result r2, Result r3, System.Func combine) + public static Result Aggregate(this Result r1, Result r2, Result r3, global::System.Func combine) { if (r1 is Result.Ok_ ok1 && r2 is Result.Ok_ ok2 && r3 is Result.Ok_ ok3) return combine(ok1.Value, ok2.Value, ok3.Value); @@ -171,19 +171,19 @@ public static Result Aggregate(this Result r1, )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3) => Aggregate(r1, r2, r3, (v1, v2, v3) => (v1, v2, v3)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3); return Aggregate(r1.Result, r2.Result, r3.Result, combine); } public static Result<(T1, T2, T3, T4)> Aggregate(this Result r1, Result r2, Result r3, Result r4) => Aggregate(r1, r2, r3, r4, (v1, v2, v3, v4) => (v1, v2, v3, v4)); - public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, System.Func combine) + public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, global::System.Func combine) { if (r1 is Result.Ok_ ok1 && r2 is Result.Ok_ ok2 && r3 is Result.Ok_ ok3 && r4 is Result.Ok_ ok4) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value); @@ -195,19 +195,19 @@ public static Result Aggregate(this Result )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4) => Aggregate(r1, r2, r3, r4, (v1, v2, v3, v4) => (v1, v2, v3, v4)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, combine); } public static Result<(T1, T2, T3, T4, T5)> Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5) => Aggregate(r1, r2, r3, r4, r5, (v1, v2, v3, v4, v5) => (v1, v2, v3, v4, v5)); - public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, System.Func combine) + public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, global::System.Func combine) { if (r1 is Result.Ok_ ok1 && r2 is Result.Ok_ ok2 && r3 is Result.Ok_ ok3 && r4 is Result.Ok_ ok4 && r5 is Result.Ok_ ok5) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value); @@ -219,19 +219,19 @@ public static Result Aggregate(this Result )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5) => Aggregate(r1, r2, r3, r4, r5, (v1, v2, v3, v4, v5) => (v1, v2, v3, v4, v5)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, combine); } public static Result<(T1, T2, T3, T4, T5, T6)> Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6) => Aggregate(r1, r2, r3, r4, r5, r6, (v1, v2, v3, v4, v5, v6) => (v1, v2, v3, v4, v5, v6)); - public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, System.Func combine) + public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, global::System.Func combine) { if (r1 is Result.Ok_ ok1 && r2 is Result.Ok_ ok2 && r3 is Result.Ok_ ok3 && r4 is Result.Ok_ ok4 && r5 is Result.Ok_ ok5 && r6 is Result.Ok_ ok6) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value, ok6.Value); @@ -243,19 +243,19 @@ public static Result Aggregate(this Re )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6) => Aggregate(r1, r2, r3, r4, r5, r6, (v1, v2, v3, v4, v5, v6) => (v1, v2, v3, v4, v5, v6)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, r6.Result, combine); } public static Result<(T1, T2, T3, T4, T5, T6, T7)> Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7) => Aggregate(r1, r2, r3, r4, r5, r6, r7, (v1, v2, v3, v4, v5, v6, v7) => (v1, v2, v3, v4, v5, v6, v7)); - public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, System.Func combine) + public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, global::System.Func combine) { if (r1 is Result.Ok_ ok1 && r2 is Result.Ok_ ok2 && r3 is Result.Ok_ ok3 && r4 is Result.Ok_ ok4 && r5 is Result.Ok_ ok5 && r6 is Result.Ok_ ok6 && r7 is Result.Ok_ ok7) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value, ok6.Value, ok7.Value); @@ -267,19 +267,19 @@ public static Result Aggregate(thi )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7) => Aggregate(r1, r2, r3, r4, r5, r6, r7, (v1, v2, v3, v4, v5, v6, v7) => (v1, v2, v3, v4, v5, v6, v7)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, r6.Result, r7.Result, combine); } public static Result<(T1, T2, T3, T4, T5, T6, T7, T8)> Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8) => Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, (v1, v2, v3, v4, v5, v6, v7, v8) => (v1, v2, v3, v4, v5, v6, v7, v8)); - public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8, System.Func combine) + public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8, global::System.Func combine) { if (r1 is Result.Ok_ ok1 && r2 is Result.Ok_ ok2 && r3 is Result.Ok_ ok3 && r4 is Result.Ok_ ok4 && r5 is Result.Ok_ ok5 && r6 is Result.Ok_ ok6 && r7 is Result.Ok_ ok7 && r8 is Result.Ok_ ok8) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value, ok6.Value, ok7.Value, ok8.Value); @@ -291,19 +291,19 @@ public static Result Aggregate )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8) => Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, (v1, v2, v3, v4, v5, v6, v7, v8) => (v1, v2, v3, v4, v5, v6, v7, v8)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7, r8); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7, r8); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, r6.Result, r7.Result, r8.Result, combine); } public static Result<(T1, T2, T3, T4, T5, T6, T7, T8, T9)> Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8, Result r9) => Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, (v1, v2, v3, v4, v5, v6, v7, v8, v9) => (v1, v2, v3, v4, v5, v6, v7, v8, v9)); - public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8, Result r9, System.Func combine) + public static Result Aggregate(this Result r1, Result r2, Result r3, Result r4, Result r5, Result r6, Result r7, Result r8, Result r9, global::System.Func combine) { if (r1 is Result.Ok_ ok1 && r2 is Result.Ok_ ok2 && r3 is Result.Ok_ ok3 && r4 is Result.Ok_ ok4 && r5 is Result.Ok_ ok5 && r6 is Result.Ok_ ok6 && r7 is Result.Ok_ ok7 && r8 is Result.Ok_ ok8 && r9 is Result.Ok_ ok9) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value, ok6.Value, ok7.Value, ok8.Value, ok9.Value); @@ -315,18 +315,18 @@ public static Result Aggregate> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Threading.Tasks.Task> r9) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Threading.Tasks.Task> r9) => Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, (v1, v2, v3, v4, v5, v6, v7, v8, v9) => (v1, v2, v3, v4, v5, v6, v7, v8, v9)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Threading.Tasks.Task> r9, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Threading.Tasks.Task> r9, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7, r8, r9); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7, r8, r9); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, r6.Result, r7.Result, r8.Result, r9.Result, combine); } - public static Result FirstOk(this System.Collections.Generic.IEnumerable> results, System.Func onEmpty) + public static Result FirstOk(this global::System.Collections.Generic.IEnumerable> results, global::System.Func onEmpty) { - var errors = new System.Collections.Generic.List(); + var errors = new global::System.Collections.Generic.List(); foreach (var result in results) { if (result is Result.Error_ e) @@ -341,24 +341,24 @@ public static Result FirstOk(this System.Collections.Generic.IEnumerable(MergeErrors(errors)); } - public static async System.Threading.Tasks.Task>> Aggregate( - this System.Collections.Generic.IEnumerable>> results, + public static async global::System.Threading.Tasks.Task>> Aggregate( + this global::System.Collections.Generic.IEnumerable>> results, int maxDegreeOfParallelism) => (await results.SelectAsync(e => e, maxDegreeOfParallelism).ConfigureAwait(false)) .Aggregate(); - public static async System.Threading.Tasks.Task>> AggregateMany( - this System.Collections.Generic.IEnumerable>>> results, + public static async global::System.Threading.Tasks.Task>> AggregateMany( + this global::System.Collections.Generic.IEnumerable>>> results, int maxDegreeOfParallelism) => (await results.SelectAsync(e => e, maxDegreeOfParallelism).ConfigureAwait(false)) .SelectMany(e => e) .Aggregate(); - static async System.Threading.Tasks.Task SelectAsync(this System.Collections.Generic.IEnumerable items, System.Func> selector, int maxDegreeOfParallelism) + static async global::System.Threading.Tasks.Task SelectAsync(this global::System.Collections.Generic.IEnumerable items, global::System.Func> selector, int maxDegreeOfParallelism) { - using (var throttler = new System.Threading.SemaphoreSlim(maxDegreeOfParallelism, maxDegreeOfParallelism)) + using (var throttler = new global::System.Threading.SemaphoreSlim(maxDegreeOfParallelism, maxDegreeOfParallelism)) { - return await System.Threading.Tasks.Task.WhenAll(items.Select(async item => + return await global::System.Threading.Tasks.Task.WhenAll(items.Select(async item => { // ReSharper disable once AccessToDisposedClosure await throttler.WaitAsync().ConfigureAwait(false); @@ -375,19 +375,19 @@ static async System.Threading.Tasks.Task SelectAsync(this Syste } } - public static Result> AllOk(this System.Collections.Generic.IEnumerable candidates, System.Func> validate) => + public static Result> AllOk(this global::System.Collections.Generic.IEnumerable candidates, global::System.Func> validate) => candidates .Select(c => c.Validate(validate)) .Aggregate(); - public static Result> AllOk(this System.Collections.Generic.IEnumerable> candidates, - System.Func> validate) => + public static Result> AllOk(this global::System.Collections.Generic.IEnumerable> candidates, + global::System.Func> validate) => candidates .Bind(items => items.AllOk(validate)); - public static Result Validate(this Result item, System.Func> validate) => item.Bind(i => i.Validate(validate)); + public static Result Validate(this Result item, global::System.Func> validate) => item.Bind(i => i.Validate(validate)); - public static Result Validate(this T item, System.Func> validate) + public static Result Validate(this T item, global::System.Func> validate) { try { @@ -396,21 +396,21 @@ public static Result Validate(this T item, System.Func FirstOk(this System.Collections.Generic.IEnumerable candidates, System.Func> validate, System.Func onEmpty) => + public static Result FirstOk(this global::System.Collections.Generic.IEnumerable candidates, global::System.Func> validate, global::System.Func onEmpty) => candidates .Select(r => r.Validate(validate)) .FirstOk(onEmpty); #region helpers - static String MergeErrors(System.Collections.Generic.IEnumerable errors) + static String MergeErrors(global::System.Collections.Generic.IEnumerable errors) { var first = true; String aggregated = default!; diff --git a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_error_type_in_different_namespace#FunicularSwitch.Test.OperationResult.g.verified.cs b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_error_type_in_different_namespace#FunicularSwitch.Test.OperationResult.g.verified.cs index 8003272..e55c421 100644 --- a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_error_type_in_different_namespace#FunicularSwitch.Test.OperationResult.g.verified.cs +++ b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_error_type_in_different_namespace#FunicularSwitch.Test.OperationResult.g.verified.cs @@ -1,6 +1,6 @@ //HintName: FunicularSwitch.Test.OperationResult.g.cs #nullable enable -using System.Linq; +using global::System.Linq; using FunicularSwitch; using FunicularSwitch.Test.Errors; @@ -15,56 +15,56 @@ public abstract partial class OperationResult public bool IsOk => !IsError; public abstract MyError? GetErrorOrDefault(); - public static OperationResult Try(System.Func action, System.Func formatError) + public static OperationResult Try(global::System.Func action, global::System.Func formatError) { try { return action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } - public static async System.Threading.Tasks.Task> Try(System.Func> action, System.Func formatError) + public static async global::System.Threading.Tasks.Task> Try(global::System.Func> action, global::System.Func formatError) { try { return await action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } - public static OperationResult Try(System.Func> action, System.Func formatError) + public static OperationResult Try(global::System.Func> action, global::System.Func formatError) { try { return action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } - public static async System.Threading.Tasks.Task> Try(System.Func>> action, System.Func formatError) + public static async global::System.Threading.Tasks.Task> Try(global::System.Func>> action, global::System.Func formatError) { try { return await action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } } - public abstract partial class OperationResult : OperationResult, System.Collections.Generic.IEnumerable + public abstract partial class OperationResult : OperationResult, global::System.Collections.Generic.IEnumerable { public static OperationResult Error(MyError message) => Error(message); public static OperationResult Ok(T value) => Ok(value); @@ -81,14 +81,14 @@ public abstract partial class OperationResult : OperationResult, System.Colle { Ok_ ok => ok.Equals((object)other), Error_ error => error.Equals((object)other), - _ => throw new System.InvalidOperationException($"Unexpected type derived from {nameof(OperationResult)}") + _ => throw new global::System.InvalidOperationException($"Unexpected type derived from {nameof(OperationResult)}") }; public override int GetHashCode() => this switch { Ok_ ok => ok.GetHashCode(), Error_ error => error.GetHashCode(), - _ => throw new System.InvalidOperationException($"Unexpected type derived from {nameof(OperationResult)}") + _ => throw new global::System.InvalidOperationException($"Unexpected type derived from {nameof(OperationResult)}") }; public override bool Equals(object? obj) @@ -103,7 +103,7 @@ public override bool Equals(object? obj) public static bool operator !=(OperationResult? left, OperationResult? right) => !Equals(left, right); - public void Match(System.Action ok, System.Action? error = null) => Match( + public void Match(global::System.Action ok, global::System.Action? error = null) => Match( v => { ok.Invoke(v); @@ -115,37 +115,37 @@ public void Match(System.Action ok, System.Action? error = null) => return 42; }); - public T1 Match(System.Func ok, System.Func error) + public T1 Match(global::System.Func ok, global::System.Func error) { return this switch { Ok_ okOperationResult => ok(okOperationResult.Value), Error_ errorOperationResult => error(errorOperationResult.Details), - _ => throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}") + _ => throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}") }; } - public async System.Threading.Tasks.Task Match(System.Func> ok, System.Func> error) + public async global::System.Threading.Tasks.Task Match(global::System.Func> ok, global::System.Func> error) { return this switch { Ok_ okOperationResult => await ok(okOperationResult.Value).ConfigureAwait(false), Error_ errorOperationResult => await error(errorOperationResult.Details).ConfigureAwait(false), - _ => throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}") + _ => throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}") }; } - public System.Threading.Tasks.Task Match(System.Func> ok, System.Func error) => - Match(ok, e => System.Threading.Tasks.Task.FromResult(error(e))); + public global::System.Threading.Tasks.Task Match(global::System.Func> ok, global::System.Func error) => + Match(ok, e => global::System.Threading.Tasks.Task.FromResult(error(e))); - public async System.Threading.Tasks.Task Match(System.Func ok) + public async global::System.Threading.Tasks.Task Match(global::System.Func ok) { if (this is Ok_ okOperationResult) await ok(okOperationResult.Value).ConfigureAwait(false); } - public T Match(System.Func error) => Match(v => v, error); + public T Match(global::System.Func error) => Match(v => v, error); - public OperationResult Bind(System.Func> bind) + public OperationResult Bind(global::System.Func> bind) { switch (this) { @@ -156,7 +156,7 @@ public OperationResult Bind(System.Func> bind) } // ReSharper disable once RedundantCatchClause #pragma warning disable CS0168 // Variable is declared but never used - catch (System.Exception e) + catch (global::System.Exception e) #pragma warning restore CS0168 // Variable is declared but never used { throw; //createGenericErrorResult @@ -164,11 +164,11 @@ public OperationResult Bind(System.Func> bind) case Error_ error: return error.Convert(); default: - throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); + throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); } } - public async System.Threading.Tasks.Task> Bind(System.Func>> bind) + public async global::System.Threading.Tasks.Task> Bind(global::System.Func>> bind) { switch (this) { @@ -179,7 +179,7 @@ public async System.Threading.Tasks.Task> Bind(System.Fu } // ReSharper disable once RedundantCatchClause #pragma warning disable CS0168 // Variable is declared but never used - catch (System.Exception e) + catch (global::System.Exception e) #pragma warning restore CS0168 // Variable is declared but never used { throw; //createGenericErrorResult @@ -187,14 +187,14 @@ public async System.Threading.Tasks.Task> Bind(System.Fu case Error_ error: return error.Convert(); default: - throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); + throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); } } - public OperationResult Map(System.Func map) + public OperationResult Map(global::System.Func map) => Bind(value => Ok(map(value))); - public System.Threading.Tasks.Task> Map(System.Func> map) + public global::System.Threading.Tasks.Task> Map(global::System.Func> map) => Bind(async value => Ok(await map(value).ConfigureAwait(false))); public T? GetValueOrDefault() @@ -203,7 +203,7 @@ public System.Threading.Tasks.Task> Map(System.Func default ); - public T GetValueOrDefault(System.Func defaultValue) + public T GetValueOrDefault(global::System.Func defaultValue) => Match( v => v, _ => defaultValue() @@ -218,12 +218,12 @@ public T GetValueOrDefault(T defaultValue) public T GetValueOrThrow() => Match( v => v, - details => throw new System.InvalidOperationException($"Cannot access error result value. Error: {details}")); + details => throw new global::System.InvalidOperationException($"Cannot access error result value. Error: {details}")); - public System.Collections.Generic.IEnumerator GetEnumerator() => Match(ok => new[] { ok }, _ => Enumerable.Empty()).GetEnumerator(); + public global::System.Collections.Generic.IEnumerator GetEnumerator() => Match(ok => new[] { ok }, _ => Enumerable.Empty()).GetEnumerator(); public override string ToString() => Match(ok => $"Ok {ok?.ToString()}", error => $"Error {error}"); - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); + global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); public sealed partial class Ok_ : OperationResult { @@ -237,7 +237,7 @@ public bool Equals(Ok_? other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; - return System.Collections.Generic.EqualityComparer.Default.Equals(Value, other.Value); + return global::System.Collections.Generic.EqualityComparer.Default.Equals(Value, other.Value); } public override bool Equals(object? obj) @@ -247,7 +247,7 @@ public override bool Equals(object? obj) return obj is Ok_ other && Equals(other); } - public override int GetHashCode() => Value == null ? 0 : System.Collections.Generic.EqualityComparer.Default.GetHashCode(Value); + public override int GetHashCode() => Value == null ? 0 : global::System.Collections.Generic.EqualityComparer.Default.GetHashCode(Value); public static bool operator ==(Ok_ left, Ok_ right) => Equals(left, right); @@ -291,66 +291,66 @@ public static partial class OperationResultExtension { #region bind - public static async System.Threading.Tasks.Task> Bind( - this System.Threading.Tasks.Task> result, - System.Func> bind) + public static async global::System.Threading.Tasks.Task> Bind( + this global::System.Threading.Tasks.Task> result, + global::System.Func> bind) => (await result.ConfigureAwait(false)).Bind(bind); - public static async System.Threading.Tasks.Task> Bind( - this System.Threading.Tasks.Task> result, - System.Func>> bind) + public static async global::System.Threading.Tasks.Task> Bind( + this global::System.Threading.Tasks.Task> result, + global::System.Func>> bind) => await (await result.ConfigureAwait(false)).Bind(bind).ConfigureAwait(false); #endregion #region map - public static async System.Threading.Tasks.Task> Map( - this System.Threading.Tasks.Task> result, - System.Func map) + public static async global::System.Threading.Tasks.Task> Map( + this global::System.Threading.Tasks.Task> result, + global::System.Func map) => (await result.ConfigureAwait(false)).Map(map); - public static System.Threading.Tasks.Task> Map( - this System.Threading.Tasks.Task> result, - System.Func> bind) + public static global::System.Threading.Tasks.Task> Map( + this global::System.Threading.Tasks.Task> result, + global::System.Func> bind) => Bind(result, async v => OperationResult.Ok(await bind(v).ConfigureAwait(false))); - public static OperationResult MapError(this OperationResult result, System.Func mapError) + public static OperationResult MapError(this OperationResult result, global::System.Func mapError) { if (result is OperationResult.Error_ e) return OperationResult.Error(mapError(e.Details)); return result; } - public static async System.Threading.Tasks.Task> MapError(this System.Threading.Tasks.Task> result, System.Func mapError) => (await result.ConfigureAwait(false)).MapError(mapError); + public static async global::System.Threading.Tasks.Task> MapError(this global::System.Threading.Tasks.Task> result, global::System.Func mapError) => (await result.ConfigureAwait(false)).MapError(mapError); #endregion #region match - public static async System.Threading.Tasks.Task Match( - this System.Threading.Tasks.Task> result, - System.Func> ok, - System.Func> error) + public static async global::System.Threading.Tasks.Task Match( + this global::System.Threading.Tasks.Task> result, + global::System.Func> ok, + global::System.Func> error) => await (await result.ConfigureAwait(false)).Match(ok, error).ConfigureAwait(false); - public static async System.Threading.Tasks.Task Match( - this System.Threading.Tasks.Task> result, - System.Func> ok, - System.Func error) + public static async global::System.Threading.Tasks.Task Match( + this global::System.Threading.Tasks.Task> result, + global::System.Func> ok, + global::System.Func error) => await (await result.ConfigureAwait(false)).Match(ok, error).ConfigureAwait(false); - public static async System.Threading.Tasks.Task Match( - this System.Threading.Tasks.Task> result, - System.Func ok, - System.Func error) + public static async global::System.Threading.Tasks.Task Match( + this global::System.Threading.Tasks.Task> result, + global::System.Func ok, + global::System.Func error) => (await result.ConfigureAwait(false)).Match(ok, error); #endregion public static OperationResult Flatten(this OperationResult> result) => result.Bind(r => r); - public static OperationResult As(this OperationResult result, System.Func errorTIsNotT1) => + public static OperationResult As(this OperationResult result, global::System.Func errorTIsNotT1) => result.Bind(r => { if (r is T1 converted) @@ -358,18 +358,18 @@ public static OperationResult As(this OperationResult result, Syst return OperationResult.Error(errorTIsNotT1()); }); - public static OperationResult As(this OperationResult result, System.Func errorIsNotT1) => + public static OperationResult As(this OperationResult result, global::System.Func errorIsNotT1) => result.As(errorIsNotT1); #region query-expression pattern - public static OperationResult Select(this OperationResult result, System.Func selector) => result.Map(selector); - public static System.Threading.Tasks.Task> Select(this System.Threading.Tasks.Task> result, System.Func selector) => result.Map(selector); + public static OperationResult Select(this OperationResult result, global::System.Func selector) => result.Map(selector); + public static global::System.Threading.Tasks.Task> Select(this global::System.Threading.Tasks.Task> result, global::System.Func selector) => result.Map(selector); - public static OperationResult SelectMany(this OperationResult result, System.Func> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); - public static System.Threading.Tasks.Task> SelectMany(this System.Threading.Tasks.Task> result, System.Func>> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); - public static System.Threading.Tasks.Task> SelectMany(this System.Threading.Tasks.Task> result, System.Func> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); - public static System.Threading.Tasks.Task> SelectMany(this OperationResult result, System.Func>> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static OperationResult SelectMany(this OperationResult result, global::System.Func> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static global::System.Threading.Tasks.Task> SelectMany(this global::System.Threading.Tasks.Task> result, global::System.Func>> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static global::System.Threading.Tasks.Task> SelectMany(this global::System.Threading.Tasks.Task> result, global::System.Func> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static global::System.Threading.Tasks.Task> SelectMany(this OperationResult result, global::System.Func>> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); #endregion } @@ -379,17 +379,17 @@ namespace FunicularSwitch.Test.Extensions { public static partial class OperationResultExtension { - public static System.Collections.Generic.IEnumerable Choose( - this System.Collections.Generic.IEnumerable items, - System.Func> choose, - System.Action onError) + public static global::System.Collections.Generic.IEnumerable Choose( + this global::System.Collections.Generic.IEnumerable items, + global::System.Func> choose, + global::System.Action onError) => items .Select(i => choose(i)) .Choose(onError); - public static System.Collections.Generic.IEnumerable Choose( - this System.Collections.Generic.IEnumerable> results, - System.Action onError) + public static global::System.Collections.Generic.IEnumerable Choose( + this global::System.Collections.Generic.IEnumerable> results, + global::System.Action onError) => results .Where(r => r.Match(_ => true, error => @@ -399,19 +399,19 @@ public static System.Collections.Generic.IEnumerable Choose( })) .Select(r => r.GetValueOrThrow()); - public static OperationResult As(this object item, System.Func error) => + public static OperationResult As(this object item, global::System.Func error) => !(item is T t) ? OperationResult.Error(error()) : t; - public static OperationResult NotNull(this T? item, System.Func error) => + public static OperationResult NotNull(this T? item, global::System.Func error) => item ?? OperationResult.Error(error()); - public static OperationResult NotNullOrEmpty(this string? s, System.Func error) + public static OperationResult NotNullOrEmpty(this string? s, global::System.Func error) => string.IsNullOrEmpty(s) ? OperationResult.Error(error()) : s!; - public static OperationResult NotNullOrWhiteSpace(this string? s, System.Func error) + public static OperationResult NotNullOrWhiteSpace(this string? s, global::System.Func error) => string.IsNullOrWhiteSpace(s) ? OperationResult.Error(error()) : s!; - public static OperationResult First(this System.Collections.Generic.IEnumerable candidates, System.Func predicate, System.Func noMatch) => + public static OperationResult First(this global::System.Collections.Generic.IEnumerable candidates, global::System.Func predicate, global::System.Func noMatch) => candidates .FirstOrDefault(i => predicate(i)) .NotNull(noMatch); diff --git a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_error_type_in_different_namespace#FunicularSwitch.Test.OperationResultWithMerge.g.verified.cs b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_error_type_in_different_namespace#FunicularSwitch.Test.OperationResultWithMerge.g.verified.cs index 6e7c520..2c80405 100644 --- a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_error_type_in_different_namespace#FunicularSwitch.Test.OperationResultWithMerge.g.verified.cs +++ b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_error_type_in_different_namespace#FunicularSwitch.Test.OperationResultWithMerge.g.verified.cs @@ -1,6 +1,6 @@ //HintName: FunicularSwitch.Test.OperationResultWithMerge.g.cs #nullable enable -using System.Linq; +using global::System.Linq; using FunicularSwitch; using FunicularSwitch.Test.Errors; using FunicularSwitch.Test.Extensions; @@ -13,92 +13,92 @@ public abstract partial class OperationResult public static OperationResult<(T1, T2)> Aggregate(OperationResult r1, OperationResult r2) => OperationResultExtension.Aggregate(r1, r2); - public static OperationResult Aggregate(OperationResult r1, OperationResult r2, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, combine); + public static OperationResult Aggregate(OperationResult r1, OperationResult r2, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2) => OperationResultExtension.Aggregate(r1, r2); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2) => OperationResultExtension.Aggregate(r1, r2); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, combine); public static OperationResult<(T1, T2, T3)> Aggregate(OperationResult r1, OperationResult r2, OperationResult r3) => OperationResultExtension.Aggregate(r1, r2, r3); - public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, combine); + public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3) => OperationResultExtension.Aggregate(r1, r2, r3); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3) => OperationResultExtension.Aggregate(r1, r2, r3); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, combine); public static OperationResult<(T1, T2, T3, T4)> Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4) => OperationResultExtension.Aggregate(r1, r2, r3, r4); - public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, combine); + public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4) => OperationResultExtension.Aggregate(r1, r2, r3, r4); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4) => OperationResultExtension.Aggregate(r1, r2, r3, r4); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, combine); public static OperationResult<(T1, T2, T3, T4, T5)> Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5); - public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, combine); + public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, combine); public static OperationResult<(T1, T2, T3, T4, T5, T6)> Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6); - public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, combine); + public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, combine); public static OperationResult<(T1, T2, T3, T4, T5, T6, T7)> Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7); - public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, combine); + public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, combine); public static OperationResult<(T1, T2, T3, T4, T5, T6, T7, T8)> Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8); - public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, combine); + public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, combine); public static OperationResult<(T1, T2, T3, T4, T5, T6, T7, T8, T9)> Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, OperationResult r9) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9); - public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, OperationResult r9, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, combine); + public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, OperationResult r9, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Threading.Tasks.Task> r9) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Threading.Tasks.Task> r9) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Threading.Tasks.Task> r9, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Threading.Tasks.Task> r9, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, combine); } public static partial class OperationResultExtension { - public static OperationResult> Map(this System.Collections.Generic.IEnumerable> results, - System.Func map) => + public static OperationResult> Map(this global::System.Collections.Generic.IEnumerable> results, + global::System.Func map) => results.Select(r => r.Map(map)).Aggregate(); - public static OperationResult> Bind(this System.Collections.Generic.IEnumerable> results, - System.Func> bind) => + public static OperationResult> Bind(this global::System.Collections.Generic.IEnumerable> results, + global::System.Func> bind) => results.Select(r => r.Bind(bind)).Aggregate(); - public static OperationResult> Bind(this OperationResult result, - System.Func>> bindMany) => + public static OperationResult> Bind(this OperationResult result, + global::System.Func>> bindMany) => result.Map(ok => bindMany(ok).Aggregate()).Flatten(); - public static OperationResult Bind(this System.Collections.Generic.IEnumerable> results, - System.Func, OperationResult> bind) => + public static OperationResult Bind(this global::System.Collections.Generic.IEnumerable> results, + global::System.Func, OperationResult> bind) => results.Aggregate().Bind(bind); - public static OperationResult> Aggregate(this System.Collections.Generic.IEnumerable> results) + public static OperationResult> Aggregate(this global::System.Collections.Generic.IEnumerable> results) { var isError = false; MyError aggregated = default!; - var oks = new System.Collections.Generic.List(); + var oks = new global::System.Collections.Generic.List(); foreach (var result in results) { result.Match( @@ -112,23 +112,23 @@ public static OperationResult Bind(this System.Collections.Generic.IE } return isError - ? OperationResult.Error>(aggregated) - : OperationResult.Ok>(oks); + ? OperationResult.Error>(aggregated) + : OperationResult.Ok>(oks); } - public static async System.Threading.Tasks.Task>> Aggregate( - this System.Threading.Tasks.Task>> results) + public static async global::System.Threading.Tasks.Task>> Aggregate( + this global::System.Threading.Tasks.Task>> results) => (await results.ConfigureAwait(false)) .Aggregate(); - public static async System.Threading.Tasks.Task>> Aggregate( - this System.Collections.Generic.IEnumerable>> results) - => (await System.Threading.Tasks.Task.WhenAll(results.Select(e => e)).ConfigureAwait(false)) + public static async global::System.Threading.Tasks.Task>> Aggregate( + this global::System.Collections.Generic.IEnumerable>> results) + => (await global::System.Threading.Tasks.Task.WhenAll(results.Select(e => e)).ConfigureAwait(false)) .Aggregate(); - public static async System.Threading.Tasks.Task>> AggregateMany( - this System.Collections.Generic.IEnumerable>>> results) - => (await System.Threading.Tasks.Task.WhenAll(results.Select(e => e)).ConfigureAwait(false)) + public static async global::System.Threading.Tasks.Task>> AggregateMany( + this global::System.Collections.Generic.IEnumerable>>> results) + => (await global::System.Threading.Tasks.Task.WhenAll(results.Select(e => e)).ConfigureAwait(false)) .SelectMany(e => e) .Aggregate(); @@ -136,7 +136,7 @@ public static OperationResult Bind(this System.Collections.Generic.IE public static OperationResult<(T1, T2)> Aggregate(this OperationResult r1, OperationResult r2) => Aggregate(r1, r2, (v1, v2) => (v1, v2)); - public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, System.Func combine) + public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, global::System.Func combine) { if (r1 is OperationResult.Ok_ ok1 && r2 is OperationResult.Ok_ ok2) return combine(ok1.Value, ok2.Value); @@ -148,19 +148,19 @@ public static OperationResult Aggregate(this Operation )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2) => Aggregate(r1, r2, (v1, v2) => (v1, v2)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2); return Aggregate(r1.Result, r2.Result, combine); } public static OperationResult<(T1, T2, T3)> Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3) => Aggregate(r1, r2, r3, (v1, v2, v3) => (v1, v2, v3)); - public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, System.Func combine) + public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, global::System.Func combine) { if (r1 is OperationResult.Ok_ ok1 && r2 is OperationResult.Ok_ ok2 && r3 is OperationResult.Ok_ ok3) return combine(ok1.Value, ok2.Value, ok3.Value); @@ -172,19 +172,19 @@ public static OperationResult Aggregate(this Opera )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3) => Aggregate(r1, r2, r3, (v1, v2, v3) => (v1, v2, v3)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3); return Aggregate(r1.Result, r2.Result, r3.Result, combine); } public static OperationResult<(T1, T2, T3, T4)> Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4) => Aggregate(r1, r2, r3, r4, (v1, v2, v3, v4) => (v1, v2, v3, v4)); - public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, System.Func combine) + public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, global::System.Func combine) { if (r1 is OperationResult.Ok_ ok1 && r2 is OperationResult.Ok_ ok2 && r3 is OperationResult.Ok_ ok3 && r4 is OperationResult.Ok_ ok4) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value); @@ -196,19 +196,19 @@ public static OperationResult Aggregate(this O )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4) => Aggregate(r1, r2, r3, r4, (v1, v2, v3, v4) => (v1, v2, v3, v4)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, combine); } public static OperationResult<(T1, T2, T3, T4, T5)> Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5) => Aggregate(r1, r2, r3, r4, r5, (v1, v2, v3, v4, v5) => (v1, v2, v3, v4, v5)); - public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, System.Func combine) + public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, global::System.Func combine) { if (r1 is OperationResult.Ok_ ok1 && r2 is OperationResult.Ok_ ok2 && r3 is OperationResult.Ok_ ok3 && r4 is OperationResult.Ok_ ok4 && r5 is OperationResult.Ok_ ok5) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value); @@ -220,19 +220,19 @@ public static OperationResult Aggregate(th )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5) => Aggregate(r1, r2, r3, r4, r5, (v1, v2, v3, v4, v5) => (v1, v2, v3, v4, v5)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, combine); } public static OperationResult<(T1, T2, T3, T4, T5, T6)> Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6) => Aggregate(r1, r2, r3, r4, r5, r6, (v1, v2, v3, v4, v5, v6) => (v1, v2, v3, v4, v5, v6)); - public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, System.Func combine) + public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, global::System.Func combine) { if (r1 is OperationResult.Ok_ ok1 && r2 is OperationResult.Ok_ ok2 && r3 is OperationResult.Ok_ ok3 && r4 is OperationResult.Ok_ ok4 && r5 is OperationResult.Ok_ ok5 && r6 is OperationResult.Ok_ ok6) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value, ok6.Value); @@ -244,19 +244,19 @@ public static OperationResult Aggregate> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6) => Aggregate(r1, r2, r3, r4, r5, r6, (v1, v2, v3, v4, v5, v6) => (v1, v2, v3, v4, v5, v6)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, r6.Result, combine); } public static OperationResult<(T1, T2, T3, T4, T5, T6, T7)> Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7) => Aggregate(r1, r2, r3, r4, r5, r6, r7, (v1, v2, v3, v4, v5, v6, v7) => (v1, v2, v3, v4, v5, v6, v7)); - public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, System.Func combine) + public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, global::System.Func combine) { if (r1 is OperationResult.Ok_ ok1 && r2 is OperationResult.Ok_ ok2 && r3 is OperationResult.Ok_ ok3 && r4 is OperationResult.Ok_ ok4 && r5 is OperationResult.Ok_ ok5 && r6 is OperationResult.Ok_ ok6 && r7 is OperationResult.Ok_ ok7) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value, ok6.Value, ok7.Value); @@ -268,19 +268,19 @@ public static OperationResult Aggregate> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7) => Aggregate(r1, r2, r3, r4, r5, r6, r7, (v1, v2, v3, v4, v5, v6, v7) => (v1, v2, v3, v4, v5, v6, v7)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, r6.Result, r7.Result, combine); } public static OperationResult<(T1, T2, T3, T4, T5, T6, T7, T8)> Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8) => Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, (v1, v2, v3, v4, v5, v6, v7, v8) => (v1, v2, v3, v4, v5, v6, v7, v8)); - public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, System.Func combine) + public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, global::System.Func combine) { if (r1 is OperationResult.Ok_ ok1 && r2 is OperationResult.Ok_ ok2 && r3 is OperationResult.Ok_ ok3 && r4 is OperationResult.Ok_ ok4 && r5 is OperationResult.Ok_ ok5 && r6 is OperationResult.Ok_ ok6 && r7 is OperationResult.Ok_ ok7 && r8 is OperationResult.Ok_ ok8) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value, ok6.Value, ok7.Value, ok8.Value); @@ -292,19 +292,19 @@ public static OperationResult Aggregate> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8) => Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, (v1, v2, v3, v4, v5, v6, v7, v8) => (v1, v2, v3, v4, v5, v6, v7, v8)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7, r8); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7, r8); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, r6.Result, r7.Result, r8.Result, combine); } public static OperationResult<(T1, T2, T3, T4, T5, T6, T7, T8, T9)> Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, OperationResult r9) => Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, (v1, v2, v3, v4, v5, v6, v7, v8, v9) => (v1, v2, v3, v4, v5, v6, v7, v8, v9)); - public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, OperationResult r9, System.Func combine) + public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, OperationResult r9, global::System.Func combine) { if (r1 is OperationResult.Ok_ ok1 && r2 is OperationResult.Ok_ ok2 && r3 is OperationResult.Ok_ ok3 && r4 is OperationResult.Ok_ ok4 && r5 is OperationResult.Ok_ ok5 && r6 is OperationResult.Ok_ ok6 && r7 is OperationResult.Ok_ ok7 && r8 is OperationResult.Ok_ ok8 && r9 is OperationResult.Ok_ ok9) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value, ok6.Value, ok7.Value, ok8.Value, ok9.Value); @@ -316,18 +316,18 @@ public static OperationResult Aggregate> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Threading.Tasks.Task> r9) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Threading.Tasks.Task> r9) => Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, (v1, v2, v3, v4, v5, v6, v7, v8, v9) => (v1, v2, v3, v4, v5, v6, v7, v8, v9)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Threading.Tasks.Task> r9, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Threading.Tasks.Task> r9, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7, r8, r9); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7, r8, r9); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, r6.Result, r7.Result, r8.Result, r9.Result, combine); } - public static OperationResult FirstOk(this System.Collections.Generic.IEnumerable> results, System.Func onEmpty) + public static OperationResult FirstOk(this global::System.Collections.Generic.IEnumerable> results, global::System.Func onEmpty) { - var errors = new System.Collections.Generic.List(); + var errors = new global::System.Collections.Generic.List(); foreach (var result in results) { if (result is OperationResult.Error_ e) @@ -342,24 +342,24 @@ public static OperationResult FirstOk(this System.Collections.Generic.IEnu return OperationResult.Error(MergeErrors(errors)); } - public static async System.Threading.Tasks.Task>> Aggregate( - this System.Collections.Generic.IEnumerable>> results, + public static async global::System.Threading.Tasks.Task>> Aggregate( + this global::System.Collections.Generic.IEnumerable>> results, int maxDegreeOfParallelism) => (await results.SelectAsync(e => e, maxDegreeOfParallelism).ConfigureAwait(false)) .Aggregate(); - public static async System.Threading.Tasks.Task>> AggregateMany( - this System.Collections.Generic.IEnumerable>>> results, + public static async global::System.Threading.Tasks.Task>> AggregateMany( + this global::System.Collections.Generic.IEnumerable>>> results, int maxDegreeOfParallelism) => (await results.SelectAsync(e => e, maxDegreeOfParallelism).ConfigureAwait(false)) .SelectMany(e => e) .Aggregate(); - static async System.Threading.Tasks.Task SelectAsync(this System.Collections.Generic.IEnumerable items, System.Func> selector, int maxDegreeOfParallelism) + static async global::System.Threading.Tasks.Task SelectAsync(this global::System.Collections.Generic.IEnumerable items, global::System.Func> selector, int maxDegreeOfParallelism) { - using (var throttler = new System.Threading.SemaphoreSlim(maxDegreeOfParallelism, maxDegreeOfParallelism)) + using (var throttler = new global::System.Threading.SemaphoreSlim(maxDegreeOfParallelism, maxDegreeOfParallelism)) { - return await System.Threading.Tasks.Task.WhenAll(items.Select(async item => + return await global::System.Threading.Tasks.Task.WhenAll(items.Select(async item => { // ReSharper disable once AccessToDisposedClosure await throttler.WaitAsync().ConfigureAwait(false); @@ -376,19 +376,19 @@ static async System.Threading.Tasks.Task SelectAsync(this Syste } } - public static OperationResult> AllOk(this System.Collections.Generic.IEnumerable candidates, System.Func> validate) => + public static OperationResult> AllOk(this global::System.Collections.Generic.IEnumerable candidates, global::System.Func> validate) => candidates .Select(c => c.Validate(validate)) .Aggregate(); - public static OperationResult> AllOk(this System.Collections.Generic.IEnumerable> candidates, - System.Func> validate) => + public static OperationResult> AllOk(this global::System.Collections.Generic.IEnumerable> candidates, + global::System.Func> validate) => candidates .Bind(items => items.AllOk(validate)); - public static OperationResult Validate(this OperationResult item, System.Func> validate) => item.Bind(i => i.Validate(validate)); + public static OperationResult Validate(this OperationResult item, global::System.Func> validate) => item.Bind(i => i.Validate(validate)); - public static OperationResult Validate(this T item, System.Func> validate) + public static OperationResult Validate(this T item, global::System.Func> validate) { try { @@ -397,21 +397,21 @@ public static OperationResult Validate(this T item, System.Func FirstOk(this System.Collections.Generic.IEnumerable candidates, System.Func> validate, System.Func onEmpty) => + public static OperationResult FirstOk(this global::System.Collections.Generic.IEnumerable candidates, global::System.Func> validate, global::System.Func onEmpty) => candidates .Select(r => r.Validate(validate)) .FirstOk(onEmpty); #region helpers - static MyError MergeErrors(System.Collections.Generic.IEnumerable errors) + static MyError MergeErrors(global::System.Collections.Generic.IEnumerable errors) { var first = true; MyError aggregated = default!; diff --git a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_error_type_with_merge#FunicularSwitch.Test.OperationResult.g.verified.cs b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_error_type_with_merge#FunicularSwitch.Test.OperationResult.g.verified.cs index 4abfb4b..9534135 100644 --- a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_error_type_with_merge#FunicularSwitch.Test.OperationResult.g.verified.cs +++ b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_error_type_with_merge#FunicularSwitch.Test.OperationResult.g.verified.cs @@ -1,6 +1,6 @@ //HintName: FunicularSwitch.Test.OperationResult.g.cs #nullable enable -using System.Linq; +using global::System.Linq; using FunicularSwitch; namespace FunicularSwitch.Test @@ -14,56 +14,56 @@ public abstract partial class OperationResult public bool IsOk => !IsError; public abstract MyError? GetErrorOrDefault(); - public static OperationResult Try(System.Func action, System.Func formatError) + public static OperationResult Try(global::System.Func action, global::System.Func formatError) { try { return action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } - public static async System.Threading.Tasks.Task> Try(System.Func> action, System.Func formatError) + public static async global::System.Threading.Tasks.Task> Try(global::System.Func> action, global::System.Func formatError) { try { return await action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } - public static OperationResult Try(System.Func> action, System.Func formatError) + public static OperationResult Try(global::System.Func> action, global::System.Func formatError) { try { return action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } - public static async System.Threading.Tasks.Task> Try(System.Func>> action, System.Func formatError) + public static async global::System.Threading.Tasks.Task> Try(global::System.Func>> action, global::System.Func formatError) { try { return await action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } } - public abstract partial class OperationResult : OperationResult, System.Collections.Generic.IEnumerable + public abstract partial class OperationResult : OperationResult, global::System.Collections.Generic.IEnumerable { public static OperationResult Error(MyError message) => Error(message); public static OperationResult Ok(T value) => Ok(value); @@ -80,14 +80,14 @@ public abstract partial class OperationResult : OperationResult, System.Colle { Ok_ ok => ok.Equals((object)other), Error_ error => error.Equals((object)other), - _ => throw new System.InvalidOperationException($"Unexpected type derived from {nameof(OperationResult)}") + _ => throw new global::System.InvalidOperationException($"Unexpected type derived from {nameof(OperationResult)}") }; public override int GetHashCode() => this switch { Ok_ ok => ok.GetHashCode(), Error_ error => error.GetHashCode(), - _ => throw new System.InvalidOperationException($"Unexpected type derived from {nameof(OperationResult)}") + _ => throw new global::System.InvalidOperationException($"Unexpected type derived from {nameof(OperationResult)}") }; public override bool Equals(object? obj) @@ -102,7 +102,7 @@ public override bool Equals(object? obj) public static bool operator !=(OperationResult? left, OperationResult? right) => !Equals(left, right); - public void Match(System.Action ok, System.Action? error = null) => Match( + public void Match(global::System.Action ok, global::System.Action? error = null) => Match( v => { ok.Invoke(v); @@ -114,37 +114,37 @@ public void Match(System.Action ok, System.Action? error = null) => return 42; }); - public T1 Match(System.Func ok, System.Func error) + public T1 Match(global::System.Func ok, global::System.Func error) { return this switch { Ok_ okOperationResult => ok(okOperationResult.Value), Error_ errorOperationResult => error(errorOperationResult.Details), - _ => throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}") + _ => throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}") }; } - public async System.Threading.Tasks.Task Match(System.Func> ok, System.Func> error) + public async global::System.Threading.Tasks.Task Match(global::System.Func> ok, global::System.Func> error) { return this switch { Ok_ okOperationResult => await ok(okOperationResult.Value).ConfigureAwait(false), Error_ errorOperationResult => await error(errorOperationResult.Details).ConfigureAwait(false), - _ => throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}") + _ => throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}") }; } - public System.Threading.Tasks.Task Match(System.Func> ok, System.Func error) => - Match(ok, e => System.Threading.Tasks.Task.FromResult(error(e))); + public global::System.Threading.Tasks.Task Match(global::System.Func> ok, global::System.Func error) => + Match(ok, e => global::System.Threading.Tasks.Task.FromResult(error(e))); - public async System.Threading.Tasks.Task Match(System.Func ok) + public async global::System.Threading.Tasks.Task Match(global::System.Func ok) { if (this is Ok_ okOperationResult) await ok(okOperationResult.Value).ConfigureAwait(false); } - public T Match(System.Func error) => Match(v => v, error); + public T Match(global::System.Func error) => Match(v => v, error); - public OperationResult Bind(System.Func> bind) + public OperationResult Bind(global::System.Func> bind) { switch (this) { @@ -155,7 +155,7 @@ public OperationResult Bind(System.Func> bind) } // ReSharper disable once RedundantCatchClause #pragma warning disable CS0168 // Variable is declared but never used - catch (System.Exception e) + catch (global::System.Exception e) #pragma warning restore CS0168 // Variable is declared but never used { return OperationResult.Error(FunicularSwitch.Test.ErrorFactory.FromException(e)); @@ -163,11 +163,11 @@ public OperationResult Bind(System.Func> bind) case Error_ error: return error.Convert(); default: - throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); + throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); } } - public async System.Threading.Tasks.Task> Bind(System.Func>> bind) + public async global::System.Threading.Tasks.Task> Bind(global::System.Func>> bind) { switch (this) { @@ -178,7 +178,7 @@ public async System.Threading.Tasks.Task> Bind(System.Fu } // ReSharper disable once RedundantCatchClause #pragma warning disable CS0168 // Variable is declared but never used - catch (System.Exception e) + catch (global::System.Exception e) #pragma warning restore CS0168 // Variable is declared but never used { return OperationResult.Error(FunicularSwitch.Test.ErrorFactory.FromException(e)); @@ -186,14 +186,14 @@ public async System.Threading.Tasks.Task> Bind(System.Fu case Error_ error: return error.Convert(); default: - throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); + throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); } } - public OperationResult Map(System.Func map) + public OperationResult Map(global::System.Func map) => Bind(value => Ok(map(value))); - public System.Threading.Tasks.Task> Map(System.Func> map) + public global::System.Threading.Tasks.Task> Map(global::System.Func> map) => Bind(async value => Ok(await map(value).ConfigureAwait(false))); public T? GetValueOrDefault() @@ -202,7 +202,7 @@ public System.Threading.Tasks.Task> Map(System.Func default ); - public T GetValueOrDefault(System.Func defaultValue) + public T GetValueOrDefault(global::System.Func defaultValue) => Match( v => v, _ => defaultValue() @@ -217,12 +217,12 @@ public T GetValueOrDefault(T defaultValue) public T GetValueOrThrow() => Match( v => v, - details => throw new System.InvalidOperationException($"Cannot access error result value. Error: {details}")); + details => throw new global::System.InvalidOperationException($"Cannot access error result value. Error: {details}")); - public System.Collections.Generic.IEnumerator GetEnumerator() => Match(ok => new[] { ok }, _ => Enumerable.Empty()).GetEnumerator(); + public global::System.Collections.Generic.IEnumerator GetEnumerator() => Match(ok => new[] { ok }, _ => Enumerable.Empty()).GetEnumerator(); public override string ToString() => Match(ok => $"Ok {ok?.ToString()}", error => $"Error {error}"); - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); + global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); public sealed partial class Ok_ : OperationResult { @@ -236,7 +236,7 @@ public bool Equals(Ok_? other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; - return System.Collections.Generic.EqualityComparer.Default.Equals(Value, other.Value); + return global::System.Collections.Generic.EqualityComparer.Default.Equals(Value, other.Value); } public override bool Equals(object? obj) @@ -246,7 +246,7 @@ public override bool Equals(object? obj) return obj is Ok_ other && Equals(other); } - public override int GetHashCode() => Value == null ? 0 : System.Collections.Generic.EqualityComparer.Default.GetHashCode(Value); + public override int GetHashCode() => Value == null ? 0 : global::System.Collections.Generic.EqualityComparer.Default.GetHashCode(Value); public static bool operator ==(Ok_ left, Ok_ right) => Equals(left, right); @@ -290,66 +290,66 @@ public static partial class OperationResultExtension { #region bind - public static async System.Threading.Tasks.Task> Bind( - this System.Threading.Tasks.Task> result, - System.Func> bind) + public static async global::System.Threading.Tasks.Task> Bind( + this global::System.Threading.Tasks.Task> result, + global::System.Func> bind) => (await result.ConfigureAwait(false)).Bind(bind); - public static async System.Threading.Tasks.Task> Bind( - this System.Threading.Tasks.Task> result, - System.Func>> bind) + public static async global::System.Threading.Tasks.Task> Bind( + this global::System.Threading.Tasks.Task> result, + global::System.Func>> bind) => await (await result.ConfigureAwait(false)).Bind(bind).ConfigureAwait(false); #endregion #region map - public static async System.Threading.Tasks.Task> Map( - this System.Threading.Tasks.Task> result, - System.Func map) + public static async global::System.Threading.Tasks.Task> Map( + this global::System.Threading.Tasks.Task> result, + global::System.Func map) => (await result.ConfigureAwait(false)).Map(map); - public static System.Threading.Tasks.Task> Map( - this System.Threading.Tasks.Task> result, - System.Func> bind) + public static global::System.Threading.Tasks.Task> Map( + this global::System.Threading.Tasks.Task> result, + global::System.Func> bind) => Bind(result, async v => OperationResult.Ok(await bind(v).ConfigureAwait(false))); - public static OperationResult MapError(this OperationResult result, System.Func mapError) + public static OperationResult MapError(this OperationResult result, global::System.Func mapError) { if (result is OperationResult.Error_ e) return OperationResult.Error(mapError(e.Details)); return result; } - public static async System.Threading.Tasks.Task> MapError(this System.Threading.Tasks.Task> result, System.Func mapError) => (await result.ConfigureAwait(false)).MapError(mapError); + public static async global::System.Threading.Tasks.Task> MapError(this global::System.Threading.Tasks.Task> result, global::System.Func mapError) => (await result.ConfigureAwait(false)).MapError(mapError); #endregion #region match - public static async System.Threading.Tasks.Task Match( - this System.Threading.Tasks.Task> result, - System.Func> ok, - System.Func> error) + public static async global::System.Threading.Tasks.Task Match( + this global::System.Threading.Tasks.Task> result, + global::System.Func> ok, + global::System.Func> error) => await (await result.ConfigureAwait(false)).Match(ok, error).ConfigureAwait(false); - public static async System.Threading.Tasks.Task Match( - this System.Threading.Tasks.Task> result, - System.Func> ok, - System.Func error) + public static async global::System.Threading.Tasks.Task Match( + this global::System.Threading.Tasks.Task> result, + global::System.Func> ok, + global::System.Func error) => await (await result.ConfigureAwait(false)).Match(ok, error).ConfigureAwait(false); - public static async System.Threading.Tasks.Task Match( - this System.Threading.Tasks.Task> result, - System.Func ok, - System.Func error) + public static async global::System.Threading.Tasks.Task Match( + this global::System.Threading.Tasks.Task> result, + global::System.Func ok, + global::System.Func error) => (await result.ConfigureAwait(false)).Match(ok, error); #endregion public static OperationResult Flatten(this OperationResult> result) => result.Bind(r => r); - public static OperationResult As(this OperationResult result, System.Func errorTIsNotT1) => + public static OperationResult As(this OperationResult result, global::System.Func errorTIsNotT1) => result.Bind(r => { if (r is T1 converted) @@ -357,18 +357,18 @@ public static OperationResult As(this OperationResult result, Syst return OperationResult.Error(errorTIsNotT1()); }); - public static OperationResult As(this OperationResult result, System.Func errorIsNotT1) => + public static OperationResult As(this OperationResult result, global::System.Func errorIsNotT1) => result.As(errorIsNotT1); #region query-expression pattern - public static OperationResult Select(this OperationResult result, System.Func selector) => result.Map(selector); - public static System.Threading.Tasks.Task> Select(this System.Threading.Tasks.Task> result, System.Func selector) => result.Map(selector); + public static OperationResult Select(this OperationResult result, global::System.Func selector) => result.Map(selector); + public static global::System.Threading.Tasks.Task> Select(this global::System.Threading.Tasks.Task> result, global::System.Func selector) => result.Map(selector); - public static OperationResult SelectMany(this OperationResult result, System.Func> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); - public static System.Threading.Tasks.Task> SelectMany(this System.Threading.Tasks.Task> result, System.Func>> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); - public static System.Threading.Tasks.Task> SelectMany(this System.Threading.Tasks.Task> result, System.Func> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); - public static System.Threading.Tasks.Task> SelectMany(this OperationResult result, System.Func>> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static OperationResult SelectMany(this OperationResult result, global::System.Func> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static global::System.Threading.Tasks.Task> SelectMany(this global::System.Threading.Tasks.Task> result, global::System.Func>> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static global::System.Threading.Tasks.Task> SelectMany(this global::System.Threading.Tasks.Task> result, global::System.Func> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static global::System.Threading.Tasks.Task> SelectMany(this OperationResult result, global::System.Func>> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); #endregion } @@ -378,17 +378,17 @@ namespace FunicularSwitch.Test.Extensions { public static partial class OperationResultExtension { - public static System.Collections.Generic.IEnumerable Choose( - this System.Collections.Generic.IEnumerable items, - System.Func> choose, - System.Action onError) + public static global::System.Collections.Generic.IEnumerable Choose( + this global::System.Collections.Generic.IEnumerable items, + global::System.Func> choose, + global::System.Action onError) => items .Select(i => choose(i)) .Choose(onError); - public static System.Collections.Generic.IEnumerable Choose( - this System.Collections.Generic.IEnumerable> results, - System.Action onError) + public static global::System.Collections.Generic.IEnumerable Choose( + this global::System.Collections.Generic.IEnumerable> results, + global::System.Action onError) => results .Where(r => r.Match(_ => true, error => @@ -398,19 +398,19 @@ public static System.Collections.Generic.IEnumerable Choose( })) .Select(r => r.GetValueOrThrow()); - public static OperationResult As(this object item, System.Func error) => + public static OperationResult As(this object item, global::System.Func error) => !(item is T t) ? OperationResult.Error(error()) : t; - public static OperationResult NotNull(this T? item, System.Func error) => + public static OperationResult NotNull(this T? item, global::System.Func error) => item ?? OperationResult.Error(error()); - public static OperationResult NotNullOrEmpty(this string? s, System.Func error) + public static OperationResult NotNullOrEmpty(this string? s, global::System.Func error) => string.IsNullOrEmpty(s) ? OperationResult.Error(error()) : s!; - public static OperationResult NotNullOrWhiteSpace(this string? s, System.Func error) + public static OperationResult NotNullOrWhiteSpace(this string? s, global::System.Func error) => string.IsNullOrWhiteSpace(s) ? OperationResult.Error(error()) : s!; - public static OperationResult First(this System.Collections.Generic.IEnumerable candidates, System.Func predicate, System.Func noMatch) => + public static OperationResult First(this global::System.Collections.Generic.IEnumerable candidates, global::System.Func predicate, global::System.Func noMatch) => candidates .FirstOrDefault(i => predicate(i)) .NotNull(noMatch); diff --git a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_error_type_with_merge#FunicularSwitch.Test.OperationResultWithMerge.g.verified.cs b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_error_type_with_merge#FunicularSwitch.Test.OperationResultWithMerge.g.verified.cs index 7cc3d97..f39e9a2 100644 --- a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_error_type_with_merge#FunicularSwitch.Test.OperationResultWithMerge.g.verified.cs +++ b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_error_type_with_merge#FunicularSwitch.Test.OperationResultWithMerge.g.verified.cs @@ -1,6 +1,6 @@ //HintName: FunicularSwitch.Test.OperationResultWithMerge.g.cs #nullable enable -using System.Linq; +using global::System.Linq; using FunicularSwitch; namespace FunicularSwitch.Test @@ -11,92 +11,92 @@ public abstract partial class OperationResult public static OperationResult<(T1, T2)> Aggregate(OperationResult r1, OperationResult r2) => OperationResultExtension.Aggregate(r1, r2); - public static OperationResult Aggregate(OperationResult r1, OperationResult r2, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, combine); + public static OperationResult Aggregate(OperationResult r1, OperationResult r2, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2) => OperationResultExtension.Aggregate(r1, r2); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2) => OperationResultExtension.Aggregate(r1, r2); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, combine); public static OperationResult<(T1, T2, T3)> Aggregate(OperationResult r1, OperationResult r2, OperationResult r3) => OperationResultExtension.Aggregate(r1, r2, r3); - public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, combine); + public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3) => OperationResultExtension.Aggregate(r1, r2, r3); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3) => OperationResultExtension.Aggregate(r1, r2, r3); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, combine); public static OperationResult<(T1, T2, T3, T4)> Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4) => OperationResultExtension.Aggregate(r1, r2, r3, r4); - public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, combine); + public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4) => OperationResultExtension.Aggregate(r1, r2, r3, r4); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4) => OperationResultExtension.Aggregate(r1, r2, r3, r4); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, combine); public static OperationResult<(T1, T2, T3, T4, T5)> Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5); - public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, combine); + public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, combine); public static OperationResult<(T1, T2, T3, T4, T5, T6)> Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6); - public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, combine); + public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, combine); public static OperationResult<(T1, T2, T3, T4, T5, T6, T7)> Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7); - public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, combine); + public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, combine); public static OperationResult<(T1, T2, T3, T4, T5, T6, T7, T8)> Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8); - public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, combine); + public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, combine); public static OperationResult<(T1, T2, T3, T4, T5, T6, T7, T8, T9)> Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, OperationResult r9) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9); - public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, OperationResult r9, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, combine); + public static OperationResult Aggregate(OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, OperationResult r9, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, combine); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Threading.Tasks.Task> r9) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Threading.Tasks.Task> r9) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9); - public static System.Threading.Tasks.Task> Aggregate(System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Threading.Tasks.Task> r9, System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, combine); + public static global::System.Threading.Tasks.Task> Aggregate(global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Threading.Tasks.Task> r9, global::System.Func combine) => OperationResultExtension.Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, combine); } public static partial class OperationResultExtension { - public static OperationResult> Map(this System.Collections.Generic.IEnumerable> results, - System.Func map) => + public static OperationResult> Map(this global::System.Collections.Generic.IEnumerable> results, + global::System.Func map) => results.Select(r => r.Map(map)).Aggregate(); - public static OperationResult> Bind(this System.Collections.Generic.IEnumerable> results, - System.Func> bind) => + public static OperationResult> Bind(this global::System.Collections.Generic.IEnumerable> results, + global::System.Func> bind) => results.Select(r => r.Bind(bind)).Aggregate(); - public static OperationResult> Bind(this OperationResult result, - System.Func>> bindMany) => + public static OperationResult> Bind(this OperationResult result, + global::System.Func>> bindMany) => result.Map(ok => bindMany(ok).Aggregate()).Flatten(); - public static OperationResult Bind(this System.Collections.Generic.IEnumerable> results, - System.Func, OperationResult> bind) => + public static OperationResult Bind(this global::System.Collections.Generic.IEnumerable> results, + global::System.Func, OperationResult> bind) => results.Aggregate().Bind(bind); - public static OperationResult> Aggregate(this System.Collections.Generic.IEnumerable> results) + public static OperationResult> Aggregate(this global::System.Collections.Generic.IEnumerable> results) { var isError = false; MyError aggregated = default!; - var oks = new System.Collections.Generic.List(); + var oks = new global::System.Collections.Generic.List(); foreach (var result in results) { result.Match( @@ -110,23 +110,23 @@ public static OperationResult Bind(this System.Collections.Generic.IE } return isError - ? OperationResult.Error>(aggregated) - : OperationResult.Ok>(oks); + ? OperationResult.Error>(aggregated) + : OperationResult.Ok>(oks); } - public static async System.Threading.Tasks.Task>> Aggregate( - this System.Threading.Tasks.Task>> results) + public static async global::System.Threading.Tasks.Task>> Aggregate( + this global::System.Threading.Tasks.Task>> results) => (await results.ConfigureAwait(false)) .Aggregate(); - public static async System.Threading.Tasks.Task>> Aggregate( - this System.Collections.Generic.IEnumerable>> results) - => (await System.Threading.Tasks.Task.WhenAll(results.Select(e => e)).ConfigureAwait(false)) + public static async global::System.Threading.Tasks.Task>> Aggregate( + this global::System.Collections.Generic.IEnumerable>> results) + => (await global::System.Threading.Tasks.Task.WhenAll(results.Select(e => e)).ConfigureAwait(false)) .Aggregate(); - public static async System.Threading.Tasks.Task>> AggregateMany( - this System.Collections.Generic.IEnumerable>>> results) - => (await System.Threading.Tasks.Task.WhenAll(results.Select(e => e)).ConfigureAwait(false)) + public static async global::System.Threading.Tasks.Task>> AggregateMany( + this global::System.Collections.Generic.IEnumerable>>> results) + => (await global::System.Threading.Tasks.Task.WhenAll(results.Select(e => e)).ConfigureAwait(false)) .SelectMany(e => e) .Aggregate(); @@ -134,7 +134,7 @@ public static OperationResult Bind(this System.Collections.Generic.IE public static OperationResult<(T1, T2)> Aggregate(this OperationResult r1, OperationResult r2) => Aggregate(r1, r2, (v1, v2) => (v1, v2)); - public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, System.Func combine) + public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, global::System.Func combine) { if (r1 is OperationResult.Ok_ ok1 && r2 is OperationResult.Ok_ ok2) return combine(ok1.Value, ok2.Value); @@ -146,19 +146,19 @@ public static OperationResult Aggregate(this Operation )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2) => Aggregate(r1, r2, (v1, v2) => (v1, v2)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2); return Aggregate(r1.Result, r2.Result, combine); } public static OperationResult<(T1, T2, T3)> Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3) => Aggregate(r1, r2, r3, (v1, v2, v3) => (v1, v2, v3)); - public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, System.Func combine) + public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, global::System.Func combine) { if (r1 is OperationResult.Ok_ ok1 && r2 is OperationResult.Ok_ ok2 && r3 is OperationResult.Ok_ ok3) return combine(ok1.Value, ok2.Value, ok3.Value); @@ -170,19 +170,19 @@ public static OperationResult Aggregate(this Opera )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3) => Aggregate(r1, r2, r3, (v1, v2, v3) => (v1, v2, v3)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3); return Aggregate(r1.Result, r2.Result, r3.Result, combine); } public static OperationResult<(T1, T2, T3, T4)> Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4) => Aggregate(r1, r2, r3, r4, (v1, v2, v3, v4) => (v1, v2, v3, v4)); - public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, System.Func combine) + public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, global::System.Func combine) { if (r1 is OperationResult.Ok_ ok1 && r2 is OperationResult.Ok_ ok2 && r3 is OperationResult.Ok_ ok3 && r4 is OperationResult.Ok_ ok4) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value); @@ -194,19 +194,19 @@ public static OperationResult Aggregate(this O )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4) => Aggregate(r1, r2, r3, r4, (v1, v2, v3, v4) => (v1, v2, v3, v4)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, combine); } public static OperationResult<(T1, T2, T3, T4, T5)> Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5) => Aggregate(r1, r2, r3, r4, r5, (v1, v2, v3, v4, v5) => (v1, v2, v3, v4, v5)); - public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, System.Func combine) + public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, global::System.Func combine) { if (r1 is OperationResult.Ok_ ok1 && r2 is OperationResult.Ok_ ok2 && r3 is OperationResult.Ok_ ok3 && r4 is OperationResult.Ok_ ok4 && r5 is OperationResult.Ok_ ok5) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value); @@ -218,19 +218,19 @@ public static OperationResult Aggregate(th )!); } - public static System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5) => Aggregate(r1, r2, r3, r4, r5, (v1, v2, v3, v4, v5) => (v1, v2, v3, v4, v5)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, combine); } public static OperationResult<(T1, T2, T3, T4, T5, T6)> Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6) => Aggregate(r1, r2, r3, r4, r5, r6, (v1, v2, v3, v4, v5, v6) => (v1, v2, v3, v4, v5, v6)); - public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, System.Func combine) + public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, global::System.Func combine) { if (r1 is OperationResult.Ok_ ok1 && r2 is OperationResult.Ok_ ok2 && r3 is OperationResult.Ok_ ok3 && r4 is OperationResult.Ok_ ok4 && r5 is OperationResult.Ok_ ok5 && r6 is OperationResult.Ok_ ok6) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value, ok6.Value); @@ -242,19 +242,19 @@ public static OperationResult Aggregate> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6) => Aggregate(r1, r2, r3, r4, r5, r6, (v1, v2, v3, v4, v5, v6) => (v1, v2, v3, v4, v5, v6)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, r6.Result, combine); } public static OperationResult<(T1, T2, T3, T4, T5, T6, T7)> Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7) => Aggregate(r1, r2, r3, r4, r5, r6, r7, (v1, v2, v3, v4, v5, v6, v7) => (v1, v2, v3, v4, v5, v6, v7)); - public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, System.Func combine) + public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, global::System.Func combine) { if (r1 is OperationResult.Ok_ ok1 && r2 is OperationResult.Ok_ ok2 && r3 is OperationResult.Ok_ ok3 && r4 is OperationResult.Ok_ ok4 && r5 is OperationResult.Ok_ ok5 && r6 is OperationResult.Ok_ ok6 && r7 is OperationResult.Ok_ ok7) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value, ok6.Value, ok7.Value); @@ -266,19 +266,19 @@ public static OperationResult Aggregate> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7) => Aggregate(r1, r2, r3, r4, r5, r6, r7, (v1, v2, v3, v4, v5, v6, v7) => (v1, v2, v3, v4, v5, v6, v7)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, r6.Result, r7.Result, combine); } public static OperationResult<(T1, T2, T3, T4, T5, T6, T7, T8)> Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8) => Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, (v1, v2, v3, v4, v5, v6, v7, v8) => (v1, v2, v3, v4, v5, v6, v7, v8)); - public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, System.Func combine) + public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, global::System.Func combine) { if (r1 is OperationResult.Ok_ ok1 && r2 is OperationResult.Ok_ ok2 && r3 is OperationResult.Ok_ ok3 && r4 is OperationResult.Ok_ ok4 && r5 is OperationResult.Ok_ ok5 && r6 is OperationResult.Ok_ ok6 && r7 is OperationResult.Ok_ ok7 && r8 is OperationResult.Ok_ ok8) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value, ok6.Value, ok7.Value, ok8.Value); @@ -290,19 +290,19 @@ public static OperationResult Aggregate> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8) => Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, (v1, v2, v3, v4, v5, v6, v7, v8) => (v1, v2, v3, v4, v5, v6, v7, v8)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7, r8); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7, r8); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, r6.Result, r7.Result, r8.Result, combine); } public static OperationResult<(T1, T2, T3, T4, T5, T6, T7, T8, T9)> Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, OperationResult r9) => Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, (v1, v2, v3, v4, v5, v6, v7, v8, v9) => (v1, v2, v3, v4, v5, v6, v7, v8, v9)); - public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, OperationResult r9, System.Func combine) + public static OperationResult Aggregate(this OperationResult r1, OperationResult r2, OperationResult r3, OperationResult r4, OperationResult r5, OperationResult r6, OperationResult r7, OperationResult r8, OperationResult r9, global::System.Func combine) { if (r1 is OperationResult.Ok_ ok1 && r2 is OperationResult.Ok_ ok2 && r3 is OperationResult.Ok_ ok3 && r4 is OperationResult.Ok_ ok4 && r5 is OperationResult.Ok_ ok5 && r6 is OperationResult.Ok_ ok6 && r7 is OperationResult.Ok_ ok7 && r8 is OperationResult.Ok_ ok8 && r9 is OperationResult.Ok_ ok9) return combine(ok1.Value, ok2.Value, ok3.Value, ok4.Value, ok5.Value, ok6.Value, ok7.Value, ok8.Value, ok9.Value); @@ -314,18 +314,18 @@ public static OperationResult Aggregate> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Threading.Tasks.Task> r9) + public static global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Threading.Tasks.Task> r9) => Aggregate(r1, r2, r3, r4, r5, r6, r7, r8, r9, (v1, v2, v3, v4, v5, v6, v7, v8, v9) => (v1, v2, v3, v4, v5, v6, v7, v8, v9)); - public static async System.Threading.Tasks.Task> Aggregate(this System.Threading.Tasks.Task> r1, System.Threading.Tasks.Task> r2, System.Threading.Tasks.Task> r3, System.Threading.Tasks.Task> r4, System.Threading.Tasks.Task> r5, System.Threading.Tasks.Task> r6, System.Threading.Tasks.Task> r7, System.Threading.Tasks.Task> r8, System.Threading.Tasks.Task> r9, System.Func combine) + public static async global::System.Threading.Tasks.Task> Aggregate(this global::System.Threading.Tasks.Task> r1, global::System.Threading.Tasks.Task> r2, global::System.Threading.Tasks.Task> r3, global::System.Threading.Tasks.Task> r4, global::System.Threading.Tasks.Task> r5, global::System.Threading.Tasks.Task> r6, global::System.Threading.Tasks.Task> r7, global::System.Threading.Tasks.Task> r8, global::System.Threading.Tasks.Task> r9, global::System.Func combine) { - await System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7, r8, r9); + await global::System.Threading.Tasks.Task.WhenAll(r1, r2, r3, r4, r5, r6, r7, r8, r9); return Aggregate(r1.Result, r2.Result, r3.Result, r4.Result, r5.Result, r6.Result, r7.Result, r8.Result, r9.Result, combine); } - public static OperationResult FirstOk(this System.Collections.Generic.IEnumerable> results, System.Func onEmpty) + public static OperationResult FirstOk(this global::System.Collections.Generic.IEnumerable> results, global::System.Func onEmpty) { - var errors = new System.Collections.Generic.List(); + var errors = new global::System.Collections.Generic.List(); foreach (var result in results) { if (result is OperationResult.Error_ e) @@ -340,24 +340,24 @@ public static OperationResult FirstOk(this System.Collections.Generic.IEnu return OperationResult.Error(MergeErrors(errors)); } - public static async System.Threading.Tasks.Task>> Aggregate( - this System.Collections.Generic.IEnumerable>> results, + public static async global::System.Threading.Tasks.Task>> Aggregate( + this global::System.Collections.Generic.IEnumerable>> results, int maxDegreeOfParallelism) => (await results.SelectAsync(e => e, maxDegreeOfParallelism).ConfigureAwait(false)) .Aggregate(); - public static async System.Threading.Tasks.Task>> AggregateMany( - this System.Collections.Generic.IEnumerable>>> results, + public static async global::System.Threading.Tasks.Task>> AggregateMany( + this global::System.Collections.Generic.IEnumerable>>> results, int maxDegreeOfParallelism) => (await results.SelectAsync(e => e, maxDegreeOfParallelism).ConfigureAwait(false)) .SelectMany(e => e) .Aggregate(); - static async System.Threading.Tasks.Task SelectAsync(this System.Collections.Generic.IEnumerable items, System.Func> selector, int maxDegreeOfParallelism) + static async global::System.Threading.Tasks.Task SelectAsync(this global::System.Collections.Generic.IEnumerable items, global::System.Func> selector, int maxDegreeOfParallelism) { - using (var throttler = new System.Threading.SemaphoreSlim(maxDegreeOfParallelism, maxDegreeOfParallelism)) + using (var throttler = new global::System.Threading.SemaphoreSlim(maxDegreeOfParallelism, maxDegreeOfParallelism)) { - return await System.Threading.Tasks.Task.WhenAll(items.Select(async item => + return await global::System.Threading.Tasks.Task.WhenAll(items.Select(async item => { // ReSharper disable once AccessToDisposedClosure await throttler.WaitAsync().ConfigureAwait(false); @@ -374,19 +374,19 @@ static async System.Threading.Tasks.Task SelectAsync(this Syste } } - public static OperationResult> AllOk(this System.Collections.Generic.IEnumerable candidates, System.Func> validate) => + public static OperationResult> AllOk(this global::System.Collections.Generic.IEnumerable candidates, global::System.Func> validate) => candidates .Select(c => c.Validate(validate)) .Aggregate(); - public static OperationResult> AllOk(this System.Collections.Generic.IEnumerable> candidates, - System.Func> validate) => + public static OperationResult> AllOk(this global::System.Collections.Generic.IEnumerable> candidates, + global::System.Func> validate) => candidates .Bind(items => items.AllOk(validate)); - public static OperationResult Validate(this OperationResult item, System.Func> validate) => item.Bind(i => i.Validate(validate)); + public static OperationResult Validate(this OperationResult item, global::System.Func> validate) => item.Bind(i => i.Validate(validate)); - public static OperationResult Validate(this T item, System.Func> validate) + public static OperationResult Validate(this T item, global::System.Func> validate) { try { @@ -395,21 +395,21 @@ public static OperationResult Validate(this T item, System.Func(FunicularSwitch.Test.ErrorFactory.FromException(e)); } } - public static OperationResult FirstOk(this System.Collections.Generic.IEnumerable candidates, System.Func> validate, System.Func onEmpty) => + public static OperationResult FirstOk(this global::System.Collections.Generic.IEnumerable candidates, global::System.Func> validate, global::System.Func onEmpty) => candidates .Select(r => r.Validate(validate)) .FirstOk(onEmpty); #region helpers - static MyError MergeErrors(System.Collections.Generic.IEnumerable errors) + static MyError MergeErrors(global::System.Collections.Generic.IEnumerable errors) { var first = true; MyError aggregated = default!; diff --git a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_internal_result_type#FunicularSwitch.Test.OperationResult.g.verified.cs b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_internal_result_type#FunicularSwitch.Test.OperationResult.g.verified.cs index 8b855cc..3bbfe9e 100644 --- a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_internal_result_type#FunicularSwitch.Test.OperationResult.g.verified.cs +++ b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_result_type_generator.For_internal_result_type#FunicularSwitch.Test.OperationResult.g.verified.cs @@ -1,6 +1,6 @@ //HintName: FunicularSwitch.Test.OperationResult.g.cs #nullable enable -using System.Linq; +using global::System.Linq; using FunicularSwitch; namespace FunicularSwitch.Test @@ -14,56 +14,56 @@ abstract partial class OperationResult public bool IsOk => !IsError; public abstract MyError? GetErrorOrDefault(); - public static OperationResult Try(System.Func action, System.Func formatError) + public static OperationResult Try(global::System.Func action, global::System.Func formatError) { try { return action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } - public static async System.Threading.Tasks.Task> Try(System.Func> action, System.Func formatError) + public static async global::System.Threading.Tasks.Task> Try(global::System.Func> action, global::System.Func formatError) { try { return await action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } - public static OperationResult Try(System.Func> action, System.Func formatError) + public static OperationResult Try(global::System.Func> action, global::System.Func formatError) { try { return action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } - public static async System.Threading.Tasks.Task> Try(System.Func>> action, System.Func formatError) + public static async global::System.Threading.Tasks.Task> Try(global::System.Func>> action, global::System.Func formatError) { try { return await action(); } - catch (System.Exception e) + catch (global::System.Exception e) { return Error(formatError(e)); } } } - abstract partial class OperationResult : OperationResult, System.Collections.Generic.IEnumerable + abstract partial class OperationResult : OperationResult, global::System.Collections.Generic.IEnumerable { public static OperationResult Error(MyError message) => Error(message); public static OperationResult Ok(T value) => Ok(value); @@ -80,14 +80,14 @@ abstract partial class OperationResult : OperationResult, System.Collections. { Ok_ ok => ok.Equals((object)other), Error_ error => error.Equals((object)other), - _ => throw new System.InvalidOperationException($"Unexpected type derived from {nameof(OperationResult)}") + _ => throw new global::System.InvalidOperationException($"Unexpected type derived from {nameof(OperationResult)}") }; public override int GetHashCode() => this switch { Ok_ ok => ok.GetHashCode(), Error_ error => error.GetHashCode(), - _ => throw new System.InvalidOperationException($"Unexpected type derived from {nameof(OperationResult)}") + _ => throw new global::System.InvalidOperationException($"Unexpected type derived from {nameof(OperationResult)}") }; public override bool Equals(object? obj) @@ -102,7 +102,7 @@ public override bool Equals(object? obj) public static bool operator !=(OperationResult? left, OperationResult? right) => !Equals(left, right); - public void Match(System.Action ok, System.Action? error = null) => Match( + public void Match(global::System.Action ok, global::System.Action? error = null) => Match( v => { ok.Invoke(v); @@ -114,37 +114,37 @@ public void Match(System.Action ok, System.Action? error = null) => return 42; }); - public T1 Match(System.Func ok, System.Func error) + public T1 Match(global::System.Func ok, global::System.Func error) { return this switch { Ok_ okOperationResult => ok(okOperationResult.Value), Error_ errorOperationResult => error(errorOperationResult.Details), - _ => throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}") + _ => throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}") }; } - public async System.Threading.Tasks.Task Match(System.Func> ok, System.Func> error) + public async global::System.Threading.Tasks.Task Match(global::System.Func> ok, global::System.Func> error) { return this switch { Ok_ okOperationResult => await ok(okOperationResult.Value).ConfigureAwait(false), Error_ errorOperationResult => await error(errorOperationResult.Details).ConfigureAwait(false), - _ => throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}") + _ => throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}") }; } - public System.Threading.Tasks.Task Match(System.Func> ok, System.Func error) => - Match(ok, e => System.Threading.Tasks.Task.FromResult(error(e))); + public global::System.Threading.Tasks.Task Match(global::System.Func> ok, global::System.Func error) => + Match(ok, e => global::System.Threading.Tasks.Task.FromResult(error(e))); - public async System.Threading.Tasks.Task Match(System.Func ok) + public async global::System.Threading.Tasks.Task Match(global::System.Func ok) { if (this is Ok_ okOperationResult) await ok(okOperationResult.Value).ConfigureAwait(false); } - public T Match(System.Func error) => Match(v => v, error); + public T Match(global::System.Func error) => Match(v => v, error); - public OperationResult Bind(System.Func> bind) + public OperationResult Bind(global::System.Func> bind) { switch (this) { @@ -155,7 +155,7 @@ public OperationResult Bind(System.Func> bind) } // ReSharper disable once RedundantCatchClause #pragma warning disable CS0168 // Variable is declared but never used - catch (System.Exception e) + catch (global::System.Exception e) #pragma warning restore CS0168 // Variable is declared but never used { throw; //createGenericErrorResult @@ -163,11 +163,11 @@ public OperationResult Bind(System.Func> bind) case Error_ error: return error.Convert(); default: - throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); + throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); } } - public async System.Threading.Tasks.Task> Bind(System.Func>> bind) + public async global::System.Threading.Tasks.Task> Bind(global::System.Func>> bind) { switch (this) { @@ -178,7 +178,7 @@ public async System.Threading.Tasks.Task> Bind(System.Fu } // ReSharper disable once RedundantCatchClause #pragma warning disable CS0168 // Variable is declared but never used - catch (System.Exception e) + catch (global::System.Exception e) #pragma warning restore CS0168 // Variable is declared but never used { throw; //createGenericErrorResult @@ -186,14 +186,14 @@ public async System.Threading.Tasks.Task> Bind(System.Fu case Error_ error: return error.Convert(); default: - throw new System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); + throw new global::System.InvalidOperationException($"Unexpected derived result type: {GetType()}"); } } - public OperationResult Map(System.Func map) + public OperationResult Map(global::System.Func map) => Bind(value => Ok(map(value))); - public System.Threading.Tasks.Task> Map(System.Func> map) + public global::System.Threading.Tasks.Task> Map(global::System.Func> map) => Bind(async value => Ok(await map(value).ConfigureAwait(false))); public T? GetValueOrDefault() @@ -202,7 +202,7 @@ public System.Threading.Tasks.Task> Map(System.Func default ); - public T GetValueOrDefault(System.Func defaultValue) + public T GetValueOrDefault(global::System.Func defaultValue) => Match( v => v, _ => defaultValue() @@ -217,12 +217,12 @@ public T GetValueOrDefault(T defaultValue) public T GetValueOrThrow() => Match( v => v, - details => throw new System.InvalidOperationException($"Cannot access error result value. Error: {details}")); + details => throw new global::System.InvalidOperationException($"Cannot access error result value. Error: {details}")); - public System.Collections.Generic.IEnumerator GetEnumerator() => Match(ok => new[] { ok }, _ => Enumerable.Empty()).GetEnumerator(); + public global::System.Collections.Generic.IEnumerator GetEnumerator() => Match(ok => new[] { ok }, _ => Enumerable.Empty()).GetEnumerator(); public override string ToString() => Match(ok => $"Ok {ok?.ToString()}", error => $"Error {error}"); - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); + global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); public sealed partial class Ok_ : OperationResult { @@ -236,7 +236,7 @@ public bool Equals(Ok_? other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; - return System.Collections.Generic.EqualityComparer.Default.Equals(Value, other.Value); + return global::System.Collections.Generic.EqualityComparer.Default.Equals(Value, other.Value); } public override bool Equals(object? obj) @@ -246,7 +246,7 @@ public override bool Equals(object? obj) return obj is Ok_ other && Equals(other); } - public override int GetHashCode() => Value == null ? 0 : System.Collections.Generic.EqualityComparer.Default.GetHashCode(Value); + public override int GetHashCode() => Value == null ? 0 : global::System.Collections.Generic.EqualityComparer.Default.GetHashCode(Value); public static bool operator ==(Ok_ left, Ok_ right) => Equals(left, right); @@ -290,66 +290,66 @@ static partial class OperationResultExtension { #region bind - public static async System.Threading.Tasks.Task> Bind( - this System.Threading.Tasks.Task> result, - System.Func> bind) + public static async global::System.Threading.Tasks.Task> Bind( + this global::System.Threading.Tasks.Task> result, + global::System.Func> bind) => (await result.ConfigureAwait(false)).Bind(bind); - public static async System.Threading.Tasks.Task> Bind( - this System.Threading.Tasks.Task> result, - System.Func>> bind) + public static async global::System.Threading.Tasks.Task> Bind( + this global::System.Threading.Tasks.Task> result, + global::System.Func>> bind) => await (await result.ConfigureAwait(false)).Bind(bind).ConfigureAwait(false); #endregion #region map - public static async System.Threading.Tasks.Task> Map( - this System.Threading.Tasks.Task> result, - System.Func map) + public static async global::System.Threading.Tasks.Task> Map( + this global::System.Threading.Tasks.Task> result, + global::System.Func map) => (await result.ConfigureAwait(false)).Map(map); - public static System.Threading.Tasks.Task> Map( - this System.Threading.Tasks.Task> result, - System.Func> bind) + public static global::System.Threading.Tasks.Task> Map( + this global::System.Threading.Tasks.Task> result, + global::System.Func> bind) => Bind(result, async v => OperationResult.Ok(await bind(v).ConfigureAwait(false))); - public static OperationResult MapError(this OperationResult result, System.Func mapError) + public static OperationResult MapError(this OperationResult result, global::System.Func mapError) { if (result is OperationResult.Error_ e) return OperationResult.Error(mapError(e.Details)); return result; } - public static async System.Threading.Tasks.Task> MapError(this System.Threading.Tasks.Task> result, System.Func mapError) => (await result.ConfigureAwait(false)).MapError(mapError); + public static async global::System.Threading.Tasks.Task> MapError(this global::System.Threading.Tasks.Task> result, global::System.Func mapError) => (await result.ConfigureAwait(false)).MapError(mapError); #endregion #region match - public static async System.Threading.Tasks.Task Match( - this System.Threading.Tasks.Task> result, - System.Func> ok, - System.Func> error) + public static async global::System.Threading.Tasks.Task Match( + this global::System.Threading.Tasks.Task> result, + global::System.Func> ok, + global::System.Func> error) => await (await result.ConfigureAwait(false)).Match(ok, error).ConfigureAwait(false); - public static async System.Threading.Tasks.Task Match( - this System.Threading.Tasks.Task> result, - System.Func> ok, - System.Func error) + public static async global::System.Threading.Tasks.Task Match( + this global::System.Threading.Tasks.Task> result, + global::System.Func> ok, + global::System.Func error) => await (await result.ConfigureAwait(false)).Match(ok, error).ConfigureAwait(false); - public static async System.Threading.Tasks.Task Match( - this System.Threading.Tasks.Task> result, - System.Func ok, - System.Func error) + public static async global::System.Threading.Tasks.Task Match( + this global::System.Threading.Tasks.Task> result, + global::System.Func ok, + global::System.Func error) => (await result.ConfigureAwait(false)).Match(ok, error); #endregion public static OperationResult Flatten(this OperationResult> result) => result.Bind(r => r); - public static OperationResult As(this OperationResult result, System.Func errorTIsNotT1) => + public static OperationResult As(this OperationResult result, global::System.Func errorTIsNotT1) => result.Bind(r => { if (r is T1 converted) @@ -357,18 +357,18 @@ public static OperationResult As(this OperationResult result, Syst return OperationResult.Error(errorTIsNotT1()); }); - public static OperationResult As(this OperationResult result, System.Func errorIsNotT1) => + public static OperationResult As(this OperationResult result, global::System.Func errorIsNotT1) => result.As(errorIsNotT1); #region query-expression pattern - public static OperationResult Select(this OperationResult result, System.Func selector) => result.Map(selector); - public static System.Threading.Tasks.Task> Select(this System.Threading.Tasks.Task> result, System.Func selector) => result.Map(selector); + public static OperationResult Select(this OperationResult result, global::System.Func selector) => result.Map(selector); + public static global::System.Threading.Tasks.Task> Select(this global::System.Threading.Tasks.Task> result, global::System.Func selector) => result.Map(selector); - public static OperationResult SelectMany(this OperationResult result, System.Func> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); - public static System.Threading.Tasks.Task> SelectMany(this System.Threading.Tasks.Task> result, System.Func>> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); - public static System.Threading.Tasks.Task> SelectMany(this System.Threading.Tasks.Task> result, System.Func> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); - public static System.Threading.Tasks.Task> SelectMany(this OperationResult result, System.Func>> selector, System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static OperationResult SelectMany(this OperationResult result, global::System.Func> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static global::System.Threading.Tasks.Task> SelectMany(this global::System.Threading.Tasks.Task> result, global::System.Func>> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static global::System.Threading.Tasks.Task> SelectMany(this global::System.Threading.Tasks.Task> result, global::System.Func> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); + public static global::System.Threading.Tasks.Task> SelectMany(this OperationResult result, global::System.Func>> selector, global::System.Func resultSelector) => result.Bind(t => selector(t).Map(t1 => resultSelector(t, t1))); #endregion } @@ -378,17 +378,17 @@ namespace FunicularSwitch.Test.Extensions { static partial class OperationResultExtension { - public static System.Collections.Generic.IEnumerable Choose( - this System.Collections.Generic.IEnumerable items, - System.Func> choose, - System.Action onError) + public static global::System.Collections.Generic.IEnumerable Choose( + this global::System.Collections.Generic.IEnumerable items, + global::System.Func> choose, + global::System.Action onError) => items .Select(i => choose(i)) .Choose(onError); - public static System.Collections.Generic.IEnumerable Choose( - this System.Collections.Generic.IEnumerable> results, - System.Action onError) + public static global::System.Collections.Generic.IEnumerable Choose( + this global::System.Collections.Generic.IEnumerable> results, + global::System.Action onError) => results .Where(r => r.Match(_ => true, error => @@ -398,19 +398,19 @@ public static System.Collections.Generic.IEnumerable Choose( })) .Select(r => r.GetValueOrThrow()); - public static OperationResult As(this object item, System.Func error) => + public static OperationResult As(this object item, global::System.Func error) => !(item is T t) ? OperationResult.Error(error()) : t; - public static OperationResult NotNull(this T? item, System.Func error) => + public static OperationResult NotNull(this T? item, global::System.Func error) => item ?? OperationResult.Error(error()); - public static OperationResult NotNullOrEmpty(this string? s, System.Func error) + public static OperationResult NotNullOrEmpty(this string? s, global::System.Func error) => string.IsNullOrEmpty(s) ? OperationResult.Error(error()) : s!; - public static OperationResult NotNullOrWhiteSpace(this string? s, System.Func error) + public static OperationResult NotNullOrWhiteSpace(this string? s, global::System.Func error) => string.IsNullOrWhiteSpace(s) ? OperationResult.Error(error()) : s!; - public static OperationResult First(this System.Collections.Generic.IEnumerable candidates, System.Func predicate, System.Func noMatch) => + public static OperationResult First(this global::System.Collections.Generic.IEnumerable candidates, global::System.Func predicate, global::System.Func noMatch) => candidates .FirstOrDefault(i => predicate(i)) .NotNull(noMatch); diff --git a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_empty_namespace#OuterBaseMatchExtension.g.verified.cs b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_empty_namespace#OuterBaseMatchExtension.g.verified.cs index 7a3e4f9..51a7294 100644 --- a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_empty_namespace#OuterBaseMatchExtension.g.verified.cs +++ b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_empty_namespace#OuterBaseMatchExtension.g.verified.cs @@ -2,29 +2,29 @@ #pragma warning disable 1591 public static partial class BaseMatchExtension { - public static T Match(this Outer.Base @base, System.Func one, System.Func two) => + public static T Match(this Outer.Base @base, global::System.Func one, global::System.Func two) => @base switch { Outer.One case1 => one(case1), Outer.Two case2 => two(case2), - _ => throw new System.ArgumentException($"Unknown type derived from Outer.Base: {@base.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown type derived from Outer.Base: {@base.GetType().Name}") }; - public static System.Threading.Tasks.Task Match(this Outer.Base @base, System.Func> one, System.Func> two) => + public static global::System.Threading.Tasks.Task Match(this Outer.Base @base, global::System.Func> one, global::System.Func> two) => @base switch { Outer.One case1 => one(case1), Outer.Two case2 => two(case2), - _ => throw new System.ArgumentException($"Unknown type derived from Outer.Base: {@base.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown type derived from Outer.Base: {@base.GetType().Name}") }; - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task @base, System.Func one, System.Func two) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task @base, global::System.Func one, global::System.Func two) => (await @base.ConfigureAwait(false)).Match(one, two); - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task @base, System.Func> one, System.Func> two) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task @base, global::System.Func> one, global::System.Func> two) => await (await @base.ConfigureAwait(false)).Match(one, two).ConfigureAwait(false); - public static void Switch(this Outer.Base @base, System.Action one, System.Action two) + public static void Switch(this Outer.Base @base, global::System.Action one, global::System.Action two) { switch (@base) { @@ -35,11 +35,11 @@ public static void Switch(this Outer.Base @base, System.Action one, S two(case2); break; default: - throw new System.ArgumentException($"Unknown type derived from Outer.Base: {@base.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown type derived from Outer.Base: {@base.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this Outer.Base @base, System.Func one, System.Func two) + public static async global::System.Threading.Tasks.Task Switch(this Outer.Base @base, global::System.Func one, global::System.Func two) { switch (@base) { @@ -50,14 +50,14 @@ public static async System.Threading.Tasks.Task Switch(this Outer.Base @base, Sy await two(case2).ConfigureAwait(false); break; default: - throw new System.ArgumentException($"Unknown type derived from Outer.Base: {@base.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown type derived from Outer.Base: {@base.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task @base, System.Action one, System.Action two) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task @base, global::System.Action one, global::System.Action two) => (await @base.ConfigureAwait(false)).Switch(one, two); - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task @base, System.Func one, System.Func two) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task @base, global::System.Func one, global::System.Func two) => await (await @base.ConfigureAwait(false)).Switch(one, two).ConfigureAwait(false); } #pragma warning restore 1591 diff --git a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_explicitly_internal_union_type#FunicularSwitchTestBaseMatchExtension.g.verified.cs b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_explicitly_internal_union_type#FunicularSwitchTestBaseMatchExtension.g.verified.cs index bbb98e8..84088b4 100644 --- a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_explicitly_internal_union_type#FunicularSwitchTestBaseMatchExtension.g.verified.cs +++ b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_explicitly_internal_union_type#FunicularSwitchTestBaseMatchExtension.g.verified.cs @@ -4,29 +4,29 @@ namespace FunicularSwitch.Test { internal static partial class BaseMatchExtension { - public static T Match(this FunicularSwitch.Test.Base @base, System.Func one, System.Func two) => + public static T Match(this FunicularSwitch.Test.Base @base, global::System.Func one, global::System.Func two) => @base switch { FunicularSwitch.Test.One case1 => one(case1), FunicularSwitch.Test.Two case2 => two(case2), - _ => throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}") }; - public static System.Threading.Tasks.Task Match(this FunicularSwitch.Test.Base @base, System.Func> one, System.Func> two) => + public static global::System.Threading.Tasks.Task Match(this FunicularSwitch.Test.Base @base, global::System.Func> one, global::System.Func> two) => @base switch { FunicularSwitch.Test.One case1 => one(case1), FunicularSwitch.Test.Two case2 => two(case2), - _ => throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}") }; - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task @base, System.Func one, System.Func two) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task @base, global::System.Func one, global::System.Func two) => (await @base.ConfigureAwait(false)).Match(one, two); - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task @base, System.Func> one, System.Func> two) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task @base, global::System.Func> one, global::System.Func> two) => await (await @base.ConfigureAwait(false)).Match(one, two).ConfigureAwait(false); - public static void Switch(this FunicularSwitch.Test.Base @base, System.Action one, System.Action two) + public static void Switch(this FunicularSwitch.Test.Base @base, global::System.Action one, global::System.Action two) { switch (@base) { @@ -37,11 +37,11 @@ public static void Switch(this FunicularSwitch.Test.Base @base, System.Action one, System.Func two) + public static async global::System.Threading.Tasks.Task Switch(this FunicularSwitch.Test.Base @base, global::System.Func one, global::System.Func two) { switch (@base) { @@ -52,14 +52,14 @@ public static async System.Threading.Tasks.Task Switch(this FunicularSwitch.Test await two(case2).ConfigureAwait(false); break; default: - throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task @base, System.Action one, System.Action two) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task @base, global::System.Action one, global::System.Action two) => (await @base.ConfigureAwait(false)).Switch(one, two); - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task @base, System.Func one, System.Func two) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task @base, global::System.Func one, global::System.Func two) => await (await @base.ConfigureAwait(false)).Switch(one, two).ConfigureAwait(false); } } diff --git a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_implicitly_internal_union_type#FunicularSwitchTestBaseMatchExtension.g.verified.cs b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_implicitly_internal_union_type#FunicularSwitchTestBaseMatchExtension.g.verified.cs index bbb98e8..84088b4 100644 --- a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_implicitly_internal_union_type#FunicularSwitchTestBaseMatchExtension.g.verified.cs +++ b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_implicitly_internal_union_type#FunicularSwitchTestBaseMatchExtension.g.verified.cs @@ -4,29 +4,29 @@ namespace FunicularSwitch.Test { internal static partial class BaseMatchExtension { - public static T Match(this FunicularSwitch.Test.Base @base, System.Func one, System.Func two) => + public static T Match(this FunicularSwitch.Test.Base @base, global::System.Func one, global::System.Func two) => @base switch { FunicularSwitch.Test.One case1 => one(case1), FunicularSwitch.Test.Two case2 => two(case2), - _ => throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}") }; - public static System.Threading.Tasks.Task Match(this FunicularSwitch.Test.Base @base, System.Func> one, System.Func> two) => + public static global::System.Threading.Tasks.Task Match(this FunicularSwitch.Test.Base @base, global::System.Func> one, global::System.Func> two) => @base switch { FunicularSwitch.Test.One case1 => one(case1), FunicularSwitch.Test.Two case2 => two(case2), - _ => throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}") }; - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task @base, System.Func one, System.Func two) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task @base, global::System.Func one, global::System.Func two) => (await @base.ConfigureAwait(false)).Match(one, two); - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task @base, System.Func> one, System.Func> two) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task @base, global::System.Func> one, global::System.Func> two) => await (await @base.ConfigureAwait(false)).Match(one, two).ConfigureAwait(false); - public static void Switch(this FunicularSwitch.Test.Base @base, System.Action one, System.Action two) + public static void Switch(this FunicularSwitch.Test.Base @base, global::System.Action one, global::System.Action two) { switch (@base) { @@ -37,11 +37,11 @@ public static void Switch(this FunicularSwitch.Test.Base @base, System.Action one, System.Func two) + public static async global::System.Threading.Tasks.Task Switch(this FunicularSwitch.Test.Base @base, global::System.Func one, global::System.Func two) { switch (@base) { @@ -52,14 +52,14 @@ public static async System.Threading.Tasks.Task Switch(this FunicularSwitch.Test await two(case2).ConfigureAwait(false); break; default: - throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task @base, System.Action one, System.Action two) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task @base, global::System.Action one, global::System.Action two) => (await @base.ConfigureAwait(false)).Switch(one, two); - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task @base, System.Func one, System.Func two) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task @base, global::System.Func one, global::System.Func two) => await (await @base.ConfigureAwait(false)).Switch(one, two).ConfigureAwait(false); } } diff --git a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_interface_union_type#FunicularSwitchTestIBaseMatchExtension.g.verified.cs b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_interface_union_type#FunicularSwitchTestIBaseMatchExtension.g.verified.cs index 2270651..b13a1ec 100644 --- a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_interface_union_type#FunicularSwitchTestIBaseMatchExtension.g.verified.cs +++ b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_interface_union_type#FunicularSwitchTestIBaseMatchExtension.g.verified.cs @@ -4,29 +4,29 @@ namespace FunicularSwitch.Test { public static partial class IBaseMatchExtension { - public static T Match(this FunicularSwitch.Test.IBase iBase, System.Func one, System.Func two) => + public static T Match(this FunicularSwitch.Test.IBase iBase, global::System.Func one, global::System.Func two) => iBase switch { FunicularSwitch.Test.One case1 => one(case1), FunicularSwitch.Test.Two case2 => two(case2), - _ => throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.IBase: {iBase.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.IBase: {iBase.GetType().Name}") }; - public static System.Threading.Tasks.Task Match(this FunicularSwitch.Test.IBase iBase, System.Func> one, System.Func> two) => + public static global::System.Threading.Tasks.Task Match(this FunicularSwitch.Test.IBase iBase, global::System.Func> one, global::System.Func> two) => iBase switch { FunicularSwitch.Test.One case1 => one(case1), FunicularSwitch.Test.Two case2 => two(case2), - _ => throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.IBase: {iBase.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.IBase: {iBase.GetType().Name}") }; - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task iBase, System.Func one, System.Func two) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task iBase, global::System.Func one, global::System.Func two) => (await iBase.ConfigureAwait(false)).Match(one, two); - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task iBase, System.Func> one, System.Func> two) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task iBase, global::System.Func> one, global::System.Func> two) => await (await iBase.ConfigureAwait(false)).Match(one, two).ConfigureAwait(false); - public static void Switch(this FunicularSwitch.Test.IBase iBase, System.Action one, System.Action two) + public static void Switch(this FunicularSwitch.Test.IBase iBase, global::System.Action one, global::System.Action two) { switch (iBase) { @@ -37,11 +37,11 @@ public static void Switch(this FunicularSwitch.Test.IBase iBase, System.Action one, System.Func two) + public static async global::System.Threading.Tasks.Task Switch(this FunicularSwitch.Test.IBase iBase, global::System.Func one, global::System.Func two) { switch (iBase) { @@ -52,14 +52,14 @@ public static async System.Threading.Tasks.Task Switch(this FunicularSwitch.Test await two(case2).ConfigureAwait(false); break; default: - throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.IBase: {iBase.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.IBase: {iBase.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task iBase, System.Action one, System.Action two) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task iBase, global::System.Action one, global::System.Action two) => (await iBase.ConfigureAwait(false)).Switch(one, two); - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task iBase, System.Func one, System.Func two) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task iBase, global::System.Func one, global::System.Func two) => await (await iBase.ConfigureAwait(false)).Switch(one, two).ConfigureAwait(false); } } diff --git a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_nested_record_union_type#FunicularSwitchTestOuterBaseMatchExtension.g.verified.cs b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_nested_record_union_type#FunicularSwitchTestOuterBaseMatchExtension.g.verified.cs index 8e2349b..2a3249a 100644 --- a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_nested_record_union_type#FunicularSwitchTestOuterBaseMatchExtension.g.verified.cs +++ b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_nested_record_union_type#FunicularSwitchTestOuterBaseMatchExtension.g.verified.cs @@ -4,31 +4,31 @@ namespace FunicularSwitch.Test { public static partial class BaseMatchExtension { - public static T Match(this FunicularSwitch.Test.Outer.Base @base, System.Func aaa, System.Func one, System.Func two) => + public static T Match(this FunicularSwitch.Test.Outer.Base @base, global::System.Func aaa, global::System.Func one, global::System.Func two) => @base switch { FunicularSwitch.Test.Outer.Aaa case1 => aaa(case1), FunicularSwitch.Test.Outer.One case2 => one(case2), FunicularSwitch.Test.Outer.Two case3 => two(case3), - _ => throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Outer.Base: {@base.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Outer.Base: {@base.GetType().Name}") }; - public static System.Threading.Tasks.Task Match(this FunicularSwitch.Test.Outer.Base @base, System.Func> aaa, System.Func> one, System.Func> two) => + public static global::System.Threading.Tasks.Task Match(this FunicularSwitch.Test.Outer.Base @base, global::System.Func> aaa, global::System.Func> one, global::System.Func> two) => @base switch { FunicularSwitch.Test.Outer.Aaa case1 => aaa(case1), FunicularSwitch.Test.Outer.One case2 => one(case2), FunicularSwitch.Test.Outer.Two case3 => two(case3), - _ => throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Outer.Base: {@base.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Outer.Base: {@base.GetType().Name}") }; - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task @base, System.Func aaa, System.Func one, System.Func two) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task @base, global::System.Func aaa, global::System.Func one, global::System.Func two) => (await @base.ConfigureAwait(false)).Match(aaa, one, two); - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task @base, System.Func> aaa, System.Func> one, System.Func> two) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task @base, global::System.Func> aaa, global::System.Func> one, global::System.Func> two) => await (await @base.ConfigureAwait(false)).Match(aaa, one, two).ConfigureAwait(false); - public static void Switch(this FunicularSwitch.Test.Outer.Base @base, System.Action aaa, System.Action one, System.Action two) + public static void Switch(this FunicularSwitch.Test.Outer.Base @base, global::System.Action aaa, global::System.Action one, global::System.Action two) { switch (@base) { @@ -42,11 +42,11 @@ public static void Switch(this FunicularSwitch.Test.Outer.Base @base, System.Act two(case3); break; default: - throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Outer.Base: {@base.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Outer.Base: {@base.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this FunicularSwitch.Test.Outer.Base @base, System.Func aaa, System.Func one, System.Func two) + public static async global::System.Threading.Tasks.Task Switch(this FunicularSwitch.Test.Outer.Base @base, global::System.Func aaa, global::System.Func one, global::System.Func two) { switch (@base) { @@ -60,14 +60,14 @@ public static async System.Threading.Tasks.Task Switch(this FunicularSwitch.Test await two(case3).ConfigureAwait(false); break; default: - throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Outer.Base: {@base.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Outer.Base: {@base.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task @base, System.Action aaa, System.Action one, System.Action two) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task @base, global::System.Action aaa, global::System.Action one, global::System.Action two) => (await @base.ConfigureAwait(false)).Switch(aaa, one, two); - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task @base, System.Func aaa, System.Func one, System.Func two) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task @base, global::System.Func aaa, global::System.Func one, global::System.Func two) => await (await @base.ConfigureAwait(false)).Switch(aaa, one, two).ConfigureAwait(false); } } diff --git a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_partial_record_union_type#FunicularSwitchTestBaseMatchExtension.g.verified.cs b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_partial_record_union_type#FunicularSwitchTestBaseMatchExtension.g.verified.cs index eac4cbf..07c5041 100644 --- a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_partial_record_union_type#FunicularSwitchTestBaseMatchExtension.g.verified.cs +++ b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_partial_record_union_type#FunicularSwitchTestBaseMatchExtension.g.verified.cs @@ -4,7 +4,7 @@ namespace FunicularSwitch.Test { internal static partial class BaseMatchExtension { - public static T Match(this FunicularSwitch.Test.Base @base, System.Func one, System.Func two, System.Func three, System.Func nested, System.Func five, System.Func withDefault) => + public static T Match(this FunicularSwitch.Test.Base @base, global::System.Func one, global::System.Func two, global::System.Func three, global::System.Func nested, global::System.Func five, global::System.Func withDefault) => @base switch { FunicularSwitch.Test.One case1 => one(case1), @@ -13,10 +13,10 @@ public static T Match(this FunicularSwitch.Test.Base @base, System.Func nested(case4), FunicularSwitch.Test.Cases.Five case5 => five(case5), FunicularSwitch.Test.WithDefault case6 => withDefault(case6), - _ => throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}") }; - public static System.Threading.Tasks.Task Match(this FunicularSwitch.Test.Base @base, System.Func> one, System.Func> two, System.Func> three, System.Func> nested, System.Func> five, System.Func> withDefault) => + public static global::System.Threading.Tasks.Task Match(this FunicularSwitch.Test.Base @base, global::System.Func> one, global::System.Func> two, global::System.Func> three, global::System.Func> nested, global::System.Func> five, global::System.Func> withDefault) => @base switch { FunicularSwitch.Test.One case1 => one(case1), @@ -25,16 +25,16 @@ public static System.Threading.Tasks.Task Match(this FunicularSwitch.Test. FunicularSwitch.Test.Cases.Nested case4 => nested(case4), FunicularSwitch.Test.Cases.Five case5 => five(case5), FunicularSwitch.Test.WithDefault case6 => withDefault(case6), - _ => throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}") }; - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task @base, System.Func one, System.Func two, System.Func three, System.Func nested, System.Func five, System.Func withDefault) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task @base, global::System.Func one, global::System.Func two, global::System.Func three, global::System.Func nested, global::System.Func five, global::System.Func withDefault) => (await @base.ConfigureAwait(false)).Match(one, two, three, nested, five, withDefault); - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task @base, System.Func> one, System.Func> two, System.Func> three, System.Func> nested, System.Func> five, System.Func> withDefault) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task @base, global::System.Func> one, global::System.Func> two, global::System.Func> three, global::System.Func> nested, global::System.Func> five, global::System.Func> withDefault) => await (await @base.ConfigureAwait(false)).Match(one, two, three, nested, five, withDefault).ConfigureAwait(false); - public static void Switch(this FunicularSwitch.Test.Base @base, System.Action one, System.Action two, System.Action three, System.Action nested, System.Action five, System.Action withDefault) + public static void Switch(this FunicularSwitch.Test.Base @base, global::System.Action one, global::System.Action two, global::System.Action three, global::System.Action nested, global::System.Action five, global::System.Action withDefault) { switch (@base) { @@ -57,11 +57,11 @@ public static void Switch(this FunicularSwitch.Test.Base @base, System.Action one, System.Func two, System.Func three, System.Func nested, System.Func five, System.Func withDefault) + public static async global::System.Threading.Tasks.Task Switch(this FunicularSwitch.Test.Base @base, global::System.Func one, global::System.Func two, global::System.Func three, global::System.Func nested, global::System.Func five, global::System.Func withDefault) { switch (@base) { @@ -84,14 +84,14 @@ public static async System.Threading.Tasks.Task Switch(this FunicularSwitch.Test await withDefault(case6).ConfigureAwait(false); break; default: - throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task @base, System.Action one, System.Action two, System.Action three, System.Action nested, System.Action five, System.Action withDefault) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task @base, global::System.Action one, global::System.Action two, global::System.Action three, global::System.Action nested, global::System.Action five, global::System.Action withDefault) => (await @base.ConfigureAwait(false)).Switch(one, two, three, nested, five, withDefault); - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task @base, System.Func one, System.Func two, System.Func three, System.Func nested, System.Func five, System.Func withDefault) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task @base, global::System.Func one, global::System.Func two, global::System.Func three, global::System.Func nested, global::System.Func five, global::System.Func withDefault) => await (await @base.ConfigureAwait(false)).Switch(one, two, three, nested, five, withDefault).ConfigureAwait(false); } diff --git a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_record_union_type#FunicularSwitchTestBaseMatchExtension.g.verified.cs b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_record_union_type#FunicularSwitchTestBaseMatchExtension.g.verified.cs index 394aeb2..17316ba 100644 --- a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_record_union_type#FunicularSwitchTestBaseMatchExtension.g.verified.cs +++ b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_record_union_type#FunicularSwitchTestBaseMatchExtension.g.verified.cs @@ -4,31 +4,31 @@ namespace FunicularSwitch.Test { public static partial class BaseMatchExtension { - public static T Match(this FunicularSwitch.Test.Base @base, System.Func aaa, System.Func one, System.Func two) => + public static T Match(this FunicularSwitch.Test.Base @base, global::System.Func aaa, global::System.Func one, global::System.Func two) => @base switch { FunicularSwitch.Test.Aaa case1 => aaa(case1), FunicularSwitch.Test.One case2 => one(case2), FunicularSwitch.Test.Two case3 => two(case3), - _ => throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}") }; - public static System.Threading.Tasks.Task Match(this FunicularSwitch.Test.Base @base, System.Func> aaa, System.Func> one, System.Func> two) => + public static global::System.Threading.Tasks.Task Match(this FunicularSwitch.Test.Base @base, global::System.Func> aaa, global::System.Func> one, global::System.Func> two) => @base switch { FunicularSwitch.Test.Aaa case1 => aaa(case1), FunicularSwitch.Test.One case2 => one(case2), FunicularSwitch.Test.Two case3 => two(case3), - _ => throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}") }; - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task @base, System.Func aaa, System.Func one, System.Func two) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task @base, global::System.Func aaa, global::System.Func one, global::System.Func two) => (await @base.ConfigureAwait(false)).Match(aaa, one, two); - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task @base, System.Func> aaa, System.Func> one, System.Func> two) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task @base, global::System.Func> aaa, global::System.Func> one, global::System.Func> two) => await (await @base.ConfigureAwait(false)).Match(aaa, one, two).ConfigureAwait(false); - public static void Switch(this FunicularSwitch.Test.Base @base, System.Action aaa, System.Action one, System.Action two) + public static void Switch(this FunicularSwitch.Test.Base @base, global::System.Action aaa, global::System.Action one, global::System.Action two) { switch (@base) { @@ -42,11 +42,11 @@ public static void Switch(this FunicularSwitch.Test.Base @base, System.Action aaa, System.Func one, System.Func two) + public static async global::System.Threading.Tasks.Task Switch(this FunicularSwitch.Test.Base @base, global::System.Func aaa, global::System.Func one, global::System.Func two) { switch (@base) { @@ -60,14 +60,14 @@ public static async System.Threading.Tasks.Task Switch(this FunicularSwitch.Test await two(case3).ConfigureAwait(false); break; default: - throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task @base, System.Action aaa, System.Action one, System.Action two) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task @base, global::System.Action aaa, global::System.Action one, global::System.Action two) => (await @base.ConfigureAwait(false)).Switch(aaa, one, two); - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task @base, System.Func aaa, System.Func one, System.Func two) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task @base, global::System.Func aaa, global::System.Func one, global::System.Func two) => await (await @base.ConfigureAwait(false)).Switch(aaa, one, two).ConfigureAwait(false); } } diff --git a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_record_union_type_with_as_declared_case_order#FunicularSwitchTestBaseMatchExtension.g.verified.cs b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_record_union_type_with_as_declared_case_order#FunicularSwitchTestBaseMatchExtension.g.verified.cs index d2f1218..95e1961 100644 --- a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_record_union_type_with_as_declared_case_order#FunicularSwitchTestBaseMatchExtension.g.verified.cs +++ b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_record_union_type_with_as_declared_case_order#FunicularSwitchTestBaseMatchExtension.g.verified.cs @@ -4,31 +4,31 @@ namespace FunicularSwitch.Test { public static partial class BaseMatchExtension { - public static T Match(this FunicularSwitch.Test.Base @base, System.Func one, System.Func aaa, System.Func two) => + public static T Match(this FunicularSwitch.Test.Base @base, global::System.Func one, global::System.Func aaa, global::System.Func two) => @base switch { FunicularSwitch.Test.One case1 => one(case1), FunicularSwitch.Test.Aaa case2 => aaa(case2), FunicularSwitch.Test.Two case3 => two(case3), - _ => throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}") }; - public static System.Threading.Tasks.Task Match(this FunicularSwitch.Test.Base @base, System.Func> one, System.Func> aaa, System.Func> two) => + public static global::System.Threading.Tasks.Task Match(this FunicularSwitch.Test.Base @base, global::System.Func> one, global::System.Func> aaa, global::System.Func> two) => @base switch { FunicularSwitch.Test.One case1 => one(case1), FunicularSwitch.Test.Aaa case2 => aaa(case2), FunicularSwitch.Test.Two case3 => two(case3), - _ => throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}") }; - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task @base, System.Func one, System.Func aaa, System.Func two) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task @base, global::System.Func one, global::System.Func aaa, global::System.Func two) => (await @base.ConfigureAwait(false)).Match(one, aaa, two); - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task @base, System.Func> one, System.Func> aaa, System.Func> two) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task @base, global::System.Func> one, global::System.Func> aaa, global::System.Func> two) => await (await @base.ConfigureAwait(false)).Match(one, aaa, two).ConfigureAwait(false); - public static void Switch(this FunicularSwitch.Test.Base @base, System.Action one, System.Action aaa, System.Action two) + public static void Switch(this FunicularSwitch.Test.Base @base, global::System.Action one, global::System.Action aaa, global::System.Action two) { switch (@base) { @@ -42,11 +42,11 @@ public static void Switch(this FunicularSwitch.Test.Base @base, System.Action one, System.Func aaa, System.Func two) + public static async global::System.Threading.Tasks.Task Switch(this FunicularSwitch.Test.Base @base, global::System.Func one, global::System.Func aaa, global::System.Func two) { switch (@base) { @@ -60,14 +60,14 @@ public static async System.Threading.Tasks.Task Switch(this FunicularSwitch.Test await two(case3).ConfigureAwait(false); break; default: - throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task @base, System.Action one, System.Action aaa, System.Action two) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task @base, global::System.Action one, global::System.Action aaa, global::System.Action two) => (await @base.ConfigureAwait(false)).Switch(one, aaa, two); - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task @base, System.Func one, System.Func aaa, System.Func two) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task @base, global::System.Func one, global::System.Func aaa, global::System.Func two) => await (await @base.ConfigureAwait(false)).Switch(one, aaa, two).ConfigureAwait(false); } } diff --git a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_record_union_type_with_explicit_case_order#FunicularSwitchTestBaseMatchExtension.g.verified.cs b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_record_union_type_with_explicit_case_order#FunicularSwitchTestBaseMatchExtension.g.verified.cs index 719733c..3d0590c 100644 --- a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_record_union_type_with_explicit_case_order#FunicularSwitchTestBaseMatchExtension.g.verified.cs +++ b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_record_union_type_with_explicit_case_order#FunicularSwitchTestBaseMatchExtension.g.verified.cs @@ -4,29 +4,29 @@ namespace FunicularSwitch.Test { public static partial class BaseMatchExtension { - public static T Match(this FunicularSwitch.Test.Base @base, System.Func zwei, System.Func eins) => + public static T Match(this FunicularSwitch.Test.Base @base, global::System.Func zwei, global::System.Func eins) => @base switch { FunicularSwitch.Test.Zwei case1 => zwei(case1), FunicularSwitch.Test.Eins case2 => eins(case2), - _ => throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}") }; - public static System.Threading.Tasks.Task Match(this FunicularSwitch.Test.Base @base, System.Func> zwei, System.Func> eins) => + public static global::System.Threading.Tasks.Task Match(this FunicularSwitch.Test.Base @base, global::System.Func> zwei, global::System.Func> eins) => @base switch { FunicularSwitch.Test.Zwei case1 => zwei(case1), FunicularSwitch.Test.Eins case2 => eins(case2), - _ => throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}") }; - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task @base, System.Func zwei, System.Func eins) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task @base, global::System.Func zwei, global::System.Func eins) => (await @base.ConfigureAwait(false)).Match(zwei, eins); - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task @base, System.Func> zwei, System.Func> eins) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task @base, global::System.Func> zwei, global::System.Func> eins) => await (await @base.ConfigureAwait(false)).Match(zwei, eins).ConfigureAwait(false); - public static void Switch(this FunicularSwitch.Test.Base @base, System.Action zwei, System.Action eins) + public static void Switch(this FunicularSwitch.Test.Base @base, global::System.Action zwei, global::System.Action eins) { switch (@base) { @@ -37,11 +37,11 @@ public static void Switch(this FunicularSwitch.Test.Base @base, System.Action zwei, System.Func eins) + public static async global::System.Threading.Tasks.Task Switch(this FunicularSwitch.Test.Base @base, global::System.Func zwei, global::System.Func eins) { switch (@base) { @@ -52,14 +52,14 @@ public static async System.Threading.Tasks.Task Switch(this FunicularSwitch.Test await eins(case2).ConfigureAwait(false); break; default: - throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task @base, System.Action zwei, System.Action eins) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task @base, global::System.Action zwei, global::System.Action eins) => (await @base.ConfigureAwait(false)).Switch(zwei, eins); - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task @base, System.Func zwei, System.Func eins) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task @base, global::System.Func zwei, global::System.Func eins) => await (await @base.ConfigureAwait(false)).Switch(zwei, eins).ConfigureAwait(false); } } diff --git a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_record_union_type_with_multi_level_concrete_derived_types#FunicularSwitchTestBaseMatchExtension.g.verified.cs b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_record_union_type_with_multi_level_concrete_derived_types#FunicularSwitchTestBaseMatchExtension.g.verified.cs index ec601e5..9be6624 100644 --- a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_record_union_type_with_multi_level_concrete_derived_types#FunicularSwitchTestBaseMatchExtension.g.verified.cs +++ b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_record_union_type_with_multi_level_concrete_derived_types#FunicularSwitchTestBaseMatchExtension.g.verified.cs @@ -4,31 +4,31 @@ namespace FunicularSwitch.Test { public static partial class BaseMatchExtension { - public static T Match(this FunicularSwitch.Test.Base @base, System.Func bbb, System.Func aaa, System.Func baseChild) => + public static T Match(this FunicularSwitch.Test.Base @base, global::System.Func bbb, global::System.Func aaa, global::System.Func baseChild) => @base switch { FunicularSwitch.Test.Bbb case1 => bbb(case1), FunicularSwitch.Test.Aaa case2 => aaa(case2), FunicularSwitch.Test.BaseChild case3 => baseChild(case3), - _ => throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}") }; - public static System.Threading.Tasks.Task Match(this FunicularSwitch.Test.Base @base, System.Func> bbb, System.Func> aaa, System.Func> baseChild) => + public static global::System.Threading.Tasks.Task Match(this FunicularSwitch.Test.Base @base, global::System.Func> bbb, global::System.Func> aaa, global::System.Func> baseChild) => @base switch { FunicularSwitch.Test.Bbb case1 => bbb(case1), FunicularSwitch.Test.Aaa case2 => aaa(case2), FunicularSwitch.Test.BaseChild case3 => baseChild(case3), - _ => throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}") }; - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task @base, System.Func bbb, System.Func aaa, System.Func baseChild) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task @base, global::System.Func bbb, global::System.Func aaa, global::System.Func baseChild) => (await @base.ConfigureAwait(false)).Match(bbb, aaa, baseChild); - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task @base, System.Func> bbb, System.Func> aaa, System.Func> baseChild) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task @base, global::System.Func> bbb, global::System.Func> aaa, global::System.Func> baseChild) => await (await @base.ConfigureAwait(false)).Match(bbb, aaa, baseChild).ConfigureAwait(false); - public static void Switch(this FunicularSwitch.Test.Base @base, System.Action bbb, System.Action aaa, System.Action baseChild) + public static void Switch(this FunicularSwitch.Test.Base @base, global::System.Action bbb, global::System.Action aaa, global::System.Action baseChild) { switch (@base) { @@ -42,11 +42,11 @@ public static void Switch(this FunicularSwitch.Test.Base @base, System.Action bbb, System.Func aaa, System.Func baseChild) + public static async global::System.Threading.Tasks.Task Switch(this FunicularSwitch.Test.Base @base, global::System.Func bbb, global::System.Func aaa, global::System.Func baseChild) { switch (@base) { @@ -60,14 +60,14 @@ public static async System.Threading.Tasks.Task Switch(this FunicularSwitch.Test await baseChild(case3).ConfigureAwait(false); break; default: - throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.Base: {@base.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task @base, System.Action bbb, System.Action aaa, System.Action baseChild) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task @base, global::System.Action bbb, global::System.Action aaa, global::System.Action baseChild) => (await @base.ConfigureAwait(false)).Switch(bbb, aaa, baseChild); - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task @base, System.Func bbb, System.Func aaa, System.Func baseChild) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task @base, global::System.Func bbb, global::System.Func aaa, global::System.Func baseChild) => await (await @base.ConfigureAwait(false)).Switch(bbb, aaa, baseChild).ConfigureAwait(false); } } diff --git a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_switchyard_union_type#FunicularSwitchTestFieldTypeMatchExtension.g.verified.cs b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_switchyard_union_type#FunicularSwitchTestFieldTypeMatchExtension.g.verified.cs index 753edfc..6478180 100644 --- a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_switchyard_union_type#FunicularSwitchTestFieldTypeMatchExtension.g.verified.cs +++ b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.For_switchyard_union_type#FunicularSwitchTestFieldTypeMatchExtension.g.verified.cs @@ -4,31 +4,31 @@ namespace FunicularSwitch.Test { public static partial class FieldTypeMatchExtension { - public static T Match(this FunicularSwitch.Test.FieldType fieldType, System.Func @bool, System.Func @enum, System.Func @string) => + public static T Match(this FunicularSwitch.Test.FieldType fieldType, global::System.Func @bool, global::System.Func @enum, global::System.Func @string) => fieldType switch { FunicularSwitch.Test.FieldType.Bool_ case1 => @bool(case1), FunicularSwitch.Test.FieldType.Enum_ case2 => @enum(case2), FunicularSwitch.Test.FieldType.String_ case3 => @string(case3), - _ => throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.FieldType: {fieldType.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.FieldType: {fieldType.GetType().Name}") }; - public static System.Threading.Tasks.Task Match(this FunicularSwitch.Test.FieldType fieldType, System.Func> @bool, System.Func> @enum, System.Func> @string) => + public static global::System.Threading.Tasks.Task Match(this FunicularSwitch.Test.FieldType fieldType, global::System.Func> @bool, global::System.Func> @enum, global::System.Func> @string) => fieldType switch { FunicularSwitch.Test.FieldType.Bool_ case1 => @bool(case1), FunicularSwitch.Test.FieldType.Enum_ case2 => @enum(case2), FunicularSwitch.Test.FieldType.String_ case3 => @string(case3), - _ => throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.FieldType: {fieldType.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.FieldType: {fieldType.GetType().Name}") }; - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task fieldType, System.Func @bool, System.Func @enum, System.Func @string) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task fieldType, global::System.Func @bool, global::System.Func @enum, global::System.Func @string) => (await fieldType.ConfigureAwait(false)).Match(@bool, @enum, @string); - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task fieldType, System.Func> @bool, System.Func> @enum, System.Func> @string) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task fieldType, global::System.Func> @bool, global::System.Func> @enum, global::System.Func> @string) => await (await fieldType.ConfigureAwait(false)).Match(@bool, @enum, @string).ConfigureAwait(false); - public static void Switch(this FunicularSwitch.Test.FieldType fieldType, System.Action @bool, System.Action @enum, System.Action @string) + public static void Switch(this FunicularSwitch.Test.FieldType fieldType, global::System.Action @bool, global::System.Action @enum, global::System.Action @string) { switch (fieldType) { @@ -42,11 +42,11 @@ public static void Switch(this FunicularSwitch.Test.FieldType fieldType, System. @string(case3); break; default: - throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.FieldType: {fieldType.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.FieldType: {fieldType.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this FunicularSwitch.Test.FieldType fieldType, System.Func @bool, System.Func @enum, System.Func @string) + public static async global::System.Threading.Tasks.Task Switch(this FunicularSwitch.Test.FieldType fieldType, global::System.Func @bool, global::System.Func @enum, global::System.Func @string) { switch (fieldType) { @@ -60,14 +60,14 @@ public static async System.Threading.Tasks.Task Switch(this FunicularSwitch.Test await @string(case3).ConfigureAwait(false); break; default: - throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.FieldType: {fieldType.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.FieldType: {fieldType.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task fieldType, System.Action @bool, System.Action @enum, System.Action @string) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task fieldType, global::System.Action @bool, global::System.Action @enum, global::System.Action @string) => (await fieldType.ConfigureAwait(false)).Switch(@bool, @enum, @string); - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task fieldType, System.Func @bool, System.Func @enum, System.Func @string) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task fieldType, global::System.Func @bool, global::System.Func @enum, global::System.Func @string) => await (await fieldType.ConfigureAwait(false)).Switch(@bool, @enum, @string).ConfigureAwait(false); } } diff --git a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.No_static_factories_for_interface_union_type#FunicularSwitchTestIBaseMatchExtension.g.verified.cs b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.No_static_factories_for_interface_union_type#FunicularSwitchTestIBaseMatchExtension.g.verified.cs index 2270651..b13a1ec 100644 --- a/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.No_static_factories_for_interface_union_type#FunicularSwitchTestIBaseMatchExtension.g.verified.cs +++ b/Source/Tests/FunicularSwitch.Generators.Test/Snapshots/Run_union_type_generator.No_static_factories_for_interface_union_type#FunicularSwitchTestIBaseMatchExtension.g.verified.cs @@ -4,29 +4,29 @@ namespace FunicularSwitch.Test { public static partial class IBaseMatchExtension { - public static T Match(this FunicularSwitch.Test.IBase iBase, System.Func one, System.Func two) => + public static T Match(this FunicularSwitch.Test.IBase iBase, global::System.Func one, global::System.Func two) => iBase switch { FunicularSwitch.Test.One case1 => one(case1), FunicularSwitch.Test.Two case2 => two(case2), - _ => throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.IBase: {iBase.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.IBase: {iBase.GetType().Name}") }; - public static System.Threading.Tasks.Task Match(this FunicularSwitch.Test.IBase iBase, System.Func> one, System.Func> two) => + public static global::System.Threading.Tasks.Task Match(this FunicularSwitch.Test.IBase iBase, global::System.Func> one, global::System.Func> two) => iBase switch { FunicularSwitch.Test.One case1 => one(case1), FunicularSwitch.Test.Two case2 => two(case2), - _ => throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.IBase: {iBase.GetType().Name}") + _ => throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.IBase: {iBase.GetType().Name}") }; - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task iBase, System.Func one, System.Func two) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task iBase, global::System.Func one, global::System.Func two) => (await iBase.ConfigureAwait(false)).Match(one, two); - public static async System.Threading.Tasks.Task Match(this System.Threading.Tasks.Task iBase, System.Func> one, System.Func> two) => + public static async global::System.Threading.Tasks.Task Match(this global::System.Threading.Tasks.Task iBase, global::System.Func> one, global::System.Func> two) => await (await iBase.ConfigureAwait(false)).Match(one, two).ConfigureAwait(false); - public static void Switch(this FunicularSwitch.Test.IBase iBase, System.Action one, System.Action two) + public static void Switch(this FunicularSwitch.Test.IBase iBase, global::System.Action one, global::System.Action two) { switch (iBase) { @@ -37,11 +37,11 @@ public static void Switch(this FunicularSwitch.Test.IBase iBase, System.Action one, System.Func two) + public static async global::System.Threading.Tasks.Task Switch(this FunicularSwitch.Test.IBase iBase, global::System.Func one, global::System.Func two) { switch (iBase) { @@ -52,14 +52,14 @@ public static async System.Threading.Tasks.Task Switch(this FunicularSwitch.Test await two(case2).ConfigureAwait(false); break; default: - throw new System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.IBase: {iBase.GetType().Name}"); + throw new global::System.ArgumentException($"Unknown type derived from FunicularSwitch.Test.IBase: {iBase.GetType().Name}"); } } - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task iBase, System.Action one, System.Action two) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task iBase, global::System.Action one, global::System.Action two) => (await iBase.ConfigureAwait(false)).Switch(one, two); - public static async System.Threading.Tasks.Task Switch(this System.Threading.Tasks.Task iBase, System.Func one, System.Func two) => + public static async global::System.Threading.Tasks.Task Switch(this global::System.Threading.Tasks.Task iBase, global::System.Func one, global::System.Func two) => await (await iBase.ConfigureAwait(false)).Switch(one, two).ConfigureAwait(false); } }