{"action":"created","issue":{"url":"https://api.github.com/repos/D-Programming-Language/dmd/issues/3998","labels_url":"https://api.github.com/repos/D-Programming-Language/dmd/issues/3998/labels{/name}","comments_url":"https://api.github.com/repos/D-Programming-Language/dmd/issues/3998/comments","events_url":"https://api.github.com/repos/D-Programming-Language/dmd/issues/3998/events","html_url":"https://github.com/D-Programming-Language/dmd/pull/3998","id":42872217,"number":3998,"title":"[tdpl] Multiple alias this","user":{"login":"IgorStepanov","id":1143799,"avatar_url":"https://avatars.githubusercontent.com/u/1143799?v=3","gravatar_id":"","url":"https://api.github.com/users/IgorStepanov","html_url":"https://github.com/IgorStepanov","followers_url":"https://api.github.com/users/IgorStepanov/followers","following_url":"https://api.github.com/users/IgorStepanov/following{/other_user}","gists_url":"https://api.github.com/users/IgorStepanov/gists{/gist_id}","starred_url":"https://api.github.com/users/IgorStepanov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IgorStepanov/subscriptions","organizations_url":"https://api.github.com/users/IgorStepanov/orgs","repos_url":"https://api.github.com/users/IgorStepanov/repos","events_url":"https://api.github.com/users/IgorStepanov/events{/privacy}","received_events_url":"https://api.github.com/users/IgorStepanov/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/D-Programming-Language/dmd/labels/Enhancement","name":"Enhancement","color":"0052cc"},{"url":"https://api.github.com/repos/D-Programming-Language/dmd/labels/Needs%20Approval","name":"Needs Approval","color":"e11d21"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":67,"created_at":"2014-09-16T11:40:59Z","updated_at":"2015-05-27T15:34:01Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/D-Programming-Language/dmd/pulls/3998","html_url":"https://github.com/D-Programming-Language/dmd/pull/3998","diff_url":"https://github.com/D-Programming-Language/dmd/pull/3998.diff","patch_url":"https://github.com/D-Programming-Language/dmd/pull/3998.patch"},"body":"This PR introduces multiple alias this.\r\nThe old alias this implemenation doesn't imply alias this conflicts.\r\nAll alias this-es in old implementation are serializable: compiler successively applies a, a->aliasthis, a->aliasthis->aliasthis while right expression is not found.\r\n\r\nThis implementation allows tree of alias this subtypes.\r\nType can has a direct \"alias this\"-es and \"alias this\"-es, inherited from base classes/interfaces. Thus, there can be conflict between several matching \"alias this\"-es.\r\nIn common case compile should raise error if several \"alias this\"-es have found.\r\nHowever, in the next situation conflict can be resolved:\r\n```\r\nstruct Test9a\r\n{\r\n    int a;\r\n    alias a this;\r\n}\r\n\r\nstruct Test9b\r\n{\r\n    int a;\r\n    alias a this;\r\n}\r\n\r\nstruct Test9\r\n{\r\n    Test9a a;\r\n    Test9b b;\r\n    int c;\r\n    alias a this;\r\n    alias b this;\r\n    alias c this;\r\n}\r\n\r\nvoid test()\r\n{\r\n    Test9 t9;\r\n    int a = t9;\r\n}\r\n```\r\n\r\nWhen we try to cast `Test9` to int we can find several variants: `t9.a.a`, `t9.b.a`, `t9.c`.\r\nHowever, `t9.c` is preferred, because `Test9` author is explicitly pointed out that `Test9` should be converted to `int` through `c` field. This magic works only if we have exact match. `short a = t9;` causes error.\r\n\r\nThis PR have a one limitation: it doesn't support multiple tuple alias this. It don't clearly understand how them should works.   Multiple tuple alias this can be implemented in future in a separate PR.\r\n"},"comment":{"url":"https://api.github.com/repos/D-Programming-Language/dmd/issues/comments/105962572","html_url":"https://github.com/D-Programming-Language/dmd/pull/3998#issuecomment-105962572","issue_url":"https://api.github.com/repos/D-Programming-Language/dmd/issues/3998","id":105962572,"user":{"login":"yebblies","id":580100,"avatar_url":"https://avatars.githubusercontent.com/u/580100?v=3","gravatar_id":"","url":"https://api.github.com/users/yebblies","html_url":"https://github.com/yebblies","followers_url":"https://api.github.com/users/yebblies/followers","following_url":"https://api.github.com/users/yebblies/following{/other_user}","gists_url":"https://api.github.com/users/yebblies/gists{/gist_id}","starred_url":"https://api.github.com/users/yebblies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yebblies/subscriptions","organizations_url":"https://api.github.com/users/yebblies/orgs","repos_url":"https://api.github.com/users/yebblies/repos","events_url":"https://api.github.com/users/yebblies/events{/privacy}","received_events_url":"https://api.github.com/users/yebblies/received_events","type":"User","site_admin":false},"created_at":"2015-05-27T15:34:01Z","updated_at":"2015-05-27T15:34:01Z","body":"You are declaring the function `atfindmember` twice, with the exact same arguments.  Easy solution is to change the name of one."}}