Avatar
swiftbot BOT 6/5/2018 4:56 AM
Author icon
koher
struct Foo { var a: Int = 42 } struct Bar { var foo: Foo? = Foo() } var bar = Bar() bar[keyPath: \Bar.foo?.a] = -1 // ⛔ print(bar.foo!.a)
Version:
swift-4.1.1-RELEASE
Output:
Error:
/usercode/main.swift:10:27: error: cannot assign to immutable expression of type 'Int?' bar[keyPath: \Bar.foo?.a] = -1 // ⛔