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: [email protected]
Date: Sun, 16 Dec 2012 21:47:32 +0800
To: [email protected]
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, <[email protected]> wrote:
 
> Send vala-list mailing list submissions to
>         [email protected]
>
> 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
>         [email protected]
>
> You can reach the person managing the list at
>         [email protected]
>
> 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 <[email protected]>
> To: Vala Mail List <[email protected]>
> Subject: [Vala] Defining new virtual signal is possible,        but
> overring
>         it isn't.
> Message-ID: <[email protected]>
> 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
> [email protected]
> https://mail.gnome.org/mailman/listinfo/vala-list
>
>
> End of vala-list Digest, Vol 61, Issue 7
> ****************************************
>

_______________________________________________
vala-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/vala-list                               
          
_______________________________________________
vala-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to