@@ -119,25 +119,26 @@ getClosureActorIsolation(const Solution &S, AbstractClosureExpr *ACE) {
119
119
getClosureActorIsolationThunk);
120
120
}
121
121
122
- // / Returns \c true if \p Choice refers to a function that hasn't been called
123
- // / yet.
124
- static bool isUnappliedFunctionRef (const OverloadChoice &Choice) {
125
- if (!Choice.isDecl ()) {
122
+ // / Returns \c true if \p Choice refers to a function that has been fully
123
+ // / applied, including the curried self if present.
124
+ static bool isFullyAppliedFunctionRef (const Solution &S,
125
+ const OverloadChoice &Choice) {
126
+ auto *D = Choice.getDeclOrNull ();
127
+ if (!D)
126
128
return false ;
127
- }
128
- auto fnRefKind = Choice.getFunctionRefInfo ();
129
129
130
- if (fnRefKind.isUnapplied ())
130
+ switch (Choice.getFunctionRefInfo ().getApplyLevel ()) {
131
+ case FunctionRefInfo::ApplyLevel::Unapplied:
132
+ // No argument lists have been applied.
133
+ return false ;
134
+ case FunctionRefInfo::ApplyLevel::SingleApply:
135
+ // The arguments have been applied, check to see if the curried self has
136
+ // been applied if present.
137
+ return !D->hasCurriedSelf () || hasAppliedSelf (S, Choice);
138
+ case FunctionRefInfo::ApplyLevel::DoubleApply:
139
+ // All argument lists have been applied.
131
140
return true ;
132
-
133
- // We consider curried member calls as unapplied. E.g.
134
- // MyStruct.someInstanceFunc(theInstance)#^COMPLETE^#
135
- // is unapplied.
136
- if (fnRefKind.isSingleApply ()) {
137
- if (auto BaseTy = Choice.getBaseType ())
138
- return BaseTy->is <MetatypeType>() && !Choice.getDeclOrNull ()->isStatic ();
139
141
}
140
- return false ;
141
142
}
142
143
143
144
void PostfixCompletionCallback::sawSolutionImpl (
@@ -166,7 +167,8 @@ void PostfixCompletionCallback::sawSolutionImpl(
166
167
bool IsBaseDeclUnapplied = false ;
167
168
if (auto SelectedOverload = S.getOverloadChoiceIfAvailable (CalleeLocator)) {
168
169
ReferencedDecl = SelectedOverload->choice .getDeclOrNull ();
169
- IsBaseDeclUnapplied = isUnappliedFunctionRef (SelectedOverload->choice );
170
+ IsBaseDeclUnapplied = ReferencedDecl && !isFullyAppliedFunctionRef (
171
+ S, SelectedOverload->choice );
170
172
}
171
173
172
174
bool BaseIsStaticMetaType = S.isStaticallyDerivedMetatype (ParsedExpr);
0 commit comments