Skip to content

Commit 5535be4

Browse files
committed
Disabled compiler warning emitted by Map in nested regular unions
1 parent 03c2c7a commit 5535be4

File tree

30 files changed

+72
-2
lines changed

30 files changed

+72
-2
lines changed

src/Thinktecture.Runtime.Extensions.SourceGenerator/CodeAnalysis/RegularUnions/RegularUnionCodeGenerator.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,7 @@ private void GenerateMap(bool isPartially, IReadOnlyList<TypeMember> typeMembers
543543
{
544544
_sb.Append(@"
545545
546+
#pragma warning disable CS0108 // Map in nested union hides Map from base class
546547
/// <summary>
547548
/// Maps current instance to an instance of type <typeparamref name=""TResult""/>.
548549
/// </summary>");
@@ -602,7 +603,8 @@ private void GenerateMap(bool isPartially, IReadOnlyList<TypeMember> typeMembers
602603
GenerateIndexBasedMapSwitchBody(isPartially, typeMembers);
603604

604605
_sb.Append(@"
605-
}");
606+
}
607+
#pragma warning restore CS0108 // Map in nested union hides Map from base class");
606608
}
607609

608610
private void GenerateIndexBasedMapSwitchBody(bool isPartially, IReadOnlyList<TypeMember> typeMembers)

test/Thinktecture.Runtime.Extensions.SourceGenerator.Tests/SourceGeneratorTests/RegularUnionSourceGeneratorTests.Should_generate_class_with_classes_having_same_name.verified.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ abstract partial class TestUnion :
143143
}
144144
}
145145

146+
#pragma warning disable CS0108 // Map in nested union hides Map from base class
146147
/// <summary>
147148
/// Maps current instance to an instance of type <typeparamref name="TResult"/>.
148149
/// </summary>
@@ -170,4 +171,5 @@ abstract partial class TestUnion :
170171
throw new global::System.ArgumentOutOfRangeException($"Unexpected type '{this.GetType().FullName}'.");
171172
}
172173
}
174+
#pragma warning restore CS0108 // Map in nested union hides Map from base class
173175
}

test/Thinktecture.Runtime.Extensions.SourceGenerator.Tests/SourceGeneratorTests/RegularUnionSourceGeneratorTests.Should_generate_class_without_ctor.verified.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ abstract partial class TestUnion :
124124
}
125125
}
126126

127+
#pragma warning disable CS0108 // Map in nested union hides Map from base class
127128
/// <summary>
128129
/// Maps current instance to an instance of type <typeparamref name="TResult"/>.
129130
/// </summary>
@@ -147,4 +148,5 @@ abstract partial class TestUnion :
147148
throw new global::System.ArgumentOutOfRangeException($"Unexpected type '{this.GetType().FullName}'.");
148149
}
149150
}
151+
#pragma warning restore CS0108 // Map in nested union hides Map from base class
150152
}

test/Thinktecture.Runtime.Extensions.SourceGenerator.Tests/SourceGeneratorTests/RegularUnionSourceGeneratorTests.Should_generate_record_with_and_without_generic_0.verified.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ abstract partial record Result<T> :
124124
}
125125
}
126126

127+
#pragma warning disable CS0108 // Map in nested union hides Map from base class
127128
/// <summary>
128129
/// Maps current instance to an instance of type <typeparamref name="TResult"/>.
129130
/// </summary>
@@ -147,6 +148,7 @@ abstract partial record Result<T> :
147148
throw new global::System.ArgumentOutOfRangeException($"Unexpected type '{this.GetType().FullName}'.");
148149
}
149150
}
151+
#pragma warning restore CS0108 // Map in nested union hides Map from base class
150152

151153
/// <summary>
152154
/// Implicit conversion from type <typeparamref name="T"/>.

test/Thinktecture.Runtime.Extensions.SourceGenerator.Tests/SourceGeneratorTests/RegularUnionSourceGeneratorTests.Should_generate_record_with_and_without_generic_1.verified.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ abstract partial record Result :
124124
}
125125
}
126126

127+
#pragma warning disable CS0108 // Map in nested union hides Map from base class
127128
/// <summary>
128129
/// Maps current instance to an instance of type <typeparamref name="TResult"/>.
129130
/// </summary>
@@ -147,6 +148,7 @@ abstract partial record Result :
147148
throw new global::System.ArgumentOutOfRangeException($"Unexpected type '{this.GetType().FullName}'.");
148149
}
149150
}
151+
#pragma warning restore CS0108 // Map in nested union hides Map from base class
150152

151153
/// <summary>
152154
/// Implicit conversion from type <see cref="string"/>.

test/Thinktecture.Runtime.Extensions.SourceGenerator.Tests/SourceGeneratorTests/RegularUnionSourceGeneratorTests.Should_generate_record_with_generic.verified.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ abstract partial record Result<T> :
124124
}
125125
}
126126

127+
#pragma warning disable CS0108 // Map in nested union hides Map from base class
127128
/// <summary>
128129
/// Maps current instance to an instance of type <typeparamref name="TResult"/>.
129130
/// </summary>
@@ -147,6 +148,7 @@ abstract partial record Result<T> :
147148
throw new global::System.ArgumentOutOfRangeException($"Unexpected type '{this.GetType().FullName}'.");
148149
}
149150
}
151+
#pragma warning restore CS0108 // Map in nested union hides Map from base class
150152

151153
/// <summary>
152154
/// Implicit conversion from type <typeparamref name="T"/>.

test/Thinktecture.Runtime.Extensions.SourceGenerator.Tests/SourceGeneratorTests/RegularUnionSourceGeneratorTests.Should_generate_record_with_generic_without_implicit_conversion.verified.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ abstract partial record Result<T> :
124124
}
125125
}
126126

127+
#pragma warning disable CS0108 // Map in nested union hides Map from base class
127128
/// <summary>
128129
/// Maps current instance to an instance of type <typeparamref name="TResult"/>.
129130
/// </summary>
@@ -147,4 +148,5 @@ abstract partial record Result<T> :
147148
throw new global::System.ArgumentOutOfRangeException($"Unexpected type '{this.GetType().FullName}'.");
148149
}
149150
}
151+
#pragma warning restore CS0108 // Map in nested union hides Map from base class
150152
}

test/Thinktecture.Runtime.Extensions.SourceGenerator.Tests/SourceGeneratorTests/RegularUnionSourceGeneratorTests.Should_generate_record_with_multiple_explicit_conversions_if_configured.verified.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ abstract partial record Result<T> :
124124
}
125125
}
126126

127+
#pragma warning disable CS0108 // Map in nested union hides Map from base class
127128
/// <summary>
128129
/// Maps current instance to an instance of type <typeparamref name="TResult"/>.
129130
/// </summary>
@@ -147,6 +148,7 @@ abstract partial record Result<T> :
147148
throw new global::System.ArgumentOutOfRangeException($"Unexpected type '{this.GetType().FullName}'.");
148149
}
149150
}
151+
#pragma warning restore CS0108 // Map in nested union hides Map from base class
150152

151153
/// <summary>
152154
/// Explicit conversion from type <typeparamref name="T"/>.

test/Thinktecture.Runtime.Extensions.SourceGenerator.Tests/SourceGeneratorTests/RegularUnionSourceGeneratorTests.Should_generate_record_with_multiple_implicit_conversions.verified.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ abstract partial record Result<T> :
124124
}
125125
}
126126

127+
#pragma warning disable CS0108 // Map in nested union hides Map from base class
127128
/// <summary>
128129
/// Maps current instance to an instance of type <typeparamref name="TResult"/>.
129130
/// </summary>
@@ -147,6 +148,7 @@ abstract partial record Result<T> :
147148
throw new global::System.ArgumentOutOfRangeException($"Unexpected type '{this.GetType().FullName}'.");
148149
}
149150
}
151+
#pragma warning restore CS0108 // Map in nested union hides Map from base class
150152

151153
/// <summary>
152154
/// Implicit conversion from type <typeparamref name="T"/>.

test/Thinktecture.Runtime.Extensions.SourceGenerator.Tests/SourceGeneratorTests/RegularUnionSourceGeneratorTests.Should_generate_record_with_non_default_ctor.verified.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ abstract partial record TestUnion :
120120
}
121121
}
122122

123+
#pragma warning disable CS0108 // Map in nested union hides Map from base class
123124
/// <summary>
124125
/// Maps current instance to an instance of type <typeparamref name="TResult"/>.
125126
/// </summary>
@@ -143,4 +144,5 @@ abstract partial record TestUnion :
143144
throw new global::System.ArgumentOutOfRangeException($"Unexpected type '{this.GetType().FullName}'.");
144145
}
145146
}
147+
#pragma warning restore CS0108 // Map in nested union hides Map from base class
146148
}

0 commit comments

Comments
 (0)