leostera / caramel

:candy: a functional language for building type-safe, scalable, and maintainable applications
https://caramel.run
Apache License 2.0
1.06k stars 25 forks source link

Cascading match cases result in empty patterns #9

Closed leostera closed 4 years ago

leostera commented 4 years ago

This OCaml:

match 0 with
| 0 | 1 -> true
| _ -> false

Should compile to this Erlang:

case 0 of
  0 -> true;
  1 -> true;
  _ -> false
end

but compiles to this Erlang:

case 0 of
  _ -> true;
 _ -> false
end

This is a bug somewhere in compiler/ocaml_to_erlang/fun.ml:L246-L258 -- and possible in the mk_pattern function of the same module.