mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Sema: Fix inconsistent behavior with SE-0110-related compatibility hack
Back when SE-0110 was implemented we decided that passing a function value taking multiple parameters would be allowed where a function value taking a single tuple argument was expected. Due to quirks in the old function type representation, the "splat" in the other direction sometimes worked too. When we redid the function type representation we added a simulation of the old quirk for -swift-version 4 mode. However this simulation was itself problematic because it only worked when the function value being passed was a non-overloaded declaration reference. Slightly broaden the hack to the overloaded case, to prevent user confusion when adding or removing overloads.
This commit is contained in:
@@ -1184,7 +1184,10 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2,
|
||||
// We somehow let tuple unsplatting function conversions
|
||||
// through in some cases in Swift 4, so let's let that
|
||||
// continue to work, but only for Swift 4.
|
||||
if (simplified && isa<DeclRefExpr>(simplified)) {
|
||||
if (simplified &&
|
||||
(isa<DeclRefExpr>(simplified) ||
|
||||
isa<OverloadedDeclRefExpr>(simplified) ||
|
||||
isa<UnresolvedDeclRefExpr>(simplified))) {
|
||||
implodeParams(func2Params);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user