After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 614424 - to_string requires explicit "this" in enum methods
to_string requires explicit "this" in enum methods
Product: vala
Classification: Core
Component: general
Other All
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
rejects-valid test-case
Depends on:
Reported: 2010-03-31 01:16 UTC by Jim Nelson
Modified: 2012-08-06 13:58 UTC
See Also:
GNOME target: ---
GNOME version: ---

Test case. (594 bytes, text/x-vala)
2010-03-31 01:16 UTC, Jim Nelson

Description Jim Nelson 2010-03-31 01:16:19 UTC
Created attachment 157552 [details]
Test case.

When an enum method accesses its own implicit to_string() method, it must provide the "this" ref in order to access it.  Calling other methods in its scope does not require "this".  The compiler says:

test.vala:13.16-13.24: error: The name `to_string' does not exist in the context of `'
        return to_string();

However, if an explicit to_string() method is coded in the enum, the problem does not surface.

Test case attached.
Comment 1 Michael 'Mickey' Lauer 2011-03-03 15:36:56 UTC
Confirming, looks like there's a bug in the method lookup for enums.
Comment 2 Jürg Billeter 2012-08-06 13:58:12 UTC
commit 63ae7e3c8705aa77f4394bce502c082ca1df3a2a
Author: Jürg Billeter <>
Date:   Mon Aug 6 15:15:10 2012 +0200

    Do not require explicit `this' to access generated to_string method
    Fixes bug 614424.