COMMUNITY

Irregularity in Context.typeof()

Let’s say you have a function that prints a compile-time type:

public static macro function printType(expr:Expr):Expr {
    trace(Context.typeof(expr));
    return macro null;
}

Plus a typedef:

typedef Time = Date;

What happens when these things interact?

printType(new Time(0, 0, 0, 0, 0, 0)); //Date

var time:Time = Date.now();
printType(time); //Time

var time = new Time(0, 0, 0, 0, 0, 0);
printType(time); //Date

printType((Date.now():Time)); //Time

I feel like all of these should actually print “Time.” Is there any way to make that happen?