Building Functions using private types in a macro

I am working on a macro which builds overrides to the functions of the target’s superclasses by recursively creating adding new functions with the AOverride access for each function in the parent classes. This works for normal functions so far, but breaks upon hitting a parent function which utilizes a private class. The macro completes but I get a Type not found : Listener error just after (referring to openfl.events.EventDispatcher.Listener.

It appears that the error occurs when calling Context.toComplexType(t:haxe.macro.Type) when the target type is a private class.

In researching this issue, I found the following issue that suggests the problem is unresolved: missing a way to provide access to private types through a macro · Issue #3589 · HaxeFoundation/haxe · GitHub

Is there a way to use these values properly given that I have access to the corresponding haxe.macro.Type?

Did some more testing. It appears calling just Context.toComplexType(t) calls it on the type Listener, which it fails to find. Checking for a private type and calling:

Context.toComplexType(Context.getType('${t.module}.${t.name}'));

will perform a type query on openfl.events.EventDispatcher.Listener but that gives a Cannot access private type Listener in module openfl.events.EventDispatcher

I’ve come to the conclusion that private classes are completely inaccessible outside the module they are defined in.

This thankfully means that, for my use case, I can simply skip functions that use these, so the topic of the thread is a moot point.