Skip to content

Commit 3d6006c

Browse files
Merge pull request swiftlang#35696 from nate-chandler/rdar72906989
[Test] Tested async cc's handling of constrained generic extensions.
2 parents e82544c + f361901 commit 3d6006c

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-build-swift -Xfrontend -enable-experimental-concurrency %s -emit-ir -parse-as-library -module-name main | %FileCheck %s --check-prefix=CHECK-LL
3+
// RUN: %target-build-swift -Xfrontend -enable-experimental-concurrency %s -parse-as-library -module-name main -o %t/main %target-rpath(%t)
4+
// RUN: %target-codesign %t/main
5+
// RUN: %target-run %t/main | %FileCheck %s
6+
7+
// REQUIRES: executable_test
8+
// REQUIRES: swift_test_mode_optimize_none
9+
// REQUIRES: concurrency
10+
// UNSUPPORTED: use_os_stdlib
11+
12+
import _Concurrency
13+
14+
protocol Fooable {}
15+
extension String: Fooable {}
16+
17+
extension Optional where Wrapped: Fooable {
18+
// CHECK-LL: @"$sSq4mainAA7FooableRzlE22theConstrainedFunctionyyYFTu" = hidden global %swift.async_func_pointer
19+
// CHECK-LL: define hidden swiftcc void @"$sSq4mainAA7FooableRzlE22theConstrainedFunctionyyYF"(%swift.task* {{%[0-9]+}}, %swift.executor* {{%[0-9]+}}, %swift.context* swiftasync {{%[0-9]+}}) {{#[0-9]*}} {
20+
func theConstrainedFunction() async {
21+
// CHECK: running Optional<String>.theConstrainedFunction
22+
print("running \(Self.self).theConstrainedFunction")
23+
}
24+
}
25+
26+
@main struct Main {
27+
static func main() async {
28+
let a: String? = nil
29+
await a.theConstrainedFunction()
30+
}
31+
}

0 commit comments

Comments
 (0)