haxe-traits icon indicating copy to clipboard operation
haxe-traits copied to clipboard

Problem with some circular dependencies

Open ShadowBelmolve opened this issue 12 years ago • 3 comments

Reference Gist

Seems that if you import an "interface A"(IEntity) that has a variable of type "class B"(EntityData) that has a function with return type "class C"(Entity) and "class C" implements the "interface A", then variables from "interface A" simply aren't copied to "class C" or something like this.

The same if you import "Class C" and then "Interface A".

But no problems for imports "Class C" or "Interface A" and "Class C"

ShadowBelmolve avatar Jan 06 '14 20:01 ShadowBelmolve

This happens because when macro is trying to resolve imported classes haxe compiller actualy build class before resolving. Unfortunately i didn't find any easy way to workaround this. The only way i see is to parse sources manually (without haxe compiler) to fin full classpaths of imported types. But this is not easy task for me.

RealyUniqueName avatar Jan 09 '14 13:01 RealyUniqueName

I'm having the same problem. Is there any way to work around this?

hexonaut avatar Apr 09 '14 19:04 hexonaut

The only possible way to solve this problem is to not use import statements and use full classpaths in traits' code and remove all Context.getType() calls in haxe-traits code

RealyUniqueName avatar Apr 09 '14 19:04 RealyUniqueName