From 1aa0215b6e3139c6f1ea49e9a9b1266f5850b51b Mon Sep 17 00:00:00 2001 From: zinc Date: Thu, 15 Oct 2026 02:42:53 +0330 Subject: 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 --- tests/conformance/8-runtime/o3_receiver_method_enter.zc | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 tests/conformance/8-runtime/o3_receiver_method_enter.zc (limited to 'tests') 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 -- cgit v1.2.3