haxe icon indicating copy to clipboard operation
haxe copied to clipboard

@:pos vs display type

Open kLabz opened this issue 10 months ago • 1 comments

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.

kLabz avatar Jan 20 '25 09:01 kLabz

Maybe my issue is a subset of this https://github.com/HaxeFoundation/haxe/issues/11225

RblSb avatar Jun 11 '25 14:06 RblSb