aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/conformance/8-runtime/o3_receiver_method_enter.zc13
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