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

Set<AnyHashable> isn't bridging to NSNumber correctly

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Done
    • Component/s: Standard Library
    • Labels:
    • Environment:

      Xcode 8.1, Swift 3.0.1
      Xcode 8.1, Development Snapshot 2016-11-09

      Description

      All of these statements except the last evaluate to true. I believe it should be true as well. This affects Swift to Objective-C bridging where the Objective-C code isn't using lightweight generics.

      ([42] as Array as NSArray).contains(42)
      ([42] as Array as NSArray).contains(NSNumber(value: 42))
      ([42] as Array<AnyHashable> as NSArray).contains(42)
      ([42] as Array<AnyHashable> as NSArray).contains(NSNumber(value: 42))
      ([42] as Set as NSSet).contains(42)
      ([42] as Set as NSSet).contains(NSNumber(value: 42))
      ([42] as Set<AnyHashable> as NSSet).contains(42)
      ([42] as Set<AnyHashable> as NSSet).contains(NSNumber(value: 42)) // false
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              Christopher Christopher Rogers
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: