Skip to content

Check protocol witnesses using access scopes. #4176

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

Conversation

jrose-apple
Copy link
Contributor

...rather than relying on the access-as-spelled, which may be greater than the effective access due to parent scopes.

(Some of this will get cleaned up with SR-2209.)

rdar://problem/27663492


Before merging this pull request to apple/swift repository:

  • Test pull request on Swift continuous integration.

Triggering Swift CI

The swift-ci is triggered by writing a comment on this PR addressed to the GitHub user @swift-ci. Different tests will run depending on the specific comment that you use. The currently available comments are:

Smoke Testing

Platform Comment
All supported platforms @swift-ci Please smoke test
All supported platforms @swift-ci Please smoke test and merge
OS X platform @swift-ci Please smoke test OS X platform
Linux platform @swift-ci Please smoke test Linux platform

A smoke test on macOS does the following:

  1. Builds the compiler incrementally.
  2. Builds the standard library only for macOS. Simulator standard libraries and
    device standard libraries are not built.
  3. lldb is not built.
  4. The test and validation-test targets are run only for macOS. The optimized
    version of these tests are not run.

A smoke test on Linux does the following:

  1. Builds the compiler incrementally.
  2. Builds the standard library incrementally.
  3. lldb is built incrementally.
  4. The swift test and validation-test targets are run. The optimized version of these
    tests are not run.
  5. lldb is tested.

Validation Testing

Platform Comment
All supported platforms @swift-ci Please test
All supported platforms @swift-ci Please test and merge
OS X platform @swift-ci Please test OS X platform
OS X platform @swift-ci Please benchmark
Linux platform @swift-ci Please test Linux platform

Lint Testing

Language Comment
Python @swift-ci Please Python lint

Note: Only members of the Apple organization can trigger swift-ci.

@jrose-apple
Copy link
Contributor Author

@swift-ci Please test

@jrose-apple
Copy link
Contributor Author

@slavapestov or @CodaFi, mind reviewing this?

@jrose-apple
Copy link
Contributor Author

Oops, broke a crash case (in addition to the phantom copyforward issue that all the bots are seeing).

...rather than relying on the access-as-spelled, which may be greater
than the effective access due to parent scopes.

(Some of this will get cleaned up with SR-2209.)

rdar://problem/27663492
@jrose-apple jrose-apple force-pushed the check-conformance-using-access-scopes branch from 8d60995 to 9b375d3 Compare August 10, 2016 17:20
@jrose-apple
Copy link
Contributor Author

@swift-ci Please test

@jrose-apple
Copy link
Contributor Author

@jrose-apple
Copy link
Contributor Author

@swift-ci Please test Linux platform

@jrose-apple
Copy link
Contributor Author

@swift-ci Please smoke test OS X platform

@jrose-apple
Copy link
Contributor Author

@swift-ci Please test Linux platform

@jrose-apple
Copy link
Contributor Author

@swift-ci Please smoke test OS X platform

1 similar comment
@jrose-apple
Copy link
Contributor Author

@swift-ci Please smoke test OS X platform

@jrose-apple
Copy link
Contributor Author

@swift-ci Please test Linux platform

@jrose-apple
Copy link
Contributor Author

Okay, this got all the way to Foundation tests on Linux, merging.

@jrose-apple jrose-apple merged commit f65ad81 into swiftlang:master Aug 11, 2016
@jrose-apple
Copy link
Contributor Author

Review ping for @slavapestov or @rjmccall?

@jrose-apple jrose-apple deleted the check-conformance-using-access-scopes branch August 11, 2016 21:31
if (isa<ModuleDecl>(accessScope))
return Accessibility::Internal;
if (accessScope->isModuleScopeContext() &&
accessScope->getASTContext().LangOpts.EnableSwift3Private) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need this staging flag?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not, but I'm going to stay consistent with it until we take it out completely.

@slavapestov
Copy link
Contributor

Looks good.

// that a broader scope is acceptable breaks some diagnostics.
if (attr->getAccess() != desiredAccess) {
// This uses getLocation() instead of getRange() because we don't want to
// replace the "(set)" part of a setter attribute.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a test for this?

Copy link
Contributor Author

@jrose-apple jrose-apple Aug 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of the existing tests failed when I tried to check for a narrower scope instead of a different scope, but I should probably add one for the "broader than desired" case in the FIXME. Thanks for the reminder.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just meant tests for the (set) part.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, yes, there are existing tests for that. That hasn't changed.

jrose-apple added a commit to jrose-apple/swift that referenced this pull request Aug 30, 2016
...rather than relying on the access-as-spelled, which may be greater
than the effective access due to parent scopes.

(Some of this will get cleaned up with SR-2209.)

rdar://problem/27663492
(cherry picked from commit f65ad81)
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