Skip to content

Commit

Permalink
Add a test for same method name in multiple types
Browse files Browse the repository at this point in the history
  • Loading branch information
stephentoub committed Mar 10, 2022
1 parent 5fb55c8 commit fc06231
Showing 1 changed file with 46 additions and 0 deletions.
Expand Up @@ -518,6 +518,52 @@ internal interface IBlah { }
", compile: true));
}

[Fact]
public async Task Valid_SameMethodNameInMultipleTypes()
{
Assert.Empty(await RegexGeneratorHelper.RunGenerator(@"
using System.Text.RegularExpressions;
namespace A
{
public partial class B<U>
{
private partial class C<T>
{
[RegexGenerator(""1"")]
public partial Regex Valid();
}
private partial class C<T1,T2>
{
[RegexGenerator(""2"")]
private static partial Regex Valid();
private partial class D
{
[RegexGenerator(""3"")]
internal partial Regex Valid();
}
}
private partial class E
{
[RegexGenerator(""4"")]
private static partial Regex Valid();
}
}
}
partial class F
{
[RegexGenerator(""5"")]
public partial Regex Valid();
[RegexGenerator(""6"")]
public partial Regex Valid2();
}
", compile: true));
}

public static IEnumerable<object[]> Valid_Modifiers_MemberData()
{
foreach (string type in new[] { "class", "struct", "record", "record struct", "record class", "interface" })
Expand Down

0 comments on commit fc06231

Please sign in to comment.