{"action":"created","issue":{"url":"https://api.github.com/repos/kangax/compat-table/issues/763","repository_url":"https://api.github.com/repos/kangax/compat-table","labels_url":"https://api.github.com/repos/kangax/compat-table/issues/763/labels{/name}","comments_url":"https://api.github.com/repos/kangax/compat-table/issues/763/comments","events_url":"https://api.github.com/repos/kangax/compat-table/issues/763/events","html_url":"https://github.com/kangax/compat-table/issues/763","id":141982183,"number":763,"title":"Test for super() returning object other than `this`","user":{"login":"justinfagnani","id":522948,"avatar_url":"https://avatars.githubusercontent.com/u/522948?v=3","gravatar_id":"","url":"https://api.github.com/users/justinfagnani","html_url":"https://github.com/justinfagnani","followers_url":"https://api.github.com/users/justinfagnani/followers","following_url":"https://api.github.com/users/justinfagnani/following{/other_user}","gists_url":"https://api.github.com/users/justinfagnani/gists{/gist_id}","starred_url":"https://api.github.com/users/justinfagnani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justinfagnani/subscriptions","organizations_url":"https://api.github.com/users/justinfagnani/orgs","repos_url":"https://api.github.com/users/justinfagnani/repos","events_url":"https://api.github.com/users/justinfagnani/events{/privacy}","received_events_url":"https://api.github.com/users/justinfagnani/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/kangax/compat-table/labels/ES6","name":"ES6","color":"009800"},{"url":"https://api.github.com/repos/kangax/compat-table/labels/new%20test","name":"new test","color":"f9f9f9"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-18T21:29:26Z","updated_at":"2016-03-23T16:29:38Z","closed_at":null,"body":"If a constructor returns a value other than `this`, then in subclasses `super()` calls to that constructor should use the result as `this` in the subclass constructor.\r\n\r\nThis is specified in 12.3.5.1, step 10 of SuperCall: http://www.ecma-international.org/ecma-262/6.0/index.html#sec-super-keyword\r\n\r\nHere's an example that works in correct ES2015 implementation, and fails in some others:\r\n\r\n```javascript\r\nclass Foo {\r\n  constructor() {\r\n    return {\r\n      x: 1,\r\n    };\r\n  }\r\n}\r\n\r\nclass Bar extends Foo {\r\n\r\n  constructor() {\r\n    super();\r\n    this.y = 2;\r\n  }\r\n}\r\n\r\nlet o = new Bar();\r\nconsole.assert(o.x === 1 && y === 2);\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/kangax/compat-table/issues/comments/200424264","html_url":"https://github.com/kangax/compat-table/issues/763#issuecomment-200424264","issue_url":"https://api.github.com/repos/kangax/compat-table/issues/763","id":200424264,"user":{"login":"nilssolanki","id":5477955,"avatar_url":"https://avatars.githubusercontent.com/u/5477955?v=3","gravatar_id":"","url":"https://api.github.com/users/nilssolanki","html_url":"https://github.com/nilssolanki","followers_url":"https://api.github.com/users/nilssolanki/followers","following_url":"https://api.github.com/users/nilssolanki/following{/other_user}","gists_url":"https://api.github.com/users/nilssolanki/gists{/gist_id}","starred_url":"https://api.github.com/users/nilssolanki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nilssolanki/subscriptions","organizations_url":"https://api.github.com/users/nilssolanki/orgs","repos_url":"https://api.github.com/users/nilssolanki/repos","events_url":"https://api.github.com/users/nilssolanki/events{/privacy}","received_events_url":"https://api.github.com/users/nilssolanki/received_events","type":"User","site_admin":false},"created_at":"2016-03-23T16:29:38Z","updated_at":"2016-03-23T16:29:38Z","body":"    console.assert(o.x === 1 && o.y === 2);"}}