Avatar
Avatar
niw
@swift-5.8.1 class Box<T> { private var value: T init(_ value: T) { self.value = value } func mutate(_ mutation: (inout T) -> Void) { mutation(&self.value) } } func f() { let box = Box { } let s = "meow" box.mutate { value in value = { s } } } f() (edited)
exit status: 139 with <stdin>:22:13: warning: expression of type 'String' is unused s ^ (edited)
3.29 KB