{"action":"created","issue":{"url":"https://api.github.com/repos/manastech/crystal/issues/1842","labels_url":"https://api.github.com/repos/manastech/crystal/issues/1842/labels{/name}","comments_url":"https://api.github.com/repos/manastech/crystal/issues/1842/comments","events_url":"https://api.github.com/repos/manastech/crystal/issues/1842/events","html_url":"https://github.com/manastech/crystal/issues/1842","id":114307294,"number":1842,"title":"Assertion failed: (isa(Val) && \"cast() argument of incompatible type!","user":{"login":"Perelandric","id":1114646,"avatar_url":"https://avatars.githubusercontent.com/u/1114646?v=3","gravatar_id":"","url":"https://api.github.com/users/Perelandric","html_url":"https://github.com/Perelandric","followers_url":"https://api.github.com/users/Perelandric/followers","following_url":"https://api.github.com/users/Perelandric/following{/other_user}","gists_url":"https://api.github.com/users/Perelandric/gists{/gist_id}","starred_url":"https://api.github.com/users/Perelandric/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Perelandric/subscriptions","organizations_url":"https://api.github.com/users/Perelandric/orgs","repos_url":"https://api.github.com/users/Perelandric/repos","events_url":"https://api.github.com/users/Perelandric/events{/privacy}","received_events_url":"https://api.github.com/users/Perelandric/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/manastech/crystal/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/manastech/crystal/labels/compiler","name":"compiler","color":"fef2c0"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2015-10-30T16:37:50Z","updated_at":"2015-10-30T18:16:14Z","closed_at":null,"body":"This code fails to compile and only gives the error below. I don't have any special flags set. Just compiling with `crystal test.cr`\r\n\r\n```crystal\r\nstruct Foobar\r\n    @value = \"foobar\"\r\nend\r\n\r\ndef foo()\r\n    _ = Foobar.new\r\nend\r\n\r\nfoo()\r\n```\r\n\r\n>Assertion failed: (isa<X>(Val) && \"cast<Ty>() argument of incompatible type!\"), function cast, file /tmp/llvm20150726-78491-1dqz88o/llvm-3.6.2.src/include/llvm/Support/Casting.h, line 237.\r\n\r\nIt will succeed if I remove the `_ =` or if I throw any arbitrary expression on the line following the `_ = Foobar.new`.\r\n\r\n>Crystal 0.9.1 (Fri Oct 30 16:14:17 UTC 2015)"},"comment":{"url":"https://api.github.com/repos/manastech/crystal/issues/comments/152607074","html_url":"https://github.com/manastech/crystal/issues/1842#issuecomment-152607074","issue_url":"https://api.github.com/repos/manastech/crystal/issues/1842","id":152607074,"user":{"login":"Perelandric","id":1114646,"avatar_url":"https://avatars.githubusercontent.com/u/1114646?v=3","gravatar_id":"","url":"https://api.github.com/users/Perelandric","html_url":"https://github.com/Perelandric","followers_url":"https://api.github.com/users/Perelandric/followers","following_url":"https://api.github.com/users/Perelandric/following{/other_user}","gists_url":"https://api.github.com/users/Perelandric/gists{/gist_id}","starred_url":"https://api.github.com/users/Perelandric/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Perelandric/subscriptions","organizations_url":"https://api.github.com/users/Perelandric/orgs","repos_url":"https://api.github.com/users/Perelandric/repos","events_url":"https://api.github.com/users/Perelandric/events{/privacy}","received_events_url":"https://api.github.com/users/Perelandric/received_events","type":"User","site_admin":false},"created_at":"2015-10-30T18:16:14Z","updated_at":"2015-10-30T18:16:14Z","body":"@omninonsense Yeah, I'm not a Ruby developer. Since Crystal does have `_` for the purpose of discarding a value, it would seem necessary as an expression-based language to give it a value.\r\n\r\nCode comments are useful too but if I need to search for discarded values, it can fail unless I'm perfectly consistent.\r\n\r\nBut I'm not on a mission here either. In that trailing position, I'm going to adopt `x! = _ = obj.some_method` or something. It's ugly but sufficient for this rare case."}}