-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Runtime/standard library: fix tuple printing, reflection, and casting #4898
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
Conversation
@swift-ci please smoke test and merge |
1 similar comment
@swift-ci please smoke test and merge |
@swift-ci please smoke test |
When printing a tuple via print(...), print tuple labels when they are available. This is possible now that the runtime metadata properly stores tuple labels. Fixes rdar://problem/23130016.
Fixes rdar://problem/22191852.
This allows dynamic casting to succeed between tuple types with different element types, converting each element in turn. Fixes rdar://problem/19892202.
185987e
to
c9ebcc5
Compare
@swift-ci please smoke test and merge |
@shahmishal the macOS smoke test failed with a "wrong sha" failure: https://ci.swift.org/view/Pull%20Request/job/swift-PR-osx-smoke-test/1843/console |
Linux smoke test succeeded here: https://ci.swift.org/view/Pull%20Request/job/swift-PR-Linux-smoke-test/1339/console |
I don't think we should support dynamic casting if we don't support static casting, no?
|
Yeah, but this works:
|
All tests pass, but the status API doesn't see it. Forcing the issue. |
That's not the same thing. Constructing a new tuple coerces the elements, but going from one tuple to another doesn't. let x: (Int, Int) = (1, 2)
let y: (Any, Any) = x |
The "cannot express" is the infamous "LAME:" error message we output because we don't have the AST nodes necessary to represent tuple-to-tuple conversions. AIUI covariant tuple conversions are intended to work. Elementwise conversions do work:
|
This pull request provides various improvements for the runtime handling of tuples, including:
print
andString.init(describing:)
Resolves at least rdar://problem/23130016, rdar://problem/22191852, and rdar://problem/19892202