Closed
Description
Description
Conversions of Function returning function fail in 6.2.
let a: () -> () -> Void = {{}}
let _: (() -> () -> Void)? = a // 🔴 Cannot convert value of type '() -> Void' to specified type '() -> () -> Void'
Reproduction
compile above code.
Expected behavior
compiler outputs no error.
Environment
swiftc --version
swift-driver version: 1.127.4.2 Apple Swift version 6.2 (swiftlang-6.2.0.9.909 clang-1700.3.9.907)
Target: arm64-apple-macosx15.0
Additional information
regression of #78377
- if (convertTo->is<FunctionType>())
+ if (convertTo->is<FunctionType>() && !resultType->is<FunctionType>())
return false;
Since the new condition doesn’t handle the case where both lhs
and rhs
have the same curry level, conversions of function-returning functions are incorrectly repaired by repairByInsertingExplicitCall
.