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-2840] crash on release builds with joining of arrays of tuples #45434

Closed
swift-ci opened this issue Oct 4, 2016 · 1 comment
Closed

[SR-2840] crash on release builds with joining of arrays of tuples #45434

swift-ci opened this issue Oct 4, 2016 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself regression swift 3.0

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Oct 4, 2016

Previous ID SR-2840
Radar rdar://problem/19892202
Original Reporter cezarywojcik (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

Xcode 8.0, Swift 3

Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels Bug, 3.0Regression
Assignee None
Priority Medium

md5: f820e566cc7a5ae957447e4b64a2d224

Issue Description:

func testFunction(yesStrings: [String], noStrings: [String]) {

    let yesArray = yesStrings.map { ($0, true) }
    let noArray = noStrings.map { ($0, false) }
    let combined: [(string: String, yes: Bool)] = Array([yesArray, noArray].joined())

}

The code above will crash at runtime on the "let combined" line ONLY if compiled for release builds.

I attached a sample project for quick verification of this behavior.

Note that this works fine if you specify all types (the types MUST have the tuple label or this will still crash):

func testFunction(yesStrings: [String], noStrings: [String]) {

    let yesArray: [(string: String, yes: Bool)]  = yesStrings.map { ($0, true) }
    let noArray: [(string: String, yes: Bool)]  = noStrings.map { ($0, false) }
    let combined: [(string: String, yes: Bool)] = Array([yesArray, noArray].joined())

}

Note that this worked fine in Swift 2.3

@belkadan
Copy link
Contributor

belkadan commented Oct 5, 2016

Doug fixed this.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
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 regression swift 3.0
Projects
None yet
Development

No branches or pull requests

3 participants