diff options
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 5 | ||||
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 1 |
2 files changed, 4 insertions, 2 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 38da9b14..75530739 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -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; } diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index f14108ca..552352e4 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -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; |