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

Add NullableContextAttribute #29854

Closed
terrajobst opened this issue Jun 11, 2019 · 2 comments
Closed

Add NullableContextAttribute #29854

terrajobst opened this issue Jun 11, 2019 · 2 comments
Assignees
Labels
api-suggestion Early API idea and discussion, it is NOT ready for implementation area-System.Runtime.CompilerServices
Milestone

Comments

@terrajobst
Copy link
Member

Related to #29039

@jcouv, what's the shape for this one?

@terrajobst terrajobst self-assigned this Jun 11, 2019
@jcouv
Copy link
Member

jcouv commented Jun 11, 2019

Below is the shape for NullableContextAttribute and NullableMembersAttribute (copied from dotnet/roslyn#36152).

From our discussion this morning, I assume the decision for NullableAttribute applies to those as well. Namely, we'll let the compiler inject those types for now.

namespace System.Runtime.CompilerServices
{
    [System.AttributeUsage(
        AttributeTargets.Module |
        AttributeTargets.Class |
        AttributeTargets.Delegate |
        AttributeTargets.Interface |
        AttributeTargets.Method |
        AttributeTargets.Struct,
        AllowMultiple = false,
        Inherited = false)]
    public sealed class NullableContextAttribute : Attribute
    {
        public readonly byte Flag;
        public NullableContextAttribute(byte flag)
        {
            Flag = flag;
        }
    }

    public enum NullableMembers
    {
        Public = 0,   // public and protected only
        Internal = 1, // public, protected, internal
        All = 2,
    }

    [System.AttributeUsage(AttributeTargets.Module, AllowMultiple = false)]
    public sealed class NullableMembersAttribute : Attribute
    {
        public readonly NullableMembers Members;
        public NullableMembersAttribute(NullableMembers members)
        {
            Members = members;
        }
    }
}

FYI @cston

@terrajobst
Copy link
Member Author

Closing, because we closed #29039 too.

@msftgits msftgits transferred this issue from dotnet/corefx Feb 1, 2020
@msftgits msftgits added this to the 3.0 milestone Feb 1, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api-suggestion Early API idea and discussion, it is NOT ready for implementation area-System.Runtime.CompilerServices
Projects
None yet
Development

No branches or pull requests

3 participants