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 773956 - Add check that a property has a get and/or set
Add check that a property has a get and/or set
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Semantic Analyzer
unspecified
Other All
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2016-11-04 21:42 UTC by Al Thomas
Modified: 2016-11-08 08:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
codegen: Require public get or set for properties (1.75 KB, patch)
2016-11-07 21:31 UTC, Rico Tzschichholz
none Details | Review
Add a check for an accessor or mutator to valaproperty.vala (2.07 KB, patch)
2016-11-08 00:41 UTC, Al Thomas
committed Details | Review

Description Al Thomas 2016-11-04 21:42:59 UTC
The following code compiles:

class Foo : Object {
    public string my_property { default = "none"; }
}

void main () {
    new Foo ();
}

but produces the runtime critical error:
GLib-GObject-CRITICAL **: g_object_class_install_property: assertion 'pspec->flags & (G_PARAM_READABLE | G_PARAM_WRITABLE)' failed

The same for:

class Foo : Object {
    public string my_property {}
}

void main () {
    new Foo ();
}
Comment 1 Rico Tzschichholz 2016-11-07 21:31:58 UTC
Created attachment 339278 [details] [review]
codegen: Require public get or set for properties
Comment 2 Al Thomas 2016-11-08 00:41:08 UTC
Created attachment 339295 [details] [review]
Add a check for an accessor or mutator to valaproperty.vala

This adds the check to the semantic analyzer instead of the code generator.