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 585063 - [PATCH] Implicit Value cast for binary expressions?
[PATCH] Implicit Value cast for binary expressions?
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Semantic Analyzer
0.7.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2009-06-07 14:47 UTC by Marc-Andre Lureau
Modified: 2010-01-07 20:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
first patch (2.80 KB, patch)
2009-10-30 12:26 UTC, Marc-Andre Lureau
committed Details | Review
following patch (3.42 KB, patch)
2009-10-30 12:27 UTC, Marc-Andre Lureau
none Details | Review

Description Marc-Andre Lureau 2009-06-07 14:47:27 UTC
The following vala code produces invalid C, without error from Vala.

test.vala.c:29: error: invalid operands to binary == (have ‘GValue’ and ‘int’)

static void main () {
    Value? v = Value (typeof(int));
    v.set_int (1);
    if (v == 2) {
        debug ("yep");
    }
}

And also this one produce another invalid C code.
 
static Value? get_value (Value ?v) {
    return v;
}

static void main () {
    Value? v = Value (typeof(int));
    v.set_int (1);
    if (get_value (v) == 2) {                                                                                                                                                                       
        debug ("yep");
    }
}
Comment 1 Marc-Andre Lureau 2009-06-07 14:49:55 UTC
forget the second case, that's not a big issue, it's something with constness. 
Comment 2 Marc-Andre Lureau 2009-10-30 12:26:25 UTC
Created attachment 146568 [details] [review]
first patch
Comment 3 Marc-Andre Lureau 2009-10-30 12:27:43 UTC
Created attachment 146569 [details] [review]
following patch
Comment 4 Jürg Billeter 2010-01-07 20:21:32 UTC
commit 4b6fdd0041702c5f8e7ccb62127ac707ff2d0acb
Author: Marc-André Lureau <marcandre.lureau@gmail.com>
Date:   Thu Jan 7 21:08:41 2010 +0100

    GValue: Move explicit cast support to separate function
Comment 5 Jürg Billeter 2010-01-07 20:38:47 UTC
commit 58b40d21e3eb9d52199d6e74a64b34410afdec76
Author: Marc-André Lureau <marcandre.lureau@gmail.com>
Date:   Thu Jan 7 21:35:10 2010 +0100

    GValue: Support implicit cast in equality check
    
    Fixes bug 585063.