Avatar
swiftbot BOT 7/2/2018 1:51 AM
Author icon
koher
protocol Foo { var a: Int { get set } } struct SFoo : Foo { var a: Int = 1 } class CFoo : Foo { var a: Int = 1 } func bar(_ foo: Foo) -> Int { var foo2 = foo foo2.a += 1 return foo.a + foo2.a } let sFoo = SFoo() print(bar(sFoo)) let cFoo = CFoo() print(bar(cFoo))
Version:
swift-4.1.1-RELEASE
Output:
3 4
Error: