Make generated convenience methods internal when a parameter type is internal#10852
Make generated convenience methods internal when a parameter type is internal#10852Copilot wants to merge 6 commits into
Conversation
…ernal Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
commit: |
…stom-code test Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
|
Would such methods get filtered by the default value of unreferenced-types-handling? Or are these still considered root methods? |
|
Nevermind, this is just internalizing methods, not types. |
|
These convenience methods aren't filtered out. The method being downgraded to |
|
No changes needing a change description found. |
A convenience method generated as
publicbut taking a parameter whose type isinternal(e.g. a model customized to internal viaclient.tspor custom code) fails to compile with an inconsistent-accessibility error.Changes
ScmMethodProviderCollection: addedGetConvenienceMethodModifiers, which downgrades a convenience method frompublictointernalwhen the enclosing type is not internal and not private (covering public, protected, and similar visibilities) and any signature parameter type is non-public (!p.Type.IsPublic). Applied only to the generator-controlled signature path; customized partial-method signatures keep the user's explicit modifiers, and already-internal/private enclosing types are left untouched.client.tspaccess override (method becomesinternal), the internal-parameter case via custom code using a TestDatainternal partial class(method becomesinternal), and the public-parameter case (method stayspublic).Regenerating the existing test libraries produced no output diffs, confirming the change only affects the previously-broken internal-parameter scenario.