File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -1815,7 +1815,6 @@ static ConstraintSystem::TypeMatchResult matchCallArguments(
18151815 auto *argExpr = getArgumentExpr(locator.getAnchor(), argIdx);
18161816 if (param.isAutoClosure() && !isSynthesizedArgument(argument)) {
18171817 auto &ctx = cs.getASTContext();
1818- auto *fnType = paramTy->castTo<FunctionType>();
18191818
18201819 // If this is a call to a function with a closure argument and the
18211820 // parameter is an autoclosure, let's just increment the score here
@@ -1835,7 +1834,9 @@ static ConstraintSystem::TypeMatchResult matchCallArguments(
18351834 if (ctx.isSwiftVersionAtLeast(5) || !isAutoClosureArgument(argExpr)) {
18361835 // In Swift >= 5 mode there is no @autoclosure forwarding,
18371836 // so let's match result types.
1838- paramTy = fnType->getResult();
1837+ if (auto *fnType = paramTy->getAs<FunctionType>()) {
1838+ paramTy = fnType->getResult();
1839+ }
18391840 } else {
18401841 // Matching @autoclosure argument to @autoclosure parameter
18411842 // directly would mean introducting a function conversion
You can’t perform that action at this time.
0 commit comments