-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[IDE] Fix type reconstructions for PrivateDeclName. #15126
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 |
More like
It's a shame the indentation levels got lost in the comment. |
e959839
to
feceee2
Compare
Update to have the correct fix. |
@swift-ci please test |
Build failed |
test/IDE/rdar38248403.swift
Outdated
@@ -0,0 +1,9 @@ | |||
// RUN: %target-swift-ide-test -reconstruct-type -source-filename %s | %FileCheck %s |
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.
Could you give this file a more descriptive name instead of the radar id?
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.
In fact I would just put this test case in the reconstruct_type_from_mangled_name
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.
Moved to the other file.
lib/IDE/TypeReconstruction.cpp
Outdated
"demangled identifier %s could not be found by name lookup", | ||
id_node->getText().str().c_str()); | ||
break; | ||
} |
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.
Perhaps add a comment what is being done here?
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 used the helper, so this should be fairly self-explanatory now. Please let me know if you want me to add something else.
lib/IDE/TypeReconstruction.cpp
Outdated
@@ -1186,6 +1186,37 @@ static void VisitNodeFunction( | |||
VisitNode(ast, *pos, decl_scope_result); | |||
break; | |||
|
|||
case Demangle::Node::Kind::PrivateDeclName: { | |||
if (child->getNumChildren() != 2 || !child->getChild(0)->hasText() || |
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.
Can you combine this code with the existing function VisitNodePrivateDeclName()?
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.
Done
@dcci Do you want to also do local types in a follow on patch? It should be similar to private, in fact there's a |
@slavapestov yes, I don't mind taking a look at local types as well in a follow-up. Also, updating this patch in a sec. |
feceee2
to
e6e432d
Compare
Sorry, morning in meetings. Updated. |
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.
Addressed Reviewers comments.
lib/IDE/TypeReconstruction.cpp
Outdated
@@ -1186,6 +1186,37 @@ static void VisitNodeFunction( | |||
VisitNode(ast, *pos, decl_scope_result); | |||
break; | |||
|
|||
case Demangle::Node::Kind::PrivateDeclName: { | |||
if (child->getNumChildren() != 2 || !child->getChild(0)->hasText() || |
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.
Done
lib/IDE/TypeReconstruction.cpp
Outdated
"demangled identifier %s could not be found by name lookup", | ||
id_node->getText().str().c_str()); | ||
break; | ||
} |
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 used the helper, so this should be fairly self-explanatory now. Please let me know if you want me to add something else.
test/IDE/rdar38248403.swift
Outdated
@@ -0,0 +1,9 @@ | |||
// RUN: %target-swift-ide-test -reconstruct-type -source-filename %s | %FileCheck %s |
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.
Moved to the other file.
@swift-ci please test |
Build failed |
Build failed |
e6e432d
to
4746725
Compare
@swift-ci please test |
Build failed |
Build failed |
@swift-ci please test |
Without this fix, the type reconstruction logic chokes on demangled subtree of the kind: kind=DeclContext kind=Function kind=Module, text="swift_ide_test" kind=PrivateDeclName kind=Identifier, text="_0830B395847924C73A6666B87EFD2ADF" kind=Identifier, text="patatino" Fixes the compiler part of <rdar://problem/38248403>
4746725
to
74618cb
Compare
Updated tests |
@swift-ci please test |
Build failed |
Build failed |
@swift-ci clean smoke test |
@swift-ci clean |
I'm confident this is unrelated to my changes. |
@swift-ci please clean smoke test |
Without this fix, the type reconstruction logic chokes on
demangled subtree of the kind:
kind=DeclContext
kind=Function
kind=Module, text="swift_ide_test"
kind=PrivateDeclName
kind=Identifier, text="_0830B395847924C73A6666B87EFD2ADF"
kind=Identifier, text="patatino"
Fixes the compiler part of rdar://problem/38248403