dotnet / csharplang

The official repo for the design of the C# programming language
11.02k stars 1.01k forks source link

Spec behavior for default parameter values in partial properties #8106

Closed RikkiGibson closed 3 weeks ago

RikkiGibson commented 3 weeks ago

@jcouv

SharpLab showing a similar partial methods scenario. In short, partial methods expect only the definition part to have default parameter values. A warning occurs when the implementation part has a default value, even if it matches the definition part.

I wasn't able to find any spec language or LDM notes which indicates that this is supposed to happen for partial methods. However, it seems to be an old behavior dating back to native compiler, which we haven't heard complaints about from generator authors etc. So, it seems reasonable to carry it over, and to help make things clear for feature development purposes, we spec a similar behavior for partial proeprties.