{"action":"created","issue":{"url":"https://api.github.com/repos/ponylang/ponyc/issues/1019","repository_url":"https://api.github.com/repos/ponylang/ponyc","labels_url":"https://api.github.com/repos/ponylang/ponyc/issues/1019/labels{/name}","comments_url":"https://api.github.com/repos/ponylang/ponyc/issues/1019/comments","events_url":"https://api.github.com/repos/ponylang/ponyc/issues/1019/events","html_url":"https://github.com/ponylang/ponyc/issues/1019","id":164711532,"number":1019,"title":"Method body / return type mismatch error should preempt receiver recovery error. ","user":{"login":"nlalevee","id":282823,"avatar_url":"https://avatars.githubusercontent.com/u/282823?v=3","gravatar_id":"","url":"https://api.github.com/users/nlalevee","html_url":"https://github.com/nlalevee","followers_url":"https://api.github.com/users/nlalevee/followers","following_url":"https://api.github.com/users/nlalevee/following{/other_user}","gists_url":"https://api.github.com/users/nlalevee/gists{/gist_id}","starred_url":"https://api.github.com/users/nlalevee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nlalevee/subscriptions","organizations_url":"https://api.github.com/users/nlalevee/orgs","repos_url":"https://api.github.com/users/nlalevee/repos","events_url":"https://api.github.com/users/nlalevee/events{/privacy}","received_events_url":"https://api.github.com/users/nlalevee/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ponylang/ponyc/labels/difficulty:%202%20-%20medium","name":"difficulty: 2 - medium","color":"fbca04"},{"url":"https://api.github.com/repos/ponylang/ponyc/labels/enhancement:%203%20-%20ready%20for%20work","name":"enhancement: 3 - ready for work","color":"bfd4f2"},{"url":"https://api.github.com/repos/ponylang/ponyc/labels/priority:%202%20-%20medium","name":"priority: 2 - medium","color":"d4c5f9"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-07-10T11:33:41Z","updated_at":"2016-07-13T20:07:20Z","closed_at":null,"body":"Ponyc was reporting me an error about an incorrect reference capability use. I got stuck on that error a long time until I realized that I forgot to properly return a value as expected by the function signature.\r\n\r\nI have managed to reduce the issue to this simple code:\r\n```pony\r\nactor Main\r\n  new create(env: Env) => None\r\n\r\nclass C\r\n  var s: String iso = recover String.create() end\r\n  fun ref apply(): U8 =>\r\n    s.clear()\r\n```\r\n\r\nThe compiler output:\r\n```\r\n$ ponyc -d .                         \r\nBuilding builtin -> /Users/nlalevee/dev/pony/git/packages/builtin\r\nBuilding . -> /Users/nlalevee/dev/pony/pony-yaml/git/src/bug\r\nError:\r\n/Users/nlalevee/dev/pony/pony-yaml/git/src/bug/bug.pony:8:12: receiver type is not a subtype of target type\r\n    s.clear()\r\n           ^\r\n    Info:\r\n    /Users/nlalevee/dev/pony/pony-yaml/git/src/bug/bug.pony:8:5: receiver type: String iso!\r\n        s.clear()\r\n        ^\r\n    /Users/nlalevee/dev/pony/git/packages/builtin/string.pony:696:3: target type: String ref\r\n      fun ref clear(): String ref^ =>\r\n      ^\r\n    /Users/nlalevee/dev/pony/pony-yaml/git/src/bug/bug.pony:8:12: this would be possible if the arguments and return value were all sendable\r\n        s.clear()\r\n               ^\r\n    /Users/nlalevee/dev/pony/pony-yaml/git/src/bug/bug.pony:5:10: String iso! is not a subtype of String ref: iso! is not a subtype of ref\r\n      var s: String iso = recover String.create() end\r\n             ^\r\n```\r\n\r\nI have the issue with ponyc compiled from source at today's hash d65c226 of the master branch, on MacOS X, LLVM 3.7.1."},"comment":{"url":"https://api.github.com/repos/ponylang/ponyc/issues/comments/232471134","html_url":"https://github.com/ponylang/ponyc/issues/1019#issuecomment-232471134","issue_url":"https://api.github.com/repos/ponylang/ponyc/issues/1019","id":232471134,"user":{"login":"jemc","id":4623870,"avatar_url":"https://avatars.githubusercontent.com/u/4623870?v=3","gravatar_id":"","url":"https://api.github.com/users/jemc","html_url":"https://github.com/jemc","followers_url":"https://api.github.com/users/jemc/followers","following_url":"https://api.github.com/users/jemc/following{/other_user}","gists_url":"https://api.github.com/users/jemc/gists{/gist_id}","starred_url":"https://api.github.com/users/jemc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jemc/subscriptions","organizations_url":"https://api.github.com/users/jemc/orgs","repos_url":"https://api.github.com/users/jemc/repos","events_url":"https://api.github.com/users/jemc/events{/privacy}","received_events_url":"https://api.github.com/users/jemc/received_events","type":"User","site_admin":false},"created_at":"2016-07-13T20:07:20Z","updated_at":"2016-07-13T20:07:20Z","body":"This is actually related to some other work I was doing, trying to decouple some of the checks in the `expr` pass to another compiler pass that runs *after* the `expr` pass.  This auto-recover for receivers check that causes the error you're seeing is one of the things I wanted to move to the other pass.\r\n\r\nIf I complete this work, then this issue would be solved because the type check for the return value would happen *after* the auto-recover for receiver check."}}
{"actor":{"display_login":"jemc"}}