mocks.cr
mocks.cr copied to clipboard
Compatibility fixes for 0.34.0
- Time.new -> Time.utc
- object_id needed to be made public, since the new hash implementation in 0.32 expects it to be available (presumably because of compare_by_identity)?
- Used BigInt to deal with arithmetic overflow in hash methods - I hope I got the spirit of what's being accomplished here correct - a bitmask'd unique number.
- Changed multiplications 32*32 to bitwise shifts to make intent clearer.
What I haven't solved yet is the (currently failing) test for overriding a builtin class (.e.g. File) - My current investigations indicate this is because you need to specify the argument and the argument restrictions exactly, otherwise the overload never gets called.
See this example: https://play.crystal-lang.org/#/r/8vtj
I have a couple of ideas for solving the signatures problem, but they involve specifying the types on the arguments, which might be a breaking change from here on out.