Skip to content

[AutoDiff] [Sema] Fix missing access-level mismatch diagnostic in -enable-testing builds. #33800

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

Merged
merged 1 commit into from
Sep 4, 2020

Conversation

rxwei
Copy link
Contributor

@rxwei rxwei commented Sep 4, 2020

When a derivative function is internal and its original function is public, there should be an error when the derivative is not @usableFromInline. This patch fixes a bug where the error does not appear in SwiftPM debug build configurations (or any configurations with -enable-testing).

ValueDecl::getEffectiveAccess() should not be used when we perform formal access checking for AutoDiff-related declaration attributes because it will treat all internal declarations as public when -enable-testing is enabled. Instead, we should use a combination of ValueDecl::getFormalAccess() and ValueDecl::isUsableFromInline().

Also, add a RUN line with -enable-testing to all AutoDiff declaration attribute test files.

Resolves SR-13500 (rdar://68336300).

…nable-testing` builds.

When a derivative function is internal and its original function is
public, there should be an error when the derivative is not `@usableFromInline`.
This patch fixes a bug where the error does not appear in SwiftPM debug
build configurations (or any configurations with `-enable-testing`).

`ValueDecl::getEffectiveAccess()` should not be used when we perform
formal access checking for AutoDiff-related declaration attributes because
it will treat all internal declarations as public when `-enable-testing` is
enabled. Instea we should use a combination of `ValueDecl::getFormalAccess()`
and `ValueDecl::isUsableFromInline()`.

Also, add a `RUN` line with `-enable-testing` to all AutoDiff declaration
attribute test files.

Resolves SR-13500 (rdar://68336300).
@rxwei rxwei requested review from dan-zheng and efremale September 4, 2020 10:58
@rxwei
Copy link
Contributor Author

rxwei commented Sep 4, 2020

@swift-ci please test

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

Successfully merging this pull request may close these issues.

2 participants