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

Remove the nullable wrappers from the Workspaces layer #40030

Merged

Conversation

jasonmalinowski
Copy link
Member

@jasonmalinowski jasonmalinowski commented Nov 27, 2019

The compiler merged support for top-level symbol nullability in #39498, so we can now delete our own wrappers that were performing the same thing. This is a mostly mechanical change. Commit-by-commit might be slightly more helpful as the similar types of changes were grouped together.

Closes #39737
Fixes #36093
Fixes #39693 (or was fixed by compiler work, unsure)
Closes #36099
Fixes #38047

@jasonmalinowski jasonmalinowski force-pushed the remove-nullable-wrappers branch from f8eaf1c to 14e6b00 Compare December 3, 2019 20:46
…ted base

Our constructed type symbol was holding onto an abstract type symbol;
this allowed a constructed type to be created atop another constructed
type, which would form a chain. That isn't really necessary, and doesn't
match the usual mental models. This switches to holding onto a stronger
type, and then updates the Construct methods to go back to the prior
ConstructedFrom in order to avoid creating a chain.
… symbols

This wasn't necessary when we had wrapped symbols, since it was the
wrapper that had the annotation. Now that we are removing wrappers
we need to implement it directly.
@jasonmalinowski jasonmalinowski force-pushed the remove-nullable-wrappers branch from 14e6b00 to 32592f0 Compare December 3, 2019 23:53
The compiler merged support for top-level symbol nullability in
dotnet#39498, so we can now delete our
own wrappers that were performing the same thing. This is a mostly
mechanical change.

For places where we were calling LookupSymbols or ClassifyConversion,
those places previously called .WithoutNullability() since the compiler
API would have thrown if we gave it our wrappers, but the APIs had
otherwise no way to pass top-leve nullability. That was an accepted
oversight at the time, and the belief is passing in the full symbol
will generally be more correct.
In the deepest of ironies, the extension methods we had to wrap
top-level nullability was implicitly hiding a potential null reference.
Removing the extension methods is now flagging this, so this fixes it
up. The handling isn't ideal: if we don't have a Task<T> we won't
necessarily wrap, but that's not something really worth going out of
our way to support -- most code doesn't.
This clarifies why we are stripping the nullability, and replaces it
with the "not null" instead of "oblivious" which generates to the same
code but is a bit more correct if something else tried to operate on
the type symbol.
…ctly

We weren't ensuring the the tuple elements had top-level nullability
if we inferred the pattern was itself using nullable.
@jasonmalinowski jasonmalinowski merged commit cc18a15 into dotnet:master Dec 4, 2019
@jasonmalinowski jasonmalinowski deleted the remove-nullable-wrappers branch December 4, 2019 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment