-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Description
Partial method declaration and definition signatures should match, other than in cases of backwards compatibility (based on email discussion with C# language design team).
In the following, F1(), F2(), F3() are existing scenarios in C#8, and F4(), F5(), F6() are new scenarios. Errors should be reported for the differences in F4(), F5(), F6().
using System.Collections.Generic;
#nullable enable
partial class C
{
partial void F1(dynamic o);
partial void F1(object o) { } // C#8: no warning
partial void F2(string? s);
partial void F2(string s) { } // C#8: warning CS8611
partial void F3((int x, int y) t);
partial void F3((int, int) t) { } // C#8: error CS8142
partial void F4(System.IntPtr i);
partial void F4(nint i) { } // new: error
public partial dynamic F5();
public partial object F5() => null!; // new: error
public partial void F6(IEnumerable<string?> s);
public partial void F6(IEnumerable<string> s) { } // new: error
}Reactions are currently unavailable