mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Allow enum values for constants.
This commit is contained in:
parent
49cfacced2
commit
14948e514d
@ -1466,7 +1466,10 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO some members might be pure, but for example `address(0x123).balance` is not pure
|
// TODO some members might be pure, but for example `address(0x123).balance` is not pure
|
||||||
// although every subexpression is, so leaving this to false for now.
|
// although every subexpression is, so leaving this limited for now.
|
||||||
|
if (auto tt = dynamic_cast<TypeType const*>(exprType.get()))
|
||||||
|
if (tt->actualType()->category() == Type::Category::Enum)
|
||||||
|
annotation.isPure = true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -4542,7 +4542,6 @@ BOOST_AUTO_TEST_CASE(simple_constant_variables_test)
|
|||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(constant_variables)
|
BOOST_AUTO_TEST_CASE(constant_variables)
|
||||||
{
|
{
|
||||||
//for now constant specifier is valid only for uint, bytesXX, string and enums
|
|
||||||
char const* sourceCode = R"(
|
char const* sourceCode = R"(
|
||||||
contract Foo {
|
contract Foo {
|
||||||
uint constant x = 56;
|
uint constant x = 56;
|
||||||
|
Loading…
Reference in New Issue
Block a user