Avatar
public protocol A { var aaa: Int { get set } } extension A { public var aaa: Int { get { return 1 } set { () } } } public protocol B: class { var bbb: Int { get set } } extension B { public var bbb: Int { get { return 1 } set { () } } } で sil 出すと
9:45 AM
// A.aaa.setter sil @_T04test1APAAE3aaaSifs : $@convention(method) <Self where Self : A> (Int, @inout Self) -> () { // %0 // user: %2 // %1 // user: %3 bb0(%0 : $Int, %1 : $*Self): debug_value %0 : $Int, let, name "newValue", argno 1 // id: %2 debug_value_addr %1 : $*Self, var, name "self", argno 2 // id: %3 %4 = tuple () // user: %5 return %4 : $() // id: %5 } // end sil function '_T04test1APAAE3aaaSifs' // B.bbb.setter sil @_T04test1BPAAE3bbbSifs : $@convention(method) <Self where Self : B> (Int, @guaranteed Self) -> () { // %0 // user: %2 // %1 // user: %3 bb0(%0 : $Int, %1 : $Self): debug_value %0 : $Int, let, name "newValue", argno 1 // id: %2 debug_value %1 : $Self, let, name "self", argno 2 // id: %3 %4 = tuple () // user: %5 return %4 : $() // id: %5 } // end sil function '_T04test1BPAAE3bbbSifs'
9:45 AM
ABIが違う。