Fixes https://gitlab.gnome.org/GNOME/vala/issues/347
generics/property-int-cast.vala \
generics/string-literal-comparison.vala \
generics/type-parameter-properties.vala \
+ generics/value-pointer-type-access.vala \
generics/bug640330.test \
generics/bug640330.vala \
generics/bug694765-1.vala \
--- /dev/null
+class Foo<G> {
+ G g;
+ public void set_g (G data) {
+ g = data;
+ }
+ public G get_g () {
+ return g;
+ }
+}
+
+struct Bar {
+ public int i;
+}
+
+void main () {
+ Bar bar = { 42 };
+ var foo = new Foo<Bar*> ();
+ foo.set_g (&bar);
+
+ assert (foo.get_g ()->i == 42);
+ assert (((Bar*) foo.get_g ())->i == 42);
+}
if (inner.value_type is PointerType) {
unowned PointerType? pointer_type = inner.value_type as PointerType;
if (pointer_type != null && pointer_type.base_type is ValueType) {
+ if (inner.formal_value_type is GenericType) {
+ inner = new CastExpression (inner, pointer_type.copy (), source_reference);
+ }
// transform foo->bar to (*foo).bar
inner = new PointerIndirection (inner, source_reference);
inner.check (context);