{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/12705","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/12705/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/12705/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/12705/events","html_url":"https://github.com/JuliaLang/julia/issues/12705","id":101998856,"number":12705,"title":"Doc system cannot document first expression generated by macro","user":{"login":"mauro3","id":4098145,"avatar_url":"https://avatars.githubusercontent.com/u/4098145?v=3","gravatar_id":"","url":"https://api.github.com/users/mauro3","html_url":"https://github.com/mauro3","followers_url":"https://api.github.com/users/mauro3/followers","following_url":"https://api.github.com/users/mauro3/following{/other_user}","gists_url":"https://api.github.com/users/mauro3/gists{/gist_id}","starred_url":"https://api.github.com/users/mauro3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mauro3/subscriptions","organizations_url":"https://api.github.com/users/mauro3/orgs","repos_url":"https://api.github.com/users/mauro3/repos","events_url":"https://api.github.com/users/mauro3/events{/privacy}","received_events_url":"https://api.github.com/users/mauro3/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/JuliaLang/julia/labels/docsystem","name":"docsystem","color":"d4c5f9"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-08-19T21:06:15Z","updated_at":"2015-08-20T04:50:07Z","closed_at":null,"body":"I'm pretty sure this used to work:\r\n```\r\njulia> macro mm()\r\n           esc(quote\r\n               g(x) = 4\r\n               f(x) = 3\r\n               end\r\n               )\r\n       end\r\n\r\njulia> \"d\" @mm\r\nERROR: Invalid doc expression begin  # none, line 3:\r\n    g(x) = begin  # none, line 3:\r\n            4\r\n        end # line 4:\r\n    f(x) = begin  # none, line 4:\r\n            3\r\n        end\r\nend\r\n```\r\n(`@with_kw` generates a type and the a bunch of other stuff)\r\nI would expect that `\"d\"` gets attached to `g`, i.e. the first expression generated by the macro.  I think this used to work.  At least below used to work with an about 8 days old master (this is how I got to this) but now errors with the same error:\r\n```\r\nusing Parameters\r\n\r\n\"d\"\r\n@with_kw immutable MT1\r\n    r::Int = 4\r\n    c = \"sdaf\"\r\nend\r\n```"},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/132889927","html_url":"https://github.com/JuliaLang/julia/issues/12705#issuecomment-132889927","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/12705","id":132889927,"user":{"login":"mauro3","id":4098145,"avatar_url":"https://avatars.githubusercontent.com/u/4098145?v=3","gravatar_id":"","url":"https://api.github.com/users/mauro3","html_url":"https://github.com/mauro3","followers_url":"https://api.github.com/users/mauro3/followers","following_url":"https://api.github.com/users/mauro3/following{/other_user}","gists_url":"https://api.github.com/users/mauro3/gists{/gist_id}","starred_url":"https://api.github.com/users/mauro3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mauro3/subscriptions","organizations_url":"https://api.github.com/users/mauro3/orgs","repos_url":"https://api.github.com/users/mauro3/repos","events_url":"https://api.github.com/users/mauro3/events{/privacy}","received_events_url":"https://api.github.com/users/mauro3/received_events","type":"User","site_admin":false},"created_at":"2015-08-20T04:50:07Z","updated_at":"2015-08-20T04:50:07Z","body":"Yes you're right, what I should have written: it used to work in the sense that no error was thrown. I didn't actually check to which expression the doc was attached.  \r\n\r\nYour alternative suggestion would mean that all macro writers would also have to deal with documentation, not ideal.  I think attaching to the first bit would be the best/logical thing to do."}}