{"action":"created","comment":{"url":"https://api.github.com/repos/ethereum/cpp-ethereum/pulls/comments/24688142","id":24688142,"diff_hunk":"@@ -992,6 +992,87 @@ BOOST_AUTO_TEST_CASE(exp_operator_exponent_too_big)\n \tBOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);\n }\n \n+BOOST_AUTO_TEST_CASE(enum_member_access)\n+{\n+\tchar const* text = R\"(\n+\t\t\tcontract test {\n+\t\t\t\tenum ActionChoices { GoLeft, GoRight, GoStraight, Sit };\n+\t\t\t\tfunction test()\n+\t\t\t\t{\n+\t\t\t\t\tchoices = ActionChoices.GoStraight;\n+\t\t\t\t}\n+\t\t\t\tActionChoices choices;\n+\t\t\t}\n+\t)\";\n+\tBOOST_CHECK_NO_THROW(parseTextAndResolveNamesWithChecks(text));\n+}\n+\n+BOOST_AUTO_TEST_CASE(enum_invalid_member_access)\n+{\n+\tchar const* text = R\"(\n+\t\t\tcontract test {\n+\t\t\t\tenum ActionChoices { GoLeft, GoRight, GoStraight, Sit };\n+\t\t\t\tfunction test()\n+\t\t\t\t{\n+\t\t\t\t\tchoices = ActionChoices.RunAroundWavingYourHands;\n+\t\t\t\t}\n+\t\t\t\tActionChoices choices;\n+\t\t\t}\n+\t)\";\n+\tBOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);\n+}\n+\n+BOOST_AUTO_TEST_CASE(enum_explicit_conversion_is_okay)\n+{\n+\tchar const* text = R\"(\n+\t\t\tcontract test {\n+\t\t\t\tenum ActionChoices { GoLeft, GoRight, GoStraight, Sit };\n+\t\t\t\tfunction test()\n+\t\t\t\t{\n+\t\t\t\t\ta = uint256(ActionChoices.GoStraight);\n+\t\t\t\t\tb = uint64(ActionChoices.Sit);\n+\t\t\t\t}\n+\t\t\t\tuint256 a;\n+\t\t\t\tuint64 b;\n+\t\t\t}\n+\t)\";\n+\tBOOST_CHECK_NO_THROW(parseTextAndResolveNamesWithChecks(text));\n+}\n+\n+BOOST_AUTO_TEST_CASE(enum_implicit_conversion_is_not_okay)\n+{\n+\tchar const* text = R\"(\n+\t\t\tcontract test {\n+\t\t\t\tenum ActionChoices { GoLeft, GoRight, GoStraight, Sit };\n+\t\t\t\tfunction test()\n+\t\t\t\t{\n+\t\t\t\t\ta = ActionChoices.GoStraight;\n+\t\t\t\t\tb = ActionChoices.Sit;\n+\t\t\t\t}\n+\t\t\t\tuint256 a;\n+\t\t\t\tuint64 b;\n+\t\t\t}\n+\t)\";\n+\tBOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);\n+}\n+\n+BOOST_AUTO_TEST_CASE(enum_duplicate_values)\n+{\n+\tchar const* text = R\"(\n+\t\t\tcontract test {\n+\t\t\t\tenum ActionChoices { GoLeft, GoRight, GoLeft, Sit };\n+\t\t\t\tfunction test()","path":"test/SolidityNameAndTypeResolution.cpp","position":73,"original_position":73,"commit_id":"4f99ed3f4bd490864b86f16f6bef69f6e1d0249e","original_commit_id":"4f99ed3f4bd490864b86f16f6bef69f6e1d0249e","user":{"login":"chriseth","id":9073706,"avatar_url":"https://avatars.githubusercontent.com/u/9073706?v=3","gravatar_id":"","url":"https://api.github.com/users/chriseth","html_url":"https://github.com/chriseth","followers_url":"https://api.github.com/users/chriseth/followers","following_url":"https://api.github.com/users/chriseth/following{/other_user}","gists_url":"https://api.github.com/users/chriseth/gists{/gist_id}","starred_url":"https://api.github.com/users/chriseth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chriseth/subscriptions","organizations_url":"https://api.github.com/users/chriseth/orgs","repos_url":"https://api.github.com/users/chriseth/repos","events_url":"https://api.github.com/users/chriseth/events{/privacy}","received_events_url":"https://api.github.com/users/chriseth/received_events","type":"User","site_admin":false},"body":"The test code can end here.","created_at":"2015-02-13T19:11:15Z","updated_at":"2015-02-13T19:11:15Z","html_url":"https://github.com/ethereum/cpp-ethereum/pull/1043#discussion_r24688142","pull_request_url":"https://api.github.com/repos/ethereum/cpp-ethereum/pulls/1043","_links":{"self":{"href":"https://api.github.com/repos/ethereum/cpp-ethereum/pulls/comments/24688142"},"html":{"href":"https://github.com/ethereum/cpp-ethereum/pull/1043#discussion_r24688142"},"pull_request":{"href":"https://api.github.com/repos/ethereum/cpp-ethereum/pulls/1043"}}},"pull_request":{"url":"https://api.github.com/repos/ethereum/cpp-ethereum/pulls/1043","id":29261544,"html_url":"https://github.com/ethereum/cpp-ethereum/pull/1043","diff_url":"https://github.com/ethereum/cpp-ethereum/pull/1043.diff","patch_url":"https://github.com/ethereum/cpp-ethereum/pull/1043.patch","issue_url":"https://api.github.com/repos/ethereum/cpp-ethereum/issues/1043","number":1043,"state":"open","locked":false,"title":"Enums in Solidity","user":{"login":"LefterisJP","id":1658405,"avatar_url":"https://avatars.githubusercontent.com/u/1658405?v=3","gravatar_id":"","url":"https://api.github.com/users/LefterisJP","html_url":"https://github.com/LefterisJP","followers_url":"https://api.github.com/users/LefterisJP/followers","following_url":"https://api.github.com/users/LefterisJP/following{/other_user}","gists_url":"https://api.github.com/users/LefterisJP/gists{/gist_id}","starred_url":"https://api.github.com/users/LefterisJP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LefterisJP/subscriptions","organizations_url":"https://api.github.com/users/LefterisJP/orgs","repos_url":"https://api.github.com/users/LefterisJP/repos","events_url":"https://api.github.com/users/LefterisJP/events{/privacy}","received_events_url":"https://api.github.com/users/LefterisJP/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-02-13T12:41:18Z","updated_at":"2015-02-13T19:11:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"65877988b702a8923a1a8a04788b217e70b24362","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ethereum/cpp-ethereum/pulls/1043/commits","review_comments_url":"https://api.github.com/repos/ethereum/cpp-ethereum/pulls/1043/comments","review_comment_url":"https://api.github.com/repos/ethereum/cpp-ethereum/pulls/comments/{number}","comments_url":"https://api.github.com/repos/ethereum/cpp-ethereum/issues/1043/comments","statuses_url":"https://api.github.com/repos/ethereum/cpp-ethereum/statuses/4f99ed3f4bd490864b86f16f6bef69f6e1d0249e","head":{"label":"LefterisJP:sol_EnumsIntro","ref":"sol_EnumsIntro","sha":"4f99ed3f4bd490864b86f16f6bef69f6e1d0249e","user":{"login":"LefterisJP","id":1658405,"avatar_url":"https://avatars.githubusercontent.com/u/1658405?v=3","gravatar_id":"","url":"https://api.github.com/users/LefterisJP","html_url":"https://github.com/LefterisJP","followers_url":"https://api.github.com/users/LefterisJP/followers","following_url":"https://api.github.com/users/LefterisJP/following{/other_user}","gists_url":"https://api.github.com/users/LefterisJP/gists{/gist_id}","starred_url":"https://api.github.com/users/LefterisJP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LefterisJP/subscriptions","organizations_url":"https://api.github.com/users/LefterisJP/orgs","repos_url":"https://api.github.com/users/LefterisJP/repos","events_url":"https://api.github.com/users/LefterisJP/events{/privacy}","received_events_url":"https://api.github.com/users/LefterisJP/received_events","type":"User","site_admin":false},"repo":{"id":25381518,"name":"cpp-ethereum","full_name":"LefterisJP/cpp-ethereum","owner":{"login":"LefterisJP","id":1658405,"avatar_url":"https://avatars.githubusercontent.com/u/1658405?v=3","gravatar_id":"","url":"https://api.github.com/users/LefterisJP","html_url":"https://github.com/LefterisJP","followers_url":"https://api.github.com/users/LefterisJP/followers","following_url":"https://api.github.com/users/LefterisJP/following{/other_user}","gists_url":"https://api.github.com/users/LefterisJP/gists{/gist_id}","starred_url":"https://api.github.com/users/LefterisJP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LefterisJP/subscriptions","organizations_url":"https://api.github.com/users/LefterisJP/orgs","repos_url":"https://api.github.com/users/LefterisJP/repos","events_url":"https://api.github.com/users/LefterisJP/events{/privacy}","received_events_url":"https://api.github.com/users/LefterisJP/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/LefterisJP/cpp-ethereum","description":"Gavin Wood's C++ implementation of the Ethereum yellowpaper.","fork":true,"url":"https://api.github.com/repos/LefterisJP/cpp-ethereum","forks_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/forks","keys_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/keys{/key_id}","collaborators_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/teams","hooks_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/hooks","issue_events_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/issues/events{/number}","events_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/events","assignees_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/assignees{/user}","branches_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/branches{/branch}","tags_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/tags","blobs_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/git/refs{/sha}","trees_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/git/trees{/sha}","statuses_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/statuses/{sha}","languages_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/languages","stargazers_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/stargazers","contributors_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/contributors","subscribers_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/subscribers","subscription_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/subscription","commits_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/commits{/sha}","git_commits_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/git/commits{/sha}","comments_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/comments{/number}","issue_comment_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/issues/comments/{number}","contents_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/contents/{+path}","compare_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/compare/{base}...{head}","merges_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/merges","archive_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/downloads","issues_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/issues{/number}","pulls_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/pulls{/number}","milestones_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/milestones{/number}","notifications_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/labels{/name}","releases_url":"https://api.github.com/repos/LefterisJP/cpp-ethereum/releases{/id}","created_at":"2014-10-17T23:43:38Z","updated_at":"2015-02-13T14:47:49Z","pushed_at":"2015-02-13T16:44:12Z","git_url":"git://github.com/LefterisJP/cpp-ethereum.git","ssh_url":"git@github.com:LefterisJP/cpp-ethereum.git","clone_url":"https://github.com/LefterisJP/cpp-ethereum.git","svn_url":"https://github.com/LefterisJP/cpp-ethereum","homepage":"www.gavwood.com/Paper.pdf","size":14541,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"ethereum:develop","ref":"develop","sha":"fcfadec7577a8dc152fb3c1927d78af1345e3b7a","user":{"login":"ethereum","id":6250754,"avatar_url":"https://avatars.githubusercontent.com/u/6250754?v=3","gravatar_id":"","url":"https://api.github.com/users/ethereum","html_url":"https://github.com/ethereum","followers_url":"https://api.github.com/users/ethereum/followers","following_url":"https://api.github.com/users/ethereum/following{/other_user}","gists_url":"https://api.github.com/users/ethereum/gists{/gist_id}","starred_url":"https://api.github.com/users/ethereum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethereum/subscriptions","organizations_url":"https://api.github.com/users/ethereum/orgs","repos_url":"https://api.github.com/users/ethereum/repos","events_url":"https://api.github.com/users/ethereum/events{/privacy}","received_events_url":"https://api.github.com/users/ethereum/received_events","type":"Organization","site_admin":false},"repo":{"id":15460666,"name":"cpp-ethereum","full_name":"ethereum/cpp-ethereum","owner":{"login":"ethereum","id":6250754,"avatar_url":"https://avatars.githubusercontent.com/u/6250754?v=3","gravatar_id":"","url":"https://api.github.com/users/ethereum","html_url":"https://github.com/ethereum","followers_url":"https://api.github.com/users/ethereum/followers","following_url":"https://api.github.com/users/ethereum/following{/other_user}","gists_url":"https://api.github.com/users/ethereum/gists{/gist_id}","starred_url":"https://api.github.com/users/ethereum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethereum/subscriptions","organizations_url":"https://api.github.com/users/ethereum/orgs","repos_url":"https://api.github.com/users/ethereum/repos","events_url":"https://api.github.com/users/ethereum/events{/privacy}","received_events_url":"https://api.github.com/users/ethereum/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ethereum/cpp-ethereum","description":"Gavin Wood's C++ implementation of the Ethereum yellowpaper.","fork":false,"url":"https://api.github.com/repos/ethereum/cpp-ethereum","forks_url":"https://api.github.com/repos/ethereum/cpp-ethereum/forks","keys_url":"https://api.github.com/repos/ethereum/cpp-ethereum/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ethereum/cpp-ethereum/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ethereum/cpp-ethereum/teams","hooks_url":"https://api.github.com/repos/ethereum/cpp-ethereum/hooks","issue_events_url":"https://api.github.com/repos/ethereum/cpp-ethereum/issues/events{/number}","events_url":"https://api.github.com/repos/ethereum/cpp-ethereum/events","assignees_url":"https://api.github.com/repos/ethereum/cpp-ethereum/assignees{/user}","branches_url":"https://api.github.com/repos/ethereum/cpp-ethereum/branches{/branch}","tags_url":"https://api.github.com/repos/ethereum/cpp-ethereum/tags","blobs_url":"https://api.github.com/repos/ethereum/cpp-ethereum/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ethereum/cpp-ethereum/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ethereum/cpp-ethereum/git/refs{/sha}","trees_url":"https://api.github.com/repos/ethereum/cpp-ethereum/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ethereum/cpp-ethereum/statuses/{sha}","languages_url":"https://api.github.com/repos/ethereum/cpp-ethereum/languages","stargazers_url":"https://api.github.com/repos/ethereum/cpp-ethereum/stargazers","contributors_url":"https://api.github.com/repos/ethereum/cpp-ethereum/contributors","subscribers_url":"https://api.github.com/repos/ethereum/cpp-ethereum/subscribers","subscription_url":"https://api.github.com/repos/ethereum/cpp-ethereum/subscription","commits_url":"https://api.github.com/repos/ethereum/cpp-ethereum/commits{/sha}","git_commits_url":"https://api.github.com/repos/ethereum/cpp-ethereum/git/commits{/sha}","comments_url":"https://api.github.com/repos/ethereum/cpp-ethereum/comments{/number}","issue_comment_url":"https://api.github.com/repos/ethereum/cpp-ethereum/issues/comments/{number}","contents_url":"https://api.github.com/repos/ethereum/cpp-ethereum/contents/{+path}","compare_url":"https://api.github.com/repos/ethereum/cpp-ethereum/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ethereum/cpp-ethereum/merges","archive_url":"https://api.github.com/repos/ethereum/cpp-ethereum/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ethereum/cpp-ethereum/downloads","issues_url":"https://api.github.com/repos/ethereum/cpp-ethereum/issues{/number}","pulls_url":"https://api.github.com/repos/ethereum/cpp-ethereum/pulls{/number}","milestones_url":"https://api.github.com/repos/ethereum/cpp-ethereum/milestones{/number}","notifications_url":"https://api.github.com/repos/ethereum/cpp-ethereum/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ethereum/cpp-ethereum/labels{/name}","releases_url":"https://api.github.com/repos/ethereum/cpp-ethereum/releases{/id}","created_at":"2013-12-26T21:26:06Z","updated_at":"2015-02-13T18:28:41Z","pushed_at":"2015-02-13T18:28:41Z","git_url":"git://github.com/ethereum/cpp-ethereum.git","ssh_url":"git@github.com:ethereum/cpp-ethereum.git","clone_url":"https://github.com/ethereum/cpp-ethereum.git","svn_url":"https://github.com/ethereum/cpp-ethereum","homepage":"www.gavwood.com/Paper.pdf","size":37101,"stargazers_count":403,"watchers_count":403,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":141,"mirror_url":null,"open_issues_count":112,"forks":141,"open_issues":112,"watchers":403,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/ethereum/cpp-ethereum/pulls/1043"},"html":{"href":"https://github.com/ethereum/cpp-ethereum/pull/1043"},"issue":{"href":"https://api.github.com/repos/ethereum/cpp-ethereum/issues/1043"},"comments":{"href":"https://api.github.com/repos/ethereum/cpp-ethereum/issues/1043/comments"},"review_comments":{"href":"https://api.github.com/repos/ethereum/cpp-ethereum/pulls/1043/comments"},"review_comment":{"href":"https://api.github.com/repos/ethereum/cpp-ethereum/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/ethereum/cpp-ethereum/pulls/1043/commits"},"statuses":{"href":"https://api.github.com/repos/ethereum/cpp-ethereum/statuses/4f99ed3f4bd490864b86f16f6bef69f6e1d0249e"}}}}