let a: @convention(block) () -> Int = { 42 } print("a") dump(a) print() type(of: a) // @conversion(block) () -> Int (a as AnyObject) === (a as AnyObject) // true print("a as AnyObject") print(type(of: a as AnyObject)) dump(a as AnyObject) print() let b: Any = a print("b") dump(b) type(of: b) // @conversion(block) () -> Int print() (b as AnyObject) === (b as AnyObject) // false print("b as AnyObject") print(type(of: b as AnyObject)) dump(b as AnyObject) print()
a - (Function) a as AnyObject __NSMallocBlock__ - <__NSMallocBlock__: 0x608000243390> #0 - super: __NSMallocBlock - super: NSBlock - super: NSObject b - (Function) b as AnyObject _SwiftValue - (Function) #0 - super: NSObject
_SwiftValue
にboxingされてるのが原因?a as AnyObject
の結果は NSMallocBlock だから、ラップはされてない感じだね