mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[ConstraintSystem] Only attempt to infer a type from a default argument
if there is a non-null callee. Otherwise, getParameterList(callee) will crash if the callee is a closure. Closures can't have default arguments anyway, so there's no need to attempt this new inference.
This commit is contained in:
@@ -1748,7 +1748,7 @@ static ConstraintSystem::TypeMatchResult matchCallArguments(
|
||||
// If type inference from default arguments is enabled, let's
|
||||
// add a constraint from the parameter if necessary, otherwise
|
||||
// there is nothing to do but move to the next parameter.
|
||||
if (parameterBindings[paramIdx].empty()) {
|
||||
if (parameterBindings[paramIdx].empty() && callee) {
|
||||
auto &ctx = cs.getASTContext();
|
||||
|
||||
if (ctx.TypeCheckerOpts.EnableTypeInferenceFromDefaultArguments) {
|
||||
|
||||
Reference in New Issue
Block a user