aboutsummaryrefslogtreecommitdiff
path: root/testsuite/runnable/generic_record.elna
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/runnable/generic_record.elna')
-rw-r--r--testsuite/runnable/generic_record.elna29
1 files changed, 29 insertions, 0 deletions
diff --git a/testsuite/runnable/generic_record.elna b/testsuite/runnable/generic_record.elna
new file mode 100644
index 0000000..8a334ce
--- /dev/null
+++ b/testsuite/runnable/generic_record.elna
@@ -0,0 +1,29 @@
+type
+ File = record
+ fd: Int
+ end
+
+ Stack#[T] = record
+ items: T;
+ top: Word
+ end
+
+var
+ s: Stack#[^File]
+ f: File
+
+proc push#[T](target: ^Stack#[T]; value: T)
+begin
+ target^.items := value;
+ target^.top := target^.top + 1u
+return
+
+program()
+begin
+ s.top := 0u;
+ push#[^File](@s, @f);
+ assert(s.top = 1u);
+ assert(s.items = @f)
+return 0u8
+
+end.