Re: [Vala] valasemanticanalyzer error



On Tue, 2010-08-17 at 18:09 +0530, Martin DeMello wrote:
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));
              }
      }
}

This is invalid code. Inner types don't have access to generic type
parameters of outer types. So you probably want something as follows:

public interface Enumerable<G, T> : Iterable {

        public delegate T DFunc<G, T>(G elem);
        [...]
}

It's still a bug in valac, though, as valac should report an error
instead of exiting due to an assertion failure.

Jürg




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]