diff --git a/SolidityNameAndTypeResolution.cpp b/SolidityNameAndTypeResolution.cpp index 051b3dce7..c912939fc 100644 --- a/SolidityNameAndTypeResolution.cpp +++ b/SolidityNameAndTypeResolution.cpp @@ -1061,13 +1061,6 @@ BOOST_AUTO_TEST_CASE(enum_duplicate_values) char const* text = R"( contract test { enum ActionChoices { GoLeft, GoRight, GoLeft, Sit }; - function test() - { - a = 1; - b = 2; - } - uint256 a; - uint64 b; } )"; BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError); diff --git a/SolidityParser.cpp b/SolidityParser.cpp index 07ec2dcfa..702d1d6db 100644 --- a/SolidityParser.cpp +++ b/SolidityParser.cpp @@ -703,14 +703,14 @@ BOOST_AUTO_TEST_CASE(literal_constants_with_ether_subdenominations_in_expression BOOST_CHECK_NO_THROW(parseTextExplainError(text)); } -BOOST_AUTO_TEST_CASE(enum_declaration) +BOOST_AUTO_TEST_CASE(enum_valid_declaration) { char const* text = R"( contract c { - enum foo { WARNING, NOTICE, ERROR, CRITICAL }; + enum validEnum { Value1, Value2, Value3, Value4 }; function c () { - a = foo.CRITICAL; + a = foo.Value3; } uint256 a; })"; @@ -722,11 +722,6 @@ BOOST_AUTO_TEST_CASE(empty_enum_declaration) char const* text = R"( contract c { enum foo { }; - function c () - { - a = 5; - } - uint256 a; })"; BOOST_CHECK_NO_THROW(parseTextExplainError(text)); } @@ -736,11 +731,6 @@ BOOST_AUTO_TEST_CASE(malformed_enum_declaration) char const* text = R"( contract c { enum foo { WARNING,}; - function c () - { - a = foo.CRITICAL; - } - uint256 a; })"; BOOST_CHECK_THROW(parseText(text), ParserError); }