|
@@ -110,7 +110,12 @@ class Printer {
|
|
|
// TODO: check if this can cause loops
|
|
|
public function printComplexType(ct:ComplexType) return switch(ct) {
|
|
|
case TPath(tp): printTypePath(tp);
|
|
|
- case TFunction(args, ret): (args.length>0 ? args.map(printComplexType).join(" -> ") : "Void") + " -> " + printComplexType(ret);
|
|
|
+ case TFunction(args, ret):
|
|
|
+ function printArg(ct) return switch ct {
|
|
|
+ case TFunction(_): "(" + printComplexType(ct) + ")";
|
|
|
+ default: printComplexType(ct);
|
|
|
+ };
|
|
|
+ (args.length>0 ? args.map(printArg).join(" -> ") :"Void") + " -> " + printComplexType(ret);
|
|
|
case TAnonymous(fields): "{ " + [for (f in fields) printField(f) + "; "].join("") + "}";
|
|
|
case TParent(ct): "(" + printComplexType(ct) + ")";
|
|
|
case TOptional(ct): "?" + printComplexType(ct);
|