Skip to content
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

Merged
merged 7 commits into from
Nov 14, 2020
Merged

Small nullability fixes #49279

merged 7 commits into from
Nov 14, 2020

Conversation

jcouv
Copy link
Member

@jcouv jcouv commented Nov 11, 2020

Extracting some nullability fixes from my PR on type substitution (#48694).

@jcouv jcouv self-assigned this Nov 11, 2020
@jcouv jcouv marked this pull request as ready for review November 12, 2020 18:42
@jcouv jcouv requested a review from a team as a code owner November 12, 2020 18:42
@RikkiGibson RikkiGibson self-assigned this Nov 12, 2020
@RikkiGibson

This comment has been minimized.

@jcouv jcouv requested a review from RikkiGibson November 13, 2020 18:42

if (disposalPlaceholder is not null)
{
_awaitablePlaceholdersOpt!.Remove(disposalPlaceholder);
Copy link
Member

@cston cston Nov 14, 2020

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

Copy link
Member Author

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 })
Copy link
Member

@cston cston Nov 14, 2020

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

Copy link
Member Author

@jcouv jcouv Nov 14, 2020

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

@jcouv jcouv merged commit a341062 into dotnet:master Nov 14, 2020
@ghost ghost added this to the Next milestone Nov 14, 2020
@jcouv jcouv deleted the back-port branch November 14, 2020 18:01
333fred added a commit to 333fred/roslyn that referenced this pull request Nov 16, 2020
* 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
  ...
@allisonchou allisonchou modified the milestones: Next, 16.9.P2 Nov 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Follow up on comments in ImplicitConversions_07 unit-test
4 participants