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

Review NullableWalker.GetDefaultState #30065

Closed
jcouv opened this issue Sep 20, 2018 · 0 comments
Closed

Review NullableWalker.GetDefaultState #30065

jcouv opened this issue Sep 20, 2018 · 0 comments

Comments

@jcouv
Copy link
Member

jcouv commented Sep 20, 2018

        private bool? GetDefaultState(ref LocalState state, int slot)
        {
...

            switch (symbol.Kind)
            {
...
                case SymbolKind.Field:
                case SymbolKind.Property:
                case SymbolKind.Event:
                    {
                        // PROTOTYPE(NullableReferenceTypes): State of containing struct should not be important.
                        // And if it is important, what about fields of structs that are fields of other structs, etc.?
                        int containingSlot = variable.ContainingSlot;
                        if (containingSlot > 0 &&
                            variableBySlot[containingSlot].Symbol.GetTypeOrReturnType().TypeKind == TypeKind.Struct &&
                            state[containingSlot] == null)
                        {
                            return null;
                        }
                        return !symbol.GetTypeOrReturnType().IsNullable;
                    }
                default:
                    throw ExceptionUtilities.UnexpectedValue(symbol.Kind);
            }
        }
@jcouv jcouv added this to the 16.0 milestone Sep 20, 2018
@jaredpar jaredpar added the Bug label Sep 24, 2018
AlekseyTs added a commit to AlekseyTs/roslyn that referenced this issue Nov 16, 2018
AlekseyTs added a commit that referenced this issue Nov 19, 2018
 Adjust the way nullable annotations are represented in metadata.

Closes #30075.
Closes #30065.
Closes #29594.
Closes #29683
Closes #29662
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants