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

Enable nullable reference types #98

Closed
Seb-stian opened this issue Apr 22, 2021 · 8 comments
Closed

Enable nullable reference types #98

Seb-stian opened this issue Apr 22, 2021 · 8 comments
Labels
enhancement New feature or request

Comments

@Seb-stian
Copy link
Member

Adding this feature was decided by a discord poll. Nullable annotation should be enabled in the whole solution.

@Seb-stian Seb-stian added the enhancement New feature or request label Apr 22, 2021
@tacosontitan
Copy link

Can I have this issue assigned to me?


I'm presently requesting further information on Discord. Once I have a better understanding of the full requirements through Discord conversations, I'll come back here to summarize them for documentation purposes.

@tacosontitan
Copy link

After discussing the issue in more detail on Discord, the objectives are:

  • Add the nullable annotation ? to all reference types.
    • This is regardless of the use-type (fields, properties, method arguments, local variables, etc.).

The use-case of the reference type should be taken into account when adding the annotation, to ensure it is only added where the intent is to allow null values. For example, the following snippet should mark the argument string text as nullable (string? text) since null is explicitly handled.

public ChatMessage AppendText(string text) {
    if (Text is null)
        Text = text;
    else
        Text += text;

    return this;
}

In cases where the intent cannot be easily inferred as allowing the use of null values, then it should be explicitly defined that null is not supported, along with a TODO comment:

#nullable disable // TODO: resolve nullability
private string superWeirdBehavingString;
#nullable restore

Note: Formatting simplified for the sake of comment brevity.

@tacosontitan
Copy link

Unfortunately, I keep running out of time to work on this; I apologize, I'm relinquishing the assignment.

@Naamloos
Copy link
Member

that's fine, no apologies needed. you were willing to put your free time into this project, yet did not have enough to actually do so. I understand :)

@Seb-stian
Copy link
Member Author

That's fine, thanks for letting us know!

@ndelta0
Copy link
Contributor

ndelta0 commented Oct 28, 2021

[...] you were willing to put your free time into this project, yet did not have enough to actually do so. [...]

That's why open source is open source - everyone that wants to do this can do it.

@Naamloos
Copy link
Member

Naamloos commented Jan 9, 2022

Has this been enabled yet? I'm not sure... Please close this issue if it has been enabled.

@Tides
Copy link
Member

Tides commented Feb 10, 2024

Closing as its enabled~

@Tides Tides closed this as completed Feb 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants