-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[CodeCompletion] Fix call arguments completion in overloaded case #20721
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
[CodeCompletion] Fix call arguments completion in overloaded case #20721
Conversation
To simplify call-site code.
bd723da
to
5fdf8ee
Compare
@swift-ci Please smoke test |
Will this work for individual label completions (i.e. what you get in |
That's still FIXME. ( For example, given: func foo(arg1: Int, bar: Double) {}
func foo(arg1: Int, baz: Int){}
func foo(arg1: String, qux: Int) {}
func _test() {
foo(arg1: 1, #^COMPLETE^#
} results:
But |
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 other than some nitpicks about wording.
lib/IDE/CodeCompletion.cpp
Outdated
|
||
void collectPossibleParamListByQualifiedLookup( | ||
/// Collect function (or subscript) member with specified \p name on \p baseTy. | ||
void collectPossibleCalleeByQualifiedLookup( |
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.
Callee -> Callees
lib/IDE/CodeCompletion.cpp
Outdated
void collectPossibleParamListByQualifiedLookup( | ||
/// Collect function (or subscript) member with specified \p name on | ||
/// \p baseExpr expression. | ||
void collectPossibleCalleeByQualifiedLookup( |
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.
Same comments about function name and comment as above.
lib/IDE/CodeCompletion.cpp
Outdated
|
||
void collectPossibleParamListByQualifiedLookup( | ||
/// Collect function (or subscript) member with specified \p name on \p baseTy. |
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.
... members with the given \p name ...
lib/IDE/CodeCompletion.cpp
Outdated
} | ||
|
||
bool collectPossibleParamListsApply( | ||
/// For given \c callExpr, collect possible callee types and declarations. | ||
bool collectPossibleCalleeForApply( |
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.
Callee -> Callees
lib/IDE/CodeCompletion.cpp
Outdated
DC, baseTy, DeclBaseName::createConstructor(), candidates); | ||
} | ||
} | ||
|
||
return !candidates.empty(); | ||
} | ||
|
||
bool collectPossibleParamListsSubscript( | ||
/// For given \c subscriptExpr, collect possible callee types and declarations. | ||
bool collectPossibleCalleeForSubscript( |
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.
Callee -> Callees
lib/IDE/CodeCompletion.cpp
Outdated
DeclBaseName::createSubscript(), | ||
candidates); | ||
} | ||
return !candidates.empty(); | ||
} | ||
|
||
/// Get index of \p CCExpr in \p Args. \p Args is usually a \c TupleExpr, | ||
/// \c ParenExpr, or a \c TupleShuffleExpr. | ||
/// Returns \c true if sucess, \c false if \p CCExpr is not a part of \p Args. |
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.
\returns
in context type analysis. Still NFC, but this is needed by later commits.
In `<expr> '(' <code-completion-token>` case, we usually complete call arguments. If '<expr>' isn't typechecked, for example, because of overloading, we used to give up arguments completions. Now, use possible callee informations from the context type analyzer. This increases the chance to provide accurate completions. rdar://problem/43703157
5fdf8ee
to
0e4ce12
Compare
0e4ce12
to
56c531d
Compare
@swift-ci Please smoke test |
In
<expr> '(' <code-completion-token>
case, we usually complete call arguments. However, if<expr>
isn't typechecked, for example because of overloading, we used to give up arguments completions.Now, use possible callee informations from
CodeCompletionTypeContextAnalyzer
. This increases the chance to provide arguments completions.rdar://problem/43703157
(#20703 is a groundwork for this PR)