After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 694712 - [PATCH] Vala doesn't produce fully-qualified ErrorType names
[PATCH] Vala doesn't produce fully-qualified ErrorType names
Status: RESOLVED OBSOLETE
Product: vala
Classification: Core
Component: Code Generator
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2013-02-25 23:09 UTC by Torrie Fischer
Modified: 2018-05-22 14:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
vala patch (333 bytes, patch)
2013-02-25 23:09 UTC, Torrie Fischer
none Details | Review

Description Torrie Fischer 2013-02-25 23:09:02 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;
    }
  }
}
Comment 1 Marc-Andre Lureau 2013-02-25 23:54:24 UTC
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.
Comment 2 Luca Bruno 2013-02-26 20:34:44 UTC
(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:: .
Comment 3 GNOME Infrastructure Team 2018-05-22 14:42:13 UTC
-- 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.