Skip to content

Commit 785543a

Browse files
committed
[Tests] Avoid a compiler/runtime bug that breaks the build on Linux.
Apparently we can write a type with @convention(block) on Linux, which is entertaining because when we touch the metadata for such a thing in the runtime, we fail with an assert(), assuming assertions are enabled.
1 parent 1a95ea6 commit 785543a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/TypeRoundTrip/Inputs/testcases/structural_types.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ public func test() {
2222
roundTripType((x: Int, Float, y: Int.Type).self)
2323
roundTripType(((@escaping () -> ()) -> ()).self)
2424
roundTripType(Array<@convention(c) () -> ()>.self)
25+
26+
// @convention(block) requires Objective-C support
27+
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
2528
roundTripType(Array<(@escaping @convention(block) () -> (), @convention(block) () -> ()) -> ()>.self)
29+
#endif
2630

2731
roundTripType(Int.Type.self)
2832
roundTripType(((inout String) -> ()).Type.self)
@@ -39,7 +43,11 @@ public func test() {
3943
roundTripType((x: Int, Float, y: Int.Type).Type.self)
4044
roundTripType(((@escaping () -> ()) -> ()).Type.self)
4145
roundTripType(Array<@convention(c) () -> ()>.Type.self)
46+
47+
// @convention(block) requires Objective-C support
48+
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
4249
roundTripType(Array<(@escaping @convention(block) () -> (), @convention(block) () -> ()) -> ()>.Type.self)
50+
#endif
4351

4452
// rdar://81587763: [SR-15025]: Function type syntax doesn't accept variadics
4553
// or __owned

0 commit comments

Comments
 (0)