-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Small nullability fixes #49279
Small nullability fixes #49279
Conversation
src/Compilers/CSharp/Test/Semantic/Semantics/NullableReferenceTypesTests.cs
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
|
||
if (disposalPlaceholder is not null) | ||
{ | ||
_awaitablePlaceholdersOpt!.Remove(disposalPlaceholder); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_awaitablePlaceholdersOpt [](start = 24, length = 25)
Could this be null
if node.EnumeratorInfoOpt.DisposeMethod is null
? #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. This code was actually safe because the disposalPlaceholder is not null
in first if
is redundant (it is always true if we statically know the Dispose
method to call).
Changed to use an assertion.
In reply to: 523378522 [](ancestors = 523378522)
@@ -5328,6 +5327,17 @@ private VisitArgumentResult VisitArgumentEvaluate(BoundExpression argument, RefK | |||
case RefKind.In: | |||
{ | |||
// Note: for lambda arguments, they will be converted in the context/state we saved for that argument | |||
if (conversion is { Kind: ConversionKind.ImplicitUserDefined }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (conversion is { Kind: ConversionKind.ImplicitUserDefined }) [](start = 24, length = 63)
It's not clear to me why this logic is specific to argument conversions. Won't we have the same requirements for assignments? #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In an assignment, we know the target-type (if there is to be a user-defined conversion). That target-type doesn't change because of nullable analysis, so the user-defined conversion is still the right one.
In a call, the target-type comes from re-inferring the type arguments for the method as part of nullable analysis. #Resolved
* upstream/master: (148 commits) Remove unnecessary ArrayBuilder in MakeCallWithNoExplicitArgument (dotnet#49377) Revert "Skip binary for determinism checking" Use deterministic metadata names for emitted anonymous type fields. (dotnet#49370) Reuse LSP solutions if they don't need re-forking (dotnet#49305) Small nullability fixes (dotnet#49279) Create default arguments during binding (dotnet#49186) Clean nits Backport dotnet#48420 to release/dev16.8 (dotnet#49357) Rewrite AnalyzeFileReference.GetSupportedLanguages without LINQ (dotnet#49337) Use .Any extension of ImmutableArray(Of Symbol) (dotnet#48980) fix 'remove unnecessary cast' when doing bitwise ops on unsigned values. Harden, document, cross-link XunitDisposeHook Simplify x86 hook Fix split comment exporting for VB. Code style fix Overwrite xunit's app domain handling to not call AppDomain.Unload Revert pragma suppression Remove blank line Revert file Move block structure code back to Features layer ...
Extracting some nullability fixes from my PR on type substitution (#48694).
async foreach
analysis