Skip to content

Commit f4986f9

Browse files
committed
[CodeCompletion] Don't consider calls to initializers on metatypes in argument completion
1 parent 062eccb commit f4986f9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/IDE/ArgumentCompletion.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ using namespace swift::constraints;
2424
bool ArgumentTypeCheckCompletionCallback::addPossibleParams(
2525
const ArgumentTypeCheckCompletionCallback::Result &Res,
2626
SmallVectorImpl<PossibleParamInfo> &Params, SmallVectorImpl<Type> &Types) {
27-
if (!Res.ParamIdx) {
27+
if (!Res.ParamIdx || !Res.FuncTy) {
2828
// We don't really know much here. Suggest global results without a specific
2929
// expected type.
3030
return true;
@@ -118,6 +118,13 @@ void ArgumentTypeCheckCompletionCallback::sawSolutionImpl(const Solution &S) {
118118
if (Info.Value && Info.Value->shouldHideFromEditor()) {
119119
return;
120120
}
121+
// Disallow invalid initializer references
122+
for (auto Fix : S.Fixes) {
123+
if (Fix->getLocator() == CalleeLocator &&
124+
Fix->getKind() == FixKind::AllowInvalidInitRef) {
125+
return;
126+
}
127+
}
121128

122129
// Find the parameter the completion was bound to (if any), as well as which
123130
// parameters are already bound (so we don't suggest them even when the args

0 commit comments

Comments
 (0)