trufflesuite / truffle

:warning: The Truffle Suite is being sunset. For information on ongoing support, migration options and FAQs, visit the Consensys blog. Thank you for all the support over the years.
https://consensys.io/blog/consensys-announces-the-sunset-of-truffle-and-ganache-and-new-hardhat?utm_source=github&utm_medium=referral&utm_campaign=2023_Sep_truffle-sunset-2023_announcement_
MIT License
14.02k stars 2.31k forks source link

Swap priority order of bools/strings if strictBooleans is on #6044

Closed haltman-at closed 1 year ago

haltman-at commented 1 year ago

Addresses #6028.

The point of this is that, if there's an overloaded function with a bool overload and a string overload, then truffle call Contract f true ought to hit the bool overload, not the string overload. Of course this only makes sense if we're restricted to string input, which is more or less what the strictBooleans flag means.

I added tests also. You could also test it manually by making a function with a string overload and a bool overload and try calling it with truffle call.

Arguably this is a breaking change (to codec and encoder), but I'd consider it a bug fix. Overload resolution is never guaranteed anyway! :)

haltman-at commented 1 year ago

Oh wait, I should update the docs in this PR as well... will have to go back and add that...

haltman-at commented 1 year ago

OK, updated this with documentation!