(Motivated by this question on Stack Overflow.) Evaluating a dictionary with boolean values results in a wrong output, where false is printed instead of true:
$ swift
Welcome to Apple Swift version 4.2.1 (swiftlang-1000.11.42 clang-1000.11.45.1). Type :help for assistance.
1> let dict = ["foo" : true]
dict: [String : Bool] = 1 key/value pair {
[0] = {
key = "foo"
value = false
}
}
2> dict
$R0: [String : Bool] = 1 key/value pair {
[0] = {
key = "foo"
value = false
}
}
Confirmed. Works correctly with development snapshot from January 16, 2019:
$ ./swift-DEVELOPMENT-SNAPSHOT-2019-01-16-a.xctoolchain/usr/bin/swift
Welcome to Apple Swift version 5.0-dev (LLVM f63b283c71, Clang 41ac4c4262, Swift b34f9f8392).
Type :help for assistance.
1> let d = ["foo" : true]
d: [String : Bool] = 1 key/value pair {
[0] = {
key = "foo"
value = true
}
}