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 666035 - [patch] [feature request] infer enum scope from expected type
[patch] [feature request] infer enum scope from expected type
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Semantic Analyzer
0.15.x
Other All
: Normal enhancement
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2011-12-12 22:45 UTC by Timo Kluck
Modified: 2017-11-19 19:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
allow unscoped enum values (2.12 KB, patch)
2011-12-12 22:45 UTC, Timo Kluck
none Details | Review
test cases (1.09 KB, text/x-vala)
2011-12-12 22:50 UTC, Timo Kluck
  Details
vala: Allow unscoped enum values where possible (3.68 KB, patch)
2017-10-16 19:10 UTC, Rico Tzschichholz
none Details | Review
vala: Allow unscoped enum values where possible (5.13 KB, patch)
2017-11-19 19:24 UTC, Rico Tzschichholz
committed Details | Review

Description Timo Kluck 2011-12-12 22:45:57 UTC
Created attachment 203303 [details] [review]
allow unscoped enum values

In some cases, the scope for an enumeration value can be determined from the
scope. In that case, it can save a lot of typing to be able to write

    A.bind_property("prop", B, "prop", SYNC_CREATE|BIDIRECTIONAL);

and not having to specify the scope GLib.BindingFlags:

    A.bind_property("prop", B, "prop", GLib.BindingFlags.SYNC_CREATE|GLib.BindingFlags.BIDIRECTIONAL);

This patch takes care of that.
Comment 1 Timo Kluck 2011-12-12 22:50:18 UTC
Created attachment 203304 [details]
test cases

Here's a couple of testcases I used to verify that the patch works. There's probably too few regression tests (only one), but I cannot think of many.
Comment 2 Rico Tzschichholz 2017-10-16 19:10:30 UTC
Created attachment 361692 [details] [review]
vala: Allow unscoped enum values where possible

If the scope for an enumeration value can be determined from current context
it is possible to omit the enum's scope, like for GLib.BindingFlags:

 Foo.bind_property("prop", Bar, "prop", SYNC_CREATE | BIDIRECTIONAL);
Comment 3 Rico Tzschichholz 2017-11-19 19:24:15 UTC
Created attachment 364010 [details] [review]
vala: Allow unscoped enum values where possible

If the scope for an enumeration value can be determined from current context
it is possible to omit the enum's scope.

Based on patch by Timo Kluck
Comment 4 Rico Tzschichholz 2017-11-19 19:41:42 UTC
Attachment 364010 [details] pushed as 33c91a0 - vala: Allow unscoped enum values where possible