:Int
がなくても Int
になってるわけではないから、protocol Container { associatedtype Item var item: Item { get } } struct MyContainer<T>: Container { var item: T } extension Container { func transform<T>(_ f: (Self.Item) -> T) -> some Container { MyContainer(item: f(self.item)) } } let c1 = MyContainer(item: 1) let c2 = c1.transform { item in item + 1 } let item = c2.item print(item + 1)