Browse Source

Merge pull request #1941 from jasononeil/fixprintfunctionct

Fix to print "Void -> Bool" if TFunction has no args
Simon Krajewski 12 years ago
parent
commit
7f4b03554d
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
 	// TODO: check if this can cause loops
 	public function printComplexType(ct:ComplexType) return switch(ct) {
 	public function printComplexType(ct:ComplexType) return switch(ct) {
 		case TPath(tp): printTypePath(tp);
 		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 TAnonymous(fields): "{ " + [for (f in fields) printField(f) + "; "].join("") + "}";
 		case TParent(ct): "(" + printComplexType(ct) + ")";
 		case TParent(ct): "(" + printComplexType(ct) + ")";
 		case TOptional(ct): "?" + printComplexType(ct);
 		case TOptional(ct): "?" + printComplexType(ct);