{"action":"created","issue":{"url":"https://api.github.com/repos/ceylon/ceylon/issues/5895","repository_url":"https://api.github.com/repos/ceylon/ceylon","labels_url":"https://api.github.com/repos/ceylon/ceylon/issues/5895/labels{/name}","comments_url":"https://api.github.com/repos/ceylon/ceylon/issues/5895/comments","events_url":"https://api.github.com/repos/ceylon/ceylon/issues/5895/events","html_url":"https://github.com/ceylon/ceylon/issues/5895","id":125840173,"number":5895,"title":"disallow 'super' lhs for spread attribute & spread method","user":{"login":"jvasileff","id":236050,"avatar_url":"https://avatars.githubusercontent.com/u/236050?v=3","gravatar_id":"","url":"https://api.github.com/users/jvasileff","html_url":"https://github.com/jvasileff","followers_url":"https://api.github.com/users/jvasileff/followers","following_url":"https://api.github.com/users/jvasileff/following{/other_user}","gists_url":"https://api.github.com/users/jvasileff/gists{/gist_id}","starred_url":"https://api.github.com/users/jvasileff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jvasileff/subscriptions","organizations_url":"https://api.github.com/users/jvasileff/orgs","repos_url":"https://api.github.com/users/jvasileff/repos","events_url":"https://api.github.com/users/jvasileff/events{/privacy}","received_events_url":"https://api.github.com/users/jvasileff/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ceylon/ceylon/labels/m-typechecker","name":"m-typechecker","color":"00aa00"},{"url":"https://api.github.com/repos/ceylon/ceylon/labels/t-bug","name":"t-bug","color":"e10c02"}],"state":"closed","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},"assignees":[{"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/milestones/15","html_url":"https://github.com/ceylon/ceylon/milestones/1.3.0","labels_url":"https://api.github.com/repos/ceylon/ceylon/milestones/15/labels","id":1590811,"number":15,"title":"1.3.0","description":"","creator":{"login":"FroMage","id":179265,"avatar_url":"https://avatars.githubusercontent.com/u/179265?v=3","gravatar_id":"","url":"https://api.github.com/users/FroMage","html_url":"https://github.com/FroMage","followers_url":"https://api.github.com/users/FroMage/followers","following_url":"https://api.github.com/users/FroMage/following{/other_user}","gists_url":"https://api.github.com/users/FroMage/gists{/gist_id}","starred_url":"https://api.github.com/users/FroMage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FroMage/subscriptions","organizations_url":"https://api.github.com/users/FroMage/orgs","repos_url":"https://api.github.com/users/FroMage/repos","events_url":"https://api.github.com/users/FroMage/events{/privacy}","received_events_url":"https://api.github.com/users/FroMage/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":339,"state":"open","created_at":"2016-02-18T14:05:01Z","updated_at":"2016-09-05T20:42:56Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2016-01-10T19:34:21Z","updated_at":"2016-09-05T20:45:39Z","closed_at":"2016-09-05T20:42:56Z","body":"The typechecker currently allows expressions like `super*.magnitude` and `super*.plus(0)`.\r\n\r\nGiven that the spec defines spread attribute and spread method operators as performing the following\r\n\r\n```ceylon\r\n[*lhs.map(X.attribute)] // spread attribute\r\n\r\ncompose((Iterable<T,N> ts)=>[*ts], lhs.spread(X.method)) // spread method\r\n```\r\n\r\npresumably the use of `super` would indicate that type supertype's `map` and `spread` methods should be used. But, at least for the JVM backend, `map` and `spread` aren't used at all; they are optimized away.\r\n\r\nAnd, currently, the JVM and JS backends currently produce errors when attempting to use `super` in this way.\r\n\r\nTherefore, I propose `super*.x` be disallowed by the typechecker.\r\n\r\nAlternately, the backends could implement the spec more precisely (actually use the `map` and `spread` methods). But this would probably just hurt performance.\r\n\r\nTest code:\r\n\r\n```ceylon\r\nclass ItSuper() satisfies Iterable<Integer> {\r\n    shared default actual Iterator<Integer> iterator() => {1,2,3}.iterator();\r\n    shared default actual {Result*} map<Result>(Result collecting(Integer element)) {\r\n        print(\"ItSuper.map() called\");\r\n        return super.map(collecting);\r\n    }\r\n}\r\nclass ItSub() extends ItSuper() {\r\n    shared default actual {Result*} map<Result>(Result collecting(Integer element)) {\r\n        print(\"ItSub.map() called\");\r\n        return super.map(collecting);\r\n    }\r\n    shared void foo() {\r\n        print(super.map(Integer.magnitude));\r\n        print(map(Integer.magnitude));\r\n\r\n        value s = super*.magnitude;\r\n        print(s);\r\n\r\n        value p = super*.plus(0);\r\n        print(p);\r\n    }\r\n}\r\nshared void testIt() => ItSub().foo();\r\n```"},"comment":{"url":"https://api.github.com/repos/ceylon/ceylon/issues/comments/244809627","html_url":"https://github.com/ceylon/ceylon/issues/5895#issuecomment-244809627","issue_url":"https://api.github.com/repos/ceylon/ceylon/issues/5895","id":244809627,"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},"created_at":"2016-09-05T20:45:39Z","updated_at":"2016-09-05T20:45:39Z","body":"Fixed."}}
{"actor":{"display_login":"gavinking"}}