Skip to content

Commit 82a897e

Browse files
committed
[NFC] Test unsupported typed throws use case
Fixing this would be necessary to adopt `@abi` for `Swift.Result.init(__untyped_throws_catching:)`.
1 parent e0c675b commit 82a897e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/attr/attr_abi.swift

+14
Original file line numberDiff line numberDiff line change
@@ -974,6 +974,20 @@ func testNormalProtocolsGeneric<A: CustomStringConvertible, B>( // expected-note
974974
_: A, _: B
975975
) {}
976976

977+
enum ErsatzResult<Success, Failure: Error> {}
978+
extension ErsatzResult where Failure == Swift.Error {
979+
// Similar to Swift.Result.init(__untyped_throws_catching:)
980+
// FIXME: The where clause makes this ABI-compatible, but we can't tell that.
981+
@abi(
982+
init(
983+
catching body: () throws -> Success // expected-error {{type '() throws -> Success' in '@abi' should match '() throws(Failure) -> Success'}}
984+
)
985+
)
986+
init(
987+
__untyped_throws_catching body: () throws(Failure) -> Success // expected-note {{should match type here}}
988+
) {}
989+
}
990+
977991
//
978992
// Static/Instance and interactions with `final`
979993
//

0 commit comments

Comments
 (0)