-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Closed
Feature
Copy link
Labels
Area-CompilersFeature - Extension EverythingThe extension everything featureThe extension everything featureResolution-FixedThe bug has been fixed and/or the requested behavior has been implementedThe bug has been fixed and/or the requested behavior has been implemented
Milestone
Description
Version Used: .NET Lab & Godbolt
Steps to Reproduce:
Old version:
public static class A
{
public static void M<T>(this T value) where T : class { }
public static void M<T>(this ref T value) where T : struct { }
}New version:
public static class B
{
extension<T>(T inst) where T : class
{
public void M() { }
}
extension<T>(ref T inst) where T : struct
{
public void M() { }
}
}Diagnostic Id:
error CS0111: Type 'B' already defines a member called 'M' with the same parameter types
Expected Behavior:
Compiles since they get lowered to methods that don't conflict in IL, and it worked previously.
Actual Behavior:
Does not compile, so cannot convert into the new extension style.
Relates to test plan #76130
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area-CompilersFeature - Extension EverythingThe extension everything featureThe extension everything featureResolution-FixedThe bug has been fixed and/or the requested behavior has been implementedThe bug has been fixed and/or the requested behavior has been implemented