-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Add access level import diagnostic for named pattern. #77832
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
@swift-ci please test |
f27dcdd
to
2fe5e0b
Compare
@tshortli what about this approach? It's a larger change as I had to add a parameter to the |
@swift-ci please test |
@swift-ci please smoke test Linux Platform |
if (auto *declRefTR = dyn_cast_or_null<DeclRefTypeRepr>(complainRepr)) | ||
complainDecl = declRefTR->getBoundDecl(); | ||
|
||
noteLimitingImport(userDecl, ctx, limitImport, complainDecl); |
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.
It's a small detail, but I think we still want the diagnostic to point to the TypeRepr
instead of the Decl
when there is a TypeRepr
available.
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.
The behavior should be the same here, its just the unwrapping of the TypeRepr
happens one level above in noteLimitingImport(..., const TypeRepr *complainRepr)
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.
Ok, if the exact source location that the diagnostic points to is not changing then this is fine. I was expecting that it would point directly to the type written in source (which would be different than the location of the decl), but I guess it doesn't already do that.
This PR adds a missing access level diagnostic when type checking named patterns by walking the interface type to find the importing decl to emit the diagnostic for.
2fe5e0b
to
5bcf1bf
Compare
@swift-ci please test Windows Platform |
@swift-ci please smoke test Linux Platform |
This PR adds a missing access level diagnostic when type checking named patterns by extracting the TypeRepr from the pattern's initializer.