Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-15723] Tuple conversion fails in the context of a type #58000

Open
swift-ci opened this issue Jan 12, 2022 · 0 comments
Open

[SR-15723] Tuple conversion fails in the context of a type #58000

swift-ci opened this issue Jan 12, 2022 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-15723
Radar None
Original Reporter lhunath (JIRA User)
Type Bug
Environment

swift-driver version: 1.26.21 Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
Target: x86_64-apple-macosx12.0

Additional Detail from JIRA
Votes 0
Component/s
Labels Bug
Assignee None
Priority Medium

md5: c7b7fdce4d97e5cbf51aa2e27f52979e

Issue Description:

Original discussion: https://forums.swift.org/t/tuple-label-conversion-breaks-for-member-functions/54571/3

The expectation is that the Swift compiler can convert anonymous tuples to labelled tuples on-demand through type inference when the tuple member types are compatible.

This expectation holds true in most scenarios, for instance:

typealias T = (a: Int, b: String)
func f<P: Publisher>(_ t: P) where P.Output == T {}
f(Just((0, ""))) // Fine.

However, as soon as the tuple conversion takes place within the context of a type, it appears to fail:

f( Just(0).combineLatest(Just("")) ) // Global function 'f' requires the types '(Int, Just<String>.Output)' and 'T' (aka '(a: Int, b: String)') be equivalent
protocol P {
    func f<PT: Publisher>(_ t: PT) where PT.Output == T
}
p.f(Just((0, ""))) // Instance method 'f' requires the types '(Int, String)' and 'T' (aka '(a: Int, b: String)') be equivalent
@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Projects
None yet
Development

No branches or pull requests

1 participant