-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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-7629] Fix wrong fixit when the type doesn't conform to a public protocol #17083
[SR-7629] Fix wrong fixit when the type doesn't conform to a public protocol #17083
Conversation
This looks great! Can you add a test that confirms this works correctly? Off the top of my head, I would do this in test/attr/accessibility.swift:
Like many files in the test suite, attr/accessibility.swift is run in a special mode where the Swift compiler compares the diagnostics emitted by the file to specially-formatted comments. Take a look at other parts of the file to see how it's done. Any diagnostic that isn't mentioned in a comment causes the test to fail, so when you're testing the memberwise behavior, simply not mentioning the fix-it diagnostic in the comments ensures the test will fail if it's emitted. |
@brentdax |
I wrote tests and checked to pass all tests. |
Brent, if you're good with this version so am I; feel free to run tests and merge when you're satisfied with it. (Though I'm sad |
lib/Sema/TypeCheckProtocol.cpp
Outdated
@@ -2773,6 +2773,12 @@ ConformanceChecker::resolveWitnessViaLookup(ValueDecl *requirement) { | |||
requiredAccess, | |||
protoAccessScope.accessLevelForDiagnostics(), | |||
proto->getName()); | |||
if (auto *decl = dyn_cast<AbstractFunctionDecl>(witness)) { | |||
auto isMemberwiseInitializer = decl->getBodyKind() == AbstractFunctionDecl::BodyKind::MemberwiseInitializer; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nit: can you clang-format this change?
@jrose-apple @brentdax Are there other things that you think I should do? |
I guess we can take this, and if Brent has further follow-up comments he can still provide them after the merge. |
Wrong fixit occurred when initializer is memberwiseInitializer. So I disabled fixit only in that case.
Resolves SR-7629.