Swift: readability problem with implicitly unwrapped Bool

Originator:raphael
Number:rdar://17360706 Date Originated:18-Jun-2014 05:19 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 6 Beta2
Classification:Enhancement Reproducible:Not Applicable
 
let test1: Bool! = true
let test2: Bool! = false
let test3: Bool = false

if test1 {
	"test1 OK" // pass
}
if test2 {
	"test2 OK" // pass 
}
if test3 {
	"test3 OK" // does not pass
}


You'd expect test2 to *not pass*, because it's an implicitly unwrapped value. But it passes. This is a very counter intuitive use case.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!