File tree Expand file tree Collapse file tree 3 files changed +6
-2
lines changed Expand file tree Collapse file tree 3 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -1768,15 +1768,17 @@ static ConstraintSystem::TypeMatchResult matchCallArguments(
17681768 // If type inference from default arguments is enabled, let's
17691769 // add a constraint from the parameter if necessary, otherwise
17701770 // there is nothing to do but move to the next parameter.
1771- if (parameterBindings[paramIdx].empty()) {
1771+ if (parameterBindings[paramIdx].empty() && callee ) {
17721772 auto &ctx = cs.getASTContext();
17731773
17741774 if (ctx.TypeCheckerOpts.EnableTypeInferenceFromDefaultArguments) {
17751775 auto *paramList = getParameterList(callee);
1776- auto *PD = paramList->get(paramIdx);
1776+ if (!paramList)
1777+ continue;
17771778
17781779 // There is nothing to infer if parameter doesn't have any
17791780 // generic parameters in its type.
1781+ auto *PD = paramList->get(paramIdx);
17801782 if (!PD->getInterfaceType()->hasTypeParameter())
17811783 continue;
17821784
Original file line number Diff line number Diff line change 11// RUN: %target-typecheck-verify-swift
2+ // RUN: %target-typecheck-verify-swift -enable-experimental-type-inference-from-defaults
23
34var t1a : ( Int . . . ) = ( 1 )
45// expected-error@-1 {{cannot create a variadic tuple}}
Original file line number Diff line number Diff line change 11// RUN: %target-typecheck-verify-swift
2+ // RUN: %target-typecheck-verify-swift -enable-experimental-type-inference-from-defaults
23
34func takeIntToInt( _ f: ( Int ) -> Int ) { }
45func takeIntIntToInt( _ f: ( Int , Int ) -> Int ) { }
You can’t perform that action at this time.
0 commit comments