Closed martialln closed 9 months ago
Note that this is not a recent regression, it doesn't typecheck with Xcode 15 beta either.
I think something is wrong in matchFunctionTypes()
, which purportedly claims to support pack expansion types:
// FIXME: ParamPackMatcher should completely replace the non-variadic
// case too eventually.
if (containsPackExpansionType(func1Params) ||
containsPackExpansionType(func2Params)) {
ParamPackMatcher matcher(func1Params, func2Params, getASTContext(),
isPackExpansionType);
if (matcher.match())
return getTypeMatchFailure(locator);
for (auto pair : matcher.pairs) {
auto result = matchTypes(pair.lhs, pair.rhs, subKind, subflags,
(func1Params.size() == 1
? argumentLocator
: argumentLocator.withPathElement(
LocatorPathElt::TupleElement(pair.lhsIdx))));
if (result.isFailure())
return result;
}
} else {
Another test case.
struct Foo<each T> {
let foo: (repeat each T) -> Void
init() {
let bar: (repeat each T) -> Void = { (_: repeat each T) in }
self.foo = bar // Type of expression is ambiguous without a type annotation
}
}
@AnthonyLatsis I can also repro from Xcode 15.2 and Swift 5.9.2… are there any legit workarounds for now?
This was fixed by #70457.
@slavapestov Thanks! Looks like this is shipping in 5.10 from https://github.com/apple/swift/pull/70797?
Yep, a new-enough 5.10 or main developer snapshot should have the fix.
Thank you for the update @slavapestov I will test it ASAP
Description The following code doesn't compile on the last toolchain
Compiler respond the following message with Xcode 15.0 beta 8 (15A5229m) and swift-DEVELOPMENT-SNAPSHOT-2023-09-04-a toolchain
Steps to reproduce
-typecheck
flagExpected behavior
Output of the same command with
-debug-constraints
:Environment