From d36190a5f3b8fa33fe3381771cd1efb9a1335e50 Mon Sep 17 00:00:00 2001 From: zinc Date: Thu, 15 Oct 2026 15:19:17 +0330 Subject: prescan: guess an owned return only from a local declared from new/heap, not a global assigned one (fixes lsp self-check); xref baseline for the new writers --- .../conformance/6-ownership/infer_owned_return_global_not_owned.zc | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 tests/conformance/6-ownership/infer_owned_return_global_not_owned.zc (limited to 'tests/conformance') diff --git a/tests/conformance/6-ownership/infer_owned_return_global_not_owned.zc b/tests/conformance/6-ownership/infer_owned_return_global_not_owned.zc new file mode 100644 index 0000000..5d7f793 --- /dev/null +++ b/tests/conformance/6-ownership/infer_owned_return_global_not_owned.zc @@ -0,0 +1,7 @@ +// expect: 3/ +// spec 6.8 +include rt; +int* cache; +int* refill() { cache = rt.new(int); *cache = 3; return cache; } +fn main() { refill(); rt.put_n(*cache); rt.put_c(10); } +// zc0: skip -- cgit v1.2.3