That's because Solidity only uses the first element to deduce the type of the other elements and cast them.
You cannot simply assign a string
to a bytes
array directly like that. You have to cast it to bytes
first. Solidity will only check the first element and try to convert the other elements to the same type as the first, casting them like [bytes("happy"), bytes("names")]
while compiling.
With ["hello", bytes("hello")]
it checks the first element and sees that it cannot deduce its expected type which is suppose to be bytes
.
I know that you may be wondering "But they should check the other elements to find the type I want to cast the elements and then cast the other elements with it". But there should be a standard, and their standard is to only check the first element to try to help you with casting the others. So they are helping with by doing that and not make you cast all the other elements manually.