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 523909 - Generics and array usage
Generics and array usage
Status: RESOLVED DUPLICATE of bug 568972
Product: vala
Classification: Core
Component: Semantic Analyzer
0.3.x
Other All
: High normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2008-03-22 22:01 UTC by Tomaz Vajngerl
Modified: 2010-02-08 07:29 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Tomaz Vajngerl 2008-03-22 22:01:06 UTC
Defining a array of type T as a input parameter to a method doesn't produce any errors at compiling, however when I try to use it to input array of strings it compilation fails with: "Argument 1: Cannot convert from `string[]?' to `GenericClass.T[]'".

Example to reproduce this behavior:
using GLib;

class GenericClass<T> : GLib.Object {
	public T first(T[] array) {
		return array[0];
	}
	
	public static int main(string[] args) {
		var gClass = new GenericClass<string>();
		var array = new string[] {"1", "2"};
		stdout.printf(gClass.first(array));
		
		return 0;
	}
}
Comment 1 Jürg Billeter 2008-03-23 10:27:52 UTC
Confirming.
Comment 2 Michael 'Mickey' Lauer 2009-10-07 14:11:29 UTC
This issue is still present in vala 0.7.7, although the error message now reads: "Argument 1: Cannot convert from `string[]' to `T[]'".
Comment 3 Jürg Billeter 2010-02-08 07:29:35 UTC
Thanks for taking the time to report this bug.
This particular bug has already been reported into our bug tracking system, but we are happy to tell you that the problem has already been fixed. It should be solved in the next software version. You may want to check for a software upgrade.

*** This bug has been marked as a duplicate of bug 568972 ***