Issue with Haxe Macro Library - Type Name Error in Expr.hx

THIS IS A MISTAKE ISSUE RESOLVED PLEASE GO BACK

I’m currently an issue which is apparently with the Haxe macro library, in Expr.hx (C:\HaxeToolkit\haxe\std/haxe/macro/Expr.hx:720). The error message is indicating that “Type name should start with an uppercase letter.”

C:\HaxeToolkit\haxe\std/haxe/macro/Expr.hx:720: characters 9-18 : Type name should start with an uppercase letter

This is the code that I found in line 720:

/**

Represents a function in the AST.

**/
typedef wFunction { // and so on

Code used:

using haxe.macro.Context;

enum Output {
	Text(data:String);
	Media(name:String, data:String);
}

typedef OutFunction = Output->Void;

class Commands {
	public static var out:OutFunction;

	public static function init(outFun:OutFunction) {
		Commands.out = outFun;
	}

	public static macro function discover() {
		var commands = Context.getBuildFields(Context.getLocalModule(), "commands");

		return {
			expr: macro for (cmd in commands) {
				$v{cmd}.Command.init();
			}
		};
	}
}

The error is apparently in the Haxe macro library and is related to type names starting with a lowercase letter. I’ve already updated my Haxe installation to the latest version, but the problem does not go away.

Steps Taken:

  1. Updated Haxe (haxelib upgrade stuff) to the latest version.
  2. Checked my code for proper naming conventions (all type names start with an uppercase letter).

More info:
I tried neko, hashlink and interp targets even though I think the issue is not in compiler targets.
This might be an issue specific to me but yeah, I need help.

Minimum reproducible example:
I tried my best to make this example.

using haxe.macro.Context;
using haxe.macro.Expr;

class Main {
	static function main() {
		test();
	}

	macro static function test() {
		return {
			expr: macro for (cmd in commands) {
				trace("Pls help");
			}
		};
	}
}

Output:

PS C:\Users\<no>\Documents\projects\others\haxe issue expr std> haxe --main Main
C:\HaxeToolkit\haxe\std/haxe/macro/Expr.hx:720: characters 9-18 : Type name should start with an uppercase letter

According to github that line hasn’t been modified for at least 10 years, and is correctly written typedef Function in the latest release.

You might have accidentally modified your file. Try with removing the w.

1 Like

My bad. Thanks! That was kind of embarrasing but whaatever. But that brings up the question… doesnt haxelib selfupdate (or haxelib install haxelib i tried both) replace code files with fresh files? I dont remember opening Expr.hx but it might be my mistake so yeah.

haxelib selfupdate updates haxelib itself, to update haxe you’ll have to do it manually.

Oh, thanks! This has saved my life