Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Macro used as proc pragma meddles with proc filename #19061

Open
Wh1teDuke opened this issue Oct 27, 2021 · 0 comments
Open

Macro used as proc pragma meddles with proc filename #19061

Wh1teDuke opened this issue Oct 27, 2021 · 0 comments

Comments

@Wh1teDuke
Copy link
Contributor

Test

# p3.nim
import std/macros

macro p3*(this: untyped): untyped =
  result = this
  result[^1] = quote do:
    echo currentSourcePath()
    echo getStackTraceEntries()[^1].filename
    echo getFrame().filename
#--------------------------------------
# main.nim
import "p3"

proc p2 {.p3.} = discard
proc p1 = p2()
proc main = p1()
main()

Result

p3.nim

Expected

main.nim

As far as I'm concerned, there is no workaround for this situation.


>nim -v
Nim Compiler Version 1.7.1 [Linux: amd64]
Compiled at 2021-10-24
Copyright (c) 2006-2021 by Andreas Rumpf

git hash: 62701cd3b92677c2014cf70b1cf5a5ba6e0468bf
active boot switches: -d:release -d:danger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant