{"action":"created","issue":{"url":"https://api.github.com/repos/m-labs/artiq/issues/713","repository_url":"https://api.github.com/repos/m-labs/artiq","labels_url":"https://api.github.com/repos/m-labs/artiq/issues/713/labels{/name}","comments_url":"https://api.github.com/repos/m-labs/artiq/issues/713/comments","events_url":"https://api.github.com/repos/m-labs/artiq/issues/713/events","html_url":"https://github.com/m-labs/artiq/issues/713","id":220623375,"number":713,"title":"inferring return types with annotations","user":{"login":"jordens","id":1338946,"avatar_url":"https://avatars2.githubusercontent.com/u/1338946?v=3","gravatar_id":"","url":"https://api.github.com/users/jordens","html_url":"https://github.com/jordens","followers_url":"https://api.github.com/users/jordens/followers","following_url":"https://api.github.com/users/jordens/following{/other_user}","gists_url":"https://api.github.com/users/jordens/gists{/gist_id}","starred_url":"https://api.github.com/users/jordens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jordens/subscriptions","organizations_url":"https://api.github.com/users/jordens/orgs","repos_url":"https://api.github.com/users/jordens/repos","events_url":"https://api.github.com/users/jordens/events{/privacy}","received_events_url":"https://api.github.com/users/jordens/received_events","type":"User","site_admin":false},"labels":[{"id":301182644,"url":"https://api.github.com/repos/m-labs/artiq/labels/area:compiler","name":"area:compiler","color":"009800","default":false},{"id":436518878,"url":"https://api.github.com/repos/m-labs/artiq/labels/type:bug","name":"type:bug","color":"d93f0b","default":false}],"state":"open","locked":false,"assignee":{"login":"whitequark","id":54771,"avatar_url":"https://avatars2.githubusercontent.com/u/54771?v=3","gravatar_id":"","url":"https://api.github.com/users/whitequark","html_url":"https://github.com/whitequark","followers_url":"https://api.github.com/users/whitequark/followers","following_url":"https://api.github.com/users/whitequark/following{/other_user}","gists_url":"https://api.github.com/users/whitequark/gists{/gist_id}","starred_url":"https://api.github.com/users/whitequark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whitequark/subscriptions","organizations_url":"https://api.github.com/users/whitequark/orgs","repos_url":"https://api.github.com/users/whitequark/repos","events_url":"https://api.github.com/users/whitequark/events{/privacy}","received_events_url":"https://api.github.com/users/whitequark/received_events","type":"User","site_admin":false},"assignees":[{"login":"whitequark","id":54771,"avatar_url":"https://avatars2.githubusercontent.com/u/54771?v=3","gravatar_id":"","url":"https://api.github.com/users/whitequark","html_url":"https://github.com/whitequark","followers_url":"https://api.github.com/users/whitequark/followers","following_url":"https://api.github.com/users/whitequark/following{/other_user}","gists_url":"https://api.github.com/users/whitequark/gists{/gist_id}","starred_url":"https://api.github.com/users/whitequark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whitequark/subscriptions","organizations_url":"https://api.github.com/users/whitequark/orgs","repos_url":"https://api.github.com/users/whitequark/repos","events_url":"https://api.github.com/users/whitequark/events{/privacy}","received_events_url":"https://api.github.com/users/whitequark/received_events","type":"User","site_admin":false}],"milestone":null,"comments":0,"created_at":"2017-04-10T12:05:34Z","updated_at":"2017-04-10T13:12:29Z","closed_at":null,"body":"```python\r\nfrom artiq.experiment import *\r\nfrom artiq.coredevice.rtio import rtio_input_data\r\nfrom artiq.language.types import TInt32\r\n\r\n\r\nclass Test(EnvExperiment):\r\n    def build(self):\r\n        self.setattr_device(\"core\")\r\n\r\n    @kernel\r\n    def x(self) -> TInt32:\r\n        return rtio_input_data(0) & 0xff\r\n\r\n    @kernel\r\n    def run(self):\r\n        self.x() == 0\r\n```\r\n\r\n```\r\n$ artiq_run test_data.py\r\ntest_data.py:16:9-16:17: error: the type of this expression cannot be fully inferred\r\n        self.x() == 0\r\n        ^^^^^^^^\r\ntest_data.py:16:9-16:17: note: the expression has type numpy.int?\r\n        self.x() == 0\r\n        ^^^^^^^^\r\n```\r\n\r\n* Do I really need to wrap `rtio_input_data()` in an `int()`?\r\n* The `TInt32` annotation does not change the outcome.\r\n* `rtio_input_data()` is already annotated. \r\n* Also fails with `now_mu()`.\r\n* The error message is only readable for experts and is confusing. Superficially it says that the type is unknown. But then it tells you that it still has a certain type. Could it say something like \"the expression has incomplete/partially inferred type ...\"?"},"comment":{"url":"https://api.github.com/repos/m-labs/artiq/issues/comments/292944996","html_url":"https://github.com/m-labs/artiq/issues/713#issuecomment-292944996","issue_url":"https://api.github.com/repos/m-labs/artiq/issues/713","id":292944996,"user":{"login":"whitequark","id":54771,"avatar_url":"https://avatars2.githubusercontent.com/u/54771?v=3","gravatar_id":"","url":"https://api.github.com/users/whitequark","html_url":"https://github.com/whitequark","followers_url":"https://api.github.com/users/whitequark/followers","following_url":"https://api.github.com/users/whitequark/following{/other_user}","gists_url":"https://api.github.com/users/whitequark/gists{/gist_id}","starred_url":"https://api.github.com/users/whitequark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whitequark/subscriptions","organizations_url":"https://api.github.com/users/whitequark/orgs","repos_url":"https://api.github.com/users/whitequark/repos","events_url":"https://api.github.com/users/whitequark/events{/privacy}","received_events_url":"https://api.github.com/users/whitequark/received_events","type":"User","site_admin":false},"created_at":"2017-04-10T13:12:29Z","updated_at":"2017-04-10T13:12:29Z","body":"> ```\r\n> test_data.py:16:9-16:17: error: the type of this expression cannot be fully inferred\r\n>         self.x() == 0\r\n>         ^^^^^^^^\r\n> ```\r\n\r\nThis part is definitely a bug, at least."}}
{"actor":{"display_login":"whitequark"}}