-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[CodeCompletion] Ensure all ExtensionDecl's extended types are computed #33669
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 smoke test |
lib/IDE/ExprContextAnalysis.cpp
Outdated
extensions.back()->computeExtendedNominal(); | ||
extensions.pop_back(); | ||
} | ||
class ExtensionBinder: public ASTWalker { |
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.
Why does this traverse the AST instead of iterating over the top level declarations in a file or something?
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.
I thought we need to handle something like:
struct Something {
extension A: B.#^HERE^# {
}
But I didn't know this already has ErrorType
as the extended type.
Will fix it.
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.
this already has ErrorType as the extended type.
Well, this is not true. But somehow
struct Something {
extension A: B.#^HERE^# {
}
doesn't crash. I will investigate.
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.
Malformed ASTs makes sense. 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.
Ah, I see. Non-toplevel extension
is canNeverBeBound()
. So we don't need to compute the extended nominal unless it's top-level.
…uted Fixes an assertion failure in ASTScope lookup rdar://problem/67102794
a3989ef
to
e013ebd
Compare
@@ -46,9 +46,11 @@ void swift::ide::typeCheckContextAt(DeclContext *DC, SourceLoc Loc) { | |||
while (isa<AbstractClosureExpr>(DC)) | |||
DC = DC->getParent(); | |||
|
|||
// Make sure the extension has been bound, in case it is in an inactive #if | |||
// or something weird like that. |
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.
Code completion never happens inside inactive #if
since #33475
@swift-ci Please smoke test |
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.
LGTM!
Fixes an assertion failure in ASTScope lookup
rdar://problem/67102794