happy icon indicating copy to clipboard operation
happy copied to clipboard

no function clause matching in Happy.HappyPath.happy_match_eq/1

Open OvermindDL1 opened this issue 9 years ago • 2 comments

Given this reduced test:

{:ok, str} when is_binary(str) = tuple when is_tuple(tuple) = get_a_string_or_whatever()

It gives a compile-time error of:

 ** (FunctionClauseError) no function clause matching in Happy.HappyPath.happy_match_eq/1
    (happy) lib/happy/happy_path.ex:164: Happy.HappyPath.happy_match_eq({:when, [line: 8], [{:=, [line: 8], [{:is_binary, [line: 8], [{:str, [line: 8], nil}]}, {:tuple, [line: 8], nil}]}, {:=, [line: 8], [{:is_tuple, [line: 8], [{:tuple, [line: 8], nil}]}, {:get_a_string_or_whatever, [line: 8], []}]}]})
    (happy) lib/happy/happy_path.ex:145: Happy.HappyPath.happy_match/1
    (happy) lib/happy/happy_path.ex:112: Happy.HappyPath.happy_match?/1
    (elixir) lib/enum.ex:2511: Enum.do_any?/2
    (happy) lib/happy/happy_path.ex:88: Happy.HappyPath.make_happy/2
    (happy) expanding macro: Happy.happy_path!/2
    (my_server) web/controllers/index_controller.ex:7: MyServer.IndexController.index/2
    (elixir) lib/kernel/parallel_compiler.ex:116: anonymous fn/4 in Kernel.ParallelCompiler.spawn_compilers/1

OvermindDL1 avatar Aug 25 '16 16:08 OvermindDL1

Hey, I've just released happy_with it has the same features as happy_path but uses with underneath, so if this issue is really a concern for you, you might want to try it, it's way simpler as it sits on top of with.

vic avatar Oct 13 '16 00:10 vic

Already have it actually, and awesome as usual! ^.^

OvermindDL1 avatar Oct 16 '16 00:10 OvermindDL1