{"action":"created","issue":{"url":"https://api.github.com/repos/pkulchenko/ZeroBraneStudio/issues/414","labels_url":"https://api.github.com/repos/pkulchenko/ZeroBraneStudio/issues/414/labels{/name}","comments_url":"https://api.github.com/repos/pkulchenko/ZeroBraneStudio/issues/414/comments","events_url":"https://api.github.com/repos/pkulchenko/ZeroBraneStudio/issues/414/events","html_url":"https://github.com/pkulchenko/ZeroBraneStudio/issues/414","id":58894029,"number":414,"title":"Static analyzer mistakenly reports `first use of unknown field`","user":{"login":"Dmitry-Frantsev","id":4817258,"avatar_url":"https://avatars.githubusercontent.com/u/4817258?v=3","gravatar_id":"","url":"https://api.github.com/users/Dmitry-Frantsev","html_url":"https://github.com/Dmitry-Frantsev","followers_url":"https://api.github.com/users/Dmitry-Frantsev/followers","following_url":"https://api.github.com/users/Dmitry-Frantsev/following{/other_user}","gists_url":"https://api.github.com/users/Dmitry-Frantsev/gists{/gist_id}","starred_url":"https://api.github.com/users/Dmitry-Frantsev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dmitry-Frantsev/subscriptions","organizations_url":"https://api.github.com/users/Dmitry-Frantsev/orgs","repos_url":"https://api.github.com/users/Dmitry-Frantsev/repos","events_url":"https://api.github.com/users/Dmitry-Frantsev/events{/privacy}","received_events_url":"https://api.github.com/users/Dmitry-Frantsev/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pkulchenko/ZeroBraneStudio/labels/Bug","name":"Bug","color":"e10c02"}],"state":"closed","locked":false,"assignee":{"login":"pkulchenko","id":77071,"avatar_url":"https://avatars.githubusercontent.com/u/77071?v=3","gravatar_id":"","url":"https://api.github.com/users/pkulchenko","html_url":"https://github.com/pkulchenko","followers_url":"https://api.github.com/users/pkulchenko/followers","following_url":"https://api.github.com/users/pkulchenko/following{/other_user}","gists_url":"https://api.github.com/users/pkulchenko/gists{/gist_id}","starred_url":"https://api.github.com/users/pkulchenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkulchenko/subscriptions","organizations_url":"https://api.github.com/users/pkulchenko/orgs","repos_url":"https://api.github.com/users/pkulchenko/repos","events_url":"https://api.github.com/users/pkulchenko/events{/privacy}","received_events_url":"https://api.github.com/users/pkulchenko/received_events","type":"User","site_admin":false},"milestone":null,"comments":11,"created_at":"2015-02-25T12:31:06Z","updated_at":"2015-03-06T07:42:46Z","closed_at":"2015-03-06T06:26:10Z","body":"If closure is a cycle variable, the static analyzer would falsely pop up an error message  when invoking the closure function.\r\n```Lua\r\nlocal function createObject(name)\r\n  local members = {}\r\n  members.test = function()\r\n    print(name..\":test()\")\r\n  end\r\n  return members\r\nend\r\n\r\nlocal obj = createObject(\"obj\")\r\nobj.test()                      -- ok\r\n\r\nlocal objs =\r\n{\r\n  createObject(\"obj1\"),\r\n  createObject(\"obj2\")\r\n}\r\n\r\nfor _,o in ipairs (objs) do\r\n  o.test()                    --!! first use of unknown field 'test' in 'obj'\r\nend\r\n```"},"comment":{"url":"https://api.github.com/repos/pkulchenko/ZeroBraneStudio/issues/comments/77519073","html_url":"https://github.com/pkulchenko/ZeroBraneStudio/issues/414#issuecomment-77519073","issue_url":"https://api.github.com/repos/pkulchenko/ZeroBraneStudio/issues/414","id":77519073,"user":{"login":"Dmitry-Frantsev","id":4817258,"avatar_url":"https://avatars.githubusercontent.com/u/4817258?v=3","gravatar_id":"","url":"https://api.github.com/users/Dmitry-Frantsev","html_url":"https://github.com/Dmitry-Frantsev","followers_url":"https://api.github.com/users/Dmitry-Frantsev/followers","following_url":"https://api.github.com/users/Dmitry-Frantsev/following{/other_user}","gists_url":"https://api.github.com/users/Dmitry-Frantsev/gists{/gist_id}","starred_url":"https://api.github.com/users/Dmitry-Frantsev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dmitry-Frantsev/subscriptions","organizations_url":"https://api.github.com/users/Dmitry-Frantsev/orgs","repos_url":"https://api.github.com/users/Dmitry-Frantsev/repos","events_url":"https://api.github.com/users/Dmitry-Frantsev/events{/privacy}","received_events_url":"https://api.github.com/users/Dmitry-Frantsev/received_events","type":"User","site_admin":false},"created_at":"2015-03-06T07:42:46Z","updated_at":"2015-03-06T07:42:46Z","body":"Also  I have found a similar issue. The static analyzer can't determine the type of the argument of ipairs() / pairs() functions when their argument is an argument of a function.\r\n```Lua\r\nlocal function createObject(name)\r\n  local members = {}\r\n  members.test = function()\r\n    print(name..\":test()\")\r\n  end\r\n  return members\r\nend\r\n\r\nlocal obj = createObject(\"obj\")\r\nobj.test()                      -- ok\r\n\r\nlocal objs =\r\n{\r\n  createObject(\"obj1\"),\r\n  createObject(\"obj2\")\r\n}\r\n\r\nlocal function f(objects)\r\n\tfor _,o in ipairs (objects) do\r\n\t  o.test()                    --!! first use of unknown field 'test' in 'obj'\r\n\tend\r\nend\r\n\r\nf(objs)"}}