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

[Epic] Specify nullable reference types in C# 8 #1085

Open
5 of 7 tasks
jskeet opened this issue Apr 24, 2024 · 4 comments
Open
5 of 7 tasks

[Epic] Specify nullable reference types in C# 8 #1085

jskeet opened this issue Apr 24, 2024 · 4 comments
Milestone

Comments

@jskeet jskeet added this to the C# 8.0 milestone Apr 24, 2024
@BillWagner BillWagner changed the title Specify nullable reference types in C# 8 [Epic] Specify nullable reference types in C# 8 Apr 26, 2024
@KalleOlaviNiemitalo
Copy link
Contributor

Are MaybeNullWhenAttribute and others going to be standardised?

@BillWagner
Copy link
Member

Are MaybeNullWhenAttribute and others going to be standardised?

Yes, see #1092

@BillWagner BillWagner removed their assignment Apr 26, 2024
@KalleOlaviNiemitalo
Copy link
Contributor

Does any of those issues cover how variance of generic parameters should affect warnings about identity conversions:

using System;
public class C {
    // f1 is a delegate that takes string? and returns string.
    public void M(Func<string?, string> f1) {
        // Nullability of type arguments does not match,
        // but there is no warning, because of variance.
        Func<string, string?> f2 = f1;

        // Convert back to the original type.
        // This causes a warning.
        Func<string?, string> f3 = f2;
    }
}

https:/dotnet/csharplang/blob/main/proposals/csharp-9.0/nullable-reference-types-specification.md doesn't seem to mention this.

I'm not sure whether this behaviour is C# 8 or 9, but I guess 8.

@BillWagner
Copy link
Member

BillWagner commented Jul 10, 2024

Terminology question: Do we want to use "nullable context" or "null analysis context"? Alternative is "set the flags in the nullable context".

See https:/dotnet/csharpstandard/pull/1123/files#r1672741166

However, note that the null state analysis is always being done. The comment states that the context may impact that.

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

No branches or pull requests

3 participants