File tree Expand file tree Collapse file tree 2 files changed +28
-12
lines changed Expand file tree Collapse file tree 2 files changed +28
-12
lines changed Original file line number Diff line number Diff line change @@ -3421,11 +3421,15 @@ static bool candidatesHaveAnyDefaultValues(
3421
3421
auto function = dyn_cast_or_null<AbstractFunctionDecl>(cand.getDecl ());
3422
3422
if (!function) continue ;
3423
3423
3424
- auto paramLists = function->getParameterLists ();
3425
- if (cand.level >= paramLists.size ()) continue ;
3424
+ if (function->getImplicitSelfDecl ()) {
3425
+ if (cand.level != 1 )
3426
+ return false ;
3427
+ } else {
3428
+ if (cand.level != 0 )
3429
+ return false ;
3430
+ }
3426
3431
3427
- auto paramList = paramLists[cand.level ];
3428
- for (auto param : *paramList) {
3432
+ for (auto param : *function->getParameters ()) {
3429
3433
if (param->getDefaultArgumentKind () != DefaultArgumentKind::None)
3430
3434
return true ;
3431
3435
}
@@ -3456,11 +3460,15 @@ static Optional<unsigned> getElementForScalarInitOfArg(
3456
3460
auto function = dyn_cast_or_null<AbstractFunctionDecl>(cand.getDecl ());
3457
3461
if (!function) return getElementForScalarInitSimple (tupleTy);
3458
3462
3459
- auto paramLists = function->getParameterLists ();
3460
- if (cand.level >= paramLists.size ())
3461
- return getElementForScalarInitSimple (tupleTy);
3463
+ if (function->getImplicitSelfDecl ()) {
3464
+ if (cand.level != 1 )
3465
+ return getElementForScalarInitSimple (tupleTy);
3466
+ } else {
3467
+ if (cand.level != 0 )
3468
+ return getElementForScalarInitSimple (tupleTy);
3469
+ }
3462
3470
3463
- auto paramList = paramLists[cand. level ] ;
3471
+ auto paramList = function-> getParameters () ;
3464
3472
if (tupleTy->getNumElements () != paramList->size ())
3465
3473
return getElementForScalarInitSimple (tupleTy);
3466
3474
Original file line number Diff line number Diff line change @@ -90,10 +90,18 @@ ArrayRef<Identifier> UncurriedCandidate::getArgumentLabels(
90
90
scratch.clear ();
91
91
if (auto decl = getDecl ()) {
92
92
if (auto func = dyn_cast<AbstractFunctionDecl>(decl)) {
93
- // Retrieve the argument labels of the corresponding parameter list.
94
- if (level < func->getNumParameterLists ()) {
95
- auto paramList = func->getParameterList (level);
96
- for (auto param : *paramList) {
93
+ if (func->getImplicitSelfDecl ()) {
94
+ if (level == 0 ) {
95
+ scratch.push_back (Identifier ());
96
+ return scratch;
97
+ }
98
+
99
+ --level;
100
+ }
101
+
102
+ if (level == 0 ) {
103
+ // Retrieve the argument labels of the corresponding parameter list.
104
+ for (auto param : *func->getParameters ()) {
97
105
scratch.push_back (param->getArgumentName ());
98
106
}
99
107
return scratch;
You can’t perform that action at this time.
0 commit comments