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-1782] SwiftNSCharacterSet unrecognized selector mutableCopyWithZone #4570

Closed
swift-ci opened this issue Jun 15, 2016 · 1 comment
Closed

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-1782
Radar None
Original Reporter ayaka (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

Xcode version 8.0 beta (8S128d)

Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug, RunTimeCrash
Assignee @phausler
Priority Medium

md5: e2da46d06a88225b959e11530e4b8ede

is duplicated by:

  • SR-2058 CharacterSet.substracting crashes

Issue Description:

Steps to reproduce:

1. Create a Swift playground with the following code:

import Foundation
var nonAlphanumeric = CharacterSet.alphanumerics.inverted
nonAlphanumeric.remove(charactersIn: " ")

2. Wait for it to run
3. Crash

The current workaround is to use NSMutableCharacterSet.alphanumerics() instead

var nonAlphaNumeric = NSMutableCharacterSet.alphanumerics().inverted
nonAlphaNumeric.remove(charactersIn: " ")

I think Philippe just fixed it during a lab but wanted to make sure it gets tracked!

Thanks 😃

@phausler
Copy link
Member

For some reason NSCharacterSet requires copyWithZone: and mutableCopyWithZone: to be overridden (even though they both could probably be implemented abstractly via the data representations.

Pushed fixes plus unit tests encapsulating this use case with commit 07f0049e

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 6, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants