package com.redhat.ceylon.compiler.model;

import java.util.ArrayList;
import java.util.List;

public class Type extends Model {
	
	List<Type> typeArguments = new ArrayList<Type>();
	GenericType genericType;
	
	public GenericType getGenericType() {
		return genericType;
	}
	
	public void setGenericType(GenericType type) {
		this.genericType = type;
	}
	
	public List<Type> getTypeArguments() {
		return typeArguments;
	}
	
	@Override
	public String toString() {
		return "Type[" + getProducedTypeName() + "]";
	}

	public String getProducedTypeName() {
		String producedTypeName = genericType.getName();
		if (!typeArguments.isEmpty()) {
			producedTypeName+="<";
			for (Type t: typeArguments) {
				producedTypeName+=t.getProducedTypeName();
			}
			producedTypeName+=">";
		}
		return producedTypeName;
	}
	
}

@@ -36,16 +36,62 @@
 model;%0A%0A
+import com.redhat.ceylon.compiler.tree.Tree;%0A%0A
 import j
@@ -594,16 +594,113 @@
 ame() %7B%0A
+        if (genericType == null) %7B%0A            //unknown type%0A            return null;%0A        %7D%0A
 %09%09String

Make sure tree is properly displayed on missing types