-
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
[ASTPrinter] Account for contextual where clauses when printing gen. … #30488
[ASTPrinter] Account for contextual where clauses when printing gen. … #30488
Conversation
@swift-ci please smoke test |
1 similar comment
@swift-ci please smoke test |
df5e21d
to
7ce9135
Compare
@swift-ci please smoke test |
@slavapestov Do you have a minute to sanity check this (the change is almost trivial)? Thank you. |
lib/AST/ASTPrinter.cpp
Outdated
void PrintAST::printDeclGenericRequirements(GenericContext *decl) { | ||
// Even if the declaration is not generic, it might carry a contextual | ||
// where clause. | ||
if (!decl->isGeneric() && !decl->getTrailingWhereClause()) |
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 might be more robust to just check that the decl's generic signature is different (pointer-wise) than the parent context's as a fast path, and then do the loop over the unstatisfied requirements. Otherwise, it's possible that the precondition goes out of sync (but unlikely, I guess)
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.
Right, the where clause is always around no matter how the generic signature computation went. Thanks!
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.
While this is safer, perhaps it makes sense to also get rid of completely invalid where clauses on non-generic top-level declarations when we diagnose them, since we won't ever need to inspect them anyways?
7ce9135
to
403004b
Compare
@swift-ci please smoke test |
…requirements
follow-up on #23489