HaxeFoundation / HaxeFoundation/haxe

haxe.PosInfos and macro

Open
#11,712 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

Hej,

When using `?pos : haxe.PosInfos` as last argument onto a macro function (inline expression) I get this message : `haxe.PosInfos is not allowed on macro functions, use Context.currentPos() instead`
But It still works when using init macro functions, Idk if it's normal (I use it to get the call `{methodName: toString, fileName: --macro Macro.test(), className: , lineNumber: 1}` because `haxe.macro.Context.currentPos()` gives `#pos((unknown))` and it would be handy if it gave us the build file position or something like that...
And I get compiler error when doing that on build macro functions : https://try.haxe.org/#4C2d8a8e

Regards,

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the linked try.haxe.org example and compare `?pos : haxe.PosInfos` on inline, init, and build macro functions. Inspect the behavior of `haxe.macro.Context.currentPos()` and determine the expected position for each macro kind; done should mean the behavior is clarified or consistently corrected and covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.