haxe
haxe copied to clipboard
@:pos vs display type
The following code:
macro @:pos(pos) var foo : foo.Bar<$whatever> = bar;
Will create an expression with a TypePath that has pos as position.
This will be an issue in some (admittedly niche) cases where this expression ends up being loaded before the actual display type, because compiler will enter load_instance with that type path, and call display_type for foo.Bar if pos encloses the actual display position (which can happen when using positions like class position or field position for generated expressions, which should probably be avoided in the first place).
It seems this is not easy to fix, because setting pos to the TypePath here is wanted behavior for @:genericBuild at least.
Maybe my issue is a subset of this https://github.com/HaxeFoundation/haxe/issues/11225