-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfexpressionsFeature: expressionsFeature: expressionsimplicit conversionsFeature: implicit conversionsFeature: implicit conversionstype checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis
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.
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfexpressionsFeature: expressionsFeature: expressionsimplicit conversionsFeature: implicit conversionsFeature: implicit conversionstype checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis