aboutsummaryrefslogtreecommitdiff
path: root/testsuite/runnable/generic_erasure.elna
blob: db4d8c91b9b451d048f4d35a620b927d9e83e532 (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

  Cell#[T] = record
    held: ^T
  end

var
  files: Cell#[File]
  bytes: Cell#[Word8]
  f: File
  b: Word8

proc store#[T](target: ^Cell#[T]; value: ^T)
begin
  target^.held := value
return

begin
  f.fd := 7;
  b := 3u8;
  store#[File](@files, @f);
  store#[Word8](@bytes, @b);
  assert(files.held^.fd = 7);
  assert(bytes.held^ = 3u8)
end.