See https://gitlab.gnome.org/GNOME/vala/issues/1043
objects/with-expression.vala \
objects/with-instance.vala \
objects/with-nested.vala \
+ objects/with-nested-method.vala \
errors/catch-error-code.vala \
errors/catch-in-finally.vala \
errors/default-gtype.vala \
--- /dev/null
+class Foo {
+ public int foo () {
+ return 23;
+ }
+}
+
+class Bar {
+ public int foo () {
+ return 42;
+ }
+}
+
+void main () {
+ var foo = new Foo ();
+ var bar = new Bar ();
+
+ with (foo) {
+ assert (foo () == 23);
+
+ with (bar) {
+ assert (foo () == 42);
+ }
+ }
+}
symbol_reference = variable_type.get_member (member_name);
if (symbol_reference != null) {
inner = new MemberAccess (null, w.with_variable.name, source_reference);
- inner.check (context);
+ if (w.with_variable.parent_symbol == w.body) {
+ inner.check (context);
+ } else {
+ var old_symbol = context.analyzer.current_symbol;
+ context.analyzer.current_symbol = w.parent_symbol;
+ inner.check (context);
+ context.analyzer.current_symbol = old_symbol;
+ }
may_access_instance_members = true;
}
}