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(
1815
1815
auto *argExpr = getArgumentExpr(locator.getAnchor(), argIdx);
1816
1816
if (param.isAutoClosure() && !isSynthesizedArgument(argument)) {
1817
1817
auto &ctx = cs.getASTContext();
1818
- auto *fnType = paramTy->castTo<FunctionType>();
1819
1818
1820
1819
// If this is a call to a function with a closure argument and the
1821
1820
// parameter is an autoclosure, let's just increment the score here
@@ -1835,7 +1834,9 @@ static ConstraintSystem::TypeMatchResult matchCallArguments(
1835
1834
if (ctx.isSwiftVersionAtLeast(5) || !isAutoClosureArgument(argExpr)) {
1836
1835
// In Swift >= 5 mode there is no @autoclosure forwarding,
1837
1836
// so let's match result types.
1838
- paramTy = fnType->getResult();
1837
+ if (auto *fnType = paramTy->getAs<FunctionType>()) {
1838
+ paramTy = fnType->getResult();
1839
+ }
1839
1840
} else {
1840
1841
// Matching @autoclosure argument to @autoclosure parameter
1841
1842
// directly would mean introducting a function conversion
You can’t perform that action at this time.
0 commit comments