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 511286 - Implicit types for generics derivatives
Implicit types for generics derivatives
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Objects
0.3.x
Other All
: High normal
: ---
Assigned To: Jürg Billeter
Vala maintainers
: 538405 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2008-01-22 16:14 UTC by Alessandro Pellizzari
Modified: 2008-11-28 12:26 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Alessandro Pellizzari 2008-01-22 16:14:45 UTC
It would be useful to have implicit types when creating classes that implement some generics interfaces, as in the following example:

using GLib;
using Gee;

public class AssociativeArray: Object, Map<string,string>
{
        public string get(string key)
        { ... }
}

This could allow to write code like this:

arr = new AssociativeArray();
arr["foo"] = "bar";
stdout.printf("%s\n", arr["foo"]);

The code above generates error at compile-time, expecting explicit inherited types for the get function:

error: Return type and/or parameters of overriding method `AssociativeArray.get' do not match overridden method `Gee.Map.get'.
Comment 1 Jürg Billeter 2008-01-22 17:49:18 UTC
Confirming.
Comment 2 Jürg Billeter 2008-07-30 21:04:07 UTC
*** Bug 538405 has been marked as a duplicate of this bug. ***
Comment 3 Jürg Billeter 2008-11-28 12:26:03 UTC
2008-11-28  Jürg Billeter  <j@bitron.ch>

	* vala/valaclass.vala:
	* vala/valadatatype.vala:
	* vala/valagenerictype.vala:
	* vala/valainterface.vala:
	* vala/valamethod.vala:
	* vala/valaobjecttypesymbol.vala:
	* vala/valasymbolresolver.vala:

	Fix method checking with generic base types, fixes bug 511286

Fixed in r2068.