Unsafe evolution speclet: add more modifier restrictions - #10289
Conversation
safe| When a user-facing *requires-unsafe* member generates hidden members, such as an auto-property's get/set methods, | ||
| both the user-facing member and any hidden members generated by that user-facing member are all *requires-unsafe*, and `RequiresUnsafeAttribute` is applied to all of them. |
There was a problem hiding this comment.
It doesn't seem to be adding anything new. get/set methods are already members to which the kept sentence applies. And now with safe/unsafe keywords, the caller-safety can differ between the accessor and the containing member, so this detail would have to be modified somehow, so I just thought it's easier to remove it.
There was a problem hiding this comment.
I think we should keep it. We can remove the line about auto-props, but this still impacts things such as the MoveNext of compiler-async or iterators.
There was a problem hiding this comment.
this still impacts things such as the
MoveNextof compiler-async or iterators.
Currently it actually does not. These members are not user-callable, and we don't emit [RequiresUnsafe] on them. (It's a good point that we should clarify that fact either way though.)
There was a problem hiding this comment.
Users could use reflection to call them. We should make sure that synthesized members generated from an unsafe method are also marked as unsafe.
There was a problem hiding this comment.
Users could use reflection to call them.
Not sure how does the fact whether [RequiresUnsafe] is on such members make a difference - unless users calling those members via reflection manually check that attribute and then do... what? add unsafe block (which IDE immediately declares as unnecessary)?
Perhaps I can just add an open question for now?
(FWIW, I don't think it was previously clear from that block of speclet that it would apply to things like MoveNext.)
There was a problem hiding this comment.
It was certainly my intention that it apply to them. That's what I meant by hidden members generated by that user-facing member.
No description provided.