From 47c8f99b6ef812dbc22ca56a39ba21bccad47796 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Tue, 8 Sep 2026 20:43:39 +0200 Subject: Implement generic pointers --- testsuite/compilable/generic_inference.elna | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 testsuite/compilable/generic_inference.elna (limited to 'testsuite/compilable/generic_inference.elna') diff --git a/testsuite/compilable/generic_inference.elna b/testsuite/compilable/generic_inference.elna new file mode 100644 index 0000000..25faca4 --- /dev/null +++ b/testsuite/compilable/generic_inference.elna @@ -0,0 +1,33 @@ +type + File = record + fd: Int + end + + Cell#[T] = record + held: T + end + +var + files: Cell#[^File] + bytes: Cell#[^Word8] + f: File + b: Word8 + +proc store#[T](target: ^Cell#[T]; value: T) +begin + target^.held := value +return + +proc relay#[T](target: ^Cell#[T]; value: T) +begin + store(target, value) +return + +program() +begin + store(@files, @f); + relay(@bytes, @b); + store(@files, nil) +return 0u8 + +end. -- cgit v1.2.3