mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
The main fixes here are: - we weren't looking through open-existentials in the l-value - we weren't handling mutating gets correctly unless CSApply wrapped the base in an InOutExpr, which seems to be multifile-sensitive - we were missing diagnostics in some cases involving subscripts A better fix would be to re-introduce LValueAccessKind, but I wanted a workable short-term fix that I could try to get into 5.1. Fixes rdar://49482742, which is specific to the lazy-getter problem.
24 lines
419 B
Swift
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"
|
|
let map: [AnyHashable : Any] = [lvalue: lvalue]
|
|
lvalue = map[lvalue] as! String
|
|
}
|