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-6836] Swift 4.1 segfault when taking _ObjectiveCBridgeable as generic argument #49385

Open
zwaldowski opened this issue Jan 25, 2018 · 5 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software regression swift 4.1

Comments

@zwaldowski
Copy link

Previous ID SR-6836
Radar rdar://problem/36875194
Original Reporter @zwaldowski
Type Bug

Attachment: Download

Environment

macOS High Sierra 10.13.3 (17D47) | Xcode Version 9.3 beta (9Q98q) / Apple Swift version 4.1 (swiftlang-902.0.34 clang-902.0.30)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, 4.1Regression, CompilerCrash
Assignee None
Priority Medium

md5: 6d44987700e842edeefe98cbffaa3e4b

Issue Description:

See attached for reduction and crash log. The code compiles and functions as expected in 4.0.x.

@zwaldowski
Copy link
Author

Tightening the generic requirements or changing the as cast did not work around the crasher. Replacing the cast with a call to `_bridgeToObjectiveC() ` did.

@belkadan
Copy link
Contributor

Usual disclaimer: pretty much anything you do with an underscored type or function is subject to change, and crashes aren't out of the question if it turns out there's some secret limitation on how it's supposed to be used.

@swift-ci create

@jckarter
Copy link
Member

Any reason you can't remove the 'T: _ObjectiveCBridgeable' constraint? Everything bridges to AnyObject already.

@zwaldowski
Copy link
Author

In all three contexts where this crash is occurring, it's needed for disambiguation. One is a set of tiebreakers for string interpolation and the other two are bridging helpers for NSCoding (extension RawRepresentable a la _SwiftNewtypeWrapper and some helpers on NSCoding itself, Obviously to be replaced with Codable as soon as we get the chance…)

@zwaldowski
Copy link
Author

Re: underscored stuff, we as a team have accepted the boneheaded risks as a tradeoff to gain bug fixes from type safety (U+1F643).

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 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. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software regression swift 4.1
Projects
None yet
Development

No branches or pull requests

4 participants