mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
commit
34e2209bcc
@ -3,6 +3,7 @@
|
|||||||
Features:
|
Features:
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
|
* Type checker: forbid signed exponential that led to an incorrect use of EXP opcode.
|
||||||
|
|
||||||
### 0.4.3 (2016-10-25)
|
### 0.4.3 (2016-10-25)
|
||||||
|
|
||||||
|
@ -349,11 +349,14 @@ TypePointer IntegerType::binaryOperatorResult(Token::Value _operator, TypePointe
|
|||||||
return commonType;
|
return commonType;
|
||||||
if (Token::isBooleanOp(_operator))
|
if (Token::isBooleanOp(_operator))
|
||||||
return TypePointer();
|
return TypePointer();
|
||||||
// Nothing else can be done with addresses
|
|
||||||
if (auto intType = dynamic_pointer_cast<IntegerType const>(commonType))
|
if (auto intType = dynamic_pointer_cast<IntegerType const>(commonType))
|
||||||
{
|
{
|
||||||
|
// Nothing else can be done with addresses
|
||||||
if (intType->isAddress())
|
if (intType->isAddress())
|
||||||
return TypePointer();
|
return TypePointer();
|
||||||
|
// Signed EXP is not allowed
|
||||||
|
if (Token::Exp == _operator && intType->isSigned())
|
||||||
|
return TypePointer();
|
||||||
}
|
}
|
||||||
else if (auto fixType = dynamic_pointer_cast<FixedPointType const>(commonType))
|
else if (auto fixType = dynamic_pointer_cast<FixedPointType const>(commonType))
|
||||||
if (Token::Exp == _operator)
|
if (Token::Exp == _operator)
|
||||||
|
@ -2098,6 +2098,22 @@ BOOST_AUTO_TEST_CASE(integer_boolean_operators)
|
|||||||
BOOST_CHECK(expectError(sourceCode3) == Error::Type::TypeError);
|
BOOST_CHECK(expectError(sourceCode3) == Error::Type::TypeError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(exp_signed_variable)
|
||||||
|
{
|
||||||
|
char const* sourceCode1 = R"(
|
||||||
|
contract test { function() { uint x = 3; int y = -4; x ** y; } }
|
||||||
|
)";
|
||||||
|
BOOST_CHECK(expectError(sourceCode1) == Error::Type::TypeError);
|
||||||
|
char const* sourceCode2 = R"(
|
||||||
|
contract test { function() { uint x = 3; int y = -4; y ** x; } }
|
||||||
|
)";
|
||||||
|
BOOST_CHECK(expectError(sourceCode2) == Error::Type::TypeError);
|
||||||
|
char const* sourceCode3 = R"(
|
||||||
|
contract test { function() { int x = -3; int y = -4; x ** y; } }
|
||||||
|
)";
|
||||||
|
BOOST_CHECK(expectError(sourceCode3) == Error::Type::TypeError);
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(reference_compare_operators)
|
BOOST_AUTO_TEST_CASE(reference_compare_operators)
|
||||||
{
|
{
|
||||||
char const* sourceCode1 = R"(
|
char const* sourceCode1 = R"(
|
||||||
|
Loading…
Reference in New Issue
Block a user