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-8407] NSNumber as? Bool behaves differently on Swift 4.2 #3660

Closed
swift-ci opened this issue Jul 30, 2018 · 5 comments
Closed

[SR-8407] NSNumber as? Bool behaves differently on Swift 4.2 #3660

swift-ci opened this issue Jul 30, 2018 · 5 comments
Assignees

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-8407
Radar None
Original Reporter guidomb (JIRA User)
Type Bug
Status Closed
Resolution Done
Environment

Ubuntu 16.04

Swift version 4.2-dev (LLVM da1c9a3ae4, Clang 78aa734eee, Swift fe1f442af0)

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

md5: 5a624138e0df69b003fa2f905bee94d2

Issue Description:

It seems there is a regression, at least comparing Swift 4.2 snapshot 2018-07-28 with 2018-06-21 (on linux) when trying to optionally cast a instance of NSNumber to Bool. Here is a snippet that reproduces the issue

import Foundation

let a = NSNumber(value: 10)
let b: Any = a
print("\(b as? Bool)")

On macOS with Swift 4.1 the output is nil. On Linux with Swift 4.2 snapshot 2018-07-28 the output is Optional(true).

@belkadan
Copy link

cc @phausler

@spevans
Copy link
Collaborator

spevans commented Jul 31, 2018

#1642

@spevans
Copy link
Collaborator

spevans commented Aug 3, 2018

This has been merged into master and the swift-4.2-branch now

@belkadan
Copy link

belkadan commented Aug 3, 2018

Ah, in general the person who filed the bug should be the one to close it. The person who fixes it can use "Verify" instead.

@belkadan
Copy link

belkadan commented Aug 3, 2018

Er, that should be "Resolved", of course. Radar terminology getting the better of me.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 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

3 participants