{"action":"created","issue":{"url":"https://api.github.com/repos/ceylon/ceylon-spec/issues/1415","labels_url":"https://api.github.com/repos/ceylon/ceylon-spec/issues/1415/labels{/name}","comments_url":"https://api.github.com/repos/ceylon/ceylon-spec/issues/1415/comments","events_url":"https://api.github.com/repos/ceylon/ceylon-spec/issues/1415/events","html_url":"https://github.com/ceylon/ceylon-spec/issues/1415","id":104651291,"number":1415,"title":"else clause narrowing for if (exists)","user":{"login":"gavinking","id":579974,"avatar_url":"https://avatars.githubusercontent.com/u/579974?v=3","gravatar_id":"","url":"https://api.github.com/users/gavinking","html_url":"https://github.com/gavinking","followers_url":"https://api.github.com/users/gavinking/followers","following_url":"https://api.github.com/users/gavinking/following{/other_user}","gists_url":"https://api.github.com/users/gavinking/gists{/gist_id}","starred_url":"https://api.github.com/users/gavinking/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gavinking/subscriptions","organizations_url":"https://api.github.com/users/gavinking/orgs","repos_url":"https://api.github.com/users/gavinking/repos","events_url":"https://api.github.com/users/gavinking/events{/privacy}","received_events_url":"https://api.github.com/users/gavinking/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ceylon/ceylon-spec/labels/improvement","name":"improvement","color":"02d7e1"}],"state":"open","locked":false,"assignee":{"login":"gavinking","id":579974,"avatar_url":"https://avatars.githubusercontent.com/u/579974?v=3","gravatar_id":"","url":"https://api.github.com/users/gavinking","html_url":"https://github.com/gavinking","followers_url":"https://api.github.com/users/gavinking/followers","following_url":"https://api.github.com/users/gavinking/following{/other_user}","gists_url":"https://api.github.com/users/gavinking/gists{/gist_id}","starred_url":"https://api.github.com/users/gavinking/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gavinking/subscriptions","organizations_url":"https://api.github.com/users/gavinking/orgs","repos_url":"https://api.github.com/users/gavinking/repos","events_url":"https://api.github.com/users/gavinking/events{/privacy}","received_events_url":"https://api.github.com/users/gavinking/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/ceylon/ceylon-spec/milestones/11","html_url":"https://github.com/ceylon/ceylon-spec/milestones/1.2","labels_url":"https://api.github.com/repos/ceylon/ceylon-spec/milestones/11/labels","id":798020,"number":11,"title":"1.2","description":"Serialization.","creator":{"login":"gavinking","id":579974,"avatar_url":"https://avatars.githubusercontent.com/u/579974?v=3","gravatar_id":"","url":"https://api.github.com/users/gavinking","html_url":"https://github.com/gavinking","followers_url":"https://api.github.com/users/gavinking/followers","following_url":"https://api.github.com/users/gavinking/following{/other_user}","gists_url":"https://api.github.com/users/gavinking/gists{/gist_id}","starred_url":"https://api.github.com/users/gavinking/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gavinking/subscriptions","organizations_url":"https://api.github.com/users/gavinking/orgs","repos_url":"https://api.github.com/users/gavinking/repos","events_url":"https://api.github.com/users/gavinking/events{/privacy}","received_events_url":"https://api.github.com/users/gavinking/received_events","type":"User","site_admin":false},"open_issues":23,"closed_issues":211,"state":"open","created_at":"2014-09-22T09:55:40Z","updated_at":"2015-09-03T09:03:34Z","due_on":"2014-10-28T23:00:00Z","closed_at":null},"comments":6,"created_at":"2015-09-03T09:03:34Z","updated_at":"2015-09-04T16:30:50Z","closed_at":null,"body":"Given:\r\n\r\n```ceylon\r\nvoid f<T>(T t) {\r\n    if (exists t) {\r\n    }\r\n    else {\r\n        //t has type Null here\r\n    }\r\n}\r\n```\r\n\r\nIt would be better for `t` to be narrowed to `T&Null`, since `Null` is not a subtype of `T`."},"comment":{"url":"https://api.github.com/repos/ceylon/ceylon-spec/issues/comments/137783277","html_url":"https://github.com/ceylon/ceylon-spec/issues/1415#issuecomment-137783277","issue_url":"https://api.github.com/repos/ceylon/ceylon-spec/issues/1415","id":137783277,"user":{"login":"Zambonifofex","id":12286722,"avatar_url":"https://avatars.githubusercontent.com/u/12286722?v=3","gravatar_id":"","url":"https://api.github.com/users/Zambonifofex","html_url":"https://github.com/Zambonifofex","followers_url":"https://api.github.com/users/Zambonifofex/followers","following_url":"https://api.github.com/users/Zambonifofex/following{/other_user}","gists_url":"https://api.github.com/users/Zambonifofex/gists{/gist_id}","starred_url":"https://api.github.com/users/Zambonifofex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zambonifofex/subscriptions","organizations_url":"https://api.github.com/users/Zambonifofex/orgs","repos_url":"https://api.github.com/users/Zambonifofex/repos","events_url":"https://api.github.com/users/Zambonifofex/events{/privacy}","received_events_url":"https://api.github.com/users/Zambonifofex/received_events","type":"User","site_admin":false},"created_at":"2015-09-04T16:30:50Z","updated_at":"2015-09-04T16:30:50Z","body":"No, @quintesse, I think he means:\r\n```Ceylon\r\nshared class<T>(T t)\r\n{\r\n    shared T tt;\r\n    if(exists t)\r\n    {\r\n        assert(false);\r\n    }\r\n    else\r\n    {\r\n        // tt = t; // fails\r\n        \r\n        // workaround:\r\n        assert(is T null);\r\n        tt = null;\r\n    }\r\n}\r\n```\r\nI see what you mean now, @gavinking... I guess it makes sense, since `exists` is suppose to mean `is Object`, and with `is Object`, it works fine..."}}