{"action":"created","comment":{"url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/pulls/comments/198520953","pull_request_review_id":132464633,"id":198520953,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5ODUyMDk1Mw==","diff_hunk":"@@ -268,31 +294,58 @@ private void GetContextValue(ParserRuleContext context, out string declaredTypeN\n                 expressionValue = rangeClauseIdentifierReference.IdentifierName;\n                 declaredTypeName = GetBaseTypeForDeclaration(declaration);\n \n-                if (declaration.DeclarationType.HasFlag(DeclarationType.Constant)\n-                    || declaration.DeclarationType.HasFlag(DeclarationType.EnumerationMember))\n+                if (declaration.DeclarationType.HasFlag(DeclarationType.Constant))\n+                {\n+                    expressionValue = GetConstantContextValueToken(declaration.Context);\n+                    if (declaration.DeclarationType.HasFlag(DeclarationType.Constant)\n+                        && declaredTypeName.Equals(Tokens.String))\n+                    {\n+                        expressionValue = \"\\\"\" + expressionValue + \"\\\"\";\n+                    }\n+                }\n+                else if (declaration.DeclarationType.HasFlag(DeclarationType.EnumerationMember))\n                 {\n-                    expressionValue = GetConstantDeclarationValueToken(declaration);\n+                    declaredTypeName = Tokens.Long;\n+                    expressionValue = GetConstantContextValueToken(declaration.Context);\n+                    if (expressionValue.Equals(string.Empty))\n+                    {\n+                        var enumValues = _enumMembers.Where(dt => dt.ConstantContext == declaration.Context);\n+                        if (enumValues.Any())\n+                        {\n+                            var enumValue = enumValues.First();\n+                            expressionValue = enumValue.Value.ToString();\n+                        }\n+                    }\n                 }\n             }\n         }\n \n         private bool TryGetIdentifierReferenceForContext(ParserRuleContext context, out IdentifierReference idRef)\n         {\n             idRef = null;\n-            var identifierReferences = (_state.DeclarationFinder.MatchName(context.GetText()).Select(dec => dec.References)).SelectMany(rf => rf)\n-                .Where(rf => rf.Context == context);\n-            if (identifierReferences.Count() == 1)\n+            if (IdRefRetriever != null)\n             {\n-                idRef = identifierReferences.First();\n-                return true;\n+                (bool success, IdentifierReference idReference) = IdRefRetriever(context);\n+                idRef = idReference;\n+                return success;\n+            }\n+            else if (State != null) //State is set to non-null for testing","path":"Rubberduck.CodeAnalysis/Inspections/Concrete/UnreachableCaseInspection/ParseTreeValueVisitor.cs","position":null,"original_position":250,"commit_id":"d80016c3767c28bb0b45aaa699adbe92187a2068","original_commit_id":"7bfdf05358c65540d60829c9ee3e7874bd691902","user":{"login":"BZngr","id":16185628,"node_id":"MDQ6VXNlcjE2MTg1NjI4","avatar_url":"https://avatars2.githubusercontent.com/u/16185628?v=4","gravatar_id":"","url":"https://api.github.com/users/BZngr","html_url":"https://github.com/BZngr","followers_url":"https://api.github.com/users/BZngr/followers","following_url":"https://api.github.com/users/BZngr/following{/other_user}","gists_url":"https://api.github.com/users/BZngr/gists{/gist_id}","starred_url":"https://api.github.com/users/BZngr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BZngr/subscriptions","organizations_url":"https://api.github.com/users/BZngr/orgs","repos_url":"https://api.github.com/users/BZngr/repos","events_url":"https://api.github.com/users/BZngr/events{/privacy}","received_events_url":"https://api.github.com/users/BZngr/received_events","type":"User","site_admin":false},"body":"Agreed - removed.","created_at":"2018-06-27T14:41:00Z","updated_at":"2018-06-27T14:41:00Z","html_url":"https://github.com/rubberduck-vba/Rubberduck/pull/4127#discussion_r198520953","pull_request_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/pulls/4127","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/rubberduck-vba/Rubberduck/pulls/comments/198520953"},"html":{"href":"https://github.com/rubberduck-vba/Rubberduck/pull/4127#discussion_r198520953"},"pull_request":{"href":"https://api.github.com/repos/rubberduck-vba/Rubberduck/pulls/4127"}},"in_reply_to_id":198481041},"pull_request":{"url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/pulls/4127","id":196797067,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk2Nzk3MDY3","html_url":"https://github.com/rubberduck-vba/Rubberduck/pull/4127","diff_url":"https://github.com/rubberduck-vba/Rubberduck/pull/4127.diff","patch_url":"https://github.com/rubberduck-vba/Rubberduck/pull/4127.patch","issue_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/issues/4127","number":4127,"state":"open","locked":false,"title":"Unreachable Case Inspection:  follow-up","user":{"login":"BZngr","id":16185628,"node_id":"MDQ6VXNlcjE2MTg1NjI4","avatar_url":"https://avatars2.githubusercontent.com/u/16185628?v=4","gravatar_id":"","url":"https://api.github.com/users/BZngr","html_url":"https://github.com/BZngr","followers_url":"https://api.github.com/users/BZngr/followers","following_url":"https://api.github.com/users/BZngr/following{/other_user}","gists_url":"https://api.github.com/users/BZngr/gists{/gist_id}","starred_url":"https://api.github.com/users/BZngr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BZngr/subscriptions","organizations_url":"https://api.github.com/users/BZngr/orgs","repos_url":"https://api.github.com/users/BZngr/repos","events_url":"https://api.github.com/users/BZngr/events{/privacy}","received_events_url":"https://api.github.com/users/BZngr/received_events","type":"User","site_admin":false},"body":"This is a refactored version of the UnreachableCaseInspection.  This version addresses many of the unresolved comments from the initial PR as well as some improvements/corrections:\r\n\r\n1. Refactored tests into multiple files - IMO, the single file had become unwieldy.  Also allows better identification of unit tests versus functional tests.\r\n2. Simplified the inspections processing to a single pass - prior design essentially evaluated each RangeClause context a couple times.\r\n3. Adds `Like` expression support.\r\n4. Adds `&` operator support\r\n5. Enhanced/Corrected `Eqv` and `Imp` operator support\r\n6. Flags value range clauses like 'x To y' where x > y.  These RangeClauses are unreachable due to invalid order...but VBE still compiles and executes without errors.\r\n7. Strengthened the handling of RangeClauses containing variables\r\n8. Respects `Option Compare Binary/Text` setting.\r\n9. Resolves #4119","created_at":"2018-06-22T17:19:05Z","updated_at":"2018-06-27T14:41:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5277cf49ca6247382cbd8d61858c154a4e4af650","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/pulls/4127/commits","review_comments_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/pulls/4127/comments","review_comment_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/issues/4127/comments","statuses_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/statuses/d80016c3767c28bb0b45aaa699adbe92187a2068","head":{"label":"BZngr:UnreachableCaseInsp_Comments2","ref":"UnreachableCaseInsp_Comments2","sha":"d80016c3767c28bb0b45aaa699adbe92187a2068","user":{"login":"BZngr","id":16185628,"node_id":"MDQ6VXNlcjE2MTg1NjI4","avatar_url":"https://avatars2.githubusercontent.com/u/16185628?v=4","gravatar_id":"","url":"https://api.github.com/users/BZngr","html_url":"https://github.com/BZngr","followers_url":"https://api.github.com/users/BZngr/followers","following_url":"https://api.github.com/users/BZngr/following{/other_user}","gists_url":"https://api.github.com/users/BZngr/gists{/gist_id}","starred_url":"https://api.github.com/users/BZngr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BZngr/subscriptions","organizations_url":"https://api.github.com/users/BZngr/orgs","repos_url":"https://api.github.com/users/BZngr/repos","events_url":"https://api.github.com/users/BZngr/events{/privacy}","received_events_url":"https://api.github.com/users/BZngr/received_events","type":"User","site_admin":false},"repo":{"id":80457931,"node_id":"MDEwOlJlcG9zaXRvcnk4MDQ1NzkzMQ==","name":"Rubberduck","full_name":"BZngr/Rubberduck","owner":{"login":"BZngr","id":16185628,"node_id":"MDQ6VXNlcjE2MTg1NjI4","avatar_url":"https://avatars2.githubusercontent.com/u/16185628?v=4","gravatar_id":"","url":"https://api.github.com/users/BZngr","html_url":"https://github.com/BZngr","followers_url":"https://api.github.com/users/BZngr/followers","following_url":"https://api.github.com/users/BZngr/following{/other_user}","gists_url":"https://api.github.com/users/BZngr/gists{/gist_id}","starred_url":"https://api.github.com/users/BZngr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BZngr/subscriptions","organizations_url":"https://api.github.com/users/BZngr/orgs","repos_url":"https://api.github.com/users/BZngr/repos","events_url":"https://api.github.com/users/BZngr/events{/privacy}","received_events_url":"https://api.github.com/users/BZngr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/BZngr/Rubberduck","description":"Every programmer needs a rubberduck. COM add-in for the VBA IDE (VBE).","fork":true,"url":"https://api.github.com/repos/BZngr/Rubberduck","forks_url":"https://api.github.com/repos/BZngr/Rubberduck/forks","keys_url":"https://api.github.com/repos/BZngr/Rubberduck/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BZngr/Rubberduck/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BZngr/Rubberduck/teams","hooks_url":"https://api.github.com/repos/BZngr/Rubberduck/hooks","issue_events_url":"https://api.github.com/repos/BZngr/Rubberduck/issues/events{/number}","events_url":"https://api.github.com/repos/BZngr/Rubberduck/events","assignees_url":"https://api.github.com/repos/BZngr/Rubberduck/assignees{/user}","branches_url":"https://api.github.com/repos/BZngr/Rubberduck/branches{/branch}","tags_url":"https://api.github.com/repos/BZngr/Rubberduck/tags","blobs_url":"https://api.github.com/repos/BZngr/Rubberduck/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BZngr/Rubberduck/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BZngr/Rubberduck/git/refs{/sha}","trees_url":"https://api.github.com/repos/BZngr/Rubberduck/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BZngr/Rubberduck/statuses/{sha}","languages_url":"https://api.github.com/repos/BZngr/Rubberduck/languages","stargazers_url":"https://api.github.com/repos/BZngr/Rubberduck/stargazers","contributors_url":"https://api.github.com/repos/BZngr/Rubberduck/contributors","subscribers_url":"https://api.github.com/repos/BZngr/Rubberduck/subscribers","subscription_url":"https://api.github.com/repos/BZngr/Rubberduck/subscription","commits_url":"https://api.github.com/repos/BZngr/Rubberduck/commits{/sha}","git_commits_url":"https://api.github.com/repos/BZngr/Rubberduck/git/commits{/sha}","comments_url":"https://api.github.com/repos/BZngr/Rubberduck/comments{/number}","issue_comment_url":"https://api.github.com/repos/BZngr/Rubberduck/issues/comments{/number}","contents_url":"https://api.github.com/repos/BZngr/Rubberduck/contents/{+path}","compare_url":"https://api.github.com/repos/BZngr/Rubberduck/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BZngr/Rubberduck/merges","archive_url":"https://api.github.com/repos/BZngr/Rubberduck/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BZngr/Rubberduck/downloads","issues_url":"https://api.github.com/repos/BZngr/Rubberduck/issues{/number}","pulls_url":"https://api.github.com/repos/BZngr/Rubberduck/pulls{/number}","milestones_url":"https://api.github.com/repos/BZngr/Rubberduck/milestones{/number}","notifications_url":"https://api.github.com/repos/BZngr/Rubberduck/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BZngr/Rubberduck/labels{/name}","releases_url":"https://api.github.com/repos/BZngr/Rubberduck/releases{/id}","deployments_url":"https://api.github.com/repos/BZngr/Rubberduck/deployments","created_at":"2017-01-30T20:00:54Z","updated_at":"2017-01-30T20:30:54Z","pushed_at":"2018-06-27T14:24:05Z","git_url":"git://github.com/BZngr/Rubberduck.git","ssh_url":"git@github.com:BZngr/Rubberduck.git","clone_url":"https://github.com/BZngr/Rubberduck.git","svn_url":"https://github.com/BZngr/Rubberduck","homepage":"","size":63745,"stargazers_count":1,"watchers_count":1,"language":"C#","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":1,"default_branch":"next"}},"base":{"label":"rubberduck-vba:next","ref":"next","sha":"7da2d1405b011a78a741f5600e8476e7c3ca9d8b","user":{"login":"rubberduck-vba","id":12832254,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyODMyMjU0","avatar_url":"https://avatars0.githubusercontent.com/u/12832254?v=4","gravatar_id":"","url":"https://api.github.com/users/rubberduck-vba","html_url":"https://github.com/rubberduck-vba","followers_url":"https://api.github.com/users/rubberduck-vba/followers","following_url":"https://api.github.com/users/rubberduck-vba/following{/other_user}","gists_url":"https://api.github.com/users/rubberduck-vba/gists{/gist_id}","starred_url":"https://api.github.com/users/rubberduck-vba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rubberduck-vba/subscriptions","organizations_url":"https://api.github.com/users/rubberduck-vba/orgs","repos_url":"https://api.github.com/users/rubberduck-vba/repos","events_url":"https://api.github.com/users/rubberduck-vba/events{/privacy}","received_events_url":"https://api.github.com/users/rubberduck-vba/received_events","type":"Organization","site_admin":false},"repo":{"id":25800128,"node_id":"MDEwOlJlcG9zaXRvcnkyNTgwMDEyOA==","name":"Rubberduck","full_name":"rubberduck-vba/Rubberduck","owner":{"login":"rubberduck-vba","id":12832254,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyODMyMjU0","avatar_url":"https://avatars0.githubusercontent.com/u/12832254?v=4","gravatar_id":"","url":"https://api.github.com/users/rubberduck-vba","html_url":"https://github.com/rubberduck-vba","followers_url":"https://api.github.com/users/rubberduck-vba/followers","following_url":"https://api.github.com/users/rubberduck-vba/following{/other_user}","gists_url":"https://api.github.com/users/rubberduck-vba/gists{/gist_id}","starred_url":"https://api.github.com/users/rubberduck-vba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rubberduck-vba/subscriptions","organizations_url":"https://api.github.com/users/rubberduck-vba/orgs","repos_url":"https://api.github.com/users/rubberduck-vba/repos","events_url":"https://api.github.com/users/rubberduck-vba/events{/privacy}","received_events_url":"https://api.github.com/users/rubberduck-vba/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rubberduck-vba/Rubberduck","description":"Every programmer needs a rubberduck. COM add-in for the VBA IDE (VBE).","fork":false,"url":"https://api.github.com/repos/rubberduck-vba/Rubberduck","forks_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/forks","keys_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/teams","hooks_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/hooks","issue_events_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/issues/events{/number}","events_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/events","assignees_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/assignees{/user}","branches_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/branches{/branch}","tags_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/tags","blobs_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/git/refs{/sha}","trees_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/statuses/{sha}","languages_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/languages","stargazers_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/stargazers","contributors_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/contributors","subscribers_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/subscribers","subscription_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/subscription","commits_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/commits{/sha}","git_commits_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/git/commits{/sha}","comments_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/comments{/number}","issue_comment_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/issues/comments{/number}","contents_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/contents/{+path}","compare_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/merges","archive_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/downloads","issues_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/issues{/number}","pulls_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/pulls{/number}","milestones_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/milestones{/number}","notifications_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/labels{/name}","releases_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/releases{/id}","deployments_url":"https://api.github.com/repos/rubberduck-vba/Rubberduck/deployments","created_at":"2014-10-27T02:35:11Z","updated_at":"2018-06-27T14:32:35Z","pushed_at":"2018-06-27T14:32:33Z","git_url":"git://github.com/rubberduck-vba/Rubberduck.git","ssh_url":"git@github.com:rubberduck-vba/Rubberduck.git","clone_url":"https://github.com/rubberduck-vba/Rubberduck.git","svn_url":"https://github.com/rubberduck-vba/Rubberduck","homepage":"","size":63832,"stargazers_count":604,"watchers_count":604,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":156,"mirror_url":null,"archived":false,"open_issues_count":706,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":156,"open_issues":706,"watchers":604,"default_branch":"next"}},"_links":{"self":{"href":"https://api.github.com/repos/rubberduck-vba/Rubberduck/pulls/4127"},"html":{"href":"https://github.com/rubberduck-vba/Rubberduck/pull/4127"},"issue":{"href":"https://api.github.com/repos/rubberduck-vba/Rubberduck/issues/4127"},"comments":{"href":"https://api.github.com/repos/rubberduck-vba/Rubberduck/issues/4127/comments"},"review_comments":{"href":"https://api.github.com/repos/rubberduck-vba/Rubberduck/pulls/4127/comments"},"review_comment":{"href":"https://api.github.com/repos/rubberduck-vba/Rubberduck/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rubberduck-vba/Rubberduck/pulls/4127/commits"},"statuses":{"href":"https://api.github.com/repos/rubberduck-vba/Rubberduck/statuses/d80016c3767c28bb0b45aaa699adbe92187a2068"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"BZngr"}}