aboutsummaryrefslogtreecommitdiff
path: root/testsuite/compilable/generic_inference.elna
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2026-09-08 20:43:39 +0200
committerEugen Wissner <belka@caraus.de>2026-09-08 20:43:39 +0200
commit47c8f99b6ef812dbc22ca56a39ba21bccad47796 (patch)
tree7c057a6d408f9b30801767ed528f7f4c207bfbce /testsuite/compilable/generic_inference.elna
parent8f9ba0c67479d8926edead8aa828458c5b3bc1be (diff)
downloadelna-47c8f99b6ef812dbc22ca56a39ba21bccad47796.tar.gz
Implement generic pointers
Diffstat (limited to 'testsuite/compilable/generic_inference.elna')
-rw-r--r--testsuite/compilable/generic_inference.elna33
1 files changed, 33 insertions, 0 deletions
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.