Fix NotNullIfNotNull delegate conversion#53409
Merged
RikkiGibson merged 2 commits intodotnet:mainfrom May 20, 2021
Merged
Conversation
RikkiGibson
commented
May 14, 2021
| var overrideParam = overrideParameters[i + overrideParameterOffset]; | ||
| if (notNullIfParameterNotNull.Contains(overrideParam.Name) && !baseParameters[i].TypeWithAnnotations.NullableAnnotation.IsAnnotated()) | ||
| var baseParam = baseParameters[i]; | ||
| if (notNullIfParameterNotNull.Contains(overrideParam.Name) && NullableWalker.GetParameterState(baseParam.TypeWithAnnotations, baseParam.FlowAnalysisAnnotations).IsNotNull) |
Member
Author
There was a problem hiding this comment.
Note that nullable variance checks are shared between method overrides and method group conversions. The delegate type is analogous to a "base" method while the method group is analogous to an "override" method.
Member
There was a problem hiding this comment.
I think there's a way to observe the impact of the change on an override scenario. Consider adding such tests.
jcouv
approved these changes
May 18, 2021
Member
jcouv
left a comment
There was a problem hiding this comment.
LGTM THanks (iteration 2) with a test suggestion to consider
Member
Author
|
@cston @dotnet/roslyn-compiler Could you please give this a second review? |
cston
approved these changes
May 20, 2021
Member
Author
|
I think there are still more bugs here, particularly with generic return types, but I am going to merge this since it gets us closer to correctness. |
333fred
added a commit
that referenced
this pull request
May 20, 2021
* upstream/main: (1224 commits) Fix NotNullIfNotNull delegate conversion (#53409) Verify quick info session in InvokeQuickInfo Remove unnecessary retry Enable nullable reference types Fix timeout behavior in GetQuickInfo Only generate build number on first run Update contrib documentation (#53504) update test to wait for workspace to be updated SImplify Fix out of bound crash in lsp navto. Revert changes to TypeScriptWaitContext wrappers Switch to ROSLYN_TEST_CI for CI detection Disable modification to CodeStyleOption<T> SImplify Simplify LoggerTestChannel using BlockingCollection Only require telemetry validation in CI Fix out of bound crash in lsp navto. Track fire-and-forget operations Avoid global option corruption Fix locked comment ...
333fred
added a commit
that referenced
this pull request
May 24, 2021
…ures/interpolated-string * upstream/main: (92 commits) Keep casts when necessary to prefer a constant pattern over a type pattern Remove SyntaxKind.DataKeyword (#53614) Display 'readonly' for record structs (#53634) Update Building, Debugging, and Testing on Windows.md (#53543) Update dependencies from https://github.com/dotnet/arcade build 20210521.3 (#53617) Introduce resx for BuildValidator and MS.CA.Rebuild to allow localization (#53447) Report obsoletion diagnostics for slice and indexer (#53463) Update BasicGenerateConstructorDialog.cs Add searchbox in generate overrides dialog Allow `with` on anonymous types (#53248) Report diagnostic on correct node (#53538) Fix NotNullIfNotNull delegate conversion (#53409) Verify quick info session in InvokeQuickInfo Remove unnecessary retry Ensure no navbar IO on the UI thread Enable nullable reference types Fix timeout behavior in GetQuickInfo Add a semantic model based GetQuickInfoAsync entry point into QuickInfoServiceWithProviders Move semantic model based quick info API up to CommonQuickInfoProvider type Fix dnceng build by forcing the use of xcopy msbuild ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #49865