Skip to content

Fixes namespace conflicts with System #301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ namespace Dunet.Generator.UnionExtensionsGeneration;

internal static class UnionExtensionsSourceBuilder
{
const string task = "System.Threading.Tasks.Task";
const string valueTask = "System.Threading.Tasks.ValueTask";
const string task = "global::System.Threading.Tasks.Task";
const string valueTask = "global::System.Threading.Tasks.ValueTask";

public static string GenerateExtensions(UnionDeclaration union)
{
Expand Down Expand Up @@ -83,7 +83,7 @@ string taskType
var variant = union.Variants[i];

builder
.Append($" System.Func<")
.Append($" global::System.Func<")
.AppendFullUnionName(union)
.AppendTypeParams(union.TypeParameters)
.Append($".{variant.Identifier}")
Expand Down Expand Up @@ -143,7 +143,7 @@ string taskType
var variant = union.Variants[i];

builder
.Append($" System.Action<")
.Append($" global::System.Action<")
.AppendFullUnionName(union)
.AppendTypeParams(union.TypeParameters)
.Append($".{variant.Identifier}")
Expand Down Expand Up @@ -186,8 +186,8 @@ string taskType
/// <summary>
/// public static async TaskType<TMatchOuput> MatchSpecificAsync<T1, T2, ..., TMatchOutput>(
/// this Task<Parent1.Parent2.UnionType<T1, T2, ...>> unionTask,
/// System.Func<Parent1.Parent2.UnionType<T1, T2, ...>.Specific, TMatchOutput> @specific,
/// System.Func<TMatchOutput> @else
/// global::System.Func<Parent1.Parent2.UnionType<T1, T2, ...>.Specific, TMatchOutput> @specific,
/// global::System.Func<TMatchOutput> @else
/// )
/// where T1 : notnull
/// where T2 : notnull
Expand Down Expand Up @@ -218,12 +218,12 @@ string taskType
.AppendFullUnionName(union)
.AppendTypeParams(union.TypeParameters)
.AppendLine("> unionTask,")
.Append($" System.Func<")
.Append($" global::System.Func<")
.AppendFullUnionName(union)
.AppendTypeParams(union.TypeParameters)
.Append($".{variant.Identifier}")
.AppendLine($", TMatchOutput> {variant.Identifier.ToMethodParameterCase()},")
.AppendLine(" System.Func<TMatchOutput> @else")
.AppendLine(" global::System.Func<TMatchOutput> @else")
.AppendLine($" )");

foreach (var typeParamConstraint in union.TypeParameterConstraints)
Expand All @@ -246,8 +246,8 @@ string taskType
/// <summary>
/// public static async TaskType MatchSpecificAsync<T1, T2, ...>(
/// this Task<Parent1.Parent2.UnionType<T1, T2, ...>> unionTask,
/// System.Action<Parent1.Parent2.UnionType<T1, T2, ...>.Specific> @specific,
/// System.Action @else
/// global::System.Action<Parent1.Parent2.UnionType<T1, T2, ...>.Specific> @specific,
/// global::System.Action @else
/// )
/// where T1 : notnull
/// where T2 : notnull
Expand All @@ -274,12 +274,12 @@ string taskType
.AppendFullUnionName(union)
.AppendTypeParams(union.TypeParameters)
.AppendLine("> unionTask,")
.Append($" System.Action<")
.Append($" global::System.Action<")
.AppendFullUnionName(union)
.AppendTypeParams(union.TypeParameters)
.Append($".{variant.Identifier}")
.AppendLine($"> {variant.Identifier.ToMethodParameterCase()},")
.AppendLine(" System.Action @else")
.AppendLine(" global::System.Action @else")
.AppendLine($" )");

foreach (var typeParamConstraint in union.TypeParameterConstraints)
Expand Down
Loading