{"action":"closed","issue":{"url":"https://api.github.com/repos/crystal-lang/crystal/issues/4981","repository_url":"https://api.github.com/repos/crystal-lang/crystal","labels_url":"https://api.github.com/repos/crystal-lang/crystal/issues/4981/labels{/name}","comments_url":"https://api.github.com/repos/crystal-lang/crystal/issues/4981/comments","events_url":"https://api.github.com/repos/crystal-lang/crystal/issues/4981/events","html_url":"https://github.com/crystal-lang/crystal/issues/4981","id":258208710,"number":4981,"title":"'self' was used before initializing instance variable, except it wasn't?","user":{"login":"decademoon","id":5779055,"avatar_url":"https://avatars1.githubusercontent.com/u/5779055?v=4","gravatar_id":"","url":"https://api.github.com/users/decademoon","html_url":"https://github.com/decademoon","followers_url":"https://api.github.com/users/decademoon/followers","following_url":"https://api.github.com/users/decademoon/following{/other_user}","gists_url":"https://api.github.com/users/decademoon/gists{/gist_id}","starred_url":"https://api.github.com/users/decademoon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/decademoon/subscriptions","organizations_url":"https://api.github.com/users/decademoon/orgs","repos_url":"https://api.github.com/users/decademoon/repos","events_url":"https://api.github.com/users/decademoon/events{/privacy}","received_events_url":"https://api.github.com/users/decademoon/received_events","type":"User","site_admin":false},"labels":[{"id":20487867,"url":"https://api.github.com/repos/crystal-lang/crystal/labels/kind:bug","name":"kind:bug","color":"fc2929","default":false},{"id":253019637,"url":"https://api.github.com/repos/crystal-lang/crystal/labels/topic:compiler","name":"topic:compiler","color":"fef2c0","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-09-16T05:04:30Z","updated_at":"2017-09-16T21:32:30Z","closed_at":"2017-09-16T21:32:30Z","author_association":"NONE","body":"```cr\r\ndef f(x)\r\nend\r\n\r\nclass A\r\n  def initialize\r\n    @a = 0\r\n    f(self)\r\n    @a = 0 # error\r\n  end\r\nend\r\n\r\nA.new\r\n```\r\n\r\n```\r\nError in foo.cr:12: instantiating 'A:Class#new()'\r\n\r\nA.new\r\n  ^~~\r\n\r\ninstance variable '@a' of A must be Int32, not Nil\r\n\r\nError: 'self' was used before initializing instance variable '@a', rendering it nilable\r\n```\r\n\r\nCrystal version 0.23.1\r\nhttps://play.crystal-lang.org/#/r/2qcv\r\n\r\nThis seems like an issue that was likely raised before, but I couldn't find anything specific to it (except maybe #4147 or #1687). In my example `@a` is clearly initialized and always will be in every possible situation, won't it?"}}
{"actor":{"display_login":"mverzilli"}}