You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following two statements are of the same functions:
int256 a = 22;
int256 a2 = true ? 22 : 23;
However, the second statement throws an error with message: Error: Type uint8 is not implicitly convertible to expected type int256. Seems that Solidity compiler misunderstood the type of 22 and cannot take it as a int256 literal as it did for the first statement.
This bug (or, this feature) is kind of confusing and causes a little inconvenience.
The text was updated successfully, but these errors were encountered:
@haoyang9804 This behaviour is not a bug and is in fact the normal behaviour (see docs for reference). The type system does infer types in cases that are currently limited. However, we are aware of all the cases, the likes of above, that aren't covered well by the current type system and are working on bringing a better experience through the new type system in Solidity.
For now, I will be closing this issue given the above reasoning.
The following two statements are of the same functions:
However, the second statement throws an error with message:
Error: Type uint8 is not implicitly convertible to expected type int256
. Seems that Solidity compiler misunderstood the type of 22 and cannot take it as a int256 literal as it did for the first statement.This bug (or, this feature) is kind of confusing and causes a little inconvenience.
The text was updated successfully, but these errors were encountered: