aboutsummaryrefslogtreecommitdiff
path: root/testsuite/compilable/generic_base_chain.elna
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/compilable/generic_base_chain.elna')
-rw-r--r--testsuite/compilable/generic_base_chain.elna31
1 files changed, 31 insertions, 0 deletions
diff --git a/testsuite/compilable/generic_base_chain.elna b/testsuite/compilable/generic_base_chain.elna
new file mode 100644
index 0000000..736042b
--- /dev/null
+++ b/testsuite/compilable/generic_base_chain.elna
@@ -0,0 +1,31 @@
+type
+ File = record
+ fd: Int
+ end
+
+ Map#[K, V] = record
+ key: K;
+ value: V
+ end
+
+ Cache#[K, V] = record(Map#[^Word8, V])
+ newest: K
+ end
+
+var
+ store: Cache#[^Int, ^File]
+ byte_key: ^Word8
+ upcast: ^Map#[^Word8, ^File]
+
+proc put#[K2, V2](target: ^Map#[K2, V2]; key: K2)
+begin
+ target^.key := key
+return
+
+program()
+begin
+ upcast := @store;
+ put(@store, byte_key)
+return 0u8
+
+end.