aboutsummaryrefslogtreecommitdiff
path: root/testsuite/compilable/generic_arguments.elna
blob: 6bc524272529acb5fe068d7f7651b1f923531947 (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
type
  File = record
    fd: Int
  end

  Pair#[K, V] = record
    key: K;
    value: V
  end

var
  entry: Pair#[^File, ^Word8]

proc allocate#[T](size: Word) -> T extern

proc first#[K, V](entry_ptr: ^Pair#[K, V]) -> K
begin
return entry_ptr^.key

program()
begin
  entry.key := allocate#[^File](#size(File));
  assert(#size(Pair#[^File, ^Word8]) = #size(Pointer) * 2u);
  assert(#offset(Pair#[^File, ^Word8], value) = #size(Pointer));
  assert(first#[^File, ^Word8](@entry) = entry.key)
return 0u8

end.