Previously, when using @decorate_all, if you had defined a function that
had multiple clauses, but the clauses weren't next to each other, we
would only redefine the second clause, thus the first clause would be
entirely lost.
I realise it's bad practice to have clauses not next to each other, but
the failure mode was very confusing. It would give a
FunctionClauseError saying the function clause couldn't match. But
upon looking in the source code, that clause was clearly there.
I've fixed this by checking for all previous definitions when deciding
whether to output the overridable clause.
I've added a test to show the problem. If you run that on the previous
code it will fail because the first clause is ommitted.
Thanks
By the way thanks for all your hard work, the library is really useful!
Previously, when using
@decorate_all
, if you had defined a function that had multiple clauses, but the clauses weren't next to each other, we would only redefine the second clause, thus the first clause would be entirely lost.I realise it's bad practice to have clauses not next to each other, but the failure mode was very confusing. It would give a
FunctionClauseError
saying the function clause couldn't match. But upon looking in the source code, that clause was clearly there.I've fixed this by checking for all previous definitions when deciding whether to output the overridable clause.
I've added a test to show the problem. If you run that on the previous code it will fail because the first clause is ommitted.
Thanks
By the way thanks for all your hard work, the library is really useful!