Files
swift-mirror/test/Constraints/anyhashable-collection-cast.swift
2018-07-26 23:13:43 -07:00

24 lines
419 B
Swift

// RUN: %target-typecheck-verify-swift
func dict() -> [AnyHashable: Any] {
return ["x": "y"]
}
func set() -> Set<AnyHashable> {
return ["x"]
}
func test() {
if let d = dict() as? [String: String] {
print(d)
}
if let s = set() as? Set<String> {
print(s)
}
}
func testLValueCoerce() {
var lvalue = "lvalue"
var map: [AnyHashable : Any] = [lvalue: lvalue]
lvalue = map[lvalue] as! String
}