gir/property-non-readable.test \
gir/symbol-type-csuffix.test \
gir/union.test \
+ gtktemplate/gtkchild-field-assignment.test \
+ gtktemplate/gtkchild-field-out-assignment.test \
+ gtktemplate/gtkchild-field-ref-assignment.test \
+ gtktemplate/gtkchild-property-assignment.test \
annotations/deprecated.vala \
annotations/description.vala \
annotations/noaccessormethod.test \
endif
EXTRA_DIST = \
+ gtktemplate/tests-extra-environment.sh \
linux/tests-extra-environment.sh \
nullability/tests-extra-environment.sh \
posix/tests-extra-environment.sh \
--- /dev/null
+Invalid Code
+
+[GtkTemplate (ui = "/org/example/gtktemplate.ui")]
+public class GtkTemplate : Gtk.ApplicationWindow {
+ [GtkChild]
+ public unowned Gtk.Button button0;
+
+ void foo () {
+ button0 = new Gtk.Button ();
+ }
+}
+
+void main () {
+}
--- /dev/null
+Invalid Code
+
+[GtkTemplate (ui = "/org/example/gtktemplate.ui")]
+public class GtkTemplate : Gtk.ApplicationWindow {
+ [GtkChild]
+ public unowned Gtk.Button button0;
+
+ void foo () {
+ bar (out button0);
+ }
+
+ void bar (out unowned Gtk.Button b) {
+ }
+}
+
+void main () {
+}
--- /dev/null
+Invalid Code
+
+[GtkTemplate (ui = "/org/example/gtktemplate.ui")]
+public class GtkTemplate : Gtk.ApplicationWindow {
+ [GtkChild]
+ public unowned Gtk.Button button0;
+
+ void foo () {
+ bar (ref button0);
+ }
+
+ void bar (ref unowned Gtk.Button b) {
+ }
+}
+
+void main () {
+}
--- /dev/null
+Invalid Code
+
+[GtkTemplate (ui = "/org/example/gtktemplate.ui")]
+public class GtkTemplate : Gtk.ApplicationWindow {
+ [GtkChild]
+ public unowned Gtk.Button button0 { get; set; }
+
+ void foo () {
+ button0 = new Gtk.Button ();
+ }
+}
+
+void main () {
+}
[GtkTemplate (ui = "/org/example/gtktemplate.ui")]
public class GtkTemplate : Gtk.ApplicationWindow {
[GtkChild]
- public Gtk.Button button0 { get; set; }
+ public Gtk.Button button0 { get; }
[GtkChild (internal = true)]
public Gtk.Button button1;
--- /dev/null
+PACKAGES="gtk+-3.0"
+VALAFLAGS="--gresources ${abs_srcdir}/gtktemplate/gtktemplate.gresource.xml"
return false;
}
+ if (ma.symbol_reference.get_attribute ("GtkChild") != null) {
+ error = true;
+ Report.error (source_reference, "Assignment of [GtkChild] `%s' is not allowed", ma.symbol_reference.get_full_name ());
+ return false;
+ }
+
if (ma.symbol_reference is DynamicProperty) {
// target_type not available for dynamic properties
} else {
get_accessor.check (context);
}
if (set_accessor != null) {
+ if (get_attribute ("GtkChild") != null) {
+ Report.warning (set_accessor.source_reference, "[GtkChild] property `%s' is not allowed to have `set' accessor", get_full_name ());
+ }
set_accessor.check (context);
}
Report.error (source_reference, "ref and out method arguments can only be used with fields, parameters, local variables, and array element access");
return false;
}
+ if (inner.symbol_reference.get_attribute ("GtkChild") != null) {
+ error = true;
+ Report.error (source_reference, "Assignment of [GtkChild] `%s' is not allowed", inner.symbol_reference.get_full_name ());
+ return false;
+ }
break;
default:
error = true;