summaryrefslogtreecommitdiff
path: root/test/genericrec.myr
blob: f7305d4a2140f2772485915d1c11ca03ee0cf737 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std
/* test that generic types can be recursive, as long as they're not self
 * including. This just needs to compile and exit with 0. */
type list(@t) = struct
	val	: @t
	next	: list(@t)#
;;

const main = {
	var v : list(int)

	v.val = 123
	v.next = std.alloc()
	v.next.val = 234
	var n = std.alloc()
	v.next.next = n
	n.val = 345
}