// RUN: not %target-swift-frontend %s -typecheck // https://github.com/apple/swift/issues/47152 struct V : BidirectionalCollection {} struct S { func bar(_ to: T.Type) -> V { return V() } } extension S { func foo(_ body: (UnsafeBufferPointer) -> R) -> R { return Array(self.bar(UTF16.self)).withUnsafeBufferPointer(body) } }