Use java.util.List in type system

Renze Torensma renzetorensma at
Tue Apr 7 17:48:19 UTC 2015


I want to implement a List datatype, but since SimpleLanguage doesn’t implement that I am a bit puzzled about how I should do it.
I tried adding List.class to my type system (without the <?> because that results in an error) and creating specializations like

public <T> List<T> add(List<T> left, List<T> right)

This all compiles well, but the generated code in the src_gen folder generates an error:

The method add(long, long) in the type AdditionNode is not applicable for the arguments (List<capture#39-of ?>, List<capture#40-of ?>)

The add(long, long) is the first specialization of this node, my type system begins with long and List is the last type so far.
I’m not sure it is possible to use generic classes in the type system, and if I use a concrete class like ArrayList instead of the List interface it results in the same error so List being an interface and not a class isn’t the problem I think.

So how should I implement a list type? Am I on the right track or should I try a different approach?


More information about the graal-dev mailing list