codegen: Fix floating reference regression with Variants
[vala-gnome.git] / tests / objects / bug620675.vala
blob3a86fef9ba76b439653a6e444001cd8883c0b986
1 public class Foo {
3 public GLib.GenericArray<string> paramlist;
4 public bool used_test;
6 public Foo (string msg, ...) throws Error {
7 string arg = msg;
8 va_list args = va_list ();
9 paramlist = new GLib.GenericArray<string> ();
10 while (arg != null) {
11 paramlist.add (arg);
12 arg = args.arg ();
14 used_test = false;
17 public Foo.test (string msg) {
18 paramlist = new GLib.GenericArray<string> ();
19 paramlist.add (msg);
20 used_test = true;
25 public class Bar : Foo {
27 public Bar (string text) throws Error {
28 base (text, "bye");
31 public Bar.other (int num, ...) {
32 try {
33 base ("hey");
34 } catch (Error e) {
40 void main () {
41 Foo foo;
43 foo = new Foo ("one", "two", "three");
44 assert (!foo.used_test);
45 assert (foo.paramlist.length == 3);
46 assert (foo.paramlist[0] == "one");
47 assert (foo.paramlist[1] == "two");
48 assert (foo.paramlist[2] == "three");
50 foo = new Foo.test ("meh");
51 assert (foo.used_test);
52 assert (foo.paramlist.length == 1);
53 assert (foo.paramlist[0] == "meh");
55 foo = new Bar ("hello");
56 assert (!foo.used_test);
57 assert (foo.paramlist.length == 2);
58 assert (foo.paramlist[0] == "hello");
59 assert (foo.paramlist[1] == "bye");
61 foo = new Bar.other (1, 2, 3);
62 assert (!foo.used_test);
63 assert (foo.paramlist.length == 1);
64 assert (foo.paramlist[0] == "hey");