{"action":"created","issue":{"url":"https://api.github.com/repos/wyvernlang/wyvern/issues/250","repository_url":"https://api.github.com/repos/wyvernlang/wyvern","labels_url":"https://api.github.com/repos/wyvernlang/wyvern/issues/250/labels{/name}","comments_url":"https://api.github.com/repos/wyvernlang/wyvern/issues/250/comments","events_url":"https://api.github.com/repos/wyvernlang/wyvern/issues/250/events","html_url":"https://github.com/wyvernlang/wyvern/issues/250","id":333372951,"node_id":"MDU6SXNzdWUzMzMzNzI5NTE=","number":250,"title":"Broken method lookup in nested `new`s with generics","user":{"login":"hcnelson99","id":2250314,"node_id":"MDQ6VXNlcjIyNTAzMTQ=","avatar_url":"https://avatars0.githubusercontent.com/u/2250314?v=4","gravatar_id":"","url":"https://api.github.com/users/hcnelson99","html_url":"https://github.com/hcnelson99","followers_url":"https://api.github.com/users/hcnelson99/followers","following_url":"https://api.github.com/users/hcnelson99/following{/other_user}","gists_url":"https://api.github.com/users/hcnelson99/gists{/gist_id}","starred_url":"https://api.github.com/users/hcnelson99/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hcnelson99/subscriptions","organizations_url":"https://api.github.com/users/hcnelson99/orgs","repos_url":"https://api.github.com/users/hcnelson99/repos","events_url":"https://api.github.com/users/hcnelson99/events{/privacy}","received_events_url":"https://api.github.com/users/hcnelson99/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-06-18T17:52:36Z","updated_at":"2018-06-19T04:17:07Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Test case:\r\n```\r\ntype Foo\r\n    def foo(): Int\r\n\r\ntype Bar\r\n    type T\r\n    def bar(x: this.T): Baz\r\n\r\ntype Baz\r\n    def baz(): Int\r\n\r\ndef makeBar(): Bar = new\r\n    type T = Foo\r\n    def bar(x: this.T): Baz = new\r\n        def baz(): Int = x.foo()\r\n```\r\n\r\nObserved behavior: ```There is no visible method named foo in type this.T at location file test.wyv on line 14 column 28```\r\n\r\nExpected behavior: Clean compilation\r\n\r\nWorkaround: In makeBar(), change `def bar(x: this.T)` to `def bar(x: Foo)`:\r\n```\r\ndef makeBar(): Bar = new\r\n    type T = Foo\r\n    def bar(x: Foo): Baz = new\r\n        def baz(): Int = x.foo()\r\n```\r\n\r\nNote that this works properly when `new`s aren't nested, i.e.:\r\n```\r\ntype Foo\r\n    def foo(): Int\r\n\r\ntype Bar\r\n    type T\r\n    def bar(x: this.T): Int\r\n\r\ndef makeBar(): Bar = new\r\n    type T = Foo\r\n    def bar(x: this.T): Int\r\n        x.foo()\r\n```\r\nworks fine.\r\n\r\nWhile this isn't too hard to work around, fixing it would make working with object algebras a little easier until we have some form of implementation inheritance because writing `this.T` is more copy-paste friendly."},"comment":{"url":"https://api.github.com/repos/wyvernlang/wyvern/issues/comments/398269335","html_url":"https://github.com/wyvernlang/wyvern/issues/250#issuecomment-398269335","issue_url":"https://api.github.com/repos/wyvernlang/wyvern/issues/250","id":398269335,"node_id":"MDEyOklzc3VlQ29tbWVudDM5ODI2OTMzNQ==","user":{"login":"hcnelson99","id":2250314,"node_id":"MDQ6VXNlcjIyNTAzMTQ=","avatar_url":"https://avatars0.githubusercontent.com/u/2250314?v=4","gravatar_id":"","url":"https://api.github.com/users/hcnelson99","html_url":"https://github.com/hcnelson99","followers_url":"https://api.github.com/users/hcnelson99/followers","following_url":"https://api.github.com/users/hcnelson99/following{/other_user}","gists_url":"https://api.github.com/users/hcnelson99/gists{/gist_id}","starred_url":"https://api.github.com/users/hcnelson99/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hcnelson99/subscriptions","organizations_url":"https://api.github.com/users/hcnelson99/orgs","repos_url":"https://api.github.com/users/hcnelson99/repos","events_url":"https://api.github.com/users/hcnelson99/events{/privacy}","received_events_url":"https://api.github.com/users/hcnelson99/received_events","type":"User","site_admin":false},"created_at":"2018-06-19T04:17:07Z","updated_at":"2018-06-19T04:17:07Z","author_association":"CONTRIBUTOR","body":"Thanks! Great to hear there's a workaround."}}
{"actor":{"display_login":"hcnelson99"}}