[AutoDiff] Support derivative registration for more declaration kinds. (#28468)
Make `@differentiating` and `@transposing` attributes support more original
declaration kinds: computed properties, subscripts, and initializers.
- Change `DifferentiatingAttr` and `TransposingAttr` to store an
`AbstractFunctionDecl` representing the original declaration, instead of a
`FuncDecl`.
- Change attribute parsing to support initializer/subscript `DeclName`s.
- Make `TypeChecker::lookupFuncDecl` a static function in TypeCheckAttr.cpp.
- Assorted parsing and type-checking gardening.
`@differentiating` now has feature parity with
`@differentiable(jvp: ..., vjp: ...)` for derivative registration.
This is a necessary step towards making `@differentiating` and `@transposing`
the canonical mechanism for registering derivative/transpose functions.
Registering non-`func` declaration derivatives with `@differentiable` attribute
`jvp:`/`vjp:` labels is now explicitly rejected.
Resolves TF-281.
Todos:
- TF-997: support `@transposing` attribute with initializer original
declarations.
- TF-988: do not reuse `@differentiable` attribute type-checking diagnostics
for `@differentiating`/`@transposing` attribute type-checking.