Re: [Vala] Defining new virtual signal is possible, but overring it isn't.




Thanks you for your replies!
But the bug is still there.

I have given a wrong example for this bug(since it works).

The good example for this bug, is:

public class Foo : GLib.Object {
    public virtual void func() {
    }
    
    internal static void bug () {
        new Bar ();
    }
}
public class Bar : Foo {
    public override void func() {
    }
}

Valac(0.16.1) gives:

$ valac main.vala
main.vala:11.2-11.26: error: Bar.func: no suitable method found to override
    public override void func() {
    ^^^^^^^^^^^^^^^^^^^^^^^^^
Compilation failed: 1 error(s), 0 warning(s)

When there's some method inside classes(e.g. "bug"), no matter if it's static or not,
that calls Bar contractor, valac gives this error.

However, if "bug" method is outside of Foo class blocks, valac compiles fine.

I have report this bug in GNOME Bugzilla:
https://bugzilla.gnome.org/show_bug.cgi?id=690335

Hope you'll fix this bug in next releases.

Yours
Tal

From: daiderek gmail com
Date: Sun, 16 Dec 2012 21:47:32 +0800
To: vala-list gnome org
Subject: Re: [Vala] Defining new virtual signal is possible,    but overring it isn't.

You can try code below as solution/workaround.
 
class Foo : GLib.Object
{
public virtual signal void func()
 {
message("Foo");
}
}
 
class Bar : Foo
{
public override void func()
{
 message("Bar");
}
}
 
int main()
{
Foo foo = new Bar();
foo.func.connect(() => { message("Main"); });
 foo.func();
 return 0;
}
 
Derek Dai
 
 
 
On Sun, Dec 16, 2012 at 8:00 PM, <vala-list-request gnome org> wrote:
 
Send vala-list mailing list submissions to
        vala-list gnome org

To subscribe or unsubscribe via the World Wide Web, visit
        https://mail.gnome.org/mailman/listinfo/vala-list
or, via email, send a message with subject or body 'help' to
        vala-list-request gnome org

You can reach the person managing the list at
        vala-list-owner gnome org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of vala-list digest..."


Today's Topics:

   1. Defining new virtual signal is possible,  but overring it
      isn't. (Tal Hadad)


----------------------------------------------------------------------

Message: 1
Date: Sat, 15 Dec 2012 21:00:24 +0200
From: Tal Hadad <tal_hd hotmail com>
To: Vala Mail List <vala-list gnome org>
Subject: [Vala] Defining new virtual signal is possible,        but
overring
        it isn't.
Message-ID: <DUB118-W23290D650216AC80E0291BE54C0 phx gbl>
Content-Type: text/plain; charset="windows-1255"


When I try to:
public class A : GLib.Object {
  public virtual signal void func () {}
}


public class B : A {

  public override void func () {}

}

I get an error from Valac:
error: B.func: no suitable method found to override

I'm using Vala 0.16.1

I think that this is a critical bug in Vala, or my code is wrong?

Thanks,
Tal


------------------------------

_______________________________________________
vala-list mailing list
vala-list gnome org
https://mail.gnome.org/mailman/listinfo/vala-list


End of vala-list Digest, Vol 61, Issue 7
****************************************


_______________________________________________
vala-list mailing list
vala-list gnome org
https://mail.gnome.org/mailman/listinfo/vala-list                                         


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]