Skip to content

Commit 155e20c

Browse files
authored
[Test] Add Interpreter and IRGen tests for SR-13203 (#33340)
1 parent 2bff31e commit 155e20c

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-frontend %s -disable-availability-checking -emit-ir | %FileCheck %s
3+
4+
// REQUIRES: objc_interop
5+
6+
protocol MyProtocol {}
7+
8+
func returnsClass1() -> some MyProtocol {
9+
class MyClass1: MyProtocol {}
10+
return MyClass1()
11+
}
12+
13+
var returnsClass2: some MyProtocol {
14+
class MyClass2: MyProtocol {}
15+
return MyClass2()
16+
}
17+
18+
// CHECK: @_DATA__TtCF41objc_runtime_name_local_class_opaque_type13returnsClass1FT_QuL_8MyClass1 = internal constant
19+
// CHECK: @_DATA__TtCF41objc_runtime_name_local_class_opaque_typeg13returnsClass2QuL_8MyClass2 = internal constant
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-build-swift -Xfrontend -disable-availability-checking %s -o %t/a.out
3+
// RUN: %target-run %t/a.out | %FileCheck %s
4+
5+
// REQUIRES: executable_test
6+
// REQUIRES: objc_interop
7+
8+
protocol MyProtocol {}
9+
10+
func returnsClass1() -> some MyProtocol {
11+
class MyClass1: MyProtocol {}
12+
return MyClass1()
13+
}
14+
15+
var returnsClass2: some MyProtocol {
16+
class MyClass2: MyProtocol {}
17+
return MyClass2()
18+
}
19+
20+
print(returnsClass1())
21+
// CHECK: a.(unknown context at ${{[0-9a-z]+}}).(unknown context at ${{[0-9a-z]+}}).MyClass1
22+
23+
print(returnsClass2)
24+
// CHECK: a.(unknown context at ${{[0-9a-z]+}}).(unknown context at ${{[0-9a-z]+}}).MyClass2

0 commit comments

Comments
 (0)