mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
`@differentiable` attributes may contain `where` clauses referencing generic parameters from some generic context, just like `@_specialize` attributes. Without special ASTScope support for `@differentiable` attributes, ASTScopeLookup.cpp logic tries to resolve the generic parameter `DeclName`s in `where` clauses based on source location alone (`ASTScopeImpl::findChildContaining`) and fails. The fix is to add a special `DifferentiableAttributeScope`, mimicking `SpecializeAttributeScope`. Every `@differentiable` attribute has its own scope, derived from the declaration on which it is declared. Unlike `@_specialize`, `@differentiable` may also be declared on `AbstractStorageDecl` declarations (subscripts and variables). Upstreams https://github.com/apple/swift/pull/27451. Progress towards TF-828: upstream `@differentiable` attribute type-checking.
69 KiB
69 KiB