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 779219 - Wrong c-cast-type in getter-call for non-writeable abstract properties
Wrong c-cast-type in getter-call for non-writeable abstract properties
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Code Generator
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
: 710865 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2017-02-25 14:36 UTC by Daniel Espinosa
Modified: 2017-03-11 15:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Test Case (294 bytes, text/plain)
2017-02-27 15:14 UTC, Rico Tzschichholz
  Details
codegen: Implicitly cast instance arg to match used property get-accessor (2.18 KB, patch)
2017-02-28 09:56 UTC, Rico Tzschichholz
rejected Details | Review
memberaccess: Don't resolve base_method/property twice (3.29 KB, patch)
2017-03-05 14:48 UTC, Rico Tzschichholz
committed Details | Review

Description Daniel Espinosa 2017-02-25 14:36:56 UTC
Once you use Gee, is expected a set of warning at C compilation phase.

Use this code:

using Gee;

public class Empl : Object {
  public string name { get; set; }
}

public interface Col : GLib.Object, Gee.BidirList<Empl> {
  public abstract int length { get; }
}

public class MyHash : Gee.ArrayList<Empl>, Col {
  public int length { get { return size; } }
}

static void main () {
  var m = new MyHash ();
  var e = new Empl ();
  e.name = "Soe";
  m.add (e);
}

You will get:

gee-collections.vala.c: In function ‘my_hash_real_get_length’:
/home/despinosa/Proyectos/Tests/vala/gee-collections.vala.c:248:45: warning: passing argument 1 of ‘gee_abstract_collection_get_size’ from incompatible pointer type [-Wincompatible-pointer-types]
  _tmp0_ = gee_abstract_collection_get_size ((GeeCollection*) self);
                                             ^
In file included from gee-collections.vala.c:9:0:
jhbuild/install/include/gee-0.8/gee.h:1452:6: note: expected ‘GeeAbstractCollection * {aka struct _GeeAbstractCollection *}’ but argument is of type ‘GeeCollection * {aka struct _GeeCollection *}’
 gint gee_abstract_collection_get_size (GeeAbstractCollection* self);
Comment 1 Rico Tzschichholz 2017-02-27 15:14:50 UTC
Created attachment 346829 [details]
Test Case
Comment 2 Rico Tzschichholz 2017-02-28 09:56:07 UTC
Created attachment 346894 [details] [review]
codegen: Implicitly cast instance arg to match used property get-accessor
Comment 3 Rico Tzschichholz 2017-03-05 14:48:13 UTC
Created attachment 347267 [details] [review]
memberaccess: Don't resolve base_method/property twice
Comment 4 Rico Tzschichholz 2017-03-05 15:39:32 UTC
Attachment 347267 [details] pushed as 540154b - memberaccess: Don't resolve base_method/property twice
Comment 5 Rico Tzschichholz 2017-03-11 15:47:01 UTC
*** Bug 710865 has been marked as a duplicate of this bug. ***