mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix bug in typechecking when comparing rational literals
This commit is contained in:
parent
41d81a7432
commit
3b7b962b66
@ -27,6 +27,7 @@ Bugfixes:
|
|||||||
* DocString Parser: Fix error message for empty descriptions.
|
* DocString Parser: Fix error message for empty descriptions.
|
||||||
* Standard JSON: Support ``constantinople`` as ``evmVersion`` properly.
|
* Standard JSON: Support ``constantinople`` as ``evmVersion`` properly.
|
||||||
* Type Checker: Fix detection of recursive structs.
|
* Type Checker: Fix detection of recursive structs.
|
||||||
|
* Type Checker: Fix asymmetry bug when comparing with literal numbers.
|
||||||
* Type System: Improve error message when attempting to shift by a fractional amount.
|
* Type System: Improve error message when attempting to shift by a fractional amount.
|
||||||
* Type System: Make external library functions accessible.
|
* Type System: Make external library functions accessible.
|
||||||
* Type System: Prevent encoding of weird types.
|
* Type System: Prevent encoding of weird types.
|
||||||
|
@ -839,10 +839,10 @@ TypePointer RationalNumberType::binaryOperatorResult(Token::Value _operator, Typ
|
|||||||
{
|
{
|
||||||
if (_other->category() == Category::Integer || _other->category() == Category::FixedPoint)
|
if (_other->category() == Category::Integer || _other->category() == Category::FixedPoint)
|
||||||
{
|
{
|
||||||
auto mobile = mobileType();
|
auto commonType = Type::commonType(shared_from_this(), _other);
|
||||||
if (!mobile)
|
if (!commonType)
|
||||||
return TypePointer();
|
return TypePointer();
|
||||||
return mobile->binaryOperatorResult(_operator, _other);
|
return commonType->binaryOperatorResult(_operator, _other);
|
||||||
}
|
}
|
||||||
else if (_other->category() != category())
|
else if (_other->category() != category())
|
||||||
return TypePointer();
|
return TypePointer();
|
||||||
|
7
test/libsolidity/syntaxTests/literal_comparisons.sol
Normal file
7
test/libsolidity/syntaxTests/literal_comparisons.sol
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
contract test {
|
||||||
|
function f(int8 x) public pure {
|
||||||
|
if (x == 1) {}
|
||||||
|
if (1 == x) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ----
|
Loading…
Reference in New Issue
Block a user