aboutsummaryrefslogtreecommitdiff
path: root/testsuite/compilable/generic_inference.elna
diff options
context:
space:
mode:
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.