Skip to content

[Foundation] Collapse (SignedInteger|UnsignedInteger) reqts into FixedWidthInteger #19006

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

Merged
merged 4 commits into from
Aug 29, 2018

Conversation

DougGregor
Copy link
Member

Simplify the default implementations provided for RawRepresentable
error types whose raw values are integral, replacing duplicated code
(for SignedInteger or UnsignedInteger) with a single constraint on
BinaryInteger.

Fixes rdar://problem/35230187.

@DougGregor DougGregor changed the title [Foundation] Collapse (SignedInteger|UnsignedInteger) reqts into FixeedWidthInteger [Foundation] Collapse (SignedInteger|UnsignedInteger) reqts into FixedWidthInteger Aug 27, 2018
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

@swift-ci please test source compatibility

Copy link
Contributor

@jrose-apple jrose-apple left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember looking at making this change and deciding that it did the wrong thing for unsigned integers. Since the code is just a bit pattern, you want to reinterpret-cast between Int and the raw type rather than numeric-cast.

@DougGregor
Copy link
Member Author

@swift-ci please test

@DougGregor
Copy link
Member Author

@swift-ci please test source compatibility

1 similar comment
@DougGregor
Copy link
Member Author

@swift-ci please test source compatibility

@DougGregor
Copy link
Member Author

@swift-ci please test

@DougGregor
Copy link
Member Author

@swift-ci please test Linux

@DougGregor
Copy link
Member Author

@swift-ci please test source compatibility

@DougGregor
Copy link
Member Author

@swift-ci please smoke test Linux

4 similar comments
@DougGregor
Copy link
Member Author

@swift-ci please smoke test Linux

@DougGregor
Copy link
Member Author

@swift-ci please smoke test Linux

@DougGregor
Copy link
Member Author

@swift-ci please smoke test Linux

@DougGregor
Copy link
Member Author

@swift-ci please smoke test Linux

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 66e4169b4fb7d96d4e55eab59631e9b189aeff5f

Copy link
Contributor

@jrose-apple jrose-apple left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this works. Don't forget to update corelibs Foundation too.

@DougGregor DougGregor force-pushed the error-bridging-integer-type branch from 4536099 to d1d85aa Compare August 28, 2018 17:48
…dWidthInteger.

Simplify the default implementations provided for RawRepresentable
error types whose raw values are integral, replacing duplicated code
(for SignedInteger or UnsignedInteger) with a single constraint on
BinaryInteger.

Fixes rdar://problem/35230187.
When working with Error types with unsigned raw values, numeric-cast into
a UInt and then map the bits over to an Int so we preserve values not
representable in an Int without wrapping.

Thanks to @jrose-apple for pointing this out!
@DougGregor DougGregor force-pushed the error-bridging-integer-type branch from d1d85aa to f64d5db Compare August 28, 2018 17:49
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

Corelibs Foundation bit is in swiftlang/swift-corelibs-foundation#1675

@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

@swift-ci please smoke test Linux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants