diff options
| author | 2026-10-15 02:42:53 +0330 | |
|---|---|---|
| committer | 2026-10-15 02:42:53 +0330 | |
| commit | 1aa0215b6e3139c6f1ea49e9a9b1266f5850b51b (patch) | |
| tree | db648d1a197bc44e7c803e2631f05c475c96ffb1 /tests | |
| parent | o3: break and continue out of an o3 { } block call rt.o3_leave for each block... (diff) | |
o3: an o3 function called from normal code as a receiver method (run.method) enters and leaves the region and fattens its result, like a direct call; spec 4.10.3, o3_receiver_method_enter.zc
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/conformance/8-runtime/o3_receiver_method_enter.zc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/conformance/8-runtime/o3_receiver_method_enter.zc b/tests/conformance/8-runtime/o3_receiver_method_enter.zc new file mode 100644 index 0000000..3a8d92d --- /dev/null +++ b/tests/conformance/8-runtime/o3_receiver_method_enter.zc @@ -0,0 +1,13 @@ +// expect: 1003 1003 0/ +// spec 4.10.3: an o3 function called from normal code as a receiver method (run.method) enters the region like a direct call, so no collection runs inside it +include rt; +o3 int depth_of(int[?] v) { int i = 0, s = 0; while (i < len(v)) { s = s + v[i]; i++; } return rt.o3_depth * 1000 + s; } +run.method("depth_of", depth_of); +fn main() { + int[?] v = rt.new(int[?]); v.push(1); v.push(2); + rt.put_n(depth_of(v)); rt.put_c(32); + rt.put_n(v.depth_of()); rt.put_c(32); + rt.put_n(rt.o3_depth); rt.put_c(10); + return 0; +} +// zc0: skip |
