GNOME Bugzilla – Bug 694712
[PATCH] Vala doesn't produce fully-qualified ErrorType names
Last modified: 2018-05-22 14:42:13 UTC
Created attachment 237398 [details] [review] vala patch If a method throws an error type from within a namespace of the same name, vala fails when trying to locate the symbol. The generated .vapi looks like this: namespace Foo { namespace Tracker { public class Query { public override async void execute (Tracker.Sparql.Connection resources) throws GLib.IOError, Tracker.Sparql.Error, GLib.DBusError; } } } This patch prepends global:: to the error types when the .vapi is generated: namespace Foo { namespace Tracker { public class Query { public override async void execute (global::Tracker.Sparql.Connection resources) throws global::GLib.IOError, global::Tracker.Sparql.Error, global::GLib.DBusError; } } }
I would rather use by default the namespace of the vapi declaration, instead of depending on caller context. No need for global:: everywhere in this case.
(In reply to comment #1) > I would rather use by default the namespace of the vapi declaration, instead of > depending on caller context. No need for global:: everywhere in this case. What do you mean? A self-contained test case: namespace Foo { class Bar { } } namespace Baz { namespace Foo { void meth (Foo.Bar bar); } } The problem arises from the symbol resolution used by Vala. It doesn't go to the top level for finding an alternative Foo, but rather stops at the first Foo in the current context. A solution to avoid global:: all over the vapis which is unreadable, is to simulate the symbol resolution when writing the vapi: if it resolves a different symbol than what it should be then add the global:: .
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/vala/issues/357.