{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/roslyn/pulls/comments/236459591","pull_request_review_id":178540162,"id":236459591,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNjQ1OTU5MQ==","diff_hunk":"@@ -1842,9 +1843,79 @@ public override BoundNode VisitConditionalAccess(BoundConditionalAccess node)\n             VisitRvalue(node.AccessExpression);\n             IntersectWith(ref this.State, ref receiverState);\n \n+            TypeSymbol type = node.Type;\n+            NullableAnnotation resultAnnotation;\n+            HashSet<DiagnosticInfo> useSiteDiagnostics = null;\n+\n+            if (type.SpecialType == SpecialType.System_Void || type.IsErrorType() || _resultType.IsNull)\n+            {\n+                resultAnnotation = NullableAnnotation.Unknown;\n+            }\n+            else if (_resultType.IsPossiblyNullableReferenceTypeTypeParameter())\n+            {\n+                Debug.Assert(_resultType.TypeSymbol == type);\n+                Conversion conversion;\n+\n+                if (!receiverType.GetValueNullableAnnotation().IsAnyNullable())\n+                {\n+                    resultAnnotation = NullableAnnotation.NotNullable; // Inherit nullability of the access\n+                }\n+                else if (receiverType.IsPossiblyNullableReferenceTypeTypeParameter() &&\n+                    (conversion = _conversions.ClassifyConversionFromType(receiverType.TypeSymbol, _resultType.TypeSymbol, ref useSiteDiagnostics)).Exists &&\n+                    !conversion.IsUserDefined)\n+                {\n+                    // where T : U\n+                    // T ?? U or U ?? T\n+\n+                    // T ?? U\n+                    // If T is nullable, U is also nullable - result is nullable\n+                    // If T is not nullable - result is nullable if U is nullable\n+                    // If U is nullable - result is nullable\n+                    // If U is not nullable, T is also not nullable - result is not nullable\n+                    // So, nullability of the result can be inferred from nullability of U, and the type of the result is U.   \n+\n+                    // U ?? T\n+                    // If U is nullable - result is nullable\n+                    // If U is not nullable, T is also not nullable - result is not nullable\n+                    // If T is nullable, U is also nullable - result is nullable\n+                    // If T is not nullable - result is nullable if U is nullable\n+                    // So, nullability of the result can be inferred from nullability of U, but the type of the result is T.   \n+                    // At the moment we don't have a way to represent this correlation, result type is one type parameter, but\n+                    // nullability comes from another. \n+                    // Ideally, we would want to have the following behavior:\n+                    //     U x = U ?? T - no warning\n+                    //     T y = U ?? T - a warning\n+                    // But we can track the state only in the way when either both produce a warning, or none.\n+                    // It feels like it is reasonable to prefer the latter approach, i.e. produce no warnings \n+                    // for both scenarios - no false diagnostics.\n+                    resultAnnotation = NullableAnnotation.NotNullable; // Inherit nullability of U\n+                }\n+                else\n+                {\n+                    resultAnnotation = NullableAnnotation.NullableBasedOnAnalysis;\n+                }\n+            }\n+            else\n+            {\n+                NullableAnnotation receiverAnnotation = receiverType.GetValueNullableAnnotation();\n+                NullableAnnotation accessAnnotation = _resultType.GetValueNullableAnnotation();\n+                if (receiverAnnotation.IsAnyNullable() || accessAnnotation.IsAnyNullable())\n+                {\n+                    resultAnnotation = NullableAnnotation.NullableBasedOnAnalysis;\n+                }\n+                else if (receiverAnnotation == NullableAnnotation.Unknown || accessAnnotation == NullableAnnotation.Unknown)\n+                {\n+                    resultAnnotation = NullableAnnotation.Unknown;\n+                }\n+                else\n+                {\n+                    resultAnnotation = NullableAnnotation.NotNullableBasedOnAnalysis;\n+                }\n+            }","path":"src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs","position":190,"original_position":190,"commit_id":"db64818b5f5c1d2b99031df970b416957470c08a","original_commit_id":"db64818b5f5c1d2b99031df970b416957470c08a","user":{"login":"jcouv","id":12466233,"node_id":"MDQ6VXNlcjEyNDY2MjMz","avatar_url":"https://avatars2.githubusercontent.com/u/12466233?v=4","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},"body":">} [](start = 12, length = 1)\r\n\r\nCould you update the speclet to document the handling of null-coalescing-operator?\r\n\r\nI'm still reading through this block, but it makes me uneasy. I wonder whether it could be expressed in terms of some existing or re-usable abstractions.","created_at":"2018-11-26T22:53:42Z","updated_at":"2018-11-26T22:53:42Z","html_url":"https://github.com/dotnet/roslyn/pull/31264#discussion_r236459591","pull_request_url":"https://api.github.com/repos/dotnet/roslyn/pulls/31264","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/comments/236459591"},"html":{"href":"https://github.com/dotnet/roslyn/pull/31264#discussion_r236459591"},"pull_request":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/31264"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/roslyn/pulls/31264","id":232098921,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMyMDk4OTIx","html_url":"https://github.com/dotnet/roslyn/pull/31264","diff_url":"https://github.com/dotnet/roslyn/pull/31264.diff","patch_url":"https://github.com/dotnet/roslyn/pull/31264.patch","issue_url":"https://api.github.com/repos/dotnet/roslyn/issues/31264","number":31264,"state":"open","locked":false,"title":"More special handling for unconstrained type parameters in flow analysis","user":{"login":"AlekseyTs","id":10522107,"node_id":"MDQ6VXNlcjEwNTIyMTA3","avatar_url":"https://avatars0.githubusercontent.com/u/10522107?v=4","gravatar_id":"","url":"https://api.github.com/users/AlekseyTs","html_url":"https://github.com/AlekseyTs","followers_url":"https://api.github.com/users/AlekseyTs/followers","following_url":"https://api.github.com/users/AlekseyTs/following{/other_user}","gists_url":"https://api.github.com/users/AlekseyTs/gists{/gist_id}","starred_url":"https://api.github.com/users/AlekseyTs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlekseyTs/subscriptions","organizations_url":"https://api.github.com/users/AlekseyTs/orgs","repos_url":"https://api.github.com/users/AlekseyTs/repos","events_url":"https://api.github.com/users/AlekseyTs/events{/privacy}","received_events_url":"https://api.github.com/users/AlekseyTs/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-11-19T20:16:43Z","updated_at":"2018-11-26T22:53:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f514a49c0e2444d8db3bc1debcfab402685fce0a","assignee":null,"assignees":[],"requested_reviewers":[{"login":"cston","id":10732005,"node_id":"MDQ6VXNlcjEwNzMyMDA1","avatar_url":"https://avatars2.githubusercontent.com/u/10732005?v=4","gravatar_id":"","url":"https://api.github.com/users/cston","html_url":"https://github.com/cston","followers_url":"https://api.github.com/users/cston/followers","following_url":"https://api.github.com/users/cston/following{/other_user}","gists_url":"https://api.github.com/users/cston/gists{/gist_id}","starred_url":"https://api.github.com/users/cston/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cston/subscriptions","organizations_url":"https://api.github.com/users/cston/orgs","repos_url":"https://api.github.com/users/cston/repos","events_url":"https://api.github.com/users/cston/events{/privacy}","received_events_url":"https://api.github.com/users/cston/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":166673288,"node_id":"MDU6TGFiZWwxNjY2NzMyODg=","url":"https://api.github.com/repos/dotnet/roslyn/labels/Area-Compilers","name":"Area-Compilers","color":"5319e7","default":false},{"id":344899605,"node_id":"MDU6TGFiZWwzNDQ4OTk2MDU=","url":"https://api.github.com/repos/dotnet/roslyn/labels/New%20Language%20Feature%20-%20Nullable%20Reference%20Types","name":"New Language Feature - Nullable Reference Types","color":"bfd4f2","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/roslyn/pulls/31264/commits","review_comments_url":"https://api.github.com/repos/dotnet/roslyn/pulls/31264/comments","review_comment_url":"https://api.github.com/repos/dotnet/roslyn/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/31264/comments","statuses_url":"https://api.github.com/repos/dotnet/roslyn/statuses/db64818b5f5c1d2b99031df970b416957470c08a","head":{"label":"AlekseyTs:NullabilityOfTypeParameters_02","ref":"NullabilityOfTypeParameters_02","sha":"db64818b5f5c1d2b99031df970b416957470c08a","user":{"login":"AlekseyTs","id":10522107,"node_id":"MDQ6VXNlcjEwNTIyMTA3","avatar_url":"https://avatars0.githubusercontent.com/u/10522107?v=4","gravatar_id":"","url":"https://api.github.com/users/AlekseyTs","html_url":"https://github.com/AlekseyTs","followers_url":"https://api.github.com/users/AlekseyTs/followers","following_url":"https://api.github.com/users/AlekseyTs/following{/other_user}","gists_url":"https://api.github.com/users/AlekseyTs/gists{/gist_id}","starred_url":"https://api.github.com/users/AlekseyTs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlekseyTs/subscriptions","organizations_url":"https://api.github.com/users/AlekseyTs/orgs","repos_url":"https://api.github.com/users/AlekseyTs/repos","events_url":"https://api.github.com/users/AlekseyTs/events{/privacy}","received_events_url":"https://api.github.com/users/AlekseyTs/received_events","type":"User","site_admin":false},"repo":{"id":32701567,"node_id":"MDEwOlJlcG9zaXRvcnkzMjcwMTU2Nw==","name":"roslyn","full_name":"AlekseyTs/roslyn","private":false,"owner":{"login":"AlekseyTs","id":10522107,"node_id":"MDQ6VXNlcjEwNTIyMTA3","avatar_url":"https://avatars0.githubusercontent.com/u/10522107?v=4","gravatar_id":"","url":"https://api.github.com/users/AlekseyTs","html_url":"https://github.com/AlekseyTs","followers_url":"https://api.github.com/users/AlekseyTs/followers","following_url":"https://api.github.com/users/AlekseyTs/following{/other_user}","gists_url":"https://api.github.com/users/AlekseyTs/gists{/gist_id}","starred_url":"https://api.github.com/users/AlekseyTs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlekseyTs/subscriptions","organizations_url":"https://api.github.com/users/AlekseyTs/orgs","repos_url":"https://api.github.com/users/AlekseyTs/repos","events_url":"https://api.github.com/users/AlekseyTs/events{/privacy}","received_events_url":"https://api.github.com/users/AlekseyTs/received_events","type":"User","site_admin":false},"html_url":"https://github.com/AlekseyTs/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/AlekseyTs/roslyn","forks_url":"https://api.github.com/repos/AlekseyTs/roslyn/forks","keys_url":"https://api.github.com/repos/AlekseyTs/roslyn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AlekseyTs/roslyn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AlekseyTs/roslyn/teams","hooks_url":"https://api.github.com/repos/AlekseyTs/roslyn/hooks","issue_events_url":"https://api.github.com/repos/AlekseyTs/roslyn/issues/events{/number}","events_url":"https://api.github.com/repos/AlekseyTs/roslyn/events","assignees_url":"https://api.github.com/repos/AlekseyTs/roslyn/assignees{/user}","branches_url":"https://api.github.com/repos/AlekseyTs/roslyn/branches{/branch}","tags_url":"https://api.github.com/repos/AlekseyTs/roslyn/tags","blobs_url":"https://api.github.com/repos/AlekseyTs/roslyn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AlekseyTs/roslyn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AlekseyTs/roslyn/git/refs{/sha}","trees_url":"https://api.github.com/repos/AlekseyTs/roslyn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AlekseyTs/roslyn/statuses/{sha}","languages_url":"https://api.github.com/repos/AlekseyTs/roslyn/languages","stargazers_url":"https://api.github.com/repos/AlekseyTs/roslyn/stargazers","contributors_url":"https://api.github.com/repos/AlekseyTs/roslyn/contributors","subscribers_url":"https://api.github.com/repos/AlekseyTs/roslyn/subscribers","subscription_url":"https://api.github.com/repos/AlekseyTs/roslyn/subscription","commits_url":"https://api.github.com/repos/AlekseyTs/roslyn/commits{/sha}","git_commits_url":"https://api.github.com/repos/AlekseyTs/roslyn/git/commits{/sha}","comments_url":"https://api.github.com/repos/AlekseyTs/roslyn/comments{/number}","issue_comment_url":"https://api.github.com/repos/AlekseyTs/roslyn/issues/comments{/number}","contents_url":"https://api.github.com/repos/AlekseyTs/roslyn/contents/{+path}","compare_url":"https://api.github.com/repos/AlekseyTs/roslyn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AlekseyTs/roslyn/merges","archive_url":"https://api.github.com/repos/AlekseyTs/roslyn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AlekseyTs/roslyn/downloads","issues_url":"https://api.github.com/repos/AlekseyTs/roslyn/issues{/number}","pulls_url":"https://api.github.com/repos/AlekseyTs/roslyn/pulls{/number}","milestones_url":"https://api.github.com/repos/AlekseyTs/roslyn/milestones{/number}","notifications_url":"https://api.github.com/repos/AlekseyTs/roslyn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AlekseyTs/roslyn/labels{/name}","releases_url":"https://api.github.com/repos/AlekseyTs/roslyn/releases{/id}","deployments_url":"https://api.github.com/repos/AlekseyTs/roslyn/deployments","created_at":"2015-03-22T23:43:35Z","updated_at":"2018-11-01T23:25:46Z","pushed_at":"2018-11-21T23:44:00Z","git_url":"git://github.com/AlekseyTs/roslyn.git","ssh_url":"git@github.com:AlekseyTs/roslyn.git","clone_url":"https://github.com/AlekseyTs/roslyn.git","svn_url":"https://github.com/AlekseyTs/roslyn","homepage":"","size":447808,"stargazers_count":0,"watchers_count":0,"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":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"7666140edf112b8efee0eae605a9b44f78bfecdf","user":{"login":"dotnet","id":9141961,"node_id":"MDEyOk9yZ2FuaXphdGlvbjkxNDE5NjE=","avatar_url":"https://avatars0.githubusercontent.com/u/9141961?v=4","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,"node_id":"MDEwOlJlcG9zaXRvcnkyOTA3ODk5Nw==","name":"roslyn","full_name":"dotnet/roslyn","private":false,"owner":{"login":"dotnet","id":9141961,"node_id":"MDEyOk9yZ2FuaXphdGlvbjkxNDE5NjE=","avatar_url":"https://avatars0.githubusercontent.com/u/9141961?v=4","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},"html_url":"https://github.com/dotnet/roslyn","description":"The Roslyn .NET compiler provides C# and Visual Basic languages 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":"2018-11-26T19:00:06Z","pushed_at":"2018-11-26T22:52:12Z","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":"https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/","size":488947,"stargazers_count":10400,"watchers_count":10400,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2464,"mirror_url":null,"archived":false,"open_issues_count":5431,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":2464,"open_issues":5431,"watchers":10400,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/31264"},"html":{"href":"https://github.com/dotnet/roslyn/pull/31264"},"issue":{"href":"https://api.github.com/repos/dotnet/roslyn/issues/31264"},"comments":{"href":"https://api.github.com/repos/dotnet/roslyn/issues/31264/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/31264/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/31264/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/roslyn/statuses/db64818b5f5c1d2b99031df970b416957470c08a"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"jcouv"}}