aboutsummaryrefslogtreecommitdiff
path: root/testsuite/runnable/generic_record.elna
blob: 8a334cefaee4675c74443541ba6d4cadc991fcf2 (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
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.