GNOME Bugzilla – Bug 588825
Generic methods with generic return Types
Last modified: 2009-09-17 11:49:28 UTC
Please describe the problem: Vala doesn't handle generic return types correctly. If a method returns a generic value, the typereplacement is used. Steps to reproduce: 1. Compile following example: using GLib; public static G[] string_list_to_array<G>( List<G> theList ) { var ret = new G[theList.length()]; int counter = 0; foreach( G el in theList ) { ret[counter++] = el; } return ret; } public static void main( ) { List<string> l = new List<string>( ); l.prepend( "foo" ); l.prepend( "bar" ); string[] ls = string_list_to_array<string>( l ); } Actual results: vala throws an error: Assignment: Cannot convert from `G[]' to `string[]?' Expected results: Use correct return value and compiles successful. Does this happen every time? yes Other information:
I think this affiliated to http://bugzilla.gnome.org/show_bug.cgi?id=568972 but not really a dublicate
It only affects generic arrays, afaict.
Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find. *** This bug has been marked as a duplicate of bug 568972 ***