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(
1768
1768
// If type inference from default arguments is enabled, let's
1769
1769
// add a constraint from the parameter if necessary, otherwise
1770
1770
// there is nothing to do but move to the next parameter.
1771
- if (parameterBindings[paramIdx].empty()) {
1771
+ if (parameterBindings[paramIdx].empty() && callee ) {
1772
1772
auto &ctx = cs.getASTContext();
1773
1773
1774
1774
if (ctx.TypeCheckerOpts.EnableTypeInferenceFromDefaultArguments) {
1775
1775
auto *paramList = getParameterList(callee);
1776
- auto *PD = paramList->get(paramIdx);
1776
+ if (!paramList)
1777
+ continue;
1777
1778
1778
1779
// There is nothing to infer if parameter doesn't have any
1779
1780
// generic parameters in its type.
1781
+ auto *PD = paramList->get(paramIdx);
1780
1782
if (!PD->getInterfaceType()->hasTypeParameter())
1781
1783
continue;
1782
1784
Original file line number Diff line number Diff line change 1
1
// RUN: %target-typecheck-verify-swift
2
+ // RUN: %target-typecheck-verify-swift -enable-experimental-type-inference-from-defaults
2
3
3
4
var t1a : ( Int . . . ) = ( 1 )
4
5
// expected-error@-1 {{cannot create a variadic tuple}}
Original file line number Diff line number Diff line change 1
1
// RUN: %target-typecheck-verify-swift
2
+ // RUN: %target-typecheck-verify-swift -enable-experimental-type-inference-from-defaults
2
3
3
4
func takeIntToInt( _ f: ( Int ) -> Int ) { }
4
5
func takeIntIntToInt( _ f: ( Int , Int ) -> Int ) { }
You can’t perform that action at this time.
0 commit comments