mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
A parse-only option is needed for parse performance tracking and the current option also includes semantic analysis.
24 lines
433 B
Swift
24 lines
433 B
Swift
// RUN: %target-swift-frontend -typecheck -verify %s
|
|
|
|
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
|
|
}
|