Uploaded image for project: 'Swift'
  1. Swift
  2. SR-3667

Crash in CharacterSet

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Component/s: Foundation
    • Labels:
    • Environment:

      Xcode 8.2
      macOS 10.12.2

      Description

      There is a crash in the CharacterSet implementation. See the example below. I've attached a Playground with this issue and a screenshot of the error.

      import Foundation
      
      extension CharacterSet {
          func isSuperset(ofCharactersIn string: String) -> Bool {
              let otherSet = CharacterSet(charactersIn: string)
              return isSuperset(of: otherSet)
          }
      }
      
      let foo = "_"
      
      let bar = CharacterSet.alphanumerics.union(CharacterSet(charactersIn: foo))
      
      print(bar.isSuperset(ofCharactersIn: foo))
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            aamctustwo Aaron McTavish
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated: