Browse Source

Fix to print "Void -> Bool" if TFunction has no args

As opposed to " -> Bool" as it was previously printing

Fixes #1940
Jason O'Neil 12 years ago
parent
commit
d72aaba685
1 changed files with 1 additions and 1 deletions
  1. 1 1
      std/haxe/macro/Printer.hx

+ 1 - 1
std/haxe/macro/Printer.hx

@@ -93,7 +93,7 @@ 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.map(printComplexType).join(" -> ") + " -> " + printComplexType(ret);
+		case TFunction(args, ret): (args.length>0 ? args.map(printComplexType).join(" -> ") : "Void") + " -> " + printComplexType(ret);
 		case TAnonymous(fields): "{ " + [for (f in fields) printField(f) + "; "].join("") + "}";
 		case TParent(ct): "(" + printComplexType(ct) + ")";
 		case TOptional(ct): "?" + printComplexType(ct);