{"action":"created","issue":{"url":"https://api.github.com/repos/nim-lang/Nim/issues/3682","labels_url":"https://api.github.com/repos/nim-lang/Nim/issues/3682/labels{/name}","comments_url":"https://api.github.com/repos/nim-lang/Nim/issues/3682/comments","events_url":"https://api.github.com/repos/nim-lang/Nim/issues/3682/events","html_url":"https://github.com/nim-lang/Nim/issues/3682","id":124563582,"number":3682,"title":"static dispatch on `macros.getAst` is broken.","user":{"login":"krux02","id":929961,"avatar_url":"https://avatars.githubusercontent.com/u/929961?v=3","gravatar_id":"","url":"https://api.github.com/users/krux02","html_url":"https://github.com/krux02","followers_url":"https://api.github.com/users/krux02/followers","following_url":"https://api.github.com/users/krux02/following{/other_user}","gists_url":"https://api.github.com/users/krux02/gists{/gist_id}","starred_url":"https://api.github.com/users/krux02/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krux02/subscriptions","organizations_url":"https://api.github.com/users/krux02/orgs","repos_url":"https://api.github.com/users/krux02/repos","events_url":"https://api.github.com/users/krux02/events{/privacy}","received_events_url":"https://api.github.com/users/krux02/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nim-lang/Nim/labels/error%20messages","name":"error messages","color":"d4c5f9"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-01-01T22:14:07Z","updated_at":"2016-01-05T21:25:23Z","closed_at":null,"body":"If I call a macro from another macro via `macros.getAst`, correct static dispatch based on the type of the expression dosn't work at all.\r\n\r\n    import macros\r\n\r\n    macro inner( t : typeDesc[int] ): string = \"int\"\r\n    macro inner( t : typeDesc[float] ): string = \"float\"\r\n\r\n    macro outer(a:typed): string = \r\n      result = getAst( inner(a) )\r\n \r\n    echo \"inner(int): \", inner(int)      # inner(int): int\r\n    echo \"outer(int): \", outer(int)      # outer(int): int\r\n    echo \"inner(float): \", inner(float)  # inner(float): float\r\n    echo \"outer(float): \", outer(float)  # outer(float): int    !! <-  WRONG\r\n\r\nI also tried to call templates instead of macros, or used expressions that are not a typeDesc. None of them work.\r\n"},"comment":{"url":"https://api.github.com/repos/nim-lang/Nim/issues/comments/169138487","html_url":"https://github.com/nim-lang/Nim/issues/3682#issuecomment-169138487","issue_url":"https://api.github.com/repos/nim-lang/Nim/issues/3682","id":169138487,"user":{"login":"krux02","id":929961,"avatar_url":"https://avatars.githubusercontent.com/u/929961?v=3","gravatar_id":"","url":"https://api.github.com/users/krux02","html_url":"https://github.com/krux02","followers_url":"https://api.github.com/users/krux02/followers","following_url":"https://api.github.com/users/krux02/following{/other_user}","gists_url":"https://api.github.com/users/krux02/gists{/gist_id}","starred_url":"https://api.github.com/users/krux02/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krux02/subscriptions","organizations_url":"https://api.github.com/users/krux02/orgs","repos_url":"https://api.github.com/users/krux02/repos","events_url":"https://api.github.com/users/krux02/events{/privacy}","received_events_url":"https://api.github.com/users/krux02/received_events","type":"User","site_admin":false},"created_at":"2016-01-05T21:25:23Z","updated_at":"2016-01-05T21:25:23Z","body":"I got to this problem, because I needet to branch in my macro dependent of the type that I pass to my macro. I couldn't find a single way to do it. I am currently working on getType, so that at least getType gives me sufficient information."}}