{"action":"opened","issue":{"url":"https://api.github.com/repos/elixir-lang/elixir/issues/6738","repository_url":"https://api.github.com/repos/elixir-lang/elixir","labels_url":"https://api.github.com/repos/elixir-lang/elixir/issues/6738/labels{/name}","comments_url":"https://api.github.com/repos/elixir-lang/elixir/issues/6738/comments","events_url":"https://api.github.com/repos/elixir-lang/elixir/issues/6738/events","html_url":"https://github.com/elixir-lang/elixir/issues/6738","id":263948264,"number":6738,"title":"with clause cannot match when case is inside else block","user":{"login":"jordan0day","id":545037,"avatar_url":"https://avatars1.githubusercontent.com/u/545037?v=4","gravatar_id":"","url":"https://api.github.com/users/jordan0day","html_url":"https://github.com/jordan0day","followers_url":"https://api.github.com/users/jordan0day/followers","following_url":"https://api.github.com/users/jordan0day/following{/other_user}","gists_url":"https://api.github.com/users/jordan0day/gists{/gist_id}","starred_url":"https://api.github.com/users/jordan0day/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jordan0day/subscriptions","organizations_url":"https://api.github.com/users/jordan0day/orgs","repos_url":"https://api.github.com/users/jordan0day/repos","events_url":"https://api.github.com/users/jordan0day/events{/privacy}","received_events_url":"https://api.github.com/users/jordan0day/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-10-09T16:07:43Z","updated_at":"2017-10-09T16:07:43Z","closed_at":null,"author_association":"NONE","body":"This is very similar to #6380, but shows up when using a `case` expression inside the `else` block of a `with`.\r\n\r\n### Environment\r\n\r\n* Elixir & Erlang versions (elixir --version): Elixir 1.5.2, Erlang 20.0\r\n* Operating system: OS X 10.12.6 Sierra\r\n\r\n### Current behavior\r\nThe following code functions correctly, but emits the `this clause cannot match because of different types/sizes` warning during compilation.\r\n\r\n```elixir\r\nwith {:first, int1} when is_integer(int1)   <- {:first, Integer.gcd(2, 4)},\r\n     {:second, int2} when is_integer(int2)  <- {:second, Integer.gcd(2, 4)} do\r\n  {:ok, int1 + int2}\r\nelse\r\n  error ->\r\n    case error do\r\n      {:first, nil}  -> {:error, \"first number is not integer\"}\r\n      {:second, nil} -> {:error, \"second number is not integer\"}\r\n    end\r\nend\r\n```\r\n\r\nObviously in this example it's not useful to have an embedded case expression, but I've found it to be useful a number of times for logging an error-specific message and then sharing any amount of cleanup/retry code inside the `else` block.\r\n\r\nFailing test commited to `warning_test.exs` here: https://github.com/jordan0day/elixir/commit/ff4611acf3f1565f7c4989ade96e24a85ea68860\r\n\r\n\r\n\r\n### Expected behavior\r\nNo warning should be emitted.\r\n"}}
{"actor":{"display_login":"jordan0day"}}