Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-13684] sema forbids private derivatives in different scopes #54384

Closed
marcrasi mannequin opened this issue Dec 17, 2019 · 1 comment
Closed

[SR-13684] sema forbids private derivatives in different scopes #54384

marcrasi mannequin opened this issue Dec 17, 2019 · 1 comment

Comments

@marcrasi
Copy link
Mannequin

marcrasi mannequin commented Dec 17, 2019

Previous ID SR-13684
Radar None
Original Reporter @marcrasi
Type Sub-task
Status Closed
Resolution Won't Do
Additional Detail from JIRA
Votes 0
Component/s
Labels Sub-task
Assignee None
Priority Medium

md5: 7bf8f92a71ad0f5ef8b2cd2f24476459

Parent-Task:

  • SR-13659 Retroactive derivative registration

Issue Description:

After #28790 is merged, uncomment the second `extension FunctionWithPrivateDerivativesInSeprateExtensions` in `test/AutoDiff/Inputs/derivative_registration/main/main.swift` and run `test/AutoDiff/derivative_registration.swift` to get:

/usr/local/google/home/marcrasi/swift-base/swift/test/AutoDiff/Inputs/derivative_registration/main/main.swift:183:4: error: a derivative already exists for 'f'
  @derivative(of: f)
  ~^~~~~~~~~~~~~~~~~
  
/usr/local/google/home/marcrasi/swift-base/swift/test/AutoDiff/Inputs/derivative_registration/main/main.swift:170:4: note: other attribute declared here
  @derivative(of: f)
   ^

Related issue that we should resolve or file a separate ticket for, and add tests: If you define `foo` in file A, and a fileprivate derivative of `foo` in file A, and you try to differentiate `foo` in file B, then it will currently fail with a linker error (symbol not found). Ideally, it will give you an error that the function was defined in a different file and not marked @differentiable.

Similar related issue: If you define `foo` in file B, and a fileprivate derivative of `foo` in file A, and you try to differentiate `foo` in file B, then it will currently fail with a linker error (symbol not found). Ideally, it will try to automatically differentiate `foo` without using your custom derivative.

@marcrasi
Copy link
Mannequin Author

marcrasi mannequin commented Jan 8, 2020

Obsolete because I'm closing the PR that causes this.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants