Note: Haxe does not typecheck macros.
See https://haxe.org/manual/macro-ExprOf.html
For example, this seemingly ill-typed definition (which should return Int as suggested by the type paramater, but in fact returns a string) successfully typechecks:
class StringGetter {
public static macro function getString():haxe.macro.Expr.ExprOf<Int> {
var s:String = "";
return macro $v{s};
}
}