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 620120 - 'this' modification shouldn't be allowed
'this' modification shouldn't be allowed
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2010-05-30 20:47 UTC by pancake
Modified: 2010-06-20 19:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
do not support assigning to this (1.02 KB, patch)
2010-06-02 09:12 UTC, Luca Bruno
none Details | Review

Description pancake 2010-05-30 20:47:25 UTC
Here's an example (in a modifed glib-2.0.vapi) adding a toggle() method that modifies a local variable. This takes no sense, so the compiler shouldnt permit this. 

In non-simpletypes 'this' is a pointer and shouldnt be modified.

This bug has been discussed in mailing list with the thread subjected as:

   "[Vala] modify simpletype with methods in vapi"

[SimpleType]
[CCode (cname = "gboolean", cheader_filename = "glib.h", type_id = "G_TYPE_BOOLEAN", marshaller_type_name = "BOOLEAN", get     _value_function = "g_value_get_boolean", set_value_function = "g_value_set_boolean", default_value = "FALSE", type_signatu     re = "b")]
[BooleanType]
 public struct bool {
   public bool toggle() {
     this = !this;
     return this;
   }
}
Comment 1 Luca Bruno 2010-06-02 09:12:09 UTC
Created attachment 162520 [details] [review]
do not support assigning to this
Comment 2 Jürg Billeter 2010-06-20 19:02:14 UTC
commit 53489642779c5647eb9980dc78385e37fbb750a2
Author: Luca Bruno <lethalman88@gmail.com>
Date:   Wed Jun 2 11:11:03 2010 +0200

    Do not support assigning to `this'
    
    Fixes bug 620120.