Skip to content

[Sema] Emit only "public" access modifier in fix-it for missing witness #4585

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 1, 2016

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Sep 1, 2016

protocol P {
   func foo()
}
private class C : P {
}

Previously, fix-it tries to insert internal func foo() { <#code#> }.

With this PR, fix-it emits public access modifier only if the protocol and the class are public (or open).

@rintaro
Copy link
Member Author

rintaro commented Sep 1, 2016

@swift-ci Please smoke test

@jrose-apple
Copy link
Contributor

Code LGTM. @benlangmuir?

Can you add a test for a non-type requirement that needs public as well?

@benlangmuir
Copy link
Contributor

LGTM too

@rintaro
Copy link
Member Author

rintaro commented Sep 1, 2016

@jrose-apple @benlangmuir Thanks!

@jrose-apple What "non-type requirement" mean? non-class-type?

@jrose-apple
Copy link
Contributor

Non-associated-type. Right now the only test that inserts "public" is the associated type one, right? Or are there some that just didn't show up in the diff because they didn't change?

}

public protocol ProtocolWithPublicAccess3 {
func foo() // expected-note{{protocol requires function 'foo()' with type '() -> ()'; do you want to add a stub?}} {{78-78=\n public func foo() {\n <#code#>\n \}\n}}
Copy link
Member Author

@rintaro rintaro Sep 1, 2016

Choose a reason for hiding this comment

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

@jrose-apple Here's non-associatedtype test that emits public. Do we need init(), var, or subscript too?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I'm sorry, somehow I missed this one. All good, please feel free to merge.

Copy link
Member Author

Choose a reason for hiding this comment

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

:)
Sorry, I'm not authorized to merge. Could you?

Or @shahmishal, Could you authorize me to merge?

Copy link
Contributor

Choose a reason for hiding this comment

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

Instructions for getting commit access are at https://swift.org/contributing/#contributing-code "Commit Access" 😃

@benlangmuir benlangmuir merged commit 2ab53b5 into swiftlang:master Sep 1, 2016
@rintaro
Copy link
Member Author

rintaro commented Sep 1, 2016

@benlangmuir Thanks!

Actually I've been granted commit access on Jun. 1.
IIRC, from around Jul. 27, it seems only Apple members can merge into the master.
We non-apple "granted" contributors can trigger CI, but can't push Github "Merge pull request" buttons on this repo.
@modocache or @jtbandes, Could you confirm this?

@rintaro rintaro deleted the nowitness-access branch September 1, 2016 18:04
@modocache
Copy link
Contributor

Yes, I believe that's true. I'm unable to merge my code directly.

@jtbandes
Copy link
Contributor

jtbandes commented Sep 1, 2016

Same here, at least in this repo. I can merge into swift-evolution.

@benlangmuir
Copy link
Contributor

@shahmishal tells me this should be fixed now. After the required tests have passed, you should be able to hit the merge button if you have commit access. Let us know if it doesn't work!

@rintaro
Copy link
Member Author

rintaro commented Sep 2, 2016

Confirmed on other PRs. Thank you!

@jtbandes
Copy link
Contributor

jtbandes commented Sep 2, 2016

Yes, the merge button is green now. Thanks 😄

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.

5 participants