{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/roslyn/pulls/comments/92726216","pull_request_review_id":13247533,"id":92726216,"diff_hunk":"@@ -8247,6 +8247,186 @@ static void Test<T>((T, T, T) x)\n         }\n \n         [Fact]\n+        public void Constraints_01()\n+        {\n+            var source = @\"\n+namespace System\n+{\n+    public struct ValueTuple<T1, T2>\n+        where T2 : class\n+    {\n+        public ValueTuple(T1 _1, T2 _2)\n+        {\n+        }\n+    }\n+}\n+class C\n+{\n+    static void Main((int, int) p)\n+    {\n+        var t0 = (1, 2);\n+        (int, int) t1 = t0;\n+    }\n+}\";\n+            var comp = CreateCompilationWithMscorlib45AndCSruntime(source);\n+            comp.VerifyDiagnostics(\n+                // (14,33): error CS0452: The type 'int' must be a reference type in order to use it as parameter 'T2' in the generic type or method 'ValueTuple<T1, T2>'\n+                //     static void Main((int, int) p)\n+                Diagnostic(ErrorCode.ERR_RefConstraintNotSatisfied, \"p\").WithArguments(\"System.ValueTuple<T1, T2>\", \"T2\", \"int\").WithLocation(14, 33),\n+                // (16,22): error CS0452: The type 'int' must be a reference type in order to use it as parameter 'T2' in the generic type or method 'ValueTuple<T1, T2>'\n+                //         var t0 = (1, 2);\n+                Diagnostic(ErrorCode.ERR_RefConstraintNotSatisfied, \"2\").WithArguments(\"System.ValueTuple<T1, T2>\", \"T2\", \"int\").WithLocation(16, 22),\n+                // (17,15): error CS0452: The type 'int' must be a reference type in order to use it as parameter 'T2' in the generic type or method 'ValueTuple<T1, T2>'\n+                //         (int, int) t1 = t0\n+                Diagnostic(ErrorCode.ERR_RefConstraintNotSatisfied, \"int\").WithArguments(\"System.ValueTuple<T1, T2>\", \"T2\", \"int\").WithLocation(17, 15)\n+            );\n+        }\n+\n+        [Fact]\n+        [WorkItem(15399, \"https://github.com/dotnet/roslyn/issues/15399\")]\n+        public void Constraints_02()\n+        {\n+            var source = @\"\n+using System;\n+class Program\n+{\n+    unsafe void M((int, int*) p, ValueTuple<int, int*> q)\n+    {\n+        (int, int*) t0 = p;\n+        var t1 = (1, (int*)null);\n+        var t2 = new ValueTuple<int, int*>(1, null);\n+        ValueTuple<int, int*> t3 = t2;\n+    }\n+}\";\n+            var comp = CreateCompilationWithMscorlib45AndCSruntime(source, additionalRefs: s_valueTupleRefs,\n+               options: TestOptions.UnsafeDebugDll);\n+            comp.VerifyDiagnostics(\n+                // (5,31): error CS0306: The type 'int*' may not be used as a type argument\n+                //     unsafe void M((int, int*) p, ValueTuple<int, int*> q)\n+                Diagnostic(ErrorCode.ERR_BadTypeArgument, \"p\").WithArguments(\"int*\").WithLocation(5, 31),\n+                // (5,56): error CS0306: The type 'int*' may not be used as a type argument\n+                //     unsafe void M((int, int*) p, ValueTuple<int, int*> q)\n+                Diagnostic(ErrorCode.ERR_BadTypeArgument, \"q\").WithArguments(\"int*\").WithLocation(5, 56),\n+                // (7,15): error CS0306: The type 'int*' may not be used as a type argument\n+                //         (int, int*) t0 = p;\n+                Diagnostic(ErrorCode.ERR_BadTypeArgument, \"int*\").WithArguments(\"int*\").WithLocation(7, 15),\n+                // (8,22): error CS0306: The type 'int*' may not be used as a type argument\n+                //         var t1 = (1, (int*)null);\n+                Diagnostic(ErrorCode.ERR_BadTypeArgument, \"(int*)null\").WithArguments(\"int*\").WithLocation(8, 22),\n+                // (9,38): error CS0306: The type 'int*' may not be used as a type argument\n+                //         var t2 = new ValueTuple<int, int*>(1, null);\n+                Diagnostic(ErrorCode.ERR_BadTypeArgument, \"int*\").WithArguments(\"int*\").WithLocation(9, 38),\n+                // (10,25): error CS0306: The type 'int*' may not be used as a type argument\n+                //         ValueTuple<int, int*> t3 = t2;\n+                Diagnostic(ErrorCode.ERR_BadTypeArgument, \"int*\").WithArguments(\"int*\").WithLocation(10, 25)\n+            );\n+        }\n+\n+        [Fact]\n+        public void Constraints_03()\n+        {\n+            var source = @\"\n+using System.Collections.Generic;\n+namespace System\n+{\n+    public struct ValueTuple<T1, T2>\n+        where T2 : class\n+    {\n+        public ValueTuple(T1 _1, T2 _2)\n+        {\n+        }\n+    }\n+}\n+class C<T>","path":"src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenTupleTest.cs","position":94,"original_position":94,"commit_id":"f12d8f0a6ef79618af7d0ae8d2a47564018d547f","original_commit_id":"f12d8f0a6ef79618af7d0ae8d2a47564018d547f","user":{"login":"alrz","id":3105979,"avatar_url":"https://avatars.githubusercontent.com/u/3105979?v=3","gravatar_id":"","url":"https://api.github.com/users/alrz","html_url":"https://github.com/alrz","followers_url":"https://api.github.com/users/alrz/followers","following_url":"https://api.github.com/users/alrz/following{/other_user}","gists_url":"https://api.github.com/users/alrz/gists{/gist_id}","starred_url":"https://api.github.com/users/alrz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alrz/subscriptions","organizations_url":"https://api.github.com/users/alrz/orgs","repos_url":"https://api.github.com/users/alrz/repos","events_url":"https://api.github.com/users/alrz/events{/privacy}","received_events_url":"https://api.github.com/users/alrz/received_events","type":"User","site_admin":false},"body":"Already done.","created_at":"2016-12-15T23:52:11Z","updated_at":"2016-12-15T23:52:11Z","html_url":"https://github.com/dotnet/roslyn/pull/15641#discussion_r92726216","pull_request_url":"https://api.github.com/repos/dotnet/roslyn/pulls/15641","_links":{"self":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/comments/92726216"},"html":{"href":"https://github.com/dotnet/roslyn/pull/15641#discussion_r92726216"},"pull_request":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/15641"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/roslyn/pulls/15641","id":96266364,"html_url":"https://github.com/dotnet/roslyn/pull/15641","diff_url":"https://github.com/dotnet/roslyn/pull/15641.diff","patch_url":"https://github.com/dotnet/roslyn/pull/15641.patch","issue_url":"https://api.github.com/repos/dotnet/roslyn/issues/15641","number":15641,"state":"open","locked":false,"title":"Add constraint checking for tuple types","user":{"login":"alrz","id":3105979,"avatar_url":"https://avatars.githubusercontent.com/u/3105979?v=3","gravatar_id":"","url":"https://api.github.com/users/alrz","html_url":"https://github.com/alrz","followers_url":"https://api.github.com/users/alrz/followers","following_url":"https://api.github.com/users/alrz/following{/other_user}","gists_url":"https://api.github.com/users/alrz/gists{/gist_id}","starred_url":"https://api.github.com/users/alrz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alrz/subscriptions","organizations_url":"https://api.github.com/users/alrz/orgs","repos_url":"https://api.github.com/users/alrz/repos","events_url":"https://api.github.com/users/alrz/events{/privacy}","received_events_url":"https://api.github.com/users/alrz/received_events","type":"User","site_admin":false},"body":"Fixes #15399","created_at":"2016-12-02T11:47:08Z","updated_at":"2016-12-15T23:52:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"930d15c009208c08ee10162eac0f5e3a3b6809f7","assignee":{"login":"jcouv","id":12466233,"avatar_url":"https://avatars.githubusercontent.com/u/12466233?v=3","gravatar_id":"","url":"https://api.github.com/users/jcouv","html_url":"https://github.com/jcouv","followers_url":"https://api.github.com/users/jcouv/followers","following_url":"https://api.github.com/users/jcouv/following{/other_user}","gists_url":"https://api.github.com/users/jcouv/gists{/gist_id}","starred_url":"https://api.github.com/users/jcouv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcouv/subscriptions","organizations_url":"https://api.github.com/users/jcouv/orgs","repos_url":"https://api.github.com/users/jcouv/repos","events_url":"https://api.github.com/users/jcouv/events{/privacy}","received_events_url":"https://api.github.com/users/jcouv/received_events","type":"User","site_admin":false},"assignees":[{"login":"jcouv","id":12466233,"avatar_url":"https://avatars.githubusercontent.com/u/12466233?v=3","gravatar_id":"","url":"https://api.github.com/users/jcouv","html_url":"https://github.com/jcouv","followers_url":"https://api.github.com/users/jcouv/followers","following_url":"https://api.github.com/users/jcouv/following{/other_user}","gists_url":"https://api.github.com/users/jcouv/gists{/gist_id}","starred_url":"https://api.github.com/users/jcouv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcouv/subscriptions","organizations_url":"https://api.github.com/users/jcouv/orgs","repos_url":"https://api.github.com/users/jcouv/repos","events_url":"https://api.github.com/users/jcouv/events{/privacy}","received_events_url":"https://api.github.com/users/jcouv/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/dotnet/roslyn/milestones/25","html_url":"https://github.com/dotnet/roslyn/milestone/25","labels_url":"https://api.github.com/repos/dotnet/roslyn/milestones/25/labels","id":2090736,"number":25,"title":"2.0 (RC.3)","description":"","creator":{"login":"jaredpar","id":146967,"avatar_url":"https://avatars.githubusercontent.com/u/146967?v=3","gravatar_id":"","url":"https://api.github.com/users/jaredpar","html_url":"https://github.com/jaredpar","followers_url":"https://api.github.com/users/jaredpar/followers","following_url":"https://api.github.com/users/jaredpar/following{/other_user}","gists_url":"https://api.github.com/users/jaredpar/gists{/gist_id}","starred_url":"https://api.github.com/users/jaredpar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaredpar/subscriptions","organizations_url":"https://api.github.com/users/jaredpar/orgs","repos_url":"https://api.github.com/users/jaredpar/repos","events_url":"https://api.github.com/users/jaredpar/events{/privacy}","received_events_url":"https://api.github.com/users/jaredpar/received_events","type":"User","site_admin":false},"open_issues":205,"closed_issues":107,"state":"open","created_at":"2016-10-24T21:54:30Z","updated_at":"2016-12-15T21:46:44Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/dotnet/roslyn/pulls/15641/commits","review_comments_url":"https://api.github.com/repos/dotnet/roslyn/pulls/15641/comments","review_comment_url":"https://api.github.com/repos/dotnet/roslyn/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/15641/comments","statuses_url":"https://api.github.com/repos/dotnet/roslyn/statuses/f12d8f0a6ef79618af7d0ae8d2a47564018d547f","head":{"label":"alrz:issue-15399","ref":"issue-15399","sha":"f12d8f0a6ef79618af7d0ae8d2a47564018d547f","user":{"login":"alrz","id":3105979,"avatar_url":"https://avatars.githubusercontent.com/u/3105979?v=3","gravatar_id":"","url":"https://api.github.com/users/alrz","html_url":"https://github.com/alrz","followers_url":"https://api.github.com/users/alrz/followers","following_url":"https://api.github.com/users/alrz/following{/other_user}","gists_url":"https://api.github.com/users/alrz/gists{/gist_id}","starred_url":"https://api.github.com/users/alrz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alrz/subscriptions","organizations_url":"https://api.github.com/users/alrz/orgs","repos_url":"https://api.github.com/users/alrz/repos","events_url":"https://api.github.com/users/alrz/events{/privacy}","received_events_url":"https://api.github.com/users/alrz/received_events","type":"User","site_admin":false},"repo":{"id":54348191,"name":"roslyn","full_name":"alrz/roslyn","owner":{"login":"alrz","id":3105979,"avatar_url":"https://avatars.githubusercontent.com/u/3105979?v=3","gravatar_id":"","url":"https://api.github.com/users/alrz","html_url":"https://github.com/alrz","followers_url":"https://api.github.com/users/alrz/followers","following_url":"https://api.github.com/users/alrz/following{/other_user}","gists_url":"https://api.github.com/users/alrz/gists{/gist_id}","starred_url":"https://api.github.com/users/alrz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alrz/subscriptions","organizations_url":"https://api.github.com/users/alrz/orgs","repos_url":"https://api.github.com/users/alrz/repos","events_url":"https://api.github.com/users/alrz/events{/privacy}","received_events_url":"https://api.github.com/users/alrz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alrz/roslyn","description":"The .NET Compiler Platform (\"Roslyn\") provides open-source C# and Visual Basic compilers with rich code analysis APIs.","fork":true,"url":"https://api.github.com/repos/alrz/roslyn","forks_url":"https://api.github.com/repos/alrz/roslyn/forks","keys_url":"https://api.github.com/repos/alrz/roslyn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alrz/roslyn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alrz/roslyn/teams","hooks_url":"https://api.github.com/repos/alrz/roslyn/hooks","issue_events_url":"https://api.github.com/repos/alrz/roslyn/issues/events{/number}","events_url":"https://api.github.com/repos/alrz/roslyn/events","assignees_url":"https://api.github.com/repos/alrz/roslyn/assignees{/user}","branches_url":"https://api.github.com/repos/alrz/roslyn/branches{/branch}","tags_url":"https://api.github.com/repos/alrz/roslyn/tags","blobs_url":"https://api.github.com/repos/alrz/roslyn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alrz/roslyn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alrz/roslyn/git/refs{/sha}","trees_url":"https://api.github.com/repos/alrz/roslyn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alrz/roslyn/statuses/{sha}","languages_url":"https://api.github.com/repos/alrz/roslyn/languages","stargazers_url":"https://api.github.com/repos/alrz/roslyn/stargazers","contributors_url":"https://api.github.com/repos/alrz/roslyn/contributors","subscribers_url":"https://api.github.com/repos/alrz/roslyn/subscribers","subscription_url":"https://api.github.com/repos/alrz/roslyn/subscription","commits_url":"https://api.github.com/repos/alrz/roslyn/commits{/sha}","git_commits_url":"https://api.github.com/repos/alrz/roslyn/git/commits{/sha}","comments_url":"https://api.github.com/repos/alrz/roslyn/comments{/number}","issue_comment_url":"https://api.github.com/repos/alrz/roslyn/issues/comments{/number}","contents_url":"https://api.github.com/repos/alrz/roslyn/contents/{+path}","compare_url":"https://api.github.com/repos/alrz/roslyn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alrz/roslyn/merges","archive_url":"https://api.github.com/repos/alrz/roslyn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alrz/roslyn/downloads","issues_url":"https://api.github.com/repos/alrz/roslyn/issues{/number}","pulls_url":"https://api.github.com/repos/alrz/roslyn/pulls{/number}","milestones_url":"https://api.github.com/repos/alrz/roslyn/milestones{/number}","notifications_url":"https://api.github.com/repos/alrz/roslyn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alrz/roslyn/labels{/name}","releases_url":"https://api.github.com/repos/alrz/roslyn/releases{/id}","deployments_url":"https://api.github.com/repos/alrz/roslyn/deployments","created_at":"2016-03-21T00:28:36Z","updated_at":"2016-03-21T00:29:08Z","pushed_at":"2016-12-12T18:53:57Z","git_url":"git://github.com/alrz/roslyn.git","ssh_url":"git@github.com:alrz/roslyn.git","clone_url":"https://github.com/alrz/roslyn.git","svn_url":"https://github.com/alrz/roslyn","homepage":"","size":194647,"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":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"974abc9929f93abb1c2a4a6929c5c886a9fce42c","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":29078997,"name":"roslyn","full_name":"dotnet/roslyn","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/roslyn","description":"The .NET Compiler Platform (\"Roslyn\") provides open-source C# and Visual Basic compilers with rich code analysis APIs.","fork":false,"url":"https://api.github.com/repos/dotnet/roslyn","forks_url":"https://api.github.com/repos/dotnet/roslyn/forks","keys_url":"https://api.github.com/repos/dotnet/roslyn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/roslyn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/roslyn/teams","hooks_url":"https://api.github.com/repos/dotnet/roslyn/hooks","issue_events_url":"https://api.github.com/repos/dotnet/roslyn/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/roslyn/events","assignees_url":"https://api.github.com/repos/dotnet/roslyn/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/roslyn/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/roslyn/tags","blobs_url":"https://api.github.com/repos/dotnet/roslyn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/roslyn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/roslyn/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/roslyn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/roslyn/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/roslyn/languages","stargazers_url":"https://api.github.com/repos/dotnet/roslyn/stargazers","contributors_url":"https://api.github.com/repos/dotnet/roslyn/contributors","subscribers_url":"https://api.github.com/repos/dotnet/roslyn/subscribers","subscription_url":"https://api.github.com/repos/dotnet/roslyn/subscription","commits_url":"https://api.github.com/repos/dotnet/roslyn/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/roslyn/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/roslyn/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/roslyn/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/roslyn/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/roslyn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/roslyn/merges","archive_url":"https://api.github.com/repos/dotnet/roslyn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/roslyn/downloads","issues_url":"https://api.github.com/repos/dotnet/roslyn/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/roslyn/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/roslyn/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/roslyn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/roslyn/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/roslyn/releases{/id}","deployments_url":"https://api.github.com/repos/dotnet/roslyn/deployments","created_at":"2015-01-11T02:39:03Z","updated_at":"2016-12-15T12:49:37Z","pushed_at":"2016-12-15T23:46:26Z","git_url":"git://github.com/dotnet/roslyn.git","ssh_url":"git@github.com:dotnet/roslyn.git","clone_url":"https://github.com/dotnet/roslyn.git","svn_url":"https://github.com/dotnet/roslyn","homepage":"","size":195991,"stargazers_count":6696,"watchers_count":6696,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1611,"mirror_url":null,"open_issues_count":3507,"forks":1611,"open_issues":3507,"watchers":6696,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/15641"},"html":{"href":"https://github.com/dotnet/roslyn/pull/15641"},"issue":{"href":"https://api.github.com/repos/dotnet/roslyn/issues/15641"},"comments":{"href":"https://api.github.com/repos/dotnet/roslyn/issues/15641/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/15641/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/15641/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/roslyn/statuses/f12d8f0a6ef79618af7d0ae8d2a47564018d547f"}}}}
{"actor":{"display_login":"alrz"}}