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

Passing a value to a not nullable parameter should update state #43383

Closed
jcouv opened this issue Apr 15, 2020 · 4 comments · Fixed by #46072
Closed

Passing a value to a not nullable parameter should update state #43383

jcouv opened this issue Apr 15, 2020 · 4 comments · Fixed by #46072

Comments

@jcouv
Copy link
Member

jcouv commented Apr 15, 2020

LDM is discussing details of the proposal, but we agreed on core scenario:

void M(string s) { }
...
string? s = null;
M(s); // warn only here
s.ToString(); // don't warn again

This means that void M(string s) would behave like void M([NotNull] string s) behaves today.

FYI @stephentoub


The latest proposal is we can change the nullable state of a slot when either (1) we give a warning, or (2) you apply the ! operator.


Update: LDM decision below

@jcouv jcouv added this to the 16.7 milestone Apr 15, 2020
@jcouv jcouv self-assigned this Apr 15, 2020
@stephentoub
Copy link
Member

Thanks, @jcouv.

@jcouv
Copy link
Member Author

jcouv commented Jun 3, 2020

From LDM today we're going to align behavior of void M(string s), void M([DisallowNull]string s) and void M([NotNull]string s). We'll change the state of the argument if it is not suppressed with !.

@jcouv jcouv removed their assignment Jun 24, 2020
@jcouv jcouv self-assigned this Jun 24, 2020
@jcouv jcouv modified the milestones: 16.7, 16.8 Jul 1, 2020
@jaredpar jaredpar assigned RikkiGibson and unassigned jcouv Jul 1, 2020
@jaredpar jaredpar added the Bug label Jul 1, 2020
@RikkiGibson
Copy link
Contributor

RikkiGibson commented Jul 15, 2020

My interpretation of this is that while a not-nullable parameter updates the argument state, an oblivious parameter does not update the argument state.

@jcouv
Copy link
Member Author

jcouv commented Jul 15, 2020

My interpretation of this is that while a not-nullable parameter updates the argument state, an oblivious parameter does not update the argument state.

Correct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants