Allow enum values for constants.

This commit is contained in:
chriseth 2017-03-01 19:49:15 +01:00
parent 49cfacced2
commit 14948e514d
2 changed files with 4 additions and 2 deletions

View File

@ -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
// 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;
}

View File

@ -4542,7 +4542,6 @@ BOOST_AUTO_TEST_CASE(simple_constant_variables_test)
BOOST_AUTO_TEST_CASE(constant_variables)
{
//for now constant specifier is valid only for uint, bytesXX, string and enums
char const* sourceCode = R"(
contract Foo {
uint constant x = 56;