Skip to content

Commit 73e7df9

Browse files
committed
Test for swift_coroFrameAlloc
1 parent ff50f8f commit 73e7df9

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

test/embedded/accessors.swift

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-frontend %s -Onone -parse-as-library -enable-experimental-feature Embedded -c -o %t/main.o
3+
// RUN: %target-clang %target-clang-resource-dir-opt %t/main.o -o %t/a.out -dead_strip
4+
// RUN: %target-run %t/a.out | %FileCheck %s
5+
6+
// REQUIRES: swift_in_compiler
7+
// REQUIRES: executable_test
8+
// REQUIRES: optimized_stdlib
9+
// REQUIRES: swift_feature_Embedded
10+
11+
public class C {
12+
public var x: Int {
13+
_read {
14+
yield(y)
15+
}
16+
_modify {
17+
yield(&y)
18+
}
19+
}
20+
21+
var y: Int = 27
22+
}
23+
24+
@main
25+
struct Main {
26+
static func main() {
27+
print("1") // CHECK: 1
28+
let c = C() // CHECK: 27
29+
print(c.y)
30+
c.y = 28
31+
print(c.y) // CHECK: 28
32+
print("")
33+
34+
print("2") // CHECK: 2
35+
print("")
36+
}
37+
}

0 commit comments

Comments
 (0)