aboutsummaryrefslogtreecommitdiff
path: root/testsuite/compilable/generic_base_chain.elna
blob: 1abe19936fc1fb4d866937ad765a970dc6c1c598 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
program()
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

begin
  upcast := @store;
  put(@store, byte_key)
end.