{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/flow/issues/336","labels_url":"https://api.github.com/repos/facebook/flow/issues/336/labels{/name}","comments_url":"https://api.github.com/repos/facebook/flow/issues/336/comments","events_url":"https://api.github.com/repos/facebook/flow/issues/336/events","html_url":"https://github.com/facebook/flow/issues/336","id":63301566,"number":336,"title":"Array indexing into a function should be an error","user":{"login":"danvk","id":98301,"avatar_url":"https://avatars.githubusercontent.com/u/98301?v=3","gravatar_id":"","url":"https://api.github.com/users/danvk","html_url":"https://github.com/danvk","followers_url":"https://api.github.com/users/danvk/followers","following_url":"https://api.github.com/users/danvk/following{/other_user}","gists_url":"https://api.github.com/users/danvk/gists{/gist_id}","starred_url":"https://api.github.com/users/danvk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danvk/subscriptions","organizations_url":"https://api.github.com/users/danvk/orgs","repos_url":"https://api.github.com/users/danvk/repos","events_url":"https://api.github.com/users/danvk/events{/privacy}","received_events_url":"https://api.github.com/users/danvk/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/facebook/flow/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-20T20:29:42Z","updated_at":"2015-03-30T18:09:04Z","closed_at":null,"body":"I mistyped the `()` to call a function as `[]`. I was surprised that Flow had no complaints!\r\n\r\n```javascript\r\nfunction add(x, y) {\r\n  return x + y;\r\n}\r\nadd[1, 2]\r\n```\r\n\r\nI suppose I could do `add[2] = 123` somewhere else, but this wasn't an exported function, so flow could have known that this was off the table. Is `fn[key]` a construct that's often used?"},"comment":{"url":"https://api.github.com/repos/facebook/flow/issues/comments/87776700","html_url":"https://github.com/facebook/flow/issues/336#issuecomment-87776700","issue_url":"https://api.github.com/repos/facebook/flow/issues/336","id":87776700,"user":{"login":"danvk","id":98301,"avatar_url":"https://avatars.githubusercontent.com/u/98301?v=3","gravatar_id":"","url":"https://api.github.com/users/danvk","html_url":"https://github.com/danvk","followers_url":"https://api.github.com/users/danvk/followers","following_url":"https://api.github.com/users/danvk/following{/other_user}","gists_url":"https://api.github.com/users/danvk/gists{/gist_id}","starred_url":"https://api.github.com/users/danvk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danvk/subscriptions","organizations_url":"https://api.github.com/users/danvk/orgs","repos_url":"https://api.github.com/users/danvk/repos","events_url":"https://api.github.com/users/danvk/events{/privacy}","received_events_url":"https://api.github.com/users/danvk/received_events","type":"User","site_admin":false},"created_at":"2015-03-30T18:09:03Z","updated_at":"2015-03-30T18:09:03Z","body":"Warning about dead code seems like a reasonable solution. There's a fine tradition of that in linting tools."}}