{"action":"created","issue":{"url":"https://api.github.com/repos/crystal-lang/crystal/issues/6002","repository_url":"https://api.github.com/repos/crystal-lang/crystal","labels_url":"https://api.github.com/repos/crystal-lang/crystal/issues/6002/labels{/name}","comments_url":"https://api.github.com/repos/crystal-lang/crystal/issues/6002/comments","events_url":"https://api.github.com/repos/crystal-lang/crystal/issues/6002/events","html_url":"https://github.com/crystal-lang/crystal/issues/6002","id":317336028,"number":6002,"title":"Nil type check fails when using ensure","user":{"login":"baelter","id":1399369,"avatar_url":"https://avatars1.githubusercontent.com/u/1399369?v=4","gravatar_id":"","url":"https://api.github.com/users/baelter","html_url":"https://github.com/baelter","followers_url":"https://api.github.com/users/baelter/followers","following_url":"https://api.github.com/users/baelter/following{/other_user}","gists_url":"https://api.github.com/users/baelter/gists{/gist_id}","starred_url":"https://api.github.com/users/baelter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baelter/subscriptions","organizations_url":"https://api.github.com/users/baelter/orgs","repos_url":"https://api.github.com/users/baelter/repos","events_url":"https://api.github.com/users/baelter/events{/privacy}","received_events_url":"https://api.github.com/users/baelter/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-04-24T18:05:55Z","updated_at":"2018-04-24T20:15:50Z","closed_at":null,"author_association":"NONE","body":"```\r\nrequire \"spec\"\r\n\r\ndescribe \"not_nil!\" do\r\n  a = 0\r\n  a + 1 # > undefined method '+' for Nil (compile-time type is (Int32 | Nil))\r\n\r\n  it \"can be nil?\" do\r\n    a + 1 # > undefined method '+' for Nil (compile-time type is (Int32 | Nil))\r\n    a.not_nil!\r\n    a + 1 # > undefined method '+' for Nil (compile-time type is (Int32 | Nil))\r\n  end\r\nensure\r\n  a + 1 # > undefined method '+' for Nil (compile-time type is (Int32 | Nil))\r\nend\r\n```\r\n\r\nCompile time type should not include `Nil` here? \r\n\r\n```\r\nCrystal 0.24.2 (2018-03-10)\r\n\r\nLLVM: 5.0.1\r\nDefault target: x86_64-apple-macosx\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/crystal-lang/crystal/issues/comments/384065158","html_url":"https://github.com/crystal-lang/crystal/issues/6002#issuecomment-384065158","issue_url":"https://api.github.com/repos/crystal-lang/crystal/issues/6002","id":384065158,"user":{"login":"asterite","id":209371,"avatar_url":"https://avatars0.githubusercontent.com/u/209371?v=4","gravatar_id":"","url":"https://api.github.com/users/asterite","html_url":"https://github.com/asterite","followers_url":"https://api.github.com/users/asterite/followers","following_url":"https://api.github.com/users/asterite/following{/other_user}","gists_url":"https://api.github.com/users/asterite/gists{/gist_id}","starred_url":"https://api.github.com/users/asterite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asterite/subscriptions","organizations_url":"https://api.github.com/users/asterite/orgs","repos_url":"https://api.github.com/users/asterite/repos","events_url":"https://api.github.com/users/asterite/events{/privacy}","received_events_url":"https://api.github.com/users/asterite/received_events","type":"User","site_admin":false},"created_at":"2018-04-24T20:15:50Z","updated_at":"2018-04-24T20:15:50Z","author_association":"MEMBER","body":"Reduced again:\r\n\r\n```crystal\r\ndef foo(&block)\r\n  block\r\nend\r\n\r\nfoo do\r\n  a = 0\r\n  foo do\r\n    a + 1 # undefined method '+' for Nil (compile-time type is (Int32 | Nil))\r\n  end\r\nensure\r\n  a\r\nend\r\n```\r\n\r\nThis time the error above makes little sense."}}
{"actor":{"display_login":"asterite"}}