Re: [Vala] valasemanticanalyzer error
- From: Martin DeMello <martindemello gmail com>
- To: vala-list gnome org
- Subject: Re: [Vala] valasemanticanalyzer error
- Date: Thu, 19 Aug 2010 16:23:11 +0530
Note also that this dies in a different place in 0.92 (last tagged
release before the "generic delegates support" feature):
$ valac --pkg gee-1.0 test.vala
test.vala:23.37-23.37: error: Argument 1: Cannot convert from `G' to `int'
a.map( (i) => { return "%d".printf(i); }, b);
^
Compilation failed: 1 error(s), 0 warning(s)
martin
On Tue, Aug 17, 2010 at 6:09 PM, Martin DeMello <martindemello gmail com> wrote:
What do I need to do to get the following code to compile? It dies with
$ valac --pkg gee-1.0 test.vala
**
ERROR:valasemanticanalyzer.c:2948:vala_semantic_analyzer_get_actual_type:
assertion failed: (instance_type != NULL)
Aborted
# -------------------------------------------------------
using Gee;
public interface Enumerable<G, T> : Iterable {
public delegate T DFunc(G elem);
public void map(DFunc fn, Gee.List<T> acc) {
foreach (G i in this) {
acc.add(fn(i));
}
}
}
public class EnumerableList<G, T> : Gee.ArrayList<G>, Enumerable<G, T> {
}
public static int main(string[] args) {
var a = new EnumerableList<int, string> ();
a.add(1);
a.add(2);
a.add(3);
var b = new Gee.ArrayList<string> ();
a.map( (i) => { return "%d".printf(i); }, b);
foreach (string i in b) {
println(i);
}
return 0;
}
#----------------------------------------------------
martin
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]