Method overloading does not work as expected #37
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
AerScript Information
bca4d1a2fa
Your problem description
Before
bca4d1a2fa
, PH7 Engine has checked if there are more than one functions/methods with the same name during OP_CALL. If this was true, it executed VmOverload() in order to select proper one. Actually, it does the compution everytime. However when method or function contains some parameters that takes default values, and such parameter are not being overwritten, it fails to match the function properly, what leads to error.W/o change committed in
bca4d1a2fa
it is also not working correctly, because any function/method can be called even parameters does not match.We need to implement some additional checks in VmOverload(). Currently, there is only:
which check if number of arguments that method can take equals to the number of arguments really passed. However, function can also take more parameters than really passed, if next one skipped, takes some default value. This check needs to be implemented. Since then, master branch will be broken (unicode_characters.aer fails).
I have added a workaround in engine/vm.c in lines 619-620 to fix master branch.
This simply considers a method as candidate if it takes more parameters than really passed. We need to implement there a check mentioned before.