Avatar
swiftbot BOT 10/1/2018 8:19 AM
Author icon
omochimetaru
struct Stone {} class Cat { init() { print("init cat") } deinit { print("deinit cat") } func nya() { print("begin nya") var stone = Stone() { didSet { self.mofu(stone) } } stone = Stone() print("end nya") } func mofu(_ stone: Stone) { print("mofu") } } func main() { var cat = Cat() cat.nya() } main()
Version:
swift-4.1.1-RELEASE
Output:
init cat begin nya mofu end nya deinit cat
Error:
/usercode/main.swift:32:9: warning: variable 'cat' was never mutated; consider changing to 'let' constant var cat = Cat() ~~~ ^ let