22:51 niw@tpurr:~/Desktop $ cat a.swift let b: Bool = nil as String? is AnyObject print(b) 22:51 niw@tpurr:~/Desktop $ swiftc a.swift 2>/dev/null && ./a false
(edited)22:57 niw@tpurr:~/Desktop $ cat a.swift import Foundation let n: NSString = "a" let b: Bool = nil as String? is AnyObject print(b) 22:57 niw@tpurr:~/Desktop $ swiftc a.swift 2>/dev/null && ./a true
(edited)$ otool -L ./a ./a: /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.100.1) /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1675.129.0) /usr/lib/swift/libswiftCore.dylib (compatibility version 1.0.0, current version 1103.8.25) /usr/lib/swift/libswiftFoundation.dylib (compatibility version 1.0.0, current version 0.0.0)
Foundation.framework
がリンクされてるかどうかで挙動がかわるっぽい? (edited)23:00 niw@tpurr:~/Desktop $ cat a.swift import Foundation let n: Data? = nil let b: Bool = nil as String? is AnyObject print(b) 23:00 niw@tpurr:~/Desktop $ swiftc a.swift 2>/dev/null && ./a false 23:00 niw@tpurr:~/Desktop $ otool -L ./a ./a: /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.100.1) /usr/lib/swift/libswiftCore.dylib (compatibility version 1.0.0, current version 1103.8.25)
(edited)Foundation.framework
がない場合の import Foundation
では挙動が変わらないと... (edited)