Skip to content

codegen: fix property access in compact class

Avoid using "priv" when accessing a private or internal field backing a property of a compact class.

Fixes bugs like:

[Compact (opaque = true)]
class Foo {
    public int bar { get; set; }

    public void print () {
        GLib.print ("bar = %d", bar);
    }
}

void main () {
    var x = new Foo ();
    x.print ();
}
% valac compact-property.vala
/home/pferro/compact-property.vala.c: In function ‘foo_print’:
/home/pferro/compact-property.vala.c:28:22: error: ‘Foo’ {aka ‘struct _Foo’} has no member named ‘priv’
   28 |         _tmp0_ = self->priv->_bar;
      |                      ^~
error: cc exited with status 256
Compilation failed: 1 error(s), 0 warning(s)
Edited by Princeton Ferro

Merge request reports