[AutoDiff upstream] forbid @derivative of protocol req#29031
Conversation
There was a problem hiding this comment.
I feel we need an error message stating clearly that defining derivatives for protocol requirements is not yet supported.
There was a problem hiding this comment.
Customized diagnostics may require extra support in findAbstractFunctionDecl in TypeCheckAttr.cpp. Currently, when std::function<bool(AbstractFunctionDecl *)> &isValidCandidate returns false for all candidates, a single generic error is emitted (std::function<void()> &noneValidDiagnostic).
We could change isValidCandidate emit diagnostics as a side effect, but this requires clever diagnostic cancellation (via DiagnosticTransaction) in case a valid candidate is found.
Alternatively, we could keep track of all invalid candidates and change noneValidDiagnostic to std::function<void(AbstractFunctionDecl *)> ¬ValidDiagnostic, so customized diagnostics can be emitted for every invalid candidate.
There was a problem hiding this comment.
This seems like more work than it's worth, especially since it's a temporary limitation, so I won't do this in this PR.
7561235 to
d69e892
Compare
|
@swift-ci please test and merge |
|
@swift-ci Please test |
|
Build failed |
|
Build failed |
Forbids @derivatives of protocol requirements, because they do not do anything until TF-982 is implemented.
This is the master branch version of #28890.