// RUN: %target-typecheck-verify-swift -disable-availability-checking func f1(_ s: any Sequence & Hashable) -> any Sequence { return s } func f2(_ s: any Sequence & Hashable) -> any Hashable { return s } func f3(_ s: any Sequence & Hashable) -> any Sequence { return s } func f4(_ s: any Sequence & Hashable) -> any Sequence & Hashable { return s } func f5(_ s: any Sequence & Hashable) -> any Sequence & Equatable { return s } func f6(_ s: any Sequence & Hashable) -> any Sequence & Hashable { return s // expected-error {{cannot convert return expression of type 'Int' to return type 'String'}} } func f7(_ s: any Sequence & Hashable) -> any Sequence { return s // expected-error {{cannot convert return expression of type 'Int' to return type 'String'}} } func f8(_ s: any Collection & Hashable) -> any Sequence & Hashable { return s } // https://github.com/swiftlang/swift/issues/71012 protocol A { associatedtype T } protocol B {} typealias C = A & B typealias D = A & B struct Foo: C { typealias T = Int } struct Bar { // expected-note {{arguments to generic parameter 'Value' ('any C' (aka 'any A & B') and 'any A & B') are expected to be equal}} let value: Value } struct Baz { let bar: Bar> } func run() { let foo: any C = Foo() let bar = Bar(value: foo) _ = Baz(bar: bar) // expected-error@-1 {{cannot convert value of type 'Bar' (aka 'Bar') to expected argument type 'Bar & B>'}} }