{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/roslyn/pulls/comments/59436642","id":59436642,"diff_hunk":"@@ -307,6 +325,70 @@ private BoundExpression CreateMethodGroupConversion(CSharpSyntaxNode syntax, Bou\n             return new BoundConversion(syntax, group, conversion, @checked: false, explicitCastInCode: isCast, constantValueOpt: ConstantValue.NotAvailable, type: destination, hasErrors: hasErrors) { WasCompilerGenerated = source.WasCompilerGenerated };\n         }\n \n+        private BoundExpression CreateTupleConversion(CSharpSyntaxNode syntax, BoundExpression source, Conversion conversion, TypeSymbol destination, DiagnosticBag diagnostics)\n+        {\n+            // We have a successful tuple conversion; rather than producing a node \n+            // which is a conversion on top of a tuple literal, tuple conversion is an element-wise conversion of arguments.\n+\n+            var sourceTuple = (BoundTupleLiteral)source;\n+            var targetType = (NamedTypeSymbol)destination;\n+\n+            Debug.Assert(conversion.Kind ==  ConversionKind.ImplicitTuple || conversion.Kind == ConversionKind.ImplicitNullable);\n+            Debug.Assert((conversion.Kind == ConversionKind.ImplicitNullable) == targetType.IsNullableType());\n+\n+            bool hasErrors = false;\n+            NamedTypeSymbol destinationWithoutNullable = null;\n+\n+            if (conversion.Kind == ConversionKind.ImplicitNullable)\n+            {\n+                destinationWithoutNullable = (NamedTypeSymbol)targetType.GetNullableUnderlyingType();\n+                targetType = destinationWithoutNullable;\n+            }\n+\n+            TupleTypeSymbol destTupleType;\n+            if (targetType.IsTupleType)\n+            {\n+                destTupleType = (TupleTypeSymbol)targetType;\n+                targetType = destTupleType.UnderlyingTupleType;\n+            }\n+\n+            var arguments = sourceTuple.Arguments;\n+            Debug.Assert(Compilation.IsTupleUnderlyingType(targetType, arguments.Length), \"converting a tuple literal to incompatible type?\");\n+\n+            var convertedArguments = ArrayBuilder<BoundExpression>.GetInstance(arguments.Length);\n+            var targetElementTypes = ArrayBuilder<TypeSymbol>.GetInstance(arguments.Length);\n+\n+            TupleTypeSymbol.GetElementTypes(targetType, targetElementTypes);","path":"src/Compilers/CSharp/Portable/Binder/Binder_Conversions.cs","position":null,"original_position":85,"commit_id":"a0a3e8e48ea191e55e6242ec4b23f4c20c666282","original_commit_id":"9b10727da94d9a92d1267868dbb111a1072a0432","user":{"login":"VSadov","id":8218165,"avatar_url":"https://avatars.githubusercontent.com/u/8218165?v=3","gravatar_id":"","url":"https://api.github.com/users/VSadov","html_url":"https://github.com/VSadov","followers_url":"https://api.github.com/users/VSadov/followers","following_url":"https://api.github.com/users/VSadov/following{/other_user}","gists_url":"https://api.github.com/users/VSadov/gists{/gist_id}","starred_url":"https://api.github.com/users/VSadov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VSadov/subscriptions","organizations_url":"https://api.github.com/users/VSadov/orgs","repos_url":"https://api.github.com/users/VSadov/repos","events_url":"https://api.github.com/users/VSadov/events{/privacy}","received_events_url":"https://api.github.com/users/VSadov/received_events","type":"User","site_admin":false},"body":"done","created_at":"2016-04-12T19:17:52Z","updated_at":"2016-04-12T19:17:52Z","html_url":"https://github.com/dotnet/roslyn/pull/10417#discussion_r59436642","pull_request_url":"https://api.github.com/repos/dotnet/roslyn/pulls/10417","_links":{"self":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/comments/59436642"},"html":{"href":"https://github.com/dotnet/roslyn/pull/10417#discussion_r59436642"},"pull_request":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/10417"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/roslyn/pulls/10417","id":65721432,"html_url":"https://github.com/dotnet/roslyn/pull/10417","diff_url":"https://github.com/dotnet/roslyn/pull/10417.diff","patch_url":"https://github.com/dotnet/roslyn/pull/10417.patch","issue_url":"https://api.github.com/repos/dotnet/roslyn/issues/10417","number":10417,"state":"open","locked":false,"title":"Implemented target typing for tuple literals.","user":{"login":"VSadov","id":8218165,"avatar_url":"https://avatars.githubusercontent.com/u/8218165?v=3","gravatar_id":"","url":"https://api.github.com/users/VSadov","html_url":"https://github.com/VSadov","followers_url":"https://api.github.com/users/VSadov/followers","following_url":"https://api.github.com/users/VSadov/following{/other_user}","gists_url":"https://api.github.com/users/VSadov/gists{/gist_id}","starred_url":"https://api.github.com/users/VSadov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VSadov/subscriptions","organizations_url":"https://api.github.com/users/VSadov/orgs","repos_url":"https://api.github.com/users/VSadov/repos","events_url":"https://api.github.com/users/VSadov/events{/privacy}","received_events_url":"https://api.github.com/users/VSadov/received_events","type":"User","site_admin":false},"body":"Known things that do not work:\r\n* mutually recursive lambda/tuple type inference\r\n* the following works with singles, but similar tuple scenario is an ambiguity error\r\n```C#\r\n        static void Main(string[] args)\r\n        {\r\n            Foo(1);\r\n        }\r\n\r\n        static void Foo(int? x) { }\r\n        static void Foo(byte x) { }\r\n```\r\nThat is because   ```byte``` converts to ```int?``` and that makes conversion to ```byte``` better, \r\nHowever  ```(byte, byte)``` does not convert to ```(int, int)?``` , so we have ambiguity\r\n\r\nWill have to figure how to deal with this. It seems like it is ok.\r\n* will need more overloading/inference tests.","created_at":"2016-04-08T00:33:03Z","updated_at":"2016-04-12T19:17:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ae6e2fd44c1ca7d8860e4fd5d7f4563f88adb1ee","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/roslyn/pulls/10417/commits","review_comments_url":"https://api.github.com/repos/dotnet/roslyn/pulls/10417/comments","review_comment_url":"https://api.github.com/repos/dotnet/roslyn/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/10417/comments","statuses_url":"https://api.github.com/repos/dotnet/roslyn/statuses/a0a3e8e48ea191e55e6242ec4b23f4c20c666282","head":{"label":"VSadov:tuplesTargetTyping","ref":"tuplesTargetTyping","sha":"a0a3e8e48ea191e55e6242ec4b23f4c20c666282","user":{"login":"VSadov","id":8218165,"avatar_url":"https://avatars.githubusercontent.com/u/8218165?v=3","gravatar_id":"","url":"https://api.github.com/users/VSadov","html_url":"https://github.com/VSadov","followers_url":"https://api.github.com/users/VSadov/followers","following_url":"https://api.github.com/users/VSadov/following{/other_user}","gists_url":"https://api.github.com/users/VSadov/gists{/gist_id}","starred_url":"https://api.github.com/users/VSadov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VSadov/subscriptions","organizations_url":"https://api.github.com/users/VSadov/orgs","repos_url":"https://api.github.com/users/VSadov/repos","events_url":"https://api.github.com/users/VSadov/events{/privacy}","received_events_url":"https://api.github.com/users/VSadov/received_events","type":"User","site_admin":false},"repo":{"id":30550950,"name":"roslyn","full_name":"VSadov/roslyn","owner":{"login":"VSadov","id":8218165,"avatar_url":"https://avatars.githubusercontent.com/u/8218165?v=3","gravatar_id":"","url":"https://api.github.com/users/VSadov","html_url":"https://github.com/VSadov","followers_url":"https://api.github.com/users/VSadov/followers","following_url":"https://api.github.com/users/VSadov/following{/other_user}","gists_url":"https://api.github.com/users/VSadov/gists{/gist_id}","starred_url":"https://api.github.com/users/VSadov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VSadov/subscriptions","organizations_url":"https://api.github.com/users/VSadov/orgs","repos_url":"https://api.github.com/users/VSadov/repos","events_url":"https://api.github.com/users/VSadov/events{/privacy}","received_events_url":"https://api.github.com/users/VSadov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/VSadov/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/VSadov/roslyn","forks_url":"https://api.github.com/repos/VSadov/roslyn/forks","keys_url":"https://api.github.com/repos/VSadov/roslyn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/VSadov/roslyn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/VSadov/roslyn/teams","hooks_url":"https://api.github.com/repos/VSadov/roslyn/hooks","issue_events_url":"https://api.github.com/repos/VSadov/roslyn/issues/events{/number}","events_url":"https://api.github.com/repos/VSadov/roslyn/events","assignees_url":"https://api.github.com/repos/VSadov/roslyn/assignees{/user}","branches_url":"https://api.github.com/repos/VSadov/roslyn/branches{/branch}","tags_url":"https://api.github.com/repos/VSadov/roslyn/tags","blobs_url":"https://api.github.com/repos/VSadov/roslyn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/VSadov/roslyn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/VSadov/roslyn/git/refs{/sha}","trees_url":"https://api.github.com/repos/VSadov/roslyn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/VSadov/roslyn/statuses/{sha}","languages_url":"https://api.github.com/repos/VSadov/roslyn/languages","stargazers_url":"https://api.github.com/repos/VSadov/roslyn/stargazers","contributors_url":"https://api.github.com/repos/VSadov/roslyn/contributors","subscribers_url":"https://api.github.com/repos/VSadov/roslyn/subscribers","subscription_url":"https://api.github.com/repos/VSadov/roslyn/subscription","commits_url":"https://api.github.com/repos/VSadov/roslyn/commits{/sha}","git_commits_url":"https://api.github.com/repos/VSadov/roslyn/git/commits{/sha}","comments_url":"https://api.github.com/repos/VSadov/roslyn/comments{/number}","issue_comment_url":"https://api.github.com/repos/VSadov/roslyn/issues/comments{/number}","contents_url":"https://api.github.com/repos/VSadov/roslyn/contents/{+path}","compare_url":"https://api.github.com/repos/VSadov/roslyn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/VSadov/roslyn/merges","archive_url":"https://api.github.com/repos/VSadov/roslyn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/VSadov/roslyn/downloads","issues_url":"https://api.github.com/repos/VSadov/roslyn/issues{/number}","pulls_url":"https://api.github.com/repos/VSadov/roslyn/pulls{/number}","milestones_url":"https://api.github.com/repos/VSadov/roslyn/milestones{/number}","notifications_url":"https://api.github.com/repos/VSadov/roslyn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/VSadov/roslyn/labels{/name}","releases_url":"https://api.github.com/repos/VSadov/roslyn/releases{/id}","deployments_url":"https://api.github.com/repos/VSadov/roslyn/deployments","created_at":"2015-02-09T18:24:54Z","updated_at":"2016-02-12T19:18:20Z","pushed_at":"2016-04-12T04:13:55Z","git_url":"git://github.com/VSadov/roslyn.git","ssh_url":"git@github.com:VSadov/roslyn.git","clone_url":"https://github.com/VSadov/roslyn.git","svn_url":"https://github.com/VSadov/roslyn","homepage":"","size":147441,"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:features/tuples","ref":"features/tuples","sha":"3957f3e3328cbe918a789990aba2e379c1471afc","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-04-12T17:29:23Z","pushed_at":"2016-04-12T19:12:51Z","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":215975,"stargazers_count":4867,"watchers_count":4867,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1226,"mirror_url":null,"open_issues_count":2644,"forks":1226,"open_issues":2644,"watchers":4867,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/10417"},"html":{"href":"https://github.com/dotnet/roslyn/pull/10417"},"issue":{"href":"https://api.github.com/repos/dotnet/roslyn/issues/10417"},"comments":{"href":"https://api.github.com/repos/dotnet/roslyn/issues/10417/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/10417/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/10417/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/roslyn/statuses/a0a3e8e48ea191e55e6242ec4b23f4c20c666282"}}}}