{"action":"created","comment":{"url":"https://api.github.com/repos/apple/swift/pulls/comments/55877938","id":55877938,"diff_hunk":"@@ -467,13 +468,46 @@ auto ArchetypeBuilder::PotentialArchetype::getNestedType(\n   // archetype conforms.\n   for (auto &conforms : ConformsTo) {\n     for (auto member : conforms.first->lookupDirect(nestedName)) {\n-      auto assocType = dyn_cast<AssociatedTypeDecl>(member);\n-      if (!assocType)\n+      PotentialArchetype *pa;\n+      \n+      if (auto assocType = dyn_cast<AssociatedTypeDecl>(member)) {\n+        // Resolve this nested type to this associated type.\n+        pa = new PotentialArchetype(this, assocType);\n+      } else if (auto alias = dyn_cast<TypeAliasDecl>(member)) {\n+        // Resolve this nested type to this type alias.\n+        pa = new PotentialArchetype(this, alias);\n+        \n+        if (alias->hasUnderlyingType()) {\n+          auto type = alias->getUnderlyingType();\n+          if (type->hasArchetype()) {\n+            auto repr = alias->getUnderlyingTypeLoc().getTypeRepr();\n+            \n+            if (auto identRepr = dyn_cast<IdentTypeRepr>(repr)) {\n+              PotentialArchetype *existingPA = this;\n+              for (auto component : identRepr->getComponentRange()) {\n+                existingPA = existingPA->getNestedType(component->getIdentifier(),","path":"lib/AST/ArchetypeBuilder.cpp","position":null,"original_position":49,"commit_id":"6bdbe01328f4ce8cd9269e24589af74201d78c37","original_commit_id":"09cae1cd2d8914f70966c02281cbd89dd6e4a04c","user":{"login":"gregomni","id":15795449,"avatar_url":"https://avatars.githubusercontent.com/u/15795449?v=3","gravatar_id":"","url":"https://api.github.com/users/gregomni","html_url":"https://github.com/gregomni","followers_url":"https://api.github.com/users/gregomni/followers","following_url":"https://api.github.com/users/gregomni/following{/other_user}","gists_url":"https://api.github.com/users/gregomni/gists{/gist_id}","starred_url":"https://api.github.com/users/gregomni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregomni/subscriptions","organizations_url":"https://api.github.com/users/gregomni/orgs","repos_url":"https://api.github.com/users/gregomni/repos","events_url":"https://api.github.com/users/gregomni/events{/privacy}","received_events_url":"https://api.github.com/users/gregomni/received_events","type":"User","site_admin":false},"body":"Added a commit decomposing the archetypes, definitely better.","created_at":"2016-03-11T19:40:58Z","updated_at":"2016-03-11T19:40:58Z","html_url":"https://github.com/apple/swift/pull/1610#discussion_r55877938","pull_request_url":"https://api.github.com/repos/apple/swift/pulls/1610","_links":{"self":{"href":"https://api.github.com/repos/apple/swift/pulls/comments/55877938"},"html":{"href":"https://github.com/apple/swift/pull/1610#discussion_r55877938"},"pull_request":{"href":"https://api.github.com/repos/apple/swift/pulls/1610"}}},"pull_request":{"url":"https://api.github.com/repos/apple/swift/pulls/1610","id":62342002,"html_url":"https://github.com/apple/swift/pull/1610","diff_url":"https://github.com/apple/swift/pull/1610.diff","patch_url":"https://github.com/apple/swift/pull/1610.patch","issue_url":"https://api.github.com/repos/apple/swift/issues/1610","number":1610,"state":"open","locked":false,"title":"[Parse/AST/Sema] Split parsing for typealias & associatedtype, allow typealias in protocols and generic constraints","user":{"login":"gregomni","id":15795449,"avatar_url":"https://avatars.githubusercontent.com/u/15795449?v=3","gravatar_id":"","url":"https://api.github.com/users/gregomni","html_url":"https://github.com/gregomni","followers_url":"https://api.github.com/users/gregomni/followers","following_url":"https://api.github.com/users/gregomni/following{/other_user}","gists_url":"https://api.github.com/users/gregomni/gists{/gist_id}","starred_url":"https://api.github.com/users/gregomni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregomni/subscriptions","organizations_url":"https://api.github.com/users/gregomni/orgs","repos_url":"https://api.github.com/users/gregomni/repos","events_url":"https://api.github.com/users/gregomni/events{/privacy}","received_events_url":"https://api.github.com/users/gregomni/received_events","type":"User","site_admin":false},"body":"Split up parsing of typealias and associatedtype, including dropping a now unneeded ParseDeclOptions flag.\n\nThen made typealias in a protocol actually valid, which works great except that you can't use them in where clauses in generics now. So produce a specific diagnosis if you try to use them as if they were an associatedtype in a where clause, but otherwise they act like you would hope for protocol conformance purposes (i.e. as an alias possibly involved in the types of other func/var conformances, not as a hidden\ngeneric param in itself).","created_at":"2016-03-10T05:37:16Z","updated_at":"2016-03-11T19:40:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"11b35b2cb6fcbb7165877824ca822008c8eddc52","assignee":{"login":"DougGregor","id":989428,"avatar_url":"https://avatars.githubusercontent.com/u/989428?v=3","gravatar_id":"","url":"https://api.github.com/users/DougGregor","html_url":"https://github.com/DougGregor","followers_url":"https://api.github.com/users/DougGregor/followers","following_url":"https://api.github.com/users/DougGregor/following{/other_user}","gists_url":"https://api.github.com/users/DougGregor/gists{/gist_id}","starred_url":"https://api.github.com/users/DougGregor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DougGregor/subscriptions","organizations_url":"https://api.github.com/users/DougGregor/orgs","repos_url":"https://api.github.com/users/DougGregor/repos","events_url":"https://api.github.com/users/DougGregor/events{/privacy}","received_events_url":"https://api.github.com/users/DougGregor/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/apple/swift/pulls/1610/commits","review_comments_url":"https://api.github.com/repos/apple/swift/pulls/1610/comments","review_comment_url":"https://api.github.com/repos/apple/swift/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apple/swift/issues/1610/comments","statuses_url":"https://api.github.com/repos/apple/swift/statuses/6bdbe01328f4ce8cd9269e24589af74201d78c37","head":{"label":"gregomni:typealias","ref":"typealias","sha":"6bdbe01328f4ce8cd9269e24589af74201d78c37","user":{"login":"gregomni","id":15795449,"avatar_url":"https://avatars.githubusercontent.com/u/15795449?v=3","gravatar_id":"","url":"https://api.github.com/users/gregomni","html_url":"https://github.com/gregomni","followers_url":"https://api.github.com/users/gregomni/followers","following_url":"https://api.github.com/users/gregomni/following{/other_user}","gists_url":"https://api.github.com/users/gregomni/gists{/gist_id}","starred_url":"https://api.github.com/users/gregomni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregomni/subscriptions","organizations_url":"https://api.github.com/users/gregomni/orgs","repos_url":"https://api.github.com/users/gregomni/repos","events_url":"https://api.github.com/users/gregomni/events{/privacy}","received_events_url":"https://api.github.com/users/gregomni/received_events","type":"User","site_admin":false},"repo":{"id":47734038,"name":"swift","full_name":"gregomni/swift","owner":{"login":"gregomni","id":15795449,"avatar_url":"https://avatars.githubusercontent.com/u/15795449?v=3","gravatar_id":"","url":"https://api.github.com/users/gregomni","html_url":"https://github.com/gregomni","followers_url":"https://api.github.com/users/gregomni/followers","following_url":"https://api.github.com/users/gregomni/following{/other_user}","gists_url":"https://api.github.com/users/gregomni/gists{/gist_id}","starred_url":"https://api.github.com/users/gregomni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregomni/subscriptions","organizations_url":"https://api.github.com/users/gregomni/orgs","repos_url":"https://api.github.com/users/gregomni/repos","events_url":"https://api.github.com/users/gregomni/events{/privacy}","received_events_url":"https://api.github.com/users/gregomni/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gregomni/swift","description":"The Swift Programming Language","fork":true,"url":"https://api.github.com/repos/gregomni/swift","forks_url":"https://api.github.com/repos/gregomni/swift/forks","keys_url":"https://api.github.com/repos/gregomni/swift/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gregomni/swift/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gregomni/swift/teams","hooks_url":"https://api.github.com/repos/gregomni/swift/hooks","issue_events_url":"https://api.github.com/repos/gregomni/swift/issues/events{/number}","events_url":"https://api.github.com/repos/gregomni/swift/events","assignees_url":"https://api.github.com/repos/gregomni/swift/assignees{/user}","branches_url":"https://api.github.com/repos/gregomni/swift/branches{/branch}","tags_url":"https://api.github.com/repos/gregomni/swift/tags","blobs_url":"https://api.github.com/repos/gregomni/swift/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gregomni/swift/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gregomni/swift/git/refs{/sha}","trees_url":"https://api.github.com/repos/gregomni/swift/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gregomni/swift/statuses/{sha}","languages_url":"https://api.github.com/repos/gregomni/swift/languages","stargazers_url":"https://api.github.com/repos/gregomni/swift/stargazers","contributors_url":"https://api.github.com/repos/gregomni/swift/contributors","subscribers_url":"https://api.github.com/repos/gregomni/swift/subscribers","subscription_url":"https://api.github.com/repos/gregomni/swift/subscription","commits_url":"https://api.github.com/repos/gregomni/swift/commits{/sha}","git_commits_url":"https://api.github.com/repos/gregomni/swift/git/commits{/sha}","comments_url":"https://api.github.com/repos/gregomni/swift/comments{/number}","issue_comment_url":"https://api.github.com/repos/gregomni/swift/issues/comments{/number}","contents_url":"https://api.github.com/repos/gregomni/swift/contents/{+path}","compare_url":"https://api.github.com/repos/gregomni/swift/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gregomni/swift/merges","archive_url":"https://api.github.com/repos/gregomni/swift/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gregomni/swift/downloads","issues_url":"https://api.github.com/repos/gregomni/swift/issues{/number}","pulls_url":"https://api.github.com/repos/gregomni/swift/pulls{/number}","milestones_url":"https://api.github.com/repos/gregomni/swift/milestones{/number}","notifications_url":"https://api.github.com/repos/gregomni/swift/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gregomni/swift/labels{/name}","releases_url":"https://api.github.com/repos/gregomni/swift/releases{/id}","deployments_url":"https://api.github.com/repos/gregomni/swift/deployments","created_at":"2015-12-10T02:58:32Z","updated_at":"2016-01-13T15:52:33Z","pushed_at":"2016-03-11T16:58:50Z","git_url":"git://github.com/gregomni/swift.git","ssh_url":"git@github.com:gregomni/swift.git","clone_url":"https://github.com/gregomni/swift.git","svn_url":"https://github.com/gregomni/swift","homepage":"","size":80264,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apple:master","ref":"master","sha":"5481743bc7635f3b3c8e525314cccaf6f0ec00d1","user":{"login":"apple","id":10639145,"avatar_url":"https://avatars.githubusercontent.com/u/10639145?v=3","gravatar_id":"","url":"https://api.github.com/users/apple","html_url":"https://github.com/apple","followers_url":"https://api.github.com/users/apple/followers","following_url":"https://api.github.com/users/apple/following{/other_user}","gists_url":"https://api.github.com/users/apple/gists{/gist_id}","starred_url":"https://api.github.com/users/apple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apple/subscriptions","organizations_url":"https://api.github.com/users/apple/orgs","repos_url":"https://api.github.com/users/apple/repos","events_url":"https://api.github.com/users/apple/events{/privacy}","received_events_url":"https://api.github.com/users/apple/received_events","type":"Organization","site_admin":false},"repo":{"id":44838949,"name":"swift","full_name":"apple/swift","owner":{"login":"apple","id":10639145,"avatar_url":"https://avatars.githubusercontent.com/u/10639145?v=3","gravatar_id":"","url":"https://api.github.com/users/apple","html_url":"https://github.com/apple","followers_url":"https://api.github.com/users/apple/followers","following_url":"https://api.github.com/users/apple/following{/other_user}","gists_url":"https://api.github.com/users/apple/gists{/gist_id}","starred_url":"https://api.github.com/users/apple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apple/subscriptions","organizations_url":"https://api.github.com/users/apple/orgs","repos_url":"https://api.github.com/users/apple/repos","events_url":"https://api.github.com/users/apple/events{/privacy}","received_events_url":"https://api.github.com/users/apple/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apple/swift","description":"The Swift Programming Language","fork":false,"url":"https://api.github.com/repos/apple/swift","forks_url":"https://api.github.com/repos/apple/swift/forks","keys_url":"https://api.github.com/repos/apple/swift/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apple/swift/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apple/swift/teams","hooks_url":"https://api.github.com/repos/apple/swift/hooks","issue_events_url":"https://api.github.com/repos/apple/swift/issues/events{/number}","events_url":"https://api.github.com/repos/apple/swift/events","assignees_url":"https://api.github.com/repos/apple/swift/assignees{/user}","branches_url":"https://api.github.com/repos/apple/swift/branches{/branch}","tags_url":"https://api.github.com/repos/apple/swift/tags","blobs_url":"https://api.github.com/repos/apple/swift/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apple/swift/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apple/swift/git/refs{/sha}","trees_url":"https://api.github.com/repos/apple/swift/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apple/swift/statuses/{sha}","languages_url":"https://api.github.com/repos/apple/swift/languages","stargazers_url":"https://api.github.com/repos/apple/swift/stargazers","contributors_url":"https://api.github.com/repos/apple/swift/contributors","subscribers_url":"https://api.github.com/repos/apple/swift/subscribers","subscription_url":"https://api.github.com/repos/apple/swift/subscription","commits_url":"https://api.github.com/repos/apple/swift/commits{/sha}","git_commits_url":"https://api.github.com/repos/apple/swift/git/commits{/sha}","comments_url":"https://api.github.com/repos/apple/swift/comments{/number}","issue_comment_url":"https://api.github.com/repos/apple/swift/issues/comments{/number}","contents_url":"https://api.github.com/repos/apple/swift/contents/{+path}","compare_url":"https://api.github.com/repos/apple/swift/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apple/swift/merges","archive_url":"https://api.github.com/repos/apple/swift/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apple/swift/downloads","issues_url":"https://api.github.com/repos/apple/swift/issues{/number}","pulls_url":"https://api.github.com/repos/apple/swift/pulls{/number}","milestones_url":"https://api.github.com/repos/apple/swift/milestones{/number}","notifications_url":"https://api.github.com/repos/apple/swift/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apple/swift/labels{/name}","releases_url":"https://api.github.com/repos/apple/swift/releases{/id}","deployments_url":"https://api.github.com/repos/apple/swift/deployments","created_at":"2015-10-23T21:15:07Z","updated_at":"2016-03-11T19:36:11Z","pushed_at":"2016-03-11T19:38:54Z","git_url":"git://github.com/apple/swift.git","ssh_url":"git@github.com:apple/swift.git","clone_url":"https://github.com/apple/swift.git","svn_url":"https://github.com/apple/swift","homepage":"https://swift.org/","size":101998,"stargazers_count":27557,"watchers_count":27557,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3587,"mirror_url":null,"open_issues_count":70,"forks":3587,"open_issues":70,"watchers":27557,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apple/swift/pulls/1610"},"html":{"href":"https://github.com/apple/swift/pull/1610"},"issue":{"href":"https://api.github.com/repos/apple/swift/issues/1610"},"comments":{"href":"https://api.github.com/repos/apple/swift/issues/1610/comments"},"review_comments":{"href":"https://api.github.com/repos/apple/swift/pulls/1610/comments"},"review_comment":{"href":"https://api.github.com/repos/apple/swift/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apple/swift/pulls/1610/commits"},"statuses":{"href":"https://api.github.com/repos/apple/swift/statuses/6bdbe01328f4ce8cd9269e24589af74201d78c37"}}}}