I don't think it ever was because bytes is a dynamic array of byte which means it has a length. Is it possible you saw bytes32 conversion to unit? That is totally acceptable in that both are 32-byte words.
This compiles under 0.4.25 as well 0.5.2.
contract Bytes {
function convert(bytes32 b) public pure returns(uint) {
return uint(b);
}
}
On the other hand, this conversion is trouble in all cases I'm aware of.
contract Bytes {
function convert(bytes b) public pure returns(uint) {
return uint(b);
}
}
In my opinion, conversion of bytes and string to numbers, string manipulation, etc. are problematic issues that should usually be dealt with by software clients rather than burdening contracts with such concerns. It's a case where the contract team should strongly resist overloading the contract with concerns that software clients are capable of resolving.
Hope it helps.
bytes32touint8conversion that I saw. Interesting, so now in solidity ^0.5 you can douint(b)but you can't douint8(b). I guessuint8(uint(b))would do the trick, but I'm wondering if there's any place where this is documented? I couldn't find anything in the solidity docs for 0.5.2 – Paul Razvan Berg Jan 17 '19 at 17:43