1discard """
2  output: '''42
3Foo'''
4"""
5
6type TFoo{.exportc.} = object
7 x:int
8
9var s{.exportc.}: seq[TFoo] = @[]
10
11s.add TFoo(x: 42)
12
13echo s[0].x
14
15
16# bug #563
17type
18  Foo =
19    object {.inheritable.}
20      x: int
21
22  Bar =
23    object of Foo
24      y: int
25
26var a = Bar(y: 100, x: 200) # works
27var b = Bar(x: 100, y: 200) # used to fail
28
29# bug 1275
30
31type
32  Graphic = object of RootObj
33    case kind: range[0..1]
34    of 0:
35      radius: float
36    of 1:
37      size: tuple[w, h: float]
38
39var d = Graphic(kind: 1, size: (12.9, 6.9))
40
41# bug #1274
42type
43  K = enum Koo, Kar
44  Graphic2 = object of RootObj
45    case kind: K
46    of Koo:
47      radius: float
48    of Kar:
49      size: tuple[w, h: float]
50
51type NamedGraphic = object of Graphic2
52  name: string
53
54var ngr = NamedGraphic(kind: Koo, radius: 6.9, name: "Foo")
55echo ngr.name
56
57GC_fullCollect()
58