Skip to content

Commit 97710b4

Browse files
committed
[sending] Add some more test coverage for public/internal methods of NominalTypes.
These already worked... I am just adding the code coverage before I fix a different issue in the next commit. This will make it clearer what I am actually fixing in the next commit when one reads the tests.
1 parent 521a70f commit 97710b4

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

test/Concurrency/sending_conditional_suppression.swift

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,69 @@ public struct TestInStruct {
9090
// CHECK-NEXT: public func testKlassArgAndResult(_ x: test.NonSendableKlass, _ y: test.NonSendableKlass, z: test.NonSendableKlass) -> test.NonSendableKlass
9191
// CHECK-NEXT: #endif
9292
public func testKlassArgAndResult(_ x: NonSendableKlass, _ y: sending NonSendableKlass, z: NonSendableKlass) -> sending NonSendableKlass { fatalError() }
93+
94+
// CHECK-LABEL: #if compiler(>=5.3) && $SendingArgsAndResults
95+
// CHECK-NEXT: public func testFunctionArg(_ x: () -> sending test.NonSendableKlass)
96+
// CHECK-NEXT: #else
97+
// CHECK-NEXT: public func testFunctionArg(_ x: () -> test.NonSendableKlass)
98+
// CHECK-NEXT: #endif
99+
public func testFunctionArg(_ x: () -> sending NonSendableKlass) { fatalError() }
100+
101+
// CHECK-LABEL: #if compiler(>=5.3) && $SendingArgsAndResults
102+
// CHECK-NEXT: public func testFunctionResult() -> (() -> sending test.NonSendableKlass)
103+
// CHECK-NEXT: #else
104+
// CHECK-NEXT: public func testFunctionResult() -> (() -> test.NonSendableKlass)
105+
// CHECK-NEXT: #endif
106+
public func testFunctionResult() -> (() -> sending NonSendableKlass) { fatalError() }
107+
108+
// CHECK-LABEL: #if compiler(>=5.3) && $SendingArgsAndResults
109+
// CHECK-NEXT: @usableFromInline
110+
// CHECK-NEXT: internal func testUsableFromInlineKlassArg(_ x: sending test.NonSendableKlass)
111+
// CHECK-NEXT: #else
112+
// CHECK-NEXT: @usableFromInline
113+
// CHECK-NEXT: internal func testUsableFromInlineKlassArg(_ x: test.NonSendableKlass)
114+
// CHECK-NEXT: #endif
115+
@usableFromInline func testUsableFromInlineKlassArg(_ x: sending NonSendableKlass) { fatalError() }
116+
117+
// CHECK-LABEL: #if compiler(>=5.3) && $SendingArgsAndResults
118+
// CHECK-NEXT: @usableFromInline
119+
// CHECK-NEXT: internal func testUsableFromInlineKlassResult() -> sending test.NonSendableKlass
120+
// CHECK-NEXT: #else
121+
// CHECK-NEXT: @usableFromInline
122+
// CHECK-NEXT: internal func testUsableFromInlineKlassResult() -> test.NonSendableKlass
123+
// CHECK-NEXT: #endif
124+
@usableFromInline
125+
func testUsableFromInlineKlassResult() -> sending NonSendableKlass { fatalError() }
126+
127+
// CHECK-LABEL: #if compiler(>=5.3) && $SendingArgsAndResults
128+
// CHECK-NEXT: @usableFromInline
129+
// CHECK-NEXT: internal func testUsableFromInlineKlassArgAndResult(_ x: test.NonSendableKlass, _ y: sending test.NonSendableKlass, z: test.NonSendableKlass) -> sending test.NonSendableKlass
130+
// CHECK-NEXT: #else
131+
// CHECK-NEXT: @usableFromInline
132+
// CHECK-NEXT: internal func testUsableFromInlineKlassArgAndResult(_ x: test.NonSendableKlass, _ y: test.NonSendableKlass, z: test.NonSendableKlass) -> test.NonSendableKlass
133+
// CHECK-NEXT: #endif
134+
@usableFromInline
135+
func testUsableFromInlineKlassArgAndResult(_ x: NonSendableKlass, _ y: sending NonSendableKlass, z: NonSendableKlass) -> sending NonSendableKlass { fatalError() }
136+
137+
// CHECK-LABEL: #if compiler(>=5.3) && $SendingArgsAndResults
138+
// CHECK-NEXT: @usableFromInline
139+
// CHECK-NEXT: internal func testUsableFromInlineFunctionArg(_ x: () -> sending test.NonSendableKlass)
140+
// CHECK-NEXT: #else
141+
// CHECK-NEXT: @usableFromInline
142+
// CHECK-NEXT: internal func testUsableFromInlineFunctionArg(_ x: () -> test.NonSendableKlass)
143+
// CHECK-NEXT: #endif
144+
@usableFromInline
145+
func testUsableFromInlineFunctionArg(_ x: () -> sending NonSendableKlass) { fatalError() }
146+
147+
// CHECK-LABEL: #if compiler(>=5.3) && $SendingArgsAndResults
148+
// CHECK-NEXT: @usableFromInline
149+
// CHECK-NEXT: internal func testUsableFromInlineFunctionResult() -> (() -> sending test.NonSendableKlass)
150+
// CHECK-NEXT: #else
151+
// CHECK-NEXT: @usableFromInline
152+
// CHECK-NEXT: internal func testUsableFromInlineFunctionResult() -> (() -> test.NonSendableKlass)
153+
// CHECK-NEXT: #endif
154+
@usableFromInline
155+
func testUsableFromInlineFunctionResult() -> (() -> sending NonSendableKlass) { fatalError() }
93156
}
94157

95158
// Make sure that we emit compiler(>= 5.3) when emitting the suppressing check

0 commit comments

Comments
 (0)