{"action":"created","issue":{"url":"https://api.github.com/repos/crystal-lang/crystal/issues/6478","repository_url":"https://api.github.com/repos/crystal-lang/crystal","labels_url":"https://api.github.com/repos/crystal-lang/crystal/issues/6478/labels{/name}","comments_url":"https://api.github.com/repos/crystal-lang/crystal/issues/6478/comments","events_url":"https://api.github.com/repos/crystal-lang/crystal/issues/6478/events","html_url":"https://github.com/crystal-lang/crystal/issues/6478","id":347027047,"node_id":"MDU6SXNzdWUzNDcwMjcwNDc=","number":6478,"title":"Compilation error when using generic","user":{"login":"TsumiNa","id":6410921,"node_id":"MDQ6VXNlcjY0MTA5MjE=","avatar_url":"https://avatars1.githubusercontent.com/u/6410921?v=4","gravatar_id":"","url":"https://api.github.com/users/TsumiNa","html_url":"https://github.com/TsumiNa","followers_url":"https://api.github.com/users/TsumiNa/followers","following_url":"https://api.github.com/users/TsumiNa/following{/other_user}","gists_url":"https://api.github.com/users/TsumiNa/gists{/gist_id}","starred_url":"https://api.github.com/users/TsumiNa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TsumiNa/subscriptions","organizations_url":"https://api.github.com/users/TsumiNa/orgs","repos_url":"https://api.github.com/users/TsumiNa/repos","events_url":"https://api.github.com/users/TsumiNa/events{/privacy}","received_events_url":"https://api.github.com/users/TsumiNa/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-08-02T14:04:41Z","updated_at":"2018-08-02T15:11:53Z","closed_at":null,"author_association":"NONE","body":"I tried to run  *channel_select.cr* which is in the crystal/sample directory. Code like this:\r\n```crystal\r\ndef generator(n : T) forall T\r\n  channel = Channel(T).new\r\n  spawn do\r\n    loop do\r\n      sleep n\r\n      channel.send n\r\n    end\r\n  end\r\n  channel\r\nend\r\n\r\nch1 = generator(1)\r\nch2 = generator(1.5)\r\nch3 = generator(5)\r\n\r\nloop do\r\n  select\r\n  when int = ch1.receive\r\n    puts \"Int: #{int}\"\r\n  when float = ch2.receive\r\n    puts \"Float: #{float}\"\r\n  when ch3.receive\r\n    break\r\n  end\r\nend\r\n```\r\n\r\nWhen compile, got this error\r\n```\r\nError in src/test.cr:16: instantiating 'generator(Int32)'\r\n\r\nch1 = generator(1)\r\n      ^~~~~~~~~\r\n\r\nin src/test.cr:5: undefined constant T\r\n\r\ndef generator(n : T)\r\n```\r\n\r\nSo is this a error or just the syntax changed."},"comment":{"url":"https://api.github.com/repos/crystal-lang/crystal/issues/comments/409961697","html_url":"https://github.com/crystal-lang/crystal/issues/6478#issuecomment-409961697","issue_url":"https://api.github.com/repos/crystal-lang/crystal/issues/6478","id":409961697,"node_id":"MDEyOklzc3VlQ29tbWVudDQwOTk2MTY5Nw==","user":{"login":"TsumiNa","id":6410921,"node_id":"MDQ6VXNlcjY0MTA5MjE=","avatar_url":"https://avatars1.githubusercontent.com/u/6410921?v=4","gravatar_id":"","url":"https://api.github.com/users/TsumiNa","html_url":"https://github.com/TsumiNa","followers_url":"https://api.github.com/users/TsumiNa/followers","following_url":"https://api.github.com/users/TsumiNa/following{/other_user}","gists_url":"https://api.github.com/users/TsumiNa/gists{/gist_id}","starred_url":"https://api.github.com/users/TsumiNa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TsumiNa/subscriptions","organizations_url":"https://api.github.com/users/TsumiNa/orgs","repos_url":"https://api.github.com/users/TsumiNa/repos","events_url":"https://api.github.com/users/TsumiNa/events{/privacy}","received_events_url":"https://api.github.com/users/TsumiNa/received_events","type":"User","site_admin":false},"created_at":"2018-08-02T15:11:53Z","updated_at":"2018-08-02T15:11:53Z","author_association":"NONE","body":"@asterite  Thanks! Work like a charm. I will close this issue."}}
{"actor":{"display_login":"TsumiNa"}}