Forbid function redefinitions in an OCaml module #12
Labels
bug
Something isn't working
compiler
Related to the OCaml to Erlang compiler
good first issue
Good for newcomers
help wanted
Extra attention is needed
Milestone
This OCaml source code:
should result in a compilation error explaining that module functions can only be defined once, and multi-clause functions are achievable by the use of the
function | pattern_1 -> expr_1 | pattern_2 -> expr_2
syntax.This currently yields a function redefinition:
Which is not valid Erlang.
All of the modules are available as we translate them (see
OCaml_to_erlang.Fun.mk_functions
) but unfortunately we do not do this with every function.Instead we are mapping over them so they are unaware of each other.
Changing this to a fold would allow us to carry around the list of functions that have already been defined, and we could check that any is being defined twice.
The text was updated successfully, but these errors were encountered: